@networkpro/web 1.20.0 → 1.21.1
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/.editorconfig +1 -3
- package/.env.template +0 -2
- package/.gitattributes +0 -2
- package/.markdownlint.mjs +1 -1
- package/.prettierignore +0 -2
- package/.stylelintignore +0 -2
- package/CHANGELOG.md +51 -1
- package/cspell.json +1 -0
- package/package.json +5 -5
- package/src/lib/pages/HomeContent.svelte +2 -0
- package/src/lib/registerServiceWorker.js +7 -5
- package/src/lib/stores/posthog.js +46 -26
- package/src/lib/unregisterServiceWorker.js +10 -2
- package/src/lib/utils/initAnalytics.js +75 -0
- package/src/routes/+layout.js +1 -1
- package/src/routes/+layout.svelte +6 -35
- package/src/routes/relay-[slug]/[...catchall]/+server.js +68 -0
- package/src/service-worker.js +1 -1
- package/static/manifest.json +1 -1
- package/stylelint.config.js +0 -6
package/.editorconfig
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# ==========================================================================
|
|
2
1
|
# .editorconfig
|
|
3
2
|
#
|
|
4
3
|
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
@@ -8,7 +7,6 @@
|
|
|
8
7
|
# EditorConfig helps developers define and maintain consistent
|
|
9
8
|
# coding styles between different editors and IDEs
|
|
10
9
|
# See http://editorconfig.org/ for full details
|
|
11
|
-
# ==========================================================================
|
|
12
10
|
|
|
13
11
|
; top-most EditorConfig file
|
|
14
12
|
root = true
|
|
@@ -36,7 +34,7 @@ indent_size = 2
|
|
|
36
34
|
indent_size = 2
|
|
37
35
|
|
|
38
36
|
; JavaScript files -
|
|
39
|
-
[*.{mjs,js,ts}]
|
|
37
|
+
[*.{mjs,cjs,js,ts}]
|
|
40
38
|
curly_bracket_next_line = true
|
|
41
39
|
quote_type = single
|
|
42
40
|
|
package/.env.template
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
# ==========================================================================
|
|
2
1
|
# .env.template
|
|
3
2
|
#
|
|
4
3
|
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
5
4
|
# Environment template for Network Pro
|
|
6
5
|
# Rename to `.env` (or `.env.local`) and customize as needed
|
|
7
|
-
# ==========================================================================
|
|
8
6
|
|
|
9
7
|
# Custom environment mode for scripts and tooling
|
|
10
8
|
# One of: dev, test, ci, preview, prod
|
package/.gitattributes
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# ==========================================================================
|
|
2
1
|
# .gitattributes
|
|
3
2
|
#
|
|
4
3
|
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
@@ -14,7 +13,6 @@
|
|
|
14
13
|
# binary These files are binary and should be left untouched.
|
|
15
14
|
#
|
|
16
15
|
# Note that binary is a macro for -text -diff.
|
|
17
|
-
# ==========================================================================
|
|
18
16
|
|
|
19
17
|
## AUTO-DETECT
|
|
20
18
|
## Handle line endings automatically for files detected as
|
package/.markdownlint.mjs
CHANGED
|
@@ -6,7 +6,7 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
========================================================================== */
|
|
8
8
|
|
|
9
|
-
import noSmartQuotes from './.md-smart-quotes.js';
|
|
9
|
+
import noSmartQuotes from './.md-smart-quotes.js';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
// Enable all default rules, then override below
|
package/.prettierignore
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
# ==========================================================================
|
|
2
1
|
# .prettierignore
|
|
3
2
|
#
|
|
4
3
|
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
5
4
|
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
6
5
|
# This file is part of Network Pro.
|
|
7
|
-
# ==========================================================================
|
|
8
6
|
|
|
9
7
|
# Custom ignores
|
|
10
8
|
.markdownlint.jsonc
|
package/.stylelintignore
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
# ==========================================================================
|
|
2
1
|
# .stylelintignore
|
|
3
2
|
#
|
|
4
3
|
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
5
4
|
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
6
5
|
# This file is part of Network Pro.
|
|
7
|
-
# ==========================================================================
|
|
8
6
|
|
|
9
7
|
# Report files and test results
|
|
10
8
|
playwright-report
|
package/CHANGELOG.md
CHANGED
|
@@ -22,6 +22,54 @@ This project attempts to follow [Keep a Changelog](https://keepachangelog.com/en
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
+
## [1.21.1] - 2025-10-17
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- Introduced universal relay mock handler at `src/routes/relay-[slug]/[...catchall]/+server.js` to consolidate test-only endpoints such as `flags`, `config`, and `config.js`.
|
|
30
|
+
- Added fallback support for `GET`, `HEAD`, and `OPTIONS` methods within the catchall relay handler.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Bumped project version to `v1.21.1`.
|
|
35
|
+
- Standardized header in various files:
|
|
36
|
+
- `.editorconfig`
|
|
37
|
+
- `.env.template`
|
|
38
|
+
- `.gitattributes`
|
|
39
|
+
- `.gitignore`
|
|
40
|
+
- `.prettierignore`
|
|
41
|
+
- `.stylelintignore`
|
|
42
|
+
|
|
43
|
+
### Removed
|
|
44
|
+
|
|
45
|
+
- Deleted unneeded comments in `stylelint.config.js` and `.markdownlint.mjs`.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## [1.21.0] - 2025-10-17
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
- Introduced modular analytics initializer at `src/lib/utils/initAnalytics.js` to handle PostHog tracking, asset preloading, and cleanup logic.
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
|
|
57
|
+
- Bumped project version to `v1.21.0`.
|
|
58
|
+
- Added `pageleave` to `cspell.json` to support custom PostHog events.
|
|
59
|
+
- Expanded `lint` script in `package.json` to include `.cjs` files.
|
|
60
|
+
- Updated `src/service-worker.js` to correctly exclude `security.txt.sig` from caching.
|
|
61
|
+
- Refactored `+layout.svelte` to use the new `initAnalytics.js` utility for cleaner side-effect management.
|
|
62
|
+
- Updated fallback meta description logic in both `+layout.svelte` and `+layout.js`.
|
|
63
|
+
- Adjusted `"purpose"` value in `static/manifest.json` from `"any maskable"` to `"maskable"` for improved PWA icon support.
|
|
64
|
+
- Increased spacing before contact info in `src/lib/pages/HomeContent.svelte`.
|
|
65
|
+
- Enhanced `registerServiceWorker.js` to skip SW registration in Firefox during development, preventing known `/@fs/` path evaluation errors.
|
|
66
|
+
- Integrated automatic cleanup of existing service workers in `registerServiceWorker.js` when running in Firefox + dev mode.
|
|
67
|
+
- Improved logging clarity in `registerServiceWorker.js` to better distinguish SW lifecycle behavior by environment.
|
|
68
|
+
- Updated `unregisterServiceWorker.js` to include scoped SW logging when unregistering.
|
|
69
|
+
- Refactored `posthog.js` to add conditional guards for suppressing noisy analytics errors in development mode.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
25
73
|
## [1.20.0] - 2025-10-17
|
|
26
74
|
|
|
27
75
|
### Added
|
|
@@ -1121,7 +1169,9 @@ This project attempts to follow [Keep a Changelog](https://keepachangelog.com/en
|
|
|
1121
1169
|
|
|
1122
1170
|
<!-- Link references -->
|
|
1123
1171
|
|
|
1124
|
-
[Unreleased]: https://github.com/netwk-pro/netwk-pro.github.io/compare/v1.
|
|
1172
|
+
[Unreleased]: https://github.com/netwk-pro/netwk-pro.github.io/compare/v1.21.1...HEAD
|
|
1173
|
+
[1.21.1]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.21.1
|
|
1174
|
+
[1.21.0]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.21.0
|
|
1125
1175
|
[1.20.0]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.20.0
|
|
1126
1176
|
[1.19.0]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.19.0
|
|
1127
1177
|
[1.18.5]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.18.5
|
package/cspell.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@networkpro/web",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.21.1",
|
|
5
5
|
"description": "Locking Down Networks, Unlocking Confidence™ | Security, Networking, Privacy — Network Pro Strategies",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"advisory",
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"coverage:client": "node scripts/openReport.js client",
|
|
64
64
|
"coverage:server": "node scripts/openReport.js server",
|
|
65
65
|
"coverage:open": "npm run coverage:client && npm run coverage:server",
|
|
66
|
-
"lint": "eslint . --ext .mjs,.
|
|
67
|
-
"lint:fix": "eslint . --ext .mjs,.
|
|
68
|
-
"lint:jsdoc": "eslint . --ext .js,.mjs,.svelte --max-warnings=0",
|
|
66
|
+
"lint": "eslint . --ext .js,.cjs,.mjs,.svelte",
|
|
67
|
+
"lint:fix": "eslint . --ext .js,.cjs,.mjs,.svelte --fix",
|
|
68
|
+
"lint:jsdoc": "eslint . --ext .js,.cjs,.mjs,.svelte --max-warnings=0",
|
|
69
69
|
"lint:css": "stylelint \"**/*.{css,svelte}\" --ignore-path .stylelintignore",
|
|
70
|
-
"lint:md": "npx markdownlint-cli2 \"**/*.{md,markdown}\" \"#node_modules/**\" \"#
|
|
70
|
+
"lint:md": "npx markdownlint-cli2 \"**/*.{md,markdown}\" \"#node_modules/**\" \"#playwright-report/**\" \"#test-results/**\"",
|
|
71
71
|
"lint:all": "npm run lint && npm run lint:md && npm run lint:css && npm run format",
|
|
72
72
|
"format": "prettier --check .",
|
|
73
73
|
"format:fix": "prettier --write .",
|
|
@@ -6,7 +6,7 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
========================================================================== */
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
import { unregisterServiceWorker } from '$lib/unregisterServiceWorker';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Registers the service worker and handles update lifecycle, install prompt,
|
|
@@ -34,11 +34,11 @@ export function registerServiceWorker() {
|
|
|
34
34
|
|
|
35
35
|
if ('serviceWorker' in navigator) {
|
|
36
36
|
const isFirefox = navigator.userAgent.includes('Firefox');
|
|
37
|
-
const
|
|
38
|
-
location.hostname === 'localhost' || location.hostname === '127.0.0.1';
|
|
37
|
+
const isDevMode = import.meta.env.MODE === 'development';
|
|
39
38
|
|
|
40
|
-
if (isFirefox &&
|
|
41
|
-
console.
|
|
39
|
+
if (isFirefox && isDevMode) {
|
|
40
|
+
console.info('[SW] Dev mode in Firefox — unregistering existing service workers.');
|
|
41
|
+
unregisterServiceWorker();
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -107,3 +107,5 @@ export function registerServiceWorker() {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
// cspell:ignore nosw beforeinstallprompt
|
|
@@ -42,40 +42,50 @@ let ph = null;
|
|
|
42
42
|
*/
|
|
43
43
|
export async function initPostHog() {
|
|
44
44
|
if (initialized || typeof window === 'undefined') return;
|
|
45
|
+
const isDev = import.meta.env.MODE === 'development';
|
|
46
|
+
if (isDev) {
|
|
47
|
+
console.info('[PostHog] Skipping init in development mode.');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
initialized = true;
|
|
46
52
|
|
|
47
53
|
const { enabled } = get(trackingPreferences);
|
|
48
54
|
trackingEnabled.set(enabled);
|
|
49
|
-
showReminder.set(get(remindUserToReconsent)); //
|
|
55
|
+
showReminder.set(get(remindUserToReconsent)); // use derived store instead
|
|
50
56
|
|
|
51
57
|
if (!enabled) {
|
|
52
58
|
console.log('[PostHog] Tracking is disabled — skipping init.');
|
|
53
59
|
return;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
62
|
+
try {
|
|
63
|
+
const posthogModule = await import('posthog-js');
|
|
64
|
+
ph = posthogModule.default;
|
|
65
|
+
|
|
66
|
+
// cspell:disable-next-line
|
|
67
|
+
ph.init('phc_Qshfo6AXzh4pS7aPigfqyeo4qj1qlyh7gDuHDeVMSR0', {
|
|
68
|
+
api_host: '/relay-MSR0/',
|
|
69
|
+
ui_host: 'https://us.posthog.com',
|
|
70
|
+
autocapture: true,
|
|
71
|
+
capture_pageview: false,
|
|
72
|
+
person_profiles: 'identified_only',
|
|
73
|
+
loaded: (phInstance) => {
|
|
74
|
+
if (!enabled) {
|
|
75
|
+
console.log(
|
|
76
|
+
'[PostHog] ⛔ User opted out — calling opt_out_capturing()',
|
|
77
|
+
);
|
|
78
|
+
phInstance.opt_out_capturing();
|
|
79
|
+
} else {
|
|
80
|
+
console.log('[PostHog] ✅ Tracking enabled');
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
ph.capture('$pageview');
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.warn('[PostHog] Failed to initialize:', err);
|
|
88
|
+
}
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
/**
|
|
@@ -84,8 +94,13 @@ export async function initPostHog() {
|
|
|
84
94
|
* @param {Record<string, any>} [properties={}] - Optional event properties
|
|
85
95
|
*/
|
|
86
96
|
export function capture(event, properties = {}) {
|
|
87
|
-
|
|
97
|
+
const isDev = import.meta.env.MODE === 'development';
|
|
98
|
+
if (isDev || ph === null || !get(trackingEnabled)) return;
|
|
99
|
+
|
|
100
|
+
try {
|
|
88
101
|
ph.capture(event, properties);
|
|
102
|
+
} catch (err) {
|
|
103
|
+
console.warn(`[PostHog] capture(${event}) failed:`, err);
|
|
89
104
|
}
|
|
90
105
|
}
|
|
91
106
|
|
|
@@ -95,8 +110,13 @@ export function capture(event, properties = {}) {
|
|
|
95
110
|
* @param {Record<string, any>} [properties={}] - Optional user traits
|
|
96
111
|
*/
|
|
97
112
|
export function identify(id, properties = {}) {
|
|
98
|
-
|
|
113
|
+
const isDev = import.meta.env.MODE === 'development';
|
|
114
|
+
if (isDev || ph === null || !get(trackingEnabled)) return;
|
|
115
|
+
|
|
116
|
+
try {
|
|
99
117
|
ph.identify(id, properties);
|
|
118
|
+
} catch (err) {
|
|
119
|
+
console.warn(`[PostHog] identify(${id}) failed:`, err);
|
|
100
120
|
}
|
|
101
121
|
}
|
|
102
122
|
|
|
@@ -8,12 +8,20 @@ This file is part of Network Pro.
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Allows for manual toggling of the service worker
|
|
11
|
+
* DEV USE ONLY
|
|
12
|
+
* @internal
|
|
11
13
|
*/
|
|
12
14
|
export function unregisterServiceWorker() {
|
|
13
15
|
if ('serviceWorker' in navigator) {
|
|
14
16
|
navigator.serviceWorker.getRegistrations().then((registrations) => {
|
|
15
|
-
registrations.
|
|
16
|
-
|
|
17
|
+
if (registrations.length === 0) {
|
|
18
|
+
console.log('🧼 No service workers to unregister.');
|
|
19
|
+
} else {
|
|
20
|
+
registrations.forEach((reg) => {
|
|
21
|
+
console.log(`🧹 Unregistering SW: ${reg.scope}`);
|
|
22
|
+
reg.unregister();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
17
25
|
});
|
|
18
26
|
}
|
|
19
27
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
src/lib/utils/initAnalytics.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
|
+
* @file initAnalytics.js
|
|
11
|
+
* @description Helper utility for initializing analytics.
|
|
12
|
+
*
|
|
13
|
+
* @module src/lib/utils
|
|
14
|
+
* @author Scott Lopez
|
|
15
|
+
* @updated 2025-10-17
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { browser } from '$app/environment';
|
|
19
|
+
import { afterNavigate } from '$app/navigation';
|
|
20
|
+
import { appleTouchIcon, faviconSvg, logoPng, logoWbp } from '$lib';
|
|
21
|
+
import { registerServiceWorker } from '$lib/registerServiceWorker.js';
|
|
22
|
+
import { capture, initPostHog } from '$lib/stores/posthog';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Initializes analytics and telemetry (e.g., PostHog tracking, asset preload).
|
|
26
|
+
* Should be called once per app mount (e.g., from +layout.svelte).
|
|
27
|
+
*
|
|
28
|
+
* @returns {() => void} Cleanup function to unregister global event listeners
|
|
29
|
+
*/
|
|
30
|
+
export function initAnalytics() {
|
|
31
|
+
if (!browser) return () => {};
|
|
32
|
+
|
|
33
|
+
console.log('[APP] initAnalytics() running');
|
|
34
|
+
|
|
35
|
+
registerServiceWorker();
|
|
36
|
+
initPostHog();
|
|
37
|
+
|
|
38
|
+
afterNavigate(() => {
|
|
39
|
+
capture('$pageview');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Track $pageleave
|
|
43
|
+
let hasFiredLeave = false;
|
|
44
|
+
const sendPageLeave = () => {
|
|
45
|
+
if (hasFiredLeave) return;
|
|
46
|
+
hasFiredLeave = true;
|
|
47
|
+
capture('$pageleave');
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
window.addEventListener('pagehide', sendPageLeave);
|
|
51
|
+
window.addEventListener('beforeunload', sendPageLeave);
|
|
52
|
+
|
|
53
|
+
// Debug toggle logic
|
|
54
|
+
const isDev = import.meta.env.MODE === 'development';
|
|
55
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
56
|
+
const debug = urlParams.get('debug') === 'true';
|
|
57
|
+
|
|
58
|
+
if (isDev || debug) {
|
|
59
|
+
console.log('ENV MODE =', import.meta.env.MODE);
|
|
60
|
+
console.log('isDev =', isDev);
|
|
61
|
+
console.log('debug param =', debug);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Preload logo assets
|
|
65
|
+
[logoPng, logoWbp, faviconSvg, appleTouchIcon].forEach((src) => {
|
|
66
|
+
const img = new Image();
|
|
67
|
+
img.src = src;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Clean up listeners when component is destroyed
|
|
71
|
+
return () => {
|
|
72
|
+
window.removeEventListener('pagehide', sendPageLeave);
|
|
73
|
+
window.removeEventListener('beforeunload', sendPageLeave);
|
|
74
|
+
};
|
|
75
|
+
}
|
package/src/routes/+layout.js
CHANGED
|
@@ -21,7 +21,7 @@ import { meta as routeMeta } from '$lib/meta.js'; // Import meta from $lib/meta.
|
|
|
21
21
|
const fallbackMeta = {
|
|
22
22
|
title: 'Security, Networking, Privacy — Network Pro™',
|
|
23
23
|
description:
|
|
24
|
-
'Locking Down Networks, Unlocking Confidence™ | Security, Networking, Privacy — Network Pro
|
|
24
|
+
'Locking Down Networks, Unlocking Confidence™ | Security, Networking, Privacy — Network Pro Strategies',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export const prerender = 'auto';
|
|
@@ -10,13 +10,11 @@ This file is part of Network Pro.
|
|
|
10
10
|
export let data;
|
|
11
11
|
|
|
12
12
|
import { onMount } from 'svelte';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { registerServiceWorker } from '$lib/registerServiceWorker.js';
|
|
16
|
-
import { browser } from '$app/environment';
|
|
17
|
-
import { logoPng, logoWbp, faviconSvg, appleTouchIcon } from '$lib';
|
|
13
|
+
import { initAnalytics } from '$lib/utils/initAnalytics';
|
|
14
|
+
import { showReminder } from '$lib/stores/posthog';
|
|
18
15
|
import { ContainerSection, PWAInstallButton } from '$lib/components';
|
|
19
16
|
import { Footer, HeaderDefault, HeaderHome } from '$lib/components/layout';
|
|
17
|
+
import { appleTouchIcon, faviconSvg, logoPng, logoWbp } from '$lib';
|
|
20
18
|
|
|
21
19
|
import '$lib/styles/global.min.css';
|
|
22
20
|
import '$lib/styles/fa-global.css';
|
|
@@ -24,35 +22,8 @@ This file is part of Network Pro.
|
|
|
24
22
|
$: shouldShowReminder = $showReminder;
|
|
25
23
|
|
|
26
24
|
onMount(() => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
registerServiceWorker();
|
|
30
|
-
initPostHog();
|
|
31
|
-
|
|
32
|
-
// Register navigation tracking only on client
|
|
33
|
-
afterNavigate(() => {
|
|
34
|
-
capture('$pageview');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
if (browser) {
|
|
38
|
-
const isDev = import.meta.env.MODE === 'development';
|
|
39
|
-
|
|
40
|
-
// Check for ?debug=true in URL (no persistence)
|
|
41
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
42
|
-
const debug = urlParams.get('debug') === 'true';
|
|
43
|
-
|
|
44
|
-
if (isDev || debug) {
|
|
45
|
-
console.log('ENV MODE =', import.meta.env.MODE);
|
|
46
|
-
console.log('isDev =', isDev);
|
|
47
|
-
console.log('debug param =', debug);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Preload logo assets
|
|
51
|
-
[logoPng, logoWbp, appleTouchIcon].forEach((src) => {
|
|
52
|
-
const img = new Image();
|
|
53
|
-
img.src = src;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
25
|
+
const cleanup = initAnalytics();
|
|
26
|
+
return cleanup;
|
|
56
27
|
});
|
|
57
28
|
|
|
58
29
|
// fallback values if data.meta not set
|
|
@@ -60,7 +31,7 @@ This file is part of Network Pro.
|
|
|
60
31
|
data?.meta?.title || 'Security, Networking, Privacy — Network Pro™';
|
|
61
32
|
const metaDescription =
|
|
62
33
|
data?.meta?.description ||
|
|
63
|
-
'Locking Down Networks, Unlocking Confidence™ | Security, Networking, Privacy — Network Pro
|
|
34
|
+
'Locking Down Networks, Unlocking Confidence™ | Security, Networking, Privacy — Network Pro Strategies';
|
|
64
35
|
</script>
|
|
65
36
|
|
|
66
37
|
<svelte:head>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
src/routes/relay-[slug]/[...catchall]/+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
|
+
* Universal mock for PostHog Proxy Handler
|
|
11
|
+
*
|
|
12
|
+
* @file +server.js
|
|
13
|
+
* @description Mocks GET, HEAD, and OPTIONS
|
|
14
|
+
* @module src/routes/relay-[slug]/[...catchall]
|
|
15
|
+
* @author Scott Lopez
|
|
16
|
+
* @updated 2025-10-17
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** @typedef {import('@sveltejs/kit').RequestHandler} Handler */
|
|
20
|
+
|
|
21
|
+
/** @type {Handler} */
|
|
22
|
+
export function GET({ url }) {
|
|
23
|
+
const path = url.pathname;
|
|
24
|
+
|
|
25
|
+
// Match known mock paths
|
|
26
|
+
if (path.includes('/flags')) {
|
|
27
|
+
return new Response(
|
|
28
|
+
JSON.stringify({
|
|
29
|
+
feature_flags: [],
|
|
30
|
+
groups: {},
|
|
31
|
+
distinct_id: 'mock-user',
|
|
32
|
+
}),
|
|
33
|
+
{
|
|
34
|
+
status: 200,
|
|
35
|
+
headers: { 'Content-Type': 'application/json', 'X-Mock': 'true' },
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (path.includes('/config') || path.includes('/config.js')) {
|
|
41
|
+
return new Response('{}', {
|
|
42
|
+
status: 200,
|
|
43
|
+
headers: { 'Content-Type': 'application/json', 'X-Mock': 'true' },
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Log unexpected paths during tests
|
|
48
|
+
console.warn('[RELAY MOCK] Unhandled path:', path);
|
|
49
|
+
|
|
50
|
+
// Default 404 response
|
|
51
|
+
return new Response('Not Found', { status: 404 });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** @type {Handler} */
|
|
55
|
+
export function HEAD() {
|
|
56
|
+
return new Response(null, { status: 200 });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** @type {Handler} */
|
|
60
|
+
export function OPTIONS() {
|
|
61
|
+
return new Response(null, {
|
|
62
|
+
status: 204,
|
|
63
|
+
headers: {
|
|
64
|
+
Allow: 'GET, HEAD, OPTIONS',
|
|
65
|
+
'Access-Control-Allow-Origin': '*',
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
package/src/service-worker.js
CHANGED
package/static/manifest.json
CHANGED
package/stylelint.config.js
CHANGED
|
@@ -56,12 +56,6 @@ export default {
|
|
|
56
56
|
"Class names must not start with 'fa-' (FontAwesome classes are ignored)",
|
|
57
57
|
},
|
|
58
58
|
],
|
|
59
|
-
// Disable unnecessarily strict rules
|
|
60
|
-
//'media-type-no-deprecated': null,
|
|
61
|
-
//'property-no-deprecated': null,
|
|
62
|
-
//'nesting-selector-no-missing-scoping-root': null,
|
|
63
|
-
//'no-invalid-position-at-import-rule': null,
|
|
64
|
-
//'no-invalid-position-declaration': null,
|
|
65
59
|
'order/properties-order': [
|
|
66
60
|
[
|
|
67
61
|
{
|