create-berna-stencil 1.0.24 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.eleventy.js +1 -0
  2. package/.gitignore +2 -2
  3. package/_tools/assistant.js +6 -6
  4. package/_tools/modules/updateOutputPath.js +1 -4
  5. package/_tools/modules/updatePage.js +33 -72
  6. package/_tools/res/templates/template.js +23 -0
  7. package/_tools/res/templates/template.njk +8 -0
  8. package/_tools/res/templates/template.scss +17 -0
  9. package/bin/create.js +1 -1
  10. package/package.json +1 -1
  11. package/src/api/.htaccess +6 -11
  12. package/src/api/config.example.php +5 -20
  13. package/src/api/config.php +5 -20
  14. package/src/api/core/composer.lock +492 -492
  15. package/src/api/{index.php → core/index.php} +53 -24
  16. package/src/api/core/init.php +0 -13
  17. package/src/api/core/vendor/composer/installed.php +2 -2
  18. package/src/api/database/Database.php +24 -0
  19. package/src/api/database/migrations/create_example_db.sql +1 -0
  20. package/src/api/database/migrations/create_users_table.sql +9 -0
  21. package/src/api/database/models/User.php +61 -0
  22. package/src/api/database/seeds/users.php +0 -0
  23. package/src/api/database/services/UserService.php +0 -0
  24. package/src/api/endpoints/protected/auth-system.php +63 -0
  25. package/src/api/endpoints/protected/example-protected.php +17 -0
  26. package/src/api/endpoints/public/auth/login.php +34 -0
  27. package/src/api/endpoints/public/auth/register.php +39 -0
  28. package/src/api/endpoints/public/example-public.php +17 -0
  29. package/src/api/web.config +6 -24
  30. package/src/components/exampleComponent.njk +5 -2
  31. package/src/components/layouts/base.njk +26 -1
  32. package/src/data/site.json +53 -53
  33. package/src/js/modules/langSwitcher.js +1 -1
  34. package/src/web.config +30 -33
  35. package/_tools/res/templates.json +0 -56
  36. package/src/api/endpoints/protected/example-protected-endpoint.php +0 -28
  37. package/src/api/endpoints/public/example-public-endpoint.php +0 -28
@@ -20,7 +20,7 @@ export async function initLangSwitcher() {
20
20
 
21
21
  applyLanguage(initialLang, data);
22
22
 
23
- document.querySelectorAll("input[name='lang-switcher']").forEach((radio) => {
23
+ document.querySelectorAll("input[name='lang-button']").forEach((radio) => {
24
24
  if (radio.value === initialLang) radio.checked = true;
25
25
 
26
26
  radio.addEventListener("change", () => {
package/src/web.config CHANGED
@@ -1,39 +1,36 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <configuration>
3
- <system.webServer>
4
-
5
- <!-- Forza IIS a usare il file 404.html per ogni errore 404 -->
6
- <httpErrors errorMode="Custom" existingResponse="Replace">
7
- <remove statusCode="404" subStatusCode="-1" />
8
- <error statusCode="404" path="/404.html" responseMode="ExecuteURL" />
9
- </httpErrors>
3
+ <system.webServer>
4
+
5
+ <defaultDocument>
6
+ <files>
7
+ <clear />
8
+ <add value="index.html" />
9
+ </files>
10
+ </defaultDocument>
10
11
 
11
- <!-- Sezione Rewrite (richiede il modulo "URL Rewrite" installato su IIS) -->
12
- <rewrite>
13
- <rules>
14
-
15
- <!-- 1. Se la richiesta è per la cartella API, ferma l'elaborazione (action type="None") -->
16
- <rule name="Ignore API Directory" stopProcessing="true">
17
- <match url="^api/.*" ignoreCase="true" />
18
- <action type="None" />
19
- </rule>
12
+ <httpErrors errorMode="Custom" existingResponse="Auto">
13
+ <remove statusCode="404" />
14
+ <error statusCode="404" path="/404.html" responseMode="ExecuteURL" />
15
+ </httpErrors>
20
16
 
21
- <!-- 2. Se il file o la cartella richiesti esistono fisicamente, servili normalmente -->
22
- <rule name="Serve Existing Files and Directories" stopProcessing="true">
23
- <match url="(.*)" />
24
- <conditions logicalGrouping="MatchAny">
25
- <add input="{REQUEST_FILENAME}" matchType="IsFile" />
26
- <add input="{REQUEST_FILENAME}" matchType="IsDirectory" />
27
- </conditions>
28
- <!-- action type="None" significa "non riscrivere l'URL, lascia fare a IIS" -->
29
- <action type="None" />
30
- </rule>
17
+ <rewrite>
18
+ <rules>
19
+ <rule name="Ignore API Directory" stopProcessing="true">
20
+ <match url="^api(/.*)?$" ignoreCase="true" />
21
+ <action type="None" />
22
+ </rule>
23
+ </rules>
24
+ </rewrite>
31
25
 
32
- <!-- 3. Se non esistono e non siamo in /api, IIS non avendo altre regole di rewrite
33
- cercherà il file, non lo troverà e farà scattare l'httpErrors 404 configurato sopra -->
34
-
35
- </rules>
36
- </rewrite>
37
-
38
- </system.webServer>
26
+ <staticContent>
27
+ <remove fileExtension=".webp" />
28
+ <mimeMap fileExtension=".webp" mimeType="image/webp" />
29
+ </staticContent>
30
+
31
+ </system.webServer>
32
+
33
+ <system.web>
34
+ <compilation tempDirectory="D:\AspNetTemp\site\webfixer.it" />
35
+ </system.web>
39
36
  </configuration>
@@ -1,56 +0,0 @@
1
- {
2
- ".scss": [
3
- "//==========================",
4
- "// CSS MODULES IMPORTS",
5
- "//==========================",
6
- "",
7
- "@use \"../modules/root\" as root;",
8
- "",
9
- "@import \"../modules/global\";",
10
- "// Import any other module you need by import down here",
11
- "@import \"../modules/notification\";",
12
- "",
13
- "//==========================",
14
- "// PAGE CUSTOM CSS RULES FOR PAGE: {{pageName}}",
15
- "//==========================",
16
- "",
17
- "// body {",
18
- "// background-color: root.$primary;",
19
- "// }"
20
- ],
21
- ".njk": [
22
- "---",
23
- "title: {{pageName}}",
24
- "permalink: /{{ title | slug }}/",
25
- "layout: includes.njk",
26
- "---",
27
- "",
28
- "<!-- Add content via components in src/components/, not directly here.",
29
- " Register them in src/layouts/includes.njk. -->"
30
- ],
31
- ".js": [
32
- "//==========================",
33
- "// JAVASCRIPT MODULES IMPORTS",
34
- "//==========================",
35
- "",
36
- "// Call inside DOMContentLoaded",
37
- "import { initLangSwitcher } from '../modules/langSwitcher.js';",
38
- "",
39
- "// Call anywhere",
40
- "import { showNotification } from '../modules/notification.js';",
41
- "",
42
- "// Uncomment to enable optional modules (call inside DOMContentLoaded)",
43
- "// import { initTextAreaAutoExpand } from '../modules/forms/textAreaAutoExpand.js';",
44
- "// import { initNormalizePhoneNumber } from '../modules/forms/normalizePhoneNumber.js';",
45
- "",
46
- "//==========================",
47
- "// \"{{pageName}}\" PAGE CUSTOM JAVASCRIPT",
48
- "//==========================",
49
- "",
50
- "document.addEventListener(\"DOMContentLoaded\", () => {",
51
- " initLangSwitcher();",
52
- "});",
53
- "",
54
- "showNotification(\"{{pageName}} notification\", \"success\", 3000);"
55
- ]
56
- }
@@ -1,28 +0,0 @@
1
- <?php
2
-
3
- declare(strict_types=1);
4
-
5
- if (!defined('CORE_ACCESS')) {
6
- $errorPage = $_SERVER['DOCUMENT_ROOT'] . '/404.html';
7
- http_response_code(404);
8
- if (file_exists($errorPage)) {
9
- header('Content-Type: text/html; charset=UTF-8');
10
- echo file_get_contents($errorPage);
11
- } else {
12
- echo "404 Not Found";
13
- }
14
- exit;
15
- }
16
-
17
- require_once __DIR__ . '/../../core/modules/Response.php';
18
-
19
- if ($method !== 'GET') {
20
- Response::error('Method not allowed', 405);
21
- }
22
-
23
- Response::success([
24
- 'message' => 'Protected endpoint is working',
25
- 'endpoint' => 'example-protected-endpoint',
26
- 'visibility' => 'protected',
27
- 'params' => $requestParams,
28
- ]);
@@ -1,28 +0,0 @@
1
- <?php
2
-
3
- declare(strict_types=1);
4
-
5
- if (!defined('CORE_ACCESS')) {
6
- $errorPage = $_SERVER['DOCUMENT_ROOT'] . '/404.html';
7
- http_response_code(404);
8
- if (file_exists($errorPage)) {
9
- header('Content-Type: text/html; charset=UTF-8');
10
- echo file_get_contents($errorPage);
11
- } else {
12
- echo "404 Not Found";
13
- }
14
- exit;
15
- }
16
-
17
- require_once __DIR__ . '/../../core/modules/Response.php';
18
-
19
- if ($method !== 'GET') {
20
- Response::error('Method not allowed', 405);
21
- }
22
-
23
- Response::success([
24
- 'message' => 'Public endpoint is working',
25
- 'endpoint' => 'example-public-endpoint',
26
- 'visibility' => 'public',
27
- 'params' => $requestParams,
28
- ]);