@networkpro/web 1.1.2 → 1.3.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.
package/LICENSE.md CHANGED
@@ -51,7 +51,7 @@ Web: <https://bio.neteng.pro>
51
51
  # Legal, Copyright, and Licensing
52
52
 
53
53
  **Network Pro Strategies**
54
- **Effective Date:** May 8, 2025
54
+ **Effective Date:** May 18, 2025
55
55
 
56
56
  &nbsp;
57
57
 
@@ -74,11 +74,10 @@ Web: <https://bio.neteng.pro>
74
74
  11. [Modifications and Liability Disclaimer](#disclaimer)
75
75
  12. [Contact](#contact)
76
76
  13. [Revisions](#revisions)
77
- 14. [Attribution](#attribution)
78
77
 
79
78
  ---
80
79
 
81
- **Formats Available:** [HTML](./legal) | Markdown
80
+ **Formats Available:** [HTML](https://netwk.pro/license) | Markdown
82
81
 
83
82
  <a name="ownership"></a>
84
83
 
@@ -144,7 +143,7 @@ This work is dual-licensed under:
144
143
 
145
144
  <a name="cc-by"></a>
146
145
 
147
- ## 6. Creative Commons License (CC BY 4.0)
146
+ ## 7. Creative Commons License (CC BY 4.0)
148
147
 
149
148
  <sup>Formats: [HTML](https://legal.netwk.pro/html/CC-BY-4.0.html) | [Markdown](https://github.com/netwk-pro/netwk-pro-legal/blob/master/assets/license/CC-BY-4.0.md) | [Text](https://github.com/netwk-pro/netwk-pro-legal/blob/master/assets/license/CC-BY-4.0.txt) | [RDFa](https://github.com/netwk-pro/netwk-pro-legal/blob/master/assets/license/CC-BY-4.0-rdfa.xml) | [XMP](https://github.com/netwk-pro/netwk-pro-legal/blob/master/assets/license/CC-BY-4.0.xml)</sup>
150
149
 
@@ -170,7 +169,7 @@ Permissions beyond the scope of this License—or instead of those permitted by
170
169
 
171
170
  <a name="gnu-gpl"></a>
172
171
 
173
- ## 7. GNU General Public License (GPL)
172
+ ## 8. GNU General Public License (GPL)
174
173
 
175
174
  <sup>Formats: [HTML](https://legal.netwk.pro/html/COPYING.html) | [Markdown](https://github.com/netwk-pro/netwk-pro-legal/blob/master/assets/license/COPYING.md) | [Text](https://github.com/netwk-pro/netwk-pro-legal/blob/master/assets/license/COPYING.txt) | [RDFa](https://github.com/netwk-pro/netwk-pro-legal/blob/master/assets/license/COPYING-rdfa.xml) | [ODT](https://github.com/netwk-pro/netwk-pro-legal/raw/refs/heads/master/assets/license/COPYING.odt)</sup>
176
175
 
@@ -203,7 +202,7 @@ The inclusion, reference, or linking of any third-party content **does not const
203
202
 
204
203
  <a name="prohibited-uses"></a>
205
204
 
206
- ## 9. Prohibited Uses
205
+ ## 10. Prohibited Uses
207
206
 
208
207
  **The following activities are strictly prohibited and may constitute infringement or unfair competition under applicable law, unless explicitly authorized in writing by the Company:**
209
208
 
@@ -216,7 +215,7 @@ The inclusion, reference, or linking of any third-party content **does not const
216
215
 
217
216
  <a name="disclaimer"></a>
218
217
 
219
- ## 10. Modifications and Liability Disclaimer
218
+ ## 11. Modifications and Liability Disclaimer
220
219
 
221
220
  Modifications, redistribution, or any use of the Licensed Material are performed entirely at your own risk.
222
221
 
@@ -228,16 +227,16 @@ Modifications, redistribution, or any use of the Licensed Material are performed
228
227
 
229
228
  <a name="contact"></a>
230
229
 
231
- ## 11. Contact
230
+ ## 12. Contact
232
231
 
233
- The Company may be contacted via our [contact form](https://contact.neteng.pro) or by email at:
234
- 📧 `support (at) neteng.pro`
232
+ The Company may be contacted via our [contact form](https://netwk.pro/contact) or by email at:
233
+ 📧 `contact (at) s.neteng.pro`
235
234
 
236
235
  <sub>[Back to top](#top)</sub>
237
236
 
238
237
  <a name="revisions"></a>
239
238
 
240
- ## 12. Revisions
239
+ ## 13. Revisions
241
240
 
242
241
  This legal page may be updated to comply with legal or operational changes. The current effective date is listed at the top of this document.
243
242
 
@@ -245,40 +244,12 @@ This legal page may be updated to comply with legal or operational changes. The
245
244
 
246
245
  <a name="attribution"></a>
247
246
 
248
- ## 13. Attribution
249
-
250
- Website base structure provided by HTML5 Boilerplate:
251
- &lt;[https://html5boilerplate.com/](https://html5boilerplate.com/)>&gt;
252
-
253
- ```markdown
254
- Copyright (c) HTML5 Boilerplate
255
-
256
- Permission is hereby granted, free of charge, to any person obtaining a copy of
257
- this software and associated documentation files (the "Software"), to deal in
258
- the Software without restriction, including without limitation the rights to
259
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
260
- the Software, and to permit persons to whom the Software is furnished to do so,
261
- subject to the following conditions:
262
-
263
- The above copyright notice and this permission notice shall be included in all
264
- copies or substantial portions of the Software.
265
-
266
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
267
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
268
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
269
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
270
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
271
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
272
- ```
273
-
274
- <sub>[Back to top](#top)</sub>
275
-
276
247
  ---
277
248
 
278
249
  <div style="font-size: 12px; font-weight: bold; text-align: center;">
279
250
 
280
- [Home](./) &nbsp; | &nbsp; [Terms of Use](./terms-of-use)
281
- [Privacy Policy](./privacy-policy) &nbsp; | &nbsp; Legal
251
+ [Home](https://netwk.pro) &nbsp; | &nbsp; [Terms of Use](https://netwk.pro/terms-of-use)
252
+ [Privacy Policy](https://netwk.pro/privacy-policy) &nbsp; | &nbsp; Legal
282
253
 
283
254
  </div>
284
255
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@networkpro/web",
3
3
  "private": false,
4
4
  "sideEffects": false,
5
- "version": "1.1.2",
5
+ "version": "1.3.0",
6
6
  "description": "Locking Down Networks, Unlocking Confidence | Security, Networking, Privacy — Network Pro Strategies",
7
7
  "keywords": [
8
8
  "security",
@@ -51,6 +51,10 @@
51
51
  "lint:md": "npx markdownlint-cli2 \"**/*.{md,markdown}\" \"#node_modules/**\" \"#build/**\"",
52
52
  "lint:css": "stylelint \"**/*.{css,svelte}\" --ignore-path .stylelintignore",
53
53
  "lint:all": "npm run lint && npm run lint:md && npm run lint:css && npm run format",
54
+ "lhci": "lhci",
55
+ "lighthouse": "npm run lighthouse:local",
56
+ "lighthouse:local": "npm run build && npm run preview & wait-on http://localhost:4173 && npm run lhci:run",
57
+ "lhci:run": "lhci autorun --config=.lighthouserc.cjs",
54
58
  "test": "npm run test:all",
55
59
  "test:all": "npm run test:client -- --run && npm run test:server -- --run",
56
60
  "test:client": "vitest --config vitest.config.client.js",
@@ -58,6 +62,8 @@
58
62
  "test:watch": "vitest --config vitest.config.client.js --watch",
59
63
  "test:coverage": "npm run test:client -- --run --coverage && npm run test:server -- --run --coverage",
60
64
  "css:bundle": "node scripts/bundleCss.js",
65
+ "head:flatten": "node scripts/flattenHeaders.js",
66
+ "head:validate": "node scripts/validateHeaders.js",
61
67
  "checkout": "npm run test:all && npm run lint:all && npm run check"
62
68
  },
63
69
  "devDependencies": {
@@ -1,3 +1,10 @@
1
+ /* ==========================================================================
2
+ playwright.config.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
1
8
  // @ts-check
2
9
  import { defineConfig, devices } from "@playwright/test";
3
10
 
@@ -0,0 +1,61 @@
1
+ /* ==========================================================================
2
+ scripts/flattenHeaders.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ /**
9
+ * CSP header flattening utility
10
+ * Flattens the Content-Security-Policy header in a headers file
11
+ *
12
+ * @module scripts/
13
+ * @author SunDevil311
14
+ * @updated 2025-05-18
15
+ */
16
+
17
+ import fs from "fs";
18
+
19
+ const HEADERS_PATH = "./static/_headers"; // update if needed
20
+ const OUTPUT_PATH = "./static/_headers.flattened";
21
+
22
+ const lines = fs.readFileSync(HEADERS_PATH, "utf-8").split("\n");
23
+ const output = [];
24
+
25
+ let cspLines = [];
26
+ let inCSP = false;
27
+
28
+ for (const line of lines) {
29
+ if (line.trim().startsWith("Content-Security-Policy:")) {
30
+ inCSP = true;
31
+ cspLines.push(line.trim());
32
+ } else if (inCSP && line.startsWith(" ")) {
33
+ cspLines.push(line.trim());
34
+ } else {
35
+ if (inCSP) {
36
+ // Output flattened CSP
37
+ const flattened = cspLines
38
+ .join(" ")
39
+ .replace(/\s*;\s*/g, "; ") // Normalize spacing
40
+ .replace(/\s+/g, " ")
41
+ .trim();
42
+ output.push(` ${flattened}`);
43
+ cspLines = [];
44
+ inCSP = false;
45
+ }
46
+ output.push(line);
47
+ }
48
+ }
49
+
50
+ // Handle edge case: CSP is last in file
51
+ if (cspLines.length > 0) {
52
+ const flattened = cspLines
53
+ .join(" ")
54
+ .replace(/\s*;\s*/g, "; ")
55
+ .replace(/\s+/g, " ")
56
+ .trim();
57
+ output.push(` ${flattened}`);
58
+ }
59
+
60
+ fs.writeFileSync(OUTPUT_PATH, output.join("\n"));
61
+ console.log(`Flattened headers written to ${OUTPUT_PATH}`);
@@ -0,0 +1,95 @@
1
+ /* ==========================================================================
2
+ scripts/validateHeaders.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ /**
9
+ * CSP header validation utility
10
+ * Validates the Content-Security-Policy header in a headers file
11
+ *
12
+ * @module scripts/
13
+ * @author SunDevil311
14
+ * @updated 2025-05-18
15
+ */
16
+
17
+ // validate-headers.js
18
+ import fs from "fs";
19
+
20
+ const file = "./static/_headers";
21
+ const lines = fs.readFileSync(file, "utf-8").split("\n");
22
+
23
+ let currentPath = null;
24
+ let errors = [];
25
+
26
+ let currentHeader = null;
27
+ let headerValueBuffer = [];
28
+
29
+ function flushBufferedHeader(lineNum) {
30
+ if (!currentHeader) return;
31
+
32
+ const value = headerValueBuffer.join(" ").trim();
33
+
34
+ if (currentHeader !== "Content-Security-Policy" && value.endsWith(";")) {
35
+ errors.push(
36
+ `Line ${lineNum}: Header '${currentHeader}' should not end with a semicolon`,
37
+ );
38
+ }
39
+
40
+ if (currentHeader === "Content-Security-Policy" && !value.endsWith(";")) {
41
+ errors.push(
42
+ `Line ${lineNum}: 'Content-Security-Policy' must end with a semicolon`,
43
+ );
44
+ }
45
+
46
+ currentHeader = null;
47
+ headerValueBuffer = [];
48
+ }
49
+
50
+ for (let i = 0; i < lines.length; i++) {
51
+ const line = lines[i];
52
+ const trimmed = line.trim();
53
+
54
+ if (trimmed.startsWith("/*")) {
55
+ if (currentPath) {
56
+ errors.push(
57
+ `Line ${i + 1}: Multiple '/*' blocks detected. Only one is allowed in Netlify _headers`,
58
+ );
59
+ }
60
+ currentPath = trimmed;
61
+ continue;
62
+ }
63
+
64
+ if (trimmed === "") continue;
65
+
66
+ if (line.startsWith(" ")) {
67
+ const colonIndex = line.indexOf(":");
68
+
69
+ if (colonIndex !== -1) {
70
+ // New header
71
+ flushBufferedHeader(i);
72
+ currentHeader = line.substring(0, colonIndex).trim();
73
+ const rest = line.substring(colonIndex + 1).trim();
74
+ headerValueBuffer.push(rest);
75
+ } else if (currentHeader) {
76
+ // Continuation of previous header
77
+ headerValueBuffer.push(trimmed);
78
+ } else {
79
+ errors.push(
80
+ `Line ${i + 1}: Continuation line without a valid header context`,
81
+ );
82
+ }
83
+ }
84
+ }
85
+
86
+ // Final flush
87
+ flushBufferedHeader(lines.length);
88
+
89
+ if (errors.length) {
90
+ console.error("❌ Header validation failed:");
91
+ errors.forEach((e) => console.error(" -", e));
92
+ process.exit(1);
93
+ } else {
94
+ console.log("✅ _headers file passed validation!");
95
+ }
@@ -0,0 +1,15 @@
1
+ /* ==========================================================================
2
+ src/global.d.ts
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ interface BeforeInstallPromptEvent extends Event {
9
+ readonly platforms: string[];
10
+ readonly userChoice: Promise<{
11
+ outcome: 'accepted' | 'dismissed';
12
+ platform: string;
13
+ }>;
14
+ prompt(): Promise<void>;
15
+ }
@@ -0,0 +1,93 @@
1
+ <!-- ==========================================================================
2
+ src/lib/components/PWAInstallButton.svelte
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== -->
7
+
8
+ <script>
9
+ import { onMount } from "svelte";
10
+ import { fade } from "svelte/transition";
11
+
12
+ let show = false;
13
+
14
+ /** @type {BeforeInstallPromptEvent | null} */
15
+ let deferredPrompt = null;
16
+
17
+ /**
18
+ * @typedef {CustomEvent<BeforeInstallPromptEvent>} PWAInstallAvailableEvent
19
+ */
20
+
21
+ onMount(() => {
22
+ /**
23
+ * Listen for the custom event fired by registerServiceWorker.js
24
+ * to enable a custom install experience.
25
+ *
26
+ * TypeScript / svelte-check does not recognize custom events by default,
27
+ * so we cast the base Event to CustomEvent manually.
28
+ */
29
+ window.addEventListener(
30
+ "pwa-install-available",
31
+ (/** @type {Event} */ e) => {
32
+ const customEvent = /** @type {PWAInstallAvailableEvent} */ (e);
33
+ deferredPrompt = customEvent.detail;
34
+ show = true;
35
+ },
36
+ );
37
+ });
38
+
39
+ /**
40
+ * Trigger the native install prompt and handle user response
41
+ */
42
+ async function promptInstall() {
43
+ if (!deferredPrompt) return;
44
+
45
+ deferredPrompt.prompt();
46
+
47
+ const { outcome } = await deferredPrompt.userChoice;
48
+ console.log(`User response to PWA install prompt: ${outcome}`);
49
+
50
+ // Always hide the button after interaction
51
+ show = false;
52
+ deferredPrompt = null;
53
+ }
54
+ </script>
55
+
56
+ {#if show}
57
+ <button
58
+ id="pwa-install"
59
+ class="install-button"
60
+ on:click={promptInstall}
61
+ transition:fade={{ duration: 600 }}>
62
+ Install App
63
+ </button>
64
+ {/if}
65
+
66
+ <style>
67
+ .install-button {
68
+ display: block;
69
+ padding: 0.5rem 1rem;
70
+ border: none;
71
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
72
+ font-size: 1rem;
73
+ font-weight: bold;
74
+ color: #000;
75
+ background-color: #ffc627;
76
+ transition: background-color 0.2s ease-in-out;
77
+ border-radius: 6px;
78
+ cursor: pointer;
79
+ font-family: inherit;
80
+ margin-left: auto;
81
+ margin-right: auto;
82
+ margin-top: 1rem;
83
+ }
84
+
85
+ .install-button:hover {
86
+ background-color: #e6b300;
87
+ }
88
+
89
+ .install-button:focus {
90
+ outline: 2px solid #000;
91
+ outline-offset: 2px;
92
+ }
93
+ </style>
@@ -5,25 +5,31 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
5
  This file is part of Network Pro.
6
6
  ========================================================================== */
7
7
 
8
+ /**
9
+ * Registers the service worker and handles update lifecycle, install prompt, and
10
+ * browser/environment compatibility checks. This supports offline usage and PWA behavior.
11
+ */
8
12
  export function registerServiceWorker() {
9
13
  if ('serviceWorker' in navigator) {
10
14
  // Skip registration in Firefox during development
11
- const isFirefox = navigator.userAgent.indexOf('Firefox') !== -1;
12
- const isDevelopment = window.location.hostname === 'localhost' ||
13
- window.location.hostname === '127.0.0.1';
15
+ const isFirefox = navigator.userAgent.includes('Firefox');
16
+ const isDevelopment =
17
+ window.location.hostname === 'localhost' ||
18
+ window.location.hostname === '127.0.0.1';
14
19
 
15
20
  if (isFirefox && isDevelopment) {
16
21
  console.log('Service Worker registration skipped in Firefox development mode');
17
22
  return;
18
23
  }
19
24
 
20
- // Wait until after the page fully loads for better performance
25
+ // Wait until after full page load for performance optimization
21
26
  window.addEventListener('load', () => {
22
- navigator.serviceWorker.register('service-worker.js')
27
+ navigator.serviceWorker
28
+ .register('service-worker.js')
23
29
  .then((registration) => {
24
30
  console.log('Service Worker registered with scope:', registration.scope);
25
31
 
26
- // Track installation of new service worker
32
+ // Track installation of a new service worker
27
33
  registration.addEventListener('updatefound', () => {
28
34
  const newWorker = registration.installing;
29
35
  console.log('New service worker installing...');
@@ -40,7 +46,7 @@ export function registerServiceWorker() {
40
46
  ) {
41
47
  updatePrompted = true;
42
48
 
43
- // Custom prompt: reload to update
49
+ // Custom prompt: ask user to reload for latest content
44
50
  if (confirm('New content is available. Reload to update?')) {
45
51
  window.location.reload();
46
52
  }
@@ -52,7 +58,7 @@ export function registerServiceWorker() {
52
58
  console.error('Service Worker registration failed:', error);
53
59
  });
54
60
 
55
- // Ensure page reloads when new service worker takes control
61
+ // Ensure the page reloads automatically when the new service worker takes control
56
62
  let refreshing = false;
57
63
  navigator.serviceWorker.addEventListener('controllerchange', () => {
58
64
  if (!refreshing) {
@@ -60,6 +66,14 @@ export function registerServiceWorker() {
60
66
  window.location.reload();
61
67
  }
62
68
  });
69
+
70
+ // Optional PWA install prompt logic
71
+ window.addEventListener('beforeinstallprompt', (e) => {
72
+ e.preventDefault();
73
+ window.dispatchEvent(new CustomEvent('pwa-install-available', {
74
+ detail: /** @type {BeforeInstallPromptEvent} */ (e)
75
+ }));
76
+ });
63
77
  });
64
78
  }
65
79
  }
@@ -12,8 +12,8 @@ This file is part of Network Pro.
12
12
  import Footer from "$lib/components/layout/Footer.svelte";
13
13
  import HeaderDefault from "$lib/components/layout/HeaderDefault.svelte";
14
14
  import HeaderHome from "$lib/components/layout/HeaderHome.svelte";
15
+ import PWAInstallButton from "$lib/components/PWAInstallButton.svelte";
15
16
  import { browser } from "$app/environment";
16
- // TODO: Testing in progress
17
17
  import { registerServiceWorker } from "$lib/registerServiceWorker.js";
18
18
  import "$lib/styles";
19
19
 
@@ -47,7 +47,6 @@ This file is part of Network Pro.
47
47
  // Preload Apple Touch icon
48
48
  touchImg.src = appleTouchIcon;
49
49
 
50
- // TODO: Testing in progress
51
50
  // Register the service worker
52
51
  registerServiceWorker();
53
52
  }
@@ -92,9 +91,11 @@ This file is part of Network Pro.
92
91
  {#if data.pathname === "/"}
93
92
  <!-- Render the Home Header for the root route -->
94
93
  <HeaderHome />
94
+ <PWAInstallButton />
95
95
  {:else}
96
96
  <!-- Render the Default Header for all other routes -->
97
97
  <HeaderDefault />
98
+ <PWAInstallButton />
98
99
  {/if}
99
100
  </ContainerSection>
100
101
  </header>
@@ -8,25 +8,71 @@ This file is part of Network Pro.
8
8
  /** @type {ServiceWorkerGlobalScope} */
9
9
  const sw = self;
10
10
 
11
+ const disallowedHosts = ["licdn.com", "googletagmanager.com"];
12
+
11
13
  import { build, files, version } from "$service-worker";
12
14
 
13
15
  /** @type {string} */
14
16
  const CACHE = `cache-${version}`;
15
17
 
16
18
  /** @type {string[]} */
17
- const ASSETS = Array.from(new Set([...build, ...files, "/offline.html"]));
19
+ const excludedAssets = [];
20
+
21
+ /** @type {string[]} */
22
+ const ASSETS = Array.from(
23
+ new Set(
24
+ [...build, ...files, "/offline.html"].filter((path) => {
25
+ try {
26
+ const url = new URL(path, location.origin);
27
+ const hostname = url.hostname;
28
+
29
+ const shouldExclude =
30
+ path.startsWith("http") ||
31
+ disallowedHosts.some(
32
+ (host) => hostname === host || hostname.endsWith(`.${host}`),
33
+ ) ||
34
+ [
35
+ "/img/banner-1280x640.png",
36
+ "/img/banner-og-1200x630.png",
37
+ "/img/logo-transparent.png",
38
+ "/img/logo.png",
39
+ "/img/svelte.png",
40
+ "/robots.txt",
41
+ "/screenshots/desktop-foss.png",
42
+ "/sitemap.xml",
43
+ "/CNAME",
44
+ ].includes(path);
45
+
46
+ if (shouldExclude) excludedAssets.push(path);
47
+ return !shouldExclude;
48
+ } catch (err) {
49
+ console.warn("[SW] URL parse failed, skipping path:", path, err);
50
+ excludedAssets.push(path);
51
+ return true;
52
+ }
53
+ }),
54
+ ),
55
+ );
18
56
 
19
- console.log("[SW] Assets to cache:", ASSETS); // Helps debug duplicates
57
+ const uniqueExcludedAssets = [...new Set(excludedAssets)].sort();
58
+
59
+ console.log("[SW] Assets to precache:", ASSETS);
60
+ console.log("[SW] Excluded assets:", uniqueExcludedAssets);
20
61
 
21
62
  /**
22
63
  * @param {ExtendableEvent} event
23
64
  */
24
65
  sw.addEventListener("install", (event) => {
25
- /** @type {ExtendableEvent} */ (event).waitUntil(
26
- caches
27
- .open(CACHE)
28
- .then((cache) => cache.addAll(ASSETS))
29
- .then(() => sw.skipWaiting()),
66
+ event.waitUntil(
67
+ (async () => {
68
+ const cache = await caches.open(CACHE);
69
+ try {
70
+ await cache.addAll(ASSETS);
71
+ sw.skipWaiting();
72
+ } catch (err) {
73
+ console.warn("[SW] Failed to precache some assets:", err);
74
+ }
75
+ })(),
30
76
  );
31
77
  });
32
78
 
@@ -64,8 +110,10 @@ sw.addEventListener("activate", (event) => {
64
110
  sw.addEventListener("fetch", (event) => {
65
111
  /** @type {FetchEvent} */ (event).respondWith(
66
112
  (async () => {
67
- const cached = await caches.match(event.request);
68
- if (cached) return cached;
113
+ if (new URL(event.request.url).origin === location.origin) {
114
+ const cached = await caches.match(event.request);
115
+ if (cached) return cached;
116
+ }
69
117
 
70
118
  try {
71
119
  if (event.request.mode === "navigate") {
@@ -1,10 +1,15 @@
1
1
  {
2
+ "id": "/",
3
+ "start_url": "/?utm_source=homescreen",
4
+ "scope": "/",
2
5
  "name": "Network Pro Strategies",
3
6
  "short_name": "Network Pro",
4
7
  "description": "Access our expert cybersecurity services anytime, anywhere with our streamlined Progressive Web App. Optimized for speed, security, and mobile use, this app offers a seamless experience to explore our solutions, view project highlights, and get in touch—all in one place.",
5
- "start_url": "/?utm_source=homescreen",
8
+ "lang": "en-US",
9
+ "dir": "ltr",
6
10
  "display": "standalone",
7
11
  "display_override": ["window-controls-overlay", "minimal-ui"],
12
+ "orientation": "any",
8
13
  "background_color": "#191919",
9
14
  "theme_color": "#ffc627",
10
15
  "icons": [
@@ -22,7 +27,7 @@
22
27
  "src": "/icon-512x512-maskable.png",
23
28
  "type": "image/png",
24
29
  "sizes": "512x512",
25
- "purpose": "maskable"
30
+ "purpose": "any maskable"
26
31
  },
27
32
  {
28
33
  "src": "/icon-splash.png",
@@ -30,9 +35,38 @@
30
35
  "sizes": "512x512"
31
36
  }
32
37
  ],
33
- "orientation": "any",
34
- "scope": "/",
35
38
  "categories": ["business", "security", "technology", "network", "privacy"],
39
+ "prefer_related_applications": false,
40
+ "screenshots": [
41
+ {
42
+ "src": "/screenshots/desktop-home.png",
43
+ "type": "image/png",
44
+ "sizes": "1920x1080",
45
+ "form_factor": "wide",
46
+ "label": "Homescreen of Network Pro Strategies"
47
+ },
48
+ {
49
+ "src": "/screenshots/desktop-about.png",
50
+ "type": "image/png",
51
+ "sizes": "1920x1080",
52
+ "form_factor": "wide",
53
+ "label": "About Network Pro Strategies"
54
+ },
55
+ {
56
+ "src": "/screenshots/mobile-home.png",
57
+ "type": "image/png",
58
+ "sizes": "1080x1920",
59
+ "form_factor": "narrow",
60
+ "label": "Mobile view of Network Pro Strategies homepage"
61
+ },
62
+ {
63
+ "src": "/screenshots/mobile-foss.png",
64
+ "type": "image/png",
65
+ "sizes": "1080x1920",
66
+ "form_factor": "narrow",
67
+ "label": "FOSS Spotlight on mobile"
68
+ }
69
+ ],
36
70
  "shortcuts": [
37
71
  {
38
72
  "name": "Consulting Services",