From 402998e417cacc2686bd8a8756c0a4f7f318a94a Mon Sep 17 00:00:00 2001 From: Serreau Jovann Date: Mon, 24 Nov 2025 20:14:49 +0100 Subject: [PATCH] =?UTF-8?q?```=20=E2=9C=A8=20feat(deps):=20Ajoute=20Sentry?= =?UTF-8?q?=20pour=20le=20suivi=20des=20erreurs=20et=20MobileDetect.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 fix(template): Corrige l'affichage des badges Stripe sur mobile et ajoute le réalisateur. ⚙️ chore(config): Active le bundle Sentry dans la configuration. ``` --- .env | 4 + composer.json | 2 + composer.lock | 400 +++++++++++++++++++++++++++++++- config/bundles.php | 1 + config/packages/sentry.yaml | 36 +++ src/Twig/ViteAssetExtension.php | 8 + symfony.lock | 12 + templates/base.twig | 16 +- translations/messages.cn.yaml | 2 + translations/messages.en.yaml | 2 + translations/messages.fr.yaml | 2 + 11 files changed, 481 insertions(+), 4 deletions(-) create mode 100644 config/packages/sentry.yaml diff --git a/.env b/.env index f117148..7479cb1 100644 --- a/.env +++ b/.env @@ -65,3 +65,7 @@ GOOGLE_CLIENT_SECRET= GOOGLE_AUTH_CONFIG=%kernel.project_dir%/google.json GOOGLE_APPLICATION_CREDENTIALS=%kernel.project_dir%/google.json ###< google/apiclient ### + +###> sentry/sentry-symfony ### +SENTRY_DSN="https://4f43769e7c483f14da26e05824a482d0@o4509563601092608.ingest.de.sentry.io/4510392636473424" +###< sentry/sentry-symfony ### diff --git a/composer.json b/composer.json index f2f5446..97d0082 100644 --- a/composer.json +++ b/composer.json @@ -33,6 +33,7 @@ "lufiipe/insee-sierene": ">=1", "minishlink/web-push": "^9.0.3", "mittwald/vault-php": "^3.0.2", + "mobiledetect/mobiledetectlib": "^4.8", "nelmio/cors-bundle": "^2.6", "ovh/ovh": ">=3.5", "pear/net_dns2": ">=2.0.6", @@ -40,6 +41,7 @@ "phpoffice/phpspreadsheet": ">=5.2", "phpstan/phpdoc-parser": "^2.3", "presta/sitemap-bundle": "^4.2", + "sentry/sentry-symfony": "^5.6", "setasign/fpdi": "^2.6.4", "spatie/mjml-php": "^1.2.5", "stancer/stancer": ">=2.0.1", diff --git a/composer.lock b/composer.lock index 7ba6202..e579eb4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d9f711e9feb3143e77672af962c889c8", + "content-hash": "360146f459050d75e1363bd79b5792e0", "packages": [ { "name": "async-aws/core", @@ -4358,6 +4358,66 @@ }, "time": "2023-01-25T14:42:45+00:00" }, + { + "name": "jean85/pretty-package-versions", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/Jean85/pretty-package-versions.git", + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/4d7aa5dab42e2a76d99559706022885de0e18e1a", + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2.1.0", + "php": "^7.4|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "jean85/composer-provided-replaced-stub-package": "^1.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^7.5|^8.5|^9.6", + "rector/rector": "^2.0", + "vimeo/psalm": "^4.3 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Jean85\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alessandro Lai", + "email": "alessandro.lai85@gmail.com" + } + ], + "description": "A library to get pretty versions strings of installed dependencies", + "keywords": [ + "composer", + "package", + "release", + "versions" + ], + "support": { + "issues": "https://github.com/Jean85/pretty-package-versions/issues", + "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.1" + }, + "time": "2025-03-19T14:43:43+00:00" + }, { "name": "jms/metadata", "version": "2.8.0", @@ -5687,6 +5747,71 @@ }, "time": "2025-06-24T13:12:56+00:00" }, + { + "name": "mobiledetect/mobiledetectlib", + "version": "4.8.09", + "source": { + "type": "git", + "url": "https://github.com/serbanghita/Mobile-Detect.git", + "reference": "a06fe2e546a06bb8c2639d6823d5250b2efb3209" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/a06fe2e546a06bb8c2639d6823d5250b2efb3209", + "reference": "a06fe2e546a06bb8c2639d6823d5250b2efb3209", + "shasum": "" + }, + "require": { + "php": ">=8.0", + "psr/cache": "^3.0", + "psr/simple-cache": "^3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^v3.65.0", + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.12.x-dev", + "phpunit/phpunit": "^9.6.18", + "squizlabs/php_codesniffer": "^3.11.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Detection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Serban Ghita", + "email": "serbanghita@gmail.com", + "homepage": "http://mobiledetect.net", + "role": "Developer" + } + ], + "description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.", + "homepage": "https://github.com/serbanghita/Mobile-Detect", + "keywords": [ + "detect mobile devices", + "mobile", + "mobile detect", + "mobile detector", + "php mobile detect" + ], + "support": { + "issues": "https://github.com/serbanghita/Mobile-Detect/issues", + "source": "https://github.com/serbanghita/Mobile-Detect/tree/4.8.09" + }, + "funding": [ + { + "url": "https://github.com/serbanghita", + "type": "github" + } + ], + "time": "2024-12-10T15:32:06+00:00" + }, { "name": "monolog/monolog", "version": "3.9.0", @@ -7617,6 +7742,196 @@ ], "time": "2024-11-27T12:13:42+00:00" }, + { + "name": "sentry/sentry", + "version": "4.18.1", + "source": { + "type": "git", + "url": "https://github.com/getsentry/sentry-php.git", + "reference": "04dcf20b39742b731b676f8b8d4f02d1db488af8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/04dcf20b39742b731b676f8b8d4f02d1db488af8", + "reference": "04dcf20b39742b731b676f8b8d4f02d1db488af8", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/psr7": "^1.8.4|^2.1.1", + "jean85/pretty-package-versions": "^1.5|^2.0.4", + "php": "^7.2|^8.0", + "psr/log": "^1.0|^2.0|^3.0", + "symfony/options-resolver": "^4.4.30|^5.0.11|^6.0|^7.0|^8.0" + }, + "conflict": { + "raven/raven": "*" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.4", + "guzzlehttp/promises": "^2.0.3", + "guzzlehttp/psr7": "^1.8.4|^2.1.1", + "monolog/monolog": "^1.6|^2.0|^3.0", + "phpbench/phpbench": "^1.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^8.5|^9.6", + "vimeo/psalm": "^4.17" + }, + "suggest": { + "monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler." + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Sentry\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sentry", + "email": "accounts@sentry.io" + } + ], + "description": "PHP SDK for Sentry (http://sentry.io)", + "homepage": "http://sentry.io", + "keywords": [ + "crash-reporting", + "crash-reports", + "error-handler", + "error-monitoring", + "log", + "logging", + "profiling", + "sentry", + "tracing" + ], + "support": { + "issues": "https://github.com/getsentry/sentry-php/issues", + "source": "https://github.com/getsentry/sentry-php/tree/4.18.1" + }, + "funding": [ + { + "url": "https://sentry.io/", + "type": "custom" + }, + { + "url": "https://sentry.io/pricing/", + "type": "custom" + } + ], + "time": "2025-11-11T09:34:53+00:00" + }, + { + "name": "sentry/sentry-symfony", + "version": "5.6.0", + "source": { + "type": "git", + "url": "https://github.com/getsentry/sentry-symfony.git", + "reference": "9867751f5091b55d7e3a223f48d88e228132e073" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/getsentry/sentry-symfony/zipball/9867751f5091b55d7e3a223f48d88e228132e073", + "reference": "9867751f5091b55d7e3a223f48d88e228132e073", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^2.1.1", + "jean85/pretty-package-versions": "^1.5||^2.0", + "php": "^7.2||^8.0", + "sentry/sentry": "^4.16.0", + "symfony/cache-contracts": "^1.1||^2.4||^3.0", + "symfony/config": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/console": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/dependency-injection": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/event-dispatcher": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/http-kernel": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/polyfill-php80": "^1.22", + "symfony/psr-http-message-bridge": "^1.2||^2.0||^6.4||^7.0" + }, + "require-dev": { + "doctrine/dbal": "^2.13||^3.3||^4.0", + "doctrine/doctrine-bundle": "^2.6", + "friendsofphp/php-cs-fixer": "^2.19||^3.40", + "masterminds/html5": "^2.8", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "1.12.5", + "phpstan/phpstan-phpunit": "1.4.0", + "phpstan/phpstan-symfony": "1.4.10", + "phpunit/phpunit": "^8.5.40||^9.6.21", + "symfony/browser-kit": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/cache": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/dom-crawler": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/framework-bundle": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/http-client": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/messenger": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/monolog-bundle": "^3.4", + "symfony/phpunit-bridge": "^5.2.6||^6.0||^7.0", + "symfony/process": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/security-core": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/security-http": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/twig-bundle": "^4.4.20||^5.0.11||^6.0||^7.0", + "symfony/yaml": "^4.4.20||^5.0.11||^6.0||^7.0", + "vimeo/psalm": "^4.3||^5.16.0" + }, + "suggest": { + "doctrine/doctrine-bundle": "Allow distributed tracing of database queries using Sentry.", + "monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler.", + "symfony/cache": "Allow distributed tracing of cache pools using Sentry.", + "symfony/twig-bundle": "Allow distributed tracing of Twig template rendering using Sentry." + }, + "type": "symfony-bundle", + "autoload": { + "files": [ + "src/aliases.php" + ], + "psr-4": { + "Sentry\\SentryBundle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sentry", + "email": "accounts@sentry.io" + } + ], + "description": "Symfony integration for Sentry (http://getsentry.com)", + "homepage": "http://getsentry.com", + "keywords": [ + "errors", + "logging", + "sentry", + "symfony" + ], + "support": { + "issues": "https://github.com/getsentry/sentry-symfony/issues", + "source": "https://github.com/getsentry/sentry-symfony/tree/5.6.0" + }, + "funding": [ + { + "url": "https://sentry.io/", + "type": "custom" + }, + { + "url": "https://sentry.io/pricing/", + "type": "custom" + } + ], + "time": "2025-09-24T13:41:01+00:00" + }, { "name": "setasign/fpdi", "version": "v2.6.4", @@ -12069,6 +12384,89 @@ ], "time": "2025-10-05T22:12:41+00:00" }, + { + "name": "symfony/psr-http-message-bridge", + "version": "v7.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/psr-http-message-bridge.git", + "reference": "03f2f72319e7acaf2a9f6fcbe30ef17eec51594f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/03f2f72319e7acaf2a9f6fcbe30ef17eec51594f", + "reference": "03f2f72319e7acaf2a9f6fcbe30ef17eec51594f", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/http-message": "^1.0|^2.0", + "symfony/http-foundation": "^6.4|^7.0" + }, + "conflict": { + "php-http/discovery": "<1.15", + "symfony/http-kernel": "<6.4" + }, + "require-dev": { + "nyholm/psr7": "^1.1", + "php-http/discovery": "^1.15", + "psr/log": "^1.1.4|^2|^3", + "symfony/browser-kit": "^6.4|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/framework-bundle": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0" + }, + "type": "symfony-bridge", + "autoload": { + "psr-4": { + "Symfony\\Bridge\\PsrHttpMessage\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "PSR HTTP message bridge", + "homepage": "https://symfony.com", + "keywords": [ + "http", + "http-message", + "psr-17", + "psr-7" + ], + "support": { + "source": "https://github.com/symfony/psr-http-message-bridge/tree/v7.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-26T08:57:56+00:00" + }, { "name": "symfony/redis-messenger", "version": "v7.3.4", diff --git a/config/bundles.php b/config/bundles.php index fb1544b..5e1b6aa 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -17,4 +17,5 @@ return [ Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], Presta\SitemapBundle\PrestaSitemapBundle::class => ['all' => true], Vich\UploaderBundle\VichUploaderBundle::class => ['all' => true], + Sentry\SentryBundle\SentryBundle::class => ['prod' => true], ]; diff --git a/config/packages/sentry.yaml b/config/packages/sentry.yaml new file mode 100644 index 0000000..d6165de --- /dev/null +++ b/config/packages/sentry.yaml @@ -0,0 +1,36 @@ +when@prod: + sentry: + dsn: '%env(SENTRY_DSN)%' + options: + # Add request headers, cookies, IP address and the authenticated user + # see https://docs.sentry.io/platforms/php/data-management/data-collected/ for more info + # send_default_pii: true + ignore_exceptions: + - 'Symfony\Component\ErrorHandler\Error\FatalError' + - 'Symfony\Component\Debug\Exception\FatalErrorException' +# +# # If you are using Monolog, you also need this additional configuration to log the errors correctly: +# # https://docs.sentry.io/platforms/php/guides/symfony/#monolog-integration +# register_error_listener: false +# register_error_handler: false +# +# monolog: +# handlers: +# # Use this only if you don't want to use structured logging and instead receive +# # certain log levels as errors. +# sentry: +# type: sentry +# level: !php/const Monolog\Logger::ERROR +# hub_id: Sentry\State\HubInterface +# fill_extra_context: true # Enables sending monolog context to Sentry +# process_psr_3_messages: false # Disables the resolution of PSR-3 placeholders +# +# # Use this for structured log integration +# sentry_logs: +# type: service +# id: Sentry\SentryBundle\Monolog\LogsHandler +# +# services: +# Sentry\SentryBundle\Monolog\LogsHandler: +# arguments: +# - !php/const Monolog\Logger::INFO diff --git a/src/Twig/ViteAssetExtension.php b/src/Twig/ViteAssetExtension.php index 1f45ed1..52088ba 100644 --- a/src/Twig/ViteAssetExtension.php +++ b/src/Twig/ViteAssetExtension.php @@ -2,6 +2,7 @@ namespace App\Twig; +use Detection\MobileDetect; use Psr\Cache\CacheItemPoolInterface; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; @@ -29,11 +30,18 @@ class ViteAssetExtension extends AbstractExtension { return [ new TwigFunction('vite_asset', $this->asset(...), ['is_safe' => ['html']]), + new TwigFunction('isMobile', $this->isMobile(...), ['is_safe' => ['html']]), // Nouvelle fonction Twig pour inclure les liens de favicons new TwigFunction('vite_favicons', $this->favicons(...), ['is_safe' => ['html']]) ]; } + public function isMobile() + { + $detect = new MobileDetect(); + return $detect->isMobile() || $detect->isTablet(); + } + /** * Charge le manifeste s'il n'est pas déjà chargé et met en cache. */ diff --git a/symfony.lock b/symfony.lock index c77ad52..57ff09d 100644 --- a/symfony.lock +++ b/symfony.lock @@ -118,6 +118,18 @@ "presta/sitemap-bundle": { "version": "v4.1.3" }, + "sentry/sentry-symfony": { + "version": "5.6", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "5.0", + "ref": "b6cb4b34429dadecd7187852123be19d628fa37a" + }, + "files": [ + "config/packages/sentry.yaml" + ] + }, "symfony/amazon-mailer": { "version": "7.3", "recipe": { diff --git a/templates/base.twig b/templates/base.twig index 4f6990d..ebe364c 100644 --- a/templates/base.twig +++ b/templates/base.twig @@ -419,7 +419,7 @@ {# 2. Réseaux Sociaux #} -
+
gestion commercial

{{ 'footer_follow_us_title'|trans }}

{{ 'footer_action_title'|trans }}

- - + {% if isMobile() %} + {% set stripeWidth ="100%" %} + {% set stripeHeight ="60" %} + {% else %} + {% set stripeWidth ="400" %} + {% set stripeHeight ="40" %} + {% endif %} + +
{# 3. Bloc Personnalisable (E-Cosplay mission) #} @@ -464,6 +471,9 @@

{{ 'association_status'|trans }} - RNA N°W022006988

+

+ {{ 'footer_realise'|trans }} SARL SITECONSEIL +

{# Liens Légaux #} diff --git a/translations/messages.cn.yaml b/translations/messages.cn.yaml index d6c894f..3b16576 100644 --- a/translations/messages.cn.yaml +++ b/translations/messages.cn.yaml @@ -668,3 +668,5 @@ adh_page_validate: success_message: "您的签名已成功记录并验证。您现在可以查看已签署的文件。" thanks: "感谢您的参与!" footer_action_title: "我们的行动" +footer_realise: '导演是' +Documents: '文件' diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 3084ced..74f6e62 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -736,3 +736,5 @@ adh_page_validate: success_message: "Your signature has been successfully recorded and validated for the General Assembly. You can now view the signed document." thanks: "Thank you for your participation!" footer_action_title: "Our actions" +footer_realise: 'Directed by' +Documents: 'Documents' diff --git a/translations/messages.fr.yaml b/translations/messages.fr.yaml index 4225982..a9c2ede 100644 --- a/translations/messages.fr.yaml +++ b/translations/messages.fr.yaml @@ -678,3 +678,5 @@ adh_page_validate: breadcrumb: "Signature validée" success_message: "Votre signature a été enregistrée et validée avec succès pour l'Assemblée Générale. Vous pouvez consulter le document signé." thanks: "Merci pour votre participation !" +footer_realise: 'Réalisé par' +Documents: 'Documents'