@networkpro/web 1.5.2 → 1.6.0

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 (108) hide show
  1. package/CODE_OF_CONDUCT.md +1 -0
  2. package/LICENSE.md +5 -39
  3. package/README.md +319 -39
  4. package/cspell.json +65 -0
  5. package/eslint.config.mjs +2 -1
  6. package/jsconfig.json +2 -1
  7. package/netlify-functions/cspReport.js +68 -0
  8. package/netlify.toml +17 -8
  9. package/package.json +52 -56
  10. package/playwright.config.js +21 -19
  11. package/postcss.config.mjs +1 -0
  12. package/scripts/auditScripts.js +1 -0
  13. package/scripts/bundleCss.js +1 -0
  14. package/scripts/checkEnv.js +1 -0
  15. package/scripts/checkNode.js +46 -19
  16. package/scripts/checkVersions.js +1 -0
  17. package/scripts/flattenHeaders.js +1 -0
  18. package/scripts/validateHeaders.js +1 -0
  19. package/src/app.d.ts +14 -3
  20. package/src/app.html +7 -49
  21. package/src/global.d.ts +1 -0
  22. package/src/hooks.client.ts +16 -7
  23. package/src/hooks.server.js +91 -0
  24. package/src/lib/components/Badges.svelte +1 -0
  25. package/src/lib/components/ContainerSection.svelte +1 -0
  26. package/src/lib/components/FullWidthSection.svelte +15 -1
  27. package/src/lib/components/LegalNav.svelte +1 -0
  28. package/src/lib/components/Logo.svelte +1 -0
  29. package/src/lib/components/MetaTags.svelte +1 -0
  30. package/src/lib/components/PWAInstallButton.svelte +1 -0
  31. package/src/lib/components/RedirectPage.svelte +20 -12
  32. package/src/lib/components/SocialMedia.svelte +1 -0
  33. package/src/lib/components/foss/FossFeatures.svelte +58 -4
  34. package/src/lib/components/foss/FossItemContent.svelte +2 -1
  35. package/src/lib/components/layout/Footer.svelte +4 -1
  36. package/src/lib/components/layout/HeaderDefault.svelte +2 -1
  37. package/src/lib/components/layout/HeaderHome.svelte +2 -1
  38. package/src/lib/data/fossData.js +271 -68
  39. package/src/lib/images.js +10 -1
  40. package/src/lib/img/logo-web.png +0 -0
  41. package/src/lib/img/logo-web.webp +0 -0
  42. package/src/lib/img/posts/eauth.png +0 -0
  43. package/src/lib/img/posts/eauth.webp +0 -0
  44. package/src/lib/index.js +1 -0
  45. package/src/lib/meta.js +1 -1
  46. package/src/lib/pages/AboutContent.svelte +1 -0
  47. package/src/lib/pages/FossContent.svelte +2 -1
  48. package/src/lib/pages/HomeContent.svelte +1 -0
  49. package/src/lib/pages/LicenseContent.svelte +33 -3
  50. package/src/lib/pages/PrivacyContent.svelte +33 -12
  51. package/src/lib/pages/TermsConditionsContent.svelte +3 -0
  52. package/src/lib/pages/TermsUseContent.svelte +3 -0
  53. package/src/lib/registerServiceWorker.js +35 -31
  54. package/src/lib/styles/css/default.css +1 -0
  55. package/src/lib/styles/css/global.css +1 -0
  56. package/src/lib/styles/css/normalize.css +1 -0
  57. package/src/lib/styles/css/offline.css +1 -0
  58. package/src/lib/styles/css/style.css +1 -0
  59. package/src/lib/styles/fa-global.css +1 -0
  60. package/src/lib/styles/global.min.css +1 -0
  61. package/src/lib/styles/index.js +2 -1
  62. package/src/lib/types/metadata.js +1 -0
  63. package/src/lib/unregisterServiceWorker.js +1 -0
  64. package/src/lib/utils/utm.js +1 -0
  65. package/src/routes/+error.svelte +1 -0
  66. package/src/routes/+layout.js +7 -1
  67. package/src/routes/+layout.svelte +8 -6
  68. package/src/routes/+page.server.js +1 -0
  69. package/src/routes/+page.svelte +1 -0
  70. package/src/routes/about/+page.server.js +1 -0
  71. package/src/routes/about/+page.svelte +1 -0
  72. package/src/routes/api/mock-csp/+server.js +22 -0
  73. package/src/routes/consultation/+page.svelte +1 -0
  74. package/src/routes/contact/+page.svelte +1 -0
  75. package/src/routes/foss-spotlight/+page.server.js +1 -0
  76. package/src/routes/foss-spotlight/+page.svelte +1 -0
  77. package/src/routes/license/+page.server.js +1 -0
  78. package/src/routes/license/+page.svelte +1 -0
  79. package/src/routes/privacy-policy/+page.server.js +1 -0
  80. package/src/routes/privacy-policy/+page.svelte +1 -0
  81. package/src/routes/privacy-rights/+page.svelte +1 -0
  82. package/src/routes/terms-conditions/+page.server.js +1 -0
  83. package/src/routes/terms-conditions/+page.svelte +1 -0
  84. package/src/routes/terms-of-use/+page.server.js +1 -0
  85. package/src/routes/terms-of-use/+page.svelte +1 -0
  86. package/src/service-worker.d.ts +8 -0
  87. package/src/service-worker.js +56 -28
  88. package/static/disableSw.js +12 -0
  89. package/static/docs/Home.md +63 -0
  90. package/static/docs/extensions.md +58 -0
  91. package/static/sitemap.xml +7 -7
  92. package/stylelint.config.js +4 -7
  93. package/svelte.config.js +1 -0
  94. package/tests/e2e/app.spec.js +59 -21
  95. package/tests/e2e/mobile.spec.js +50 -29
  96. package/tests/unit/auditScripts.test.js +1 -0
  97. package/tests/unit/checkEnv.test.js +1 -0
  98. package/tests/unit/checkVersions.test.js +1 -0
  99. package/tests/unit/cspReport.test.js +81 -0
  100. package/tests/unit/demo.test.js +1 -0
  101. package/tests/unit/routes/page.svelte.test.js +1 -0
  102. package/tests/unit/unregisterServiceWorker.test.js +1 -0
  103. package/tests/unit/utm.test.js +1 -0
  104. package/{tsconfig.custom.json → tsconfig.custom.jsonc} +2 -1
  105. package/vite.config.js +1 -0
  106. package/vitest.config.client.js +1 -0
  107. package/vitest.config.server.js +1 -0
  108. package/_headers +0 -9
@@ -0,0 +1,91 @@
1
+ /* ==========================================================================
2
+ src/hooks.server.js
3
+
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
5
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
6
+ This file is part of Network Pro.
7
+ ========================================================================== */
8
+
9
+ /**
10
+ * SvelteKit server hook to set Content Security Policy (CSP) header.
11
+ * @type {import('@sveltejs/kit').Handle}
12
+ */
13
+ export async function handle({ event, resolve }) {
14
+ // Create the response
15
+ const response = await resolve(event);
16
+
17
+ // Check if the environment is for testing
18
+ const isTestEnvironment =
19
+ process.env.NODE_ENV === "test" || process.env.ENV_MODE === "ci";
20
+
21
+ // Set the Content Security Policy header
22
+ if (isTestEnvironment) {
23
+ // Relaxed CSP for testing: Allow inline scripts and eval
24
+ response.headers.set(
25
+ "Content-Security-Policy",
26
+ [
27
+ "default-src 'self';",
28
+ "script-src 'self' 'unsafe-inline' 'unsafe-eval' ws://localhost:*;", // Allow inline and eval scripts, and websockets for local testing
29
+ "style-src 'self' 'unsafe-inline';", // Allow inline styles
30
+ "img-src 'self' data:;", // Allow images from same origin and data URIs
31
+ "connect-src 'self';", // Allow connections only to same origin
32
+ "font-src 'self' data:;", // Allow fonts from same origin and data URIs
33
+ "form-action 'self';", // Allow forms to post to same origin
34
+ "base-uri 'self';", // Restrict base URIs to same origin
35
+ "object-src 'none';", // Block all object sources
36
+ "frame-ancestors 'none';", // Prevent framing of the site
37
+ "upgrade-insecure-requests;", // Automatically upgrade HTTP to HTTPS
38
+ "report-uri /api/mock-csp;", // Mock CSP reports for testing
39
+ ].join(" "),
40
+ );
41
+ } else {
42
+ // Production or development environment: use a more restrictive CSP
43
+ response.headers.set(
44
+ "Content-Security-Policy",
45
+ [
46
+ "default-src 'self';", // Allow resources from same origin
47
+ "script-src 'self' 'unsafe-inline';", // Allow inline scripts
48
+ "style-src 'self' 'unsafe-inline';", // Allow inline styles
49
+ "img-src 'self' data:;", // Allow images from same origin and data URIs
50
+ "connect-src 'self';", // Allow connections only to same origin
51
+ "font-src 'self' data:;", // Allow fonts from same origin and data URIs
52
+ "form-action 'self';", // Allow forms to post to same origin
53
+ "base-uri 'self';", // Restrict base URIs to same origin
54
+ "object-src 'none';", // Block all object sources
55
+ "frame-ancestors 'none';", // Prevent framing of the site
56
+ "upgrade-insecure-requests;", // Automatically upgrade HTTP to HTTPS
57
+ `report-uri ${process.env.ENV_MODE === "prod" ? "/.netlify/functions/cspReport" : "/api/mock-csp"};`, // Add CSP report URI for violations
58
+ ].join(" "),
59
+ );
60
+ }
61
+
62
+ // Set other security headers
63
+ response.headers.set(
64
+ "Permissions-Policy",
65
+ [
66
+ "fullscreen=(self)",
67
+ "sync-xhr=()",
68
+ "camera=()",
69
+ "microphone=()",
70
+ "geolocation=()",
71
+ "clipboard-read=()",
72
+ "clipboard-write=()",
73
+ "payment=()",
74
+ "usb=()",
75
+ "hid=()",
76
+ "gamepad=()",
77
+ "serial=()",
78
+ "publickey-credentials-get=()",
79
+ "interest-cohort=()",
80
+ "topics=()",
81
+ ].join(", "),
82
+ );
83
+
84
+ response.headers.set("X-Content-Type-Options", "nosniff");
85
+ response.headers.set("Referrer-Policy", "strict-origin-when-cross-origin");
86
+ response.headers.set("X-Frame-Options", "DENY");
87
+
88
+ return response;
89
+ }
90
+
91
+ // cspell:ignore licdn
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/Badges.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/ContainerSection.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -1,13 +1,27 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/FullWidthSection.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
7
8
 
8
- <div class="full-width-section">
9
+ <script>
10
+ export let centered = false; // this prop lets us control vertical centering
11
+ </script>
12
+
13
+ <div class="full-width-section {centered ? 'centered' : ''}">
9
14
  <div class="container">
10
15
  <slot></slot>
11
16
  <!-- Slot to allow child content -->
12
17
  </div>
13
18
  </div>
19
+
20
+ <style>
21
+ .full-width-section.centered {
22
+ display: flex;
23
+ justify-content: center;
24
+ flex-direction: column;
25
+ min-height: 80vh;
26
+ }
27
+ </style>
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/LegalNav.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/Logo.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/MetaTags.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/PWAInstallButton.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -1,12 +1,14 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/RedirectPage.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
7
8
 
8
9
  <script>
9
10
  import { onMount } from "svelte";
11
+ import FullWidthSection from "$lib/components/FullWidthSection.svelte";
10
12
 
11
13
  export let to;
12
14
  export let delay = 3;
@@ -30,14 +32,26 @@ This file is part of Network Pro.
30
32
  <meta name="robots" content="noindex, nofollow" />
31
33
  </svelte:head>
32
34
 
33
- <div class="container">
34
- <h1>Redirecting…</h1>
35
- <p>You'll be taken to the destination in just a moment.</p>
36
- <div class="loading-spinner" aria-hidden="true"></div>
37
- <p>If nothing happens, <a href={to}>click here</a>.</p>
38
- </div>
35
+ <!-- MAIN CONTENT -->
36
+
37
+ <FullWidthSection centered>
38
+ <div class="redirect-content">
39
+ <h1>Redirecting…</h1>
40
+ <p>You'll be taken to the destination in just a moment.</p>
41
+ <div class="loading-spinner" aria-hidden="true"></div>
42
+ <p>If nothing happens, <a href={to}>click here</a>.</p>
43
+ </div>
44
+ </FullWidthSection>
45
+
46
+ <!-- END MAIN CONTENT -->
39
47
 
40
48
  <style>
49
+ .redirect-content {
50
+ text-align: center;
51
+ font-family: system-ui, sans-serif;
52
+ margin-top: 2rem; /* adjust as needed */
53
+ }
54
+
41
55
  .loading-spinner {
42
56
  width: 48px;
43
57
  height: 48px;
@@ -53,10 +67,4 @@ This file is part of Network Pro.
53
67
  transform: rotate(360deg);
54
68
  }
55
69
  }
56
-
57
- .container {
58
- text-align: center;
59
- font-family: system-ui, sans-serif;
60
- margin-top: 5rem;
61
- }
62
70
  </style>
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/SocialMedia.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -1,14 +1,15 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/foss/FossFeatures.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
7
8
 
8
9
  <script>
9
10
  /**
10
- * Array of feature strings that describe the FOSS item
11
- * @type {string[]}
11
+ * Array of feature objects that describe the FOSS item
12
+ * @type {Array<{ emoji: string, label: string, description: string }>}
12
13
  */
13
14
  export let features = [];
14
15
  </script>
@@ -16,9 +17,62 @@ This file is part of Network Pro.
16
17
  <!-- BEGIN FOSS FEATURES -->
17
18
  {#if features && features.length > 0}
18
19
  <ul>
19
- {#each features as feature}
20
- <li>{feature}</li>
20
+ {#each features as feature, index}
21
+ <li class="emoji">
22
+ {#if index === 0}
23
+ <span class="headline">
24
+ {feature.emoji}
25
+ <span class="label">{feature.label}</span>
26
+ {#if feature.description && feature.description.trim()}
27
+ <span class="description">&mdash; {feature.description}</span>
28
+ {/if}
29
+ </span>
30
+ {:else}
31
+ {feature.emoji}
32
+ <span class="label">{feature.label}</span>
33
+ {#if feature.description && feature.description.trim()}
34
+ <span class="description">&mdash; {feature.description}</span>
35
+ {/if}
36
+ {/if}
37
+ </li>
21
38
  {/each}
22
39
  </ul>
23
40
  {/if}
41
+
24
42
  <!-- END FOSS FEATURES -->
43
+
44
+ <style>
45
+ ul {
46
+ margin: 0;
47
+ list-style-type: none;
48
+ padding-left: 0;
49
+ }
50
+
51
+ ul li {
52
+ font-weight: 600;
53
+ margin-bottom: 0.5em;
54
+ }
55
+
56
+ .emoji {
57
+ margin-right: 8px;
58
+ }
59
+
60
+ .headline {
61
+ display: block; /* Ensure it is on its own line */
62
+ font-weight: bold; /* Keep the first item bold */
63
+ font-style: italic; /* Only make the first item italic */
64
+ margin-bottom: 4px; /* Add space between headline and the rest */
65
+ }
66
+
67
+ .label {
68
+ font-weight: bold; /* Keep the label bold */
69
+ font-family: inherit; /* Ensure it uses the same font-family as normal text */
70
+ }
71
+
72
+ .description {
73
+ display: inline; /* Keep description inline */
74
+ font-weight: normal; /* Ensure the description is normal (not bold) */
75
+ font-family: inherit; /* Ensure it uses the same font-family as normal text */
76
+ font-style: normal; /* Remove italic for the description */
77
+ }
78
+ </style>
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/foss/FossItemContent.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -88,7 +89,7 @@ This file is part of Network Pro.
88
89
  <h3>{fossItem.headline}</h3>
89
90
 
90
91
  <!-- Trusted input, from internal CMS -->
91
- {@html fossItem.detailsDescription}
92
+ {@html fossItem.headlineDescription}
92
93
 
93
94
  <FossFeatures features={fossItem.features} />
94
95
 
@@ -1,17 +1,20 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/layout/Footer.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
7
8
 
9
+ <!-- cspell:ignore ccby gnugpl -->
10
+
8
11
  <script>
9
12
  import { base } from "$app/paths";
10
13
  // Import icons for licenses
11
14
  import { bySvg, ccSvg } from "$lib";
12
15
 
13
16
  // Log the base path to verify its value
14
- //console.log("Base path:", base);
17
+ console.log("Base path:", base);
15
18
 
16
19
  // Dynamic links for licensing and trademark
17
20
  const ccbyLink = `${base}/license#cc-by`;
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/layout/HeaderDefault.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -9,7 +10,7 @@ This file is part of Network Pro.
9
10
  import { base } from "$app/paths";
10
11
 
11
12
  // Log the base path to verify its value
12
- //console.log("Base path:", base);
13
+ console.log("Base path:", base);
13
14
 
14
15
  const homeLink = base || "/";
15
16
  const aboutLink = `${base}/about`;
@@ -1,6 +1,7 @@
1
1
  <!-- ==========================================================================
2
2
  src/lib/components/layout/HeaderHome.svelte
3
3
 
4
+ Copyright © 2025 Network Pro Strategies (Network Pro™)
4
5
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
6
  This file is part of Network Pro.
6
7
  ========================================================================== -->
@@ -9,7 +10,7 @@ This file is part of Network Pro.
9
10
  import { base } from "$app/paths";
10
11
 
11
12
  // Log the base path to verify its value
12
- //console.log("Base path:", base);
13
+ console.log("Base path:", base);
13
14
 
14
15
  const aboutLink = `${base}/about`;
15
16
  const fossLink = `${base}/foss-spotlight`;