mirror of
https://github.com/symfony/recipes.git
synced 2026-09-12 07:36:30 +03:00
Update Flex endpoint
This commit is contained in:
+2
-1
@@ -143,7 +143,7 @@ Additional recipes can be found on the [Contrib Recipes Repository](https://gith
|
||||
| [symfony/smsense-notifier](https://packagist.org/packages/symfony/smsense-notifier) | [7.1](symfony/smsense-notifier/7.1) | `smsense-notifier`, `smsensenotifier` |
|
||||
| [symfony/smsmode-notifier](https://packagist.org/packages/symfony/smsmode-notifier) | [6.3](symfony/smsmode-notifier/6.3) | `smsmode-notifier`, `smsmodenotifier` |
|
||||
| [symfony/spot-hit-notifier](https://packagist.org/packages/symfony/spot-hit-notifier) | [5.3](symfony/spot-hit-notifier/5.3) | `spot-hit-notifier`, `spothitnotifier` |
|
||||
| [symfony/stimulus-bundle](https://packagist.org/packages/symfony/stimulus-bundle) | [2.13](symfony/stimulus-bundle/2.13) | `stimulus`, `stimulus-bundle`, `stimulusbundle` |
|
||||
| [symfony/stimulus-bundle](https://packagist.org/packages/symfony/stimulus-bundle) | [2.20](symfony/stimulus-bundle/2.20) | `stimulus`, `stimulus-bundle`, `stimulusbundle` |
|
||||
| [symfony/sweego-mailer](https://packagist.org/packages/symfony/sweego-mailer) | [7.2](symfony/sweego-mailer/7.2) | `sweego-mailer`, `sweegomailer` |
|
||||
| [symfony/sweego-notifier](https://packagist.org/packages/symfony/sweego-notifier) | [7.2](symfony/sweego-notifier/7.2) | `sweego-notifier`, `sweegonotifier` |
|
||||
| [symfony/swiftmailer-bundle](https://packagist.org/packages/symfony/swiftmailer-bundle) | [2.5](symfony/swiftmailer-bundle/2.5) | `swiftmailer`, `swiftmailer-bundle`, `swiftmailerbundle` |
|
||||
@@ -167,6 +167,7 @@ Additional recipes can be found on the [Contrib Recipes Repository](https://gith
|
||||
| [symfony/ux-react](https://packagist.org/packages/symfony/ux-react) | [2.9](symfony/ux-react/2.9) | `ux-react`, `uxreact` |
|
||||
| [symfony/ux-svelte](https://packagist.org/packages/symfony/ux-svelte) | [2.9](symfony/ux-svelte/2.9) | `ux-svelte`, `uxsvelte` |
|
||||
| [symfony/ux-translator](https://packagist.org/packages/symfony/ux-translator) | [2.9](symfony/ux-translator/2.9) | `ux-translator`, `uxtranslator` |
|
||||
| [symfony/ux-turbo](https://packagist.org/packages/symfony/ux-turbo) | [2.20](symfony/ux-turbo/2.20) | `ux-turbo`, `uxturbo` |
|
||||
| [symfony/ux-twig-component](https://packagist.org/packages/symfony/ux-twig-component) | [2.13](symfony/ux-twig-component/2.13) | `ux-twig-component`, `uxtwigcomponent` |
|
||||
| [symfony/ux-vue](https://packagist.org/packages/symfony/ux-vue) | [2.9](symfony/ux-vue/2.9) | `ux-vue`, `uxvue` |
|
||||
| [symfony/validator](https://packagist.org/packages/symfony/validator) | [7.0](symfony/validator/7.0) | `validation`, `validator` |
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/framework-bundle": {
|
||||
"manifest": {
|
||||
"bundles": {
|
||||
"Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"config/": "%CONFIG_DIR%/",
|
||||
"public/": "%PUBLIC_DIR%/",
|
||||
"src/": "%SRC_DIR%/"
|
||||
},
|
||||
"composer-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||
},
|
||||
"env": {
|
||||
"APP_ENV": "dev",
|
||||
"APP_SECRET": ""
|
||||
},
|
||||
"dotenv": {
|
||||
"dev": {
|
||||
"APP_SECRET": "%generate(secret)%"
|
||||
}
|
||||
},
|
||||
"gitignore": [
|
||||
"/.env.local",
|
||||
"/.env.local.php",
|
||||
"/.env.*.local",
|
||||
"/%CONFIG_DIR%/secrets/prod/prod.decrypt.private.php",
|
||||
"/%PUBLIC_DIR%/bundles/",
|
||||
"/%VAR_DIR%/",
|
||||
"/vendor/"
|
||||
],
|
||||
"post-install-output": [
|
||||
" * <fg=blue>Run</> your application:",
|
||||
" 1. Go to the project directory",
|
||||
" 2. Create your code repository with the <comment>git init</comment> command",
|
||||
" 3. Download the Symfony CLI at <comment>https://symfony.com/download</> to install a development web server",
|
||||
"",
|
||||
" * <fg=blue>Read</> the documentation at <comment>https://symfony.com/doc</>"
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"config/packages/cache.yaml": {
|
||||
"contents": [
|
||||
"framework:",
|
||||
" cache:",
|
||||
" # Unique name of your app: used to compute stable namespaces for cache keys.",
|
||||
" #prefix_seed: your_vendor_name/app_name",
|
||||
"",
|
||||
" # The \"app\" cache stores to the filesystem by default.",
|
||||
" # The data in this cache should persist between deploys.",
|
||||
" # Other options include:",
|
||||
"",
|
||||
" # Redis",
|
||||
" #app: cache.adapter.redis",
|
||||
" #default_redis_provider: redis://localhost",
|
||||
"",
|
||||
" # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)",
|
||||
" #app: cache.adapter.apcu",
|
||||
"",
|
||||
" # Namespaced pools use the above \"app\" backend by default",
|
||||
" #pools:",
|
||||
" #my.dedicated.cache: null",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"config/packages/framework.yaml": {
|
||||
"contents": [
|
||||
"# see https://symfony.com/doc/current/reference/configuration/framework.html",
|
||||
"framework:",
|
||||
" secret: '%env(APP_SECRET)%'",
|
||||
"",
|
||||
" # Note that the session will be started ONLY if you read or write from it.",
|
||||
" session: true",
|
||||
"",
|
||||
" #esi: true",
|
||||
" #fragments: true",
|
||||
"",
|
||||
" # Enable stateless CSRF protection for forms and logins/logouts",
|
||||
" form: { csrf_protection: { token_id: submit } }",
|
||||
" csrf_protection:",
|
||||
" stateless_token_ids: [submit, authenticate, logout]",
|
||||
"",
|
||||
"when@test:",
|
||||
" framework:",
|
||||
" test: true",
|
||||
" session:",
|
||||
" storage_factory_id: session.storage.factory.mock_file",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"config/preload.php": {
|
||||
"contents": [
|
||||
"<?php",
|
||||
"",
|
||||
"if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {",
|
||||
" require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"config/routes/framework.yaml": {
|
||||
"contents": [
|
||||
"when@dev:",
|
||||
" _errors:",
|
||||
" resource: '@FrameworkBundle/Resources/config/routing/errors.xml'",
|
||||
" prefix: /_error",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"config/services.yaml": {
|
||||
"contents": [
|
||||
"# This file is the entry point to configure your own services.",
|
||||
"# Files in the packages/ subdirectory configure your dependencies.",
|
||||
"",
|
||||
"# Put parameters here that don't need to change on each machine where the app is deployed",
|
||||
"# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration",
|
||||
"parameters:",
|
||||
"",
|
||||
"services:",
|
||||
" # default configuration for services in *this* file",
|
||||
" _defaults:",
|
||||
" autowire: true # Automatically injects dependencies in your services.",
|
||||
" autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.",
|
||||
"",
|
||||
" # makes classes in src/ available to be used as services",
|
||||
" # this creates a service per class whose id is the fully-qualified class name",
|
||||
" App\\:",
|
||||
" resource: '../src/'",
|
||||
" exclude:",
|
||||
" - '../src/DependencyInjection/'",
|
||||
" - '../src/Entity/'",
|
||||
" - '../src/Kernel.php'",
|
||||
"",
|
||||
" # add more service definitions when explicit configuration is needed",
|
||||
" # please note that last definitions always *replace* previous ones",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"public/index.php": {
|
||||
"contents": [
|
||||
"<?php",
|
||||
"",
|
||||
"use App\\Kernel;",
|
||||
"",
|
||||
"require_once dirname(__DIR__).'/vendor/autoload_runtime.php';",
|
||||
"",
|
||||
"return function (array $context) {",
|
||||
" return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);",
|
||||
"};",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"src/Controller/.gitignore": {
|
||||
"contents": [
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"src/Kernel.php": {
|
||||
"contents": [
|
||||
"<?php",
|
||||
"",
|
||||
"namespace App;",
|
||||
"",
|
||||
"use Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait;",
|
||||
"use Symfony\\Component\\HttpKernel\\Kernel as BaseKernel;",
|
||||
"",
|
||||
"class Kernel extends BaseKernel",
|
||||
"{",
|
||||
" use MicroKernelTrait;",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "eac198b53dabc891aa5c2d93e35d86e4c217a40b"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/stimulus-bundle": {
|
||||
"manifest": {
|
||||
"bundles": {
|
||||
"Symfony\\UX\\StimulusBundle\\StimulusBundle": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"assets/": "assets/"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2",
|
||||
"symfony/webpack-encore-bundle": "<2.0",
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0"
|
||||
},
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "webpack.config.js",
|
||||
"content": "\n // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)\n .enableStimulusBridge('./assets/controllers.json')",
|
||||
"position": "after_target",
|
||||
"target": ".splitEntryChunks()"
|
||||
},
|
||||
{
|
||||
"file": "assets/app.js",
|
||||
"content": "import './bootstrap.js';",
|
||||
"position": "top",
|
||||
"warn_if_missing": true
|
||||
},
|
||||
{
|
||||
"file": "assets/bootstrap.js",
|
||||
"content": "import { startStimulusApp } from '@symfony/stimulus-bridge';\n\n// Registers Stimulus controllers from controllers.json and in the controllers/ directory\nexport const app = startStimulusApp(require.context(\n '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',\n true,\n /\\.[jt]sx?$/\n));",
|
||||
"position": "top",
|
||||
"requires": "symfony/webpack-encore-bundle"
|
||||
},
|
||||
{
|
||||
"file": "assets/bootstrap.js",
|
||||
"content": "import { startStimulusApp } from '@symfony/stimulus-bundle';\n\nconst app = startStimulusApp();",
|
||||
"position": "top",
|
||||
"requires": "symfony/asset-mapper"
|
||||
}
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"assets/bootstrap.js": {
|
||||
"contents": [
|
||||
"// register any custom, 3rd party controllers here",
|
||||
"// app.register('some_controller_name', SomeImportedController);",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers.json": {
|
||||
"contents": [
|
||||
"{",
|
||||
" \"controllers\": [],",
|
||||
" \"entrypoints\": []",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers/csrf_protection_controller.js": {
|
||||
"contents": [
|
||||
"var nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;",
|
||||
"var tokenCheck = /^[-_/+a-zA-Z0-9]{24,}$/;",
|
||||
"",
|
||||
"// Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager",
|
||||
"document.addEventListener('submit', function (event) {",
|
||||
" var csrfField = event.target.querySelector('input[data-controller=\"csrf-protection\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
" var csrfToken = csrfField.value;",
|
||||
"",
|
||||
" if (!csrfCookie && nameCheck.test(csrfToken)) {",
|
||||
" csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);",
|
||||
" csrfField.value = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));",
|
||||
" }",
|
||||
"",
|
||||
" if (csrfCookie && tokenCheck.test(csrfToken)) {",
|
||||
" var cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';",
|
||||
" document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;",
|
||||
" }",
|
||||
"});",
|
||||
"",
|
||||
"// When @hotwired/turbo handles form submissions, send the CSRF token in a header in addition to a cookie",
|
||||
"// The `framework.csrf_protection.check_header` config option needs to be enabled for the header to be checked",
|
||||
"document.addEventListener('turbo:submit-start', function (event) {",
|
||||
" var csrfField = event.detail.formSubmission.formElement.querySelector('input[data-controller=\"csrf-protection\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
"",
|
||||
" if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {",
|
||||
" event.detail.formSubmission.fetchRequest.headers[csrfCookie] = csrfField.value;",
|
||||
" }",
|
||||
"});",
|
||||
"",
|
||||
"// When @hotwired/turbo handles form submissions, remove the CSRF cookie once a form has been submitted",
|
||||
"document.addEventListener('turbo:submit-end', function (event) {",
|
||||
" var csrfField = event.detail.formSubmission.formElement.querySelector('input[data-controller=\"csrf-protection\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
"",
|
||||
" if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {",
|
||||
" var cookie = csrfCookie + '_' + csrfField.value + '=0; path=/; samesite=strict; max-age=0';",
|
||||
"",
|
||||
" document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;",
|
||||
" }",
|
||||
"});",
|
||||
"",
|
||||
"/* stimulusFetch: 'lazy' */",
|
||||
"export default 'csrf-protection-controller';",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers/hello_controller.js": {
|
||||
"contents": [
|
||||
"import { Controller } from '@hotwired/stimulus';",
|
||||
"",
|
||||
"/*",
|
||||
" * This is an example Stimulus controller!",
|
||||
" *",
|
||||
" * Any element with a data-controller=\"hello\" attribute will cause",
|
||||
" * this controller to be executed. The name \"hello\" comes from the filename:",
|
||||
" * hello_controller.js -> \"hello\"",
|
||||
" *",
|
||||
" * Delete this file or adapt it for your use!",
|
||||
" */",
|
||||
"export default class extends Controller {",
|
||||
" connect() {",
|
||||
" this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "41c4285a926752ec2852a5cafa39e7b527c33a38"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/ux-turbo": {
|
||||
"manifest": {
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2"
|
||||
},
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "config/packages/framework.yaml",
|
||||
"position": "after_target",
|
||||
"target": " csrf_protection:",
|
||||
"content": " check_header: true"
|
||||
}
|
||||
]
|
||||
},
|
||||
"files": [],
|
||||
"ref": "0103ff447478c98e6af6de14c20fa6d8938b4591"
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-1
@@ -460,6 +460,7 @@
|
||||
"ux-react": "symfony/ux-react",
|
||||
"ux-svelte": "symfony/ux-svelte",
|
||||
"ux-translator": "symfony/ux-translator",
|
||||
"ux-turbo": "symfony/ux-turbo",
|
||||
"ux-twig-component": "symfony/ux-twig-component",
|
||||
"ux-vue": "symfony/ux-vue",
|
||||
"uxautocomplete": "symfony/ux-autocomplete",
|
||||
@@ -472,6 +473,7 @@
|
||||
"uxreact": "symfony/ux-react",
|
||||
"uxsvelte": "symfony/ux-svelte",
|
||||
"uxtranslator": "symfony/ux-translator",
|
||||
"uxturbo": "symfony/ux-turbo",
|
||||
"uxtwigcomponent": "symfony/ux-twig-component",
|
||||
"uxvue": "symfony/ux-vue",
|
||||
"validation": "symfony/validator",
|
||||
@@ -1016,7 +1018,8 @@
|
||||
"symfony/stimulus-bundle": [
|
||||
"2.8",
|
||||
"2.9",
|
||||
"2.13"
|
||||
"2.13",
|
||||
"2.20"
|
||||
],
|
||||
"symfony/sweego-mailer": [
|
||||
"7.2"
|
||||
@@ -1103,6 +1106,9 @@
|
||||
"2.8",
|
||||
"2.9"
|
||||
],
|
||||
"symfony/ux-turbo": [
|
||||
"2.20"
|
||||
],
|
||||
"symfony/ux-twig-component": [
|
||||
"2.13"
|
||||
],
|
||||
@@ -1313,6 +1319,12 @@
|
||||
"2.13": {
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0",
|
||||
"symfony/webpack-encore-bundle": "<2.0"
|
||||
},
|
||||
"2.20": {
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0",
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2",
|
||||
"symfony/webpack-encore-bundle": "<2.0"
|
||||
}
|
||||
},
|
||||
"symfony/twig-bundle": {
|
||||
@@ -1372,6 +1384,12 @@
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0"
|
||||
}
|
||||
},
|
||||
"symfony/ux-turbo": {
|
||||
"2.20": {
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2"
|
||||
}
|
||||
},
|
||||
"symfony/ux-vue": {
|
||||
"2.9": {
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0",
|
||||
|
||||
@@ -81,6 +81,11 @@
|
||||
" #esi: true",
|
||||
" #fragments: true",
|
||||
"",
|
||||
" # Enable stateless CSRF protection for forms and logins/logouts",
|
||||
" form: { csrf_protection: { token_id: submit } }",
|
||||
" csrf_protection:",
|
||||
" stateless_token_ids: [submit, authenticate, logout]",
|
||||
"",
|
||||
"when@test:",
|
||||
" framework:",
|
||||
" test: true",
|
||||
@@ -180,7 +185,7 @@
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "87bcf6f7c55201f345d8895deda46d2adbdbaa89"
|
||||
"ref": "eac198b53dabc891aa5c2d93e35d86e4c217a40b"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/stimulus-bundle": {
|
||||
"manifest": {
|
||||
"bundles": {
|
||||
"Symfony\\UX\\StimulusBundle\\StimulusBundle": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"assets/": "assets/"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2",
|
||||
"symfony/webpack-encore-bundle": "<2.0",
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0"
|
||||
},
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "webpack.config.js",
|
||||
"content": "\n // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)\n .enableStimulusBridge('./assets/controllers.json')",
|
||||
"position": "after_target",
|
||||
"target": ".splitEntryChunks()"
|
||||
},
|
||||
{
|
||||
"file": "assets/app.js",
|
||||
"content": "import './bootstrap.js';",
|
||||
"position": "top",
|
||||
"warn_if_missing": true
|
||||
},
|
||||
{
|
||||
"file": "assets/bootstrap.js",
|
||||
"content": "import { startStimulusApp } from '@symfony/stimulus-bridge';\n\n// Registers Stimulus controllers from controllers.json and in the controllers/ directory\nexport const app = startStimulusApp(require.context(\n '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',\n true,\n /\\.[jt]sx?$/\n));",
|
||||
"position": "top",
|
||||
"requires": "symfony/webpack-encore-bundle"
|
||||
},
|
||||
{
|
||||
"file": "assets/bootstrap.js",
|
||||
"content": "import { startStimulusApp } from '@symfony/stimulus-bundle';\n\nconst app = startStimulusApp();",
|
||||
"position": "top",
|
||||
"requires": "symfony/asset-mapper"
|
||||
}
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"assets/bootstrap.js": {
|
||||
"contents": [
|
||||
"// register any custom, 3rd party controllers here",
|
||||
"// app.register('some_controller_name', SomeImportedController);",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers.json": {
|
||||
"contents": [
|
||||
"{",
|
||||
" \"controllers\": [],",
|
||||
" \"entrypoints\": []",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers/csrf_protection_controller.js": {
|
||||
"contents": [
|
||||
"var nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;",
|
||||
"var tokenCheck = /^[-_/+a-zA-Z0-9]{24,}$/;",
|
||||
"",
|
||||
"// Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager",
|
||||
"document.addEventListener('submit', function (event) {",
|
||||
" var csrfField = event.target.querySelector('input[data-controller=\"csrf-protection\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
" var csrfToken = csrfField.value;",
|
||||
"",
|
||||
" if (!csrfCookie && nameCheck.test(csrfToken)) {",
|
||||
" csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);",
|
||||
" csrfField.value = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));",
|
||||
" }",
|
||||
"",
|
||||
" if (csrfCookie && tokenCheck.test(csrfToken)) {",
|
||||
" var cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';",
|
||||
" document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;",
|
||||
" }",
|
||||
"});",
|
||||
"",
|
||||
"// When @hotwired/turbo handles form submissions, send the CSRF token in a header in addition to a cookie",
|
||||
"// The `framework.csrf_protection.check_header` config option needs to be enabled for the header to be checked",
|
||||
"document.addEventListener('turbo:submit-start', function (event) {",
|
||||
" var csrfField = event.detail.formSubmission.formElement.querySelector('input[data-controller=\"csrf-protection\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
"",
|
||||
" if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {",
|
||||
" event.detail.formSubmission.fetchRequest.headers[csrfCookie] = csrfField.value;",
|
||||
" }",
|
||||
"});",
|
||||
"",
|
||||
"// When @hotwired/turbo handles form submissions, remove the CSRF cookie once a form has been submitted",
|
||||
"document.addEventListener('turbo:submit-end', function (event) {",
|
||||
" var csrfField = event.detail.formSubmission.formElement.querySelector('input[data-controller=\"csrf-protection\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" var csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
"",
|
||||
" if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {",
|
||||
" var cookie = csrfCookie + '_' + csrfField.value + '=0; path=/; samesite=strict; max-age=0';",
|
||||
"",
|
||||
" document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;",
|
||||
" }",
|
||||
"});",
|
||||
"",
|
||||
"/* stimulusFetch: 'lazy' */",
|
||||
"export default 'csrf-protection-controller';",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers/hello_controller.js": {
|
||||
"contents": [
|
||||
"import { Controller } from '@hotwired/stimulus';",
|
||||
"",
|
||||
"/*",
|
||||
" * This is an example Stimulus controller!",
|
||||
" *",
|
||||
" * Any element with a data-controller=\"hello\" attribute will cause",
|
||||
" * this controller to be executed. The name \"hello\" comes from the filename:",
|
||||
" * hello_controller.js -> \"hello\"",
|
||||
" *",
|
||||
" * Delete this file or adapt it for your use!",
|
||||
" */",
|
||||
"export default class extends Controller {",
|
||||
" connect() {",
|
||||
" this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "41c4285a926752ec2852a5cafa39e7b527c33a38"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/ux-turbo": {
|
||||
"manifest": {
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2"
|
||||
},
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "config/packages/framework.yaml",
|
||||
"position": "after_target",
|
||||
"target": " csrf_protection:",
|
||||
"content": " check_header: true"
|
||||
}
|
||||
]
|
||||
},
|
||||
"files": [],
|
||||
"ref": "0103ff447478c98e6af6de14c20fa6d8938b4591"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user