wherever-dev 0.2.0 → 0.4.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/dist/index.js +217 -17
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +21 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +5 -1
- package/dist/protocol.js.map +1 -1
- package/dist/session-pool.d.ts +92 -2
- package/dist/session-pool.d.ts.map +1 -1
- package/dist/session-pool.js +466 -14
- package/dist/session-pool.js.map +1 -1
- package/dist/session-types.d.ts +17 -0
- package/dist/session-types.d.ts.map +1 -1
- package/package.json +1 -1
- package/public/_app/immutable/assets/0.CgLKPJWX.css +1 -0
- package/public/_app/immutable/chunks/CEg8tgYI.js +2 -0
- package/public/_app/immutable/chunks/CEg8tgYI.js.map +1 -0
- package/public/_app/immutable/chunks/CTVuBuYH.js +2 -0
- package/public/_app/immutable/chunks/{B5WJGjcR.js.map → CTVuBuYH.js.map} +1 -1
- package/public/_app/immutable/chunks/DBDAFnY6.js +2 -0
- package/public/_app/immutable/chunks/{BqMutrfe.js.map → DBDAFnY6.js.map} +1 -1
- package/public/_app/immutable/chunks/MtE7VtNZ.js +2 -0
- package/public/_app/immutable/chunks/{DiYtJzYU.js.map → MtE7VtNZ.js.map} +1 -1
- package/public/_app/immutable/chunks/S778j9fy.js +2 -0
- package/public/_app/immutable/chunks/{_lppinj8.js.map → S778j9fy.js.map} +1 -1
- package/public/_app/immutable/chunks/vMsF8lo6.js +3 -0
- package/public/_app/immutable/chunks/{DFxBx2vA.js.map → vMsF8lo6.js.map} +1 -1
- package/public/_app/immutable/chunks/ylfInSZr.js +2 -0
- package/public/_app/immutable/chunks/{BEWoN05F.js.map → ylfInSZr.js.map} +1 -1
- package/public/_app/immutable/entry/app.CklFlIiC.js +3 -0
- package/public/_app/immutable/entry/app.CklFlIiC.js.map +1 -0
- package/public/_app/immutable/entry/start.sF1k4jCY.js +2 -0
- package/public/_app/immutable/entry/start.sF1k4jCY.js.map +1 -0
- package/public/_app/immutable/nodes/0.BEHRw2jv.js +4 -0
- package/public/_app/immutable/nodes/{0.BzvDOlXz.js.map → 0.BEHRw2jv.js.map} +1 -1
- package/public/_app/immutable/nodes/1.2gk2c-6t.js +2 -0
- package/public/_app/immutable/nodes/{1.DMtW3tA5.js.map → 1.2gk2c-6t.js.map} +1 -1
- package/public/_app/immutable/nodes/2.Dto-NrSs.js +82 -0
- package/public/_app/immutable/nodes/2.Dto-NrSs.js.map +1 -0
- package/public/_app/version.json +1 -1
- package/public/index.html +16 -16
- package/public/pwa/apple-touch-icon.png +0 -0
- package/public/pwa/favicon-192.png +0 -0
- package/public/pwa/favicon-512.png +0 -0
- package/public/pwa/favicon.ico +0 -0
- package/public/pwa/favicon.svg +1 -0
- package/public/pwa/manifest.webmanifest +31 -7
- package/public/pwa/maskable-192.png +0 -0
- package/public/pwa/maskable-512.png +0 -0
- package/public/pwa/screenshot-desktop.png +0 -0
- package/public/pwa/screenshot-mobile.png +0 -0
- package/public/robots.txt +5 -0
- package/public/service-worker.js +1 -305
- package/public/_app/immutable/assets/0.DvZxoQjW.css +0 -2754
- package/public/_app/immutable/chunks/B5WJGjcR.js +0 -23
- package/public/_app/immutable/chunks/BEWoN05F.js +0 -110
- package/public/_app/immutable/chunks/BqMutrfe.js +0 -2129
- package/public/_app/immutable/chunks/DFxBx2vA.js +0 -897
- package/public/_app/immutable/chunks/DiYtJzYU.js +0 -396
- package/public/_app/immutable/chunks/_lppinj8.js +0 -879
- package/public/_app/immutable/chunks/rMw82gDs.js +0 -3048
- package/public/_app/immutable/chunks/rMw82gDs.js.map +0 -1
- package/public/_app/immutable/entry/app.BFki2czn.js +0 -309
- package/public/_app/immutable/entry/app.BFki2czn.js.map +0 -1
- package/public/_app/immutable/entry/start.BceUuq27.js +0 -6
- package/public/_app/immutable/entry/start.BceUuq27.js.map +0 -1
- package/public/_app/immutable/nodes/0.BzvDOlXz.js +0 -546
- package/public/_app/immutable/nodes/1.DMtW3tA5.js +0 -24
- package/public/_app/immutable/nodes/2.CnZp8abw.js +0 -5152
- package/public/_app/immutable/nodes/2.CnZp8abw.js.map +0 -1
- package/public/icon.png +0 -0
package/public/_app/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"67da938"}
|
package/public/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<link rel="icon" href="./logo.svg" />
|
|
7
|
-
<meta name="description" content="
|
|
7
|
+
<meta name="description" content="Create & maintain apps from wherever with a beautiful remote workspace." />
|
|
8
8
|
|
|
9
9
|
<!-- inject named-logs-console -->
|
|
10
10
|
<!-- prettier-ignore -->
|
|
@@ -47,33 +47,33 @@
|
|
|
47
47
|
})();
|
|
48
48
|
</script>
|
|
49
49
|
|
|
50
|
-
<link href="./_app/immutable/entry/start.
|
|
51
|
-
<link href="./_app/immutable/chunks/
|
|
52
|
-
<link href="./_app/immutable/chunks/
|
|
53
|
-
<link href="./_app/immutable/entry/app.
|
|
54
|
-
<link href="./_app/immutable/chunks/
|
|
55
|
-
<link href="./_app/immutable/chunks/
|
|
56
|
-
<link href="./_app/immutable/chunks/
|
|
57
|
-
<link href="./_app/immutable/nodes/0.
|
|
58
|
-
<link href="./_app/immutable/chunks/
|
|
59
|
-
<link href="./_app/immutable/chunks/
|
|
60
|
-
<link href="./_app/immutable/nodes/2.
|
|
50
|
+
<link href="./_app/immutable/entry/start.sF1k4jCY.js" rel="modulepreload">
|
|
51
|
+
<link href="./_app/immutable/chunks/DBDAFnY6.js" rel="modulepreload">
|
|
52
|
+
<link href="./_app/immutable/chunks/CEg8tgYI.js" rel="modulepreload">
|
|
53
|
+
<link href="./_app/immutable/entry/app.CklFlIiC.js" rel="modulepreload">
|
|
54
|
+
<link href="./_app/immutable/chunks/ylfInSZr.js" rel="modulepreload">
|
|
55
|
+
<link href="./_app/immutable/chunks/vMsF8lo6.js" rel="modulepreload">
|
|
56
|
+
<link href="./_app/immutable/chunks/MtE7VtNZ.js" rel="modulepreload">
|
|
57
|
+
<link href="./_app/immutable/nodes/0.BEHRw2jv.js" rel="modulepreload">
|
|
58
|
+
<link href="./_app/immutable/chunks/S778j9fy.js" rel="modulepreload">
|
|
59
|
+
<link href="./_app/immutable/chunks/CTVuBuYH.js" rel="modulepreload">
|
|
60
|
+
<link href="./_app/immutable/nodes/2.Dto-NrSs.js" rel="modulepreload">
|
|
61
61
|
|
|
62
|
-
<link href="./_app/immutable/assets/0.
|
|
62
|
+
<link href="./_app/immutable/assets/0.CgLKPJWX.css" rel="stylesheet">
|
|
63
63
|
</head>
|
|
64
64
|
<body data-sveltekit-preload-data="hover">
|
|
65
65
|
<div style="display: contents">
|
|
66
66
|
<script>
|
|
67
67
|
{
|
|
68
|
-
|
|
68
|
+
__sveltekit_dmlg6r = {
|
|
69
69
|
base: new URL(".", location).pathname.slice(0, -1)
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
const element = document.currentScript.parentElement;
|
|
73
73
|
|
|
74
74
|
Promise.all([
|
|
75
|
-
import("./_app/immutable/entry/start.
|
|
76
|
-
import("./_app/immutable/entry/app.
|
|
75
|
+
import("./_app/immutable/entry/start.sF1k4jCY.js"),
|
|
76
|
+
import("./_app/immutable/entry/app.CklFlIiC.js")
|
|
77
77
|
]).then(([kit, app]) => {
|
|
78
78
|
kit.start(app, element);
|
|
79
79
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/public/pwa/favicon.ico
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120"><defs><linearGradient id="d" x1="0%" x2="100%" y1="0%" y2="100%"><stop offset="0%" stop-color="#06b6d4"/><stop offset="50%" stop-color="#3b82f6"/><stop offset="100%" stop-color="#8b5cf6"/></linearGradient><linearGradient id="a" x1="0%" x2="100%" y1="0%" y2="100%"><stop offset="0%" stop-color="#06b6d4" stop-opacity=".5"/><stop offset="100%" stop-color="#8b5cf6" stop-opacity=".5"/></linearGradient><filter id="c"><feGaussianBlur result="coloredBlur" stdDeviation="3"/><feMerge><feMergeNode in="coloredBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs><g fill="none" stroke="url(#a)" filter="url(#c)" opacity=".3"><circle cx="60" cy="60" r="48" stroke-dasharray="4 8"/><circle cx="60" cy="60" r="36" stroke-dasharray="6 6" stroke-width="1.5"/></g><g filter="url(#c)"><path fill="none" stroke="url(#d)" stroke-linecap="round" stroke-linejoin="round" stroke-width="10" d="M28 38s7 44 18 44c9 0 8-38 14-38s5 38 14 38c11 0 18-44 18-44"/></g><circle cx="28" cy="38" r="4" fill="#06b6d4"/><circle cx="28" cy="38" r="1.5" fill="#fff"/><circle cx="92" cy="38" r="4" fill="#8b5cf6"/><circle cx="92" cy="38" r="1.5" fill="#fff"/><circle cx="60" cy="44" r="3" fill="#3b82f6"/></svg>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"description": "
|
|
4
|
-
"display": "
|
|
2
|
+
"name": "Wherever",
|
|
3
|
+
"description": "Create & maintain apps from wherever with a beautiful remote workspace.",
|
|
4
|
+
"display": "standalone",
|
|
5
5
|
"scope": "../",
|
|
6
6
|
"start_url": "../",
|
|
7
7
|
"background_color": "#000000",
|
|
@@ -10,18 +10,42 @@
|
|
|
10
10
|
{
|
|
11
11
|
"src": "favicon-192.png",
|
|
12
12
|
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
13
|
+
"sizes": "192x192",
|
|
14
|
+
"purpose": "any"
|
|
14
15
|
},
|
|
15
16
|
{
|
|
16
17
|
"src": "favicon-512.png",
|
|
17
18
|
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
+
"sizes": "512x512",
|
|
20
|
+
"purpose": "any"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"src": "maskable-192.png",
|
|
24
|
+
"type": "image/png",
|
|
25
|
+
"sizes": "192x192",
|
|
26
|
+
"purpose": "maskable"
|
|
19
27
|
},
|
|
20
28
|
{
|
|
21
|
-
"src": "
|
|
29
|
+
"src": "maskable-512.png",
|
|
22
30
|
"type": "image/png",
|
|
23
31
|
"sizes": "512x512",
|
|
24
32
|
"purpose": "maskable"
|
|
25
33
|
}
|
|
34
|
+
],
|
|
35
|
+
"screenshots": [
|
|
36
|
+
{
|
|
37
|
+
"src": "screenshot-desktop.png",
|
|
38
|
+
"sizes": "1867x1048",
|
|
39
|
+
"type": "image/png",
|
|
40
|
+
"form_factor": "wide",
|
|
41
|
+
"label": "Wherever dashboard on desktop"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"src": "screenshot-mobile.png",
|
|
45
|
+
"sizes": "366x790",
|
|
46
|
+
"type": "image/png",
|
|
47
|
+
"form_factor": "narrow",
|
|
48
|
+
"label": "Wherever dashboard on mobile"
|
|
49
|
+
}
|
|
26
50
|
]
|
|
27
|
-
}
|
|
51
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/public/service-worker.js
CHANGED
|
@@ -1,305 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const build = [
|
|
3
|
-
base + "/_app/immutable/entry/start.BceUuq27.js",
|
|
4
|
-
base + "/_app/immutable/entry/app.BFki2czn.js",
|
|
5
|
-
base + "/_app/immutable/nodes/0.BzvDOlXz.js",
|
|
6
|
-
base + "/_app/immutable/assets/0.DvZxoQjW.css",
|
|
7
|
-
base + "/_app/immutable/nodes/1.DMtW3tA5.js",
|
|
8
|
-
base + "/_app/immutable/nodes/2.CnZp8abw.js",
|
|
9
|
-
base + "/_app/immutable/chunks/B5WJGjcR.js",
|
|
10
|
-
base + "/_app/immutable/chunks/BEWoN05F.js",
|
|
11
|
-
base + "/_app/immutable/chunks/BqMutrfe.js",
|
|
12
|
-
base + "/_app/immutable/chunks/DFxBx2vA.js",
|
|
13
|
-
base + "/_app/immutable/chunks/DiYtJzYU.js",
|
|
14
|
-
base + "/_app/immutable/chunks/_lppinj8.js",
|
|
15
|
-
base + "/_app/immutable/chunks/rMw82gDs.js"
|
|
16
|
-
];
|
|
17
|
-
const files = [
|
|
18
|
-
base + "/icon.png",
|
|
19
|
-
base + "/logo.svg",
|
|
20
|
-
base + "/pwa/apple-touch-icon.png",
|
|
21
|
-
base + "/pwa/favicon-192.png",
|
|
22
|
-
base + "/pwa/favicon-512.png",
|
|
23
|
-
base + "/pwa/favicon.ico",
|
|
24
|
-
base + "/pwa/favicon.png",
|
|
25
|
-
base + "/pwa/manifest.webmanifest"
|
|
26
|
-
];
|
|
27
|
-
const prerendered = [
|
|
28
|
-
base + "/"
|
|
29
|
-
];
|
|
30
|
-
const version = "5214502";
|
|
31
|
-
const ID = version;
|
|
32
|
-
const sw = self;
|
|
33
|
-
let ASSETS = [];
|
|
34
|
-
{
|
|
35
|
-
ASSETS = build.concat(prerendered).concat(files.filter((v) => v.indexOf("pwa/") === -1));
|
|
36
|
-
}
|
|
37
|
-
let _logEnabled = true;
|
|
38
|
-
function log(...args) {
|
|
39
|
-
if (_logEnabled) {
|
|
40
|
-
console.debug(`[Service Worker #${ID}] ${args[0]}`, ...args.slice(1));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const CACHE_NAME = `cache-${version}`;
|
|
44
|
-
const regexesOnlineFirst = [];
|
|
45
|
-
{
|
|
46
|
-
regexesOnlineFirst.push("localhost");
|
|
47
|
-
}
|
|
48
|
-
const regexesOnlineOnly = [];
|
|
49
|
-
const regexesCacheFirst = [
|
|
50
|
-
sw.location.origin,
|
|
51
|
-
// 'https://rsms.me/inter/', // TODO remove, used if using font from there
|
|
52
|
-
"cdn",
|
|
53
|
-
".*\\.png$",
|
|
54
|
-
".*\\.svg$"
|
|
55
|
-
];
|
|
56
|
-
const regexesCacheOnly = [];
|
|
57
|
-
log(`Origin: ${sw.location.origin}`);
|
|
58
|
-
sw.addEventListener("install", (event) => {
|
|
59
|
-
log("Install");
|
|
60
|
-
event.waitUntil(
|
|
61
|
-
caches.open(CACHE_NAME).then((cache) => {
|
|
62
|
-
log(`Creating cache: ${CACHE_NAME}`);
|
|
63
|
-
return cache.addAll(ASSETS);
|
|
64
|
-
}).then(() => {
|
|
65
|
-
log(`cache fully fetched!`);
|
|
66
|
-
})
|
|
67
|
-
);
|
|
68
|
-
});
|
|
69
|
-
sw.addEventListener("activate", (event) => {
|
|
70
|
-
log("Activate");
|
|
71
|
-
event.waitUntil(
|
|
72
|
-
caches.keys().then((cacheNames) => {
|
|
73
|
-
return Promise.all(
|
|
74
|
-
cacheNames.map((thisCacheName) => {
|
|
75
|
-
if (thisCacheName !== CACHE_NAME) {
|
|
76
|
-
log(`Deleting: ${thisCacheName}`);
|
|
77
|
-
return caches.delete(thisCacheName);
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
).then(() => sw.clients.claim());
|
|
81
|
-
})
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
async function fetchAndUpdateCache(request, cache) {
|
|
85
|
-
try {
|
|
86
|
-
const response = await fetch(request);
|
|
87
|
-
try {
|
|
88
|
-
const cache_1 = await caches.open(CACHE_NAME);
|
|
89
|
-
if (request.method === "GET" && request.url.startsWith("http")) {
|
|
90
|
-
cache_1.put(request, response.clone());
|
|
91
|
-
}
|
|
92
|
-
return response;
|
|
93
|
-
} catch (err) {
|
|
94
|
-
log(`error: ${err}`);
|
|
95
|
-
return response;
|
|
96
|
-
}
|
|
97
|
-
} catch (err_1) {
|
|
98
|
-
if (cache) {
|
|
99
|
-
return cache;
|
|
100
|
-
} else {
|
|
101
|
-
return new Response(`Could Not fetch ${request.url}`, {
|
|
102
|
-
status: 503,
|
|
103
|
-
headers: { "Content-Type": "text/plain" }
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
const cacheFirst = {
|
|
109
|
-
method: (request, cache) => {
|
|
110
|
-
log(`Cache first: ${request.url}`);
|
|
111
|
-
const fromNetwork = fetchAndUpdateCache(request, cache);
|
|
112
|
-
return cache || fromNetwork;
|
|
113
|
-
},
|
|
114
|
-
regexes: regexesCacheFirst
|
|
115
|
-
};
|
|
116
|
-
const cacheOnly = {
|
|
117
|
-
method: (request, cache) => {
|
|
118
|
-
log(`Cache only: ${request.url}`);
|
|
119
|
-
return cache || fetchAndUpdateCache(request, cache);
|
|
120
|
-
},
|
|
121
|
-
regexes: regexesCacheOnly
|
|
122
|
-
};
|
|
123
|
-
const onlineFirst = {
|
|
124
|
-
method: (request, cache) => {
|
|
125
|
-
log(`Online first: ${request.url}`);
|
|
126
|
-
return fetchAndUpdateCache(request, cache);
|
|
127
|
-
},
|
|
128
|
-
regexes: regexesOnlineFirst
|
|
129
|
-
};
|
|
130
|
-
const onlineOnly = {
|
|
131
|
-
method: (request) => {
|
|
132
|
-
log(`Online only: ${request.url}`);
|
|
133
|
-
return fetch(request);
|
|
134
|
-
},
|
|
135
|
-
regexes: regexesOnlineOnly
|
|
136
|
-
};
|
|
137
|
-
async function getResponse(event) {
|
|
138
|
-
const request = event.request;
|
|
139
|
-
const registration = sw.registration;
|
|
140
|
-
if (event.request.mode === "navigate" && event.request.method === "GET" && registration.waiting && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
|
-
(await sw.clients.matchAll()).length < 2) {
|
|
142
|
-
log("only one client, skipWaiting as we navigate the page");
|
|
143
|
-
registration.waiting.postMessage("skipWaiting");
|
|
144
|
-
const response2 = new Response("", { headers: { Refresh: "0" } });
|
|
145
|
-
return response2;
|
|
146
|
-
}
|
|
147
|
-
const response = await caches.match(request).then((cache) => {
|
|
148
|
-
const patterns = [onlineFirst, onlineOnly, cacheFirst, cacheOnly];
|
|
149
|
-
for (const pattern of patterns) {
|
|
150
|
-
for (const regex of pattern.regexes) {
|
|
151
|
-
if (RegExp(regex).test(request.url)) {
|
|
152
|
-
return pattern.method(request, cache);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return onlineFirst.method(request, cache);
|
|
157
|
-
});
|
|
158
|
-
return response;
|
|
159
|
-
}
|
|
160
|
-
sw.addEventListener("fetch", (event) => {
|
|
161
|
-
event.respondWith(getResponse(event));
|
|
162
|
-
});
|
|
163
|
-
sw.addEventListener("message", async function(event) {
|
|
164
|
-
if (event.data && event.data.type === "debug") {
|
|
165
|
-
_logEnabled = event.data.enabled && event.data.level >= 5;
|
|
166
|
-
if (_logEnabled) {
|
|
167
|
-
log(`log enabled ${event.data.level}`);
|
|
168
|
-
}
|
|
169
|
-
} else if (event.data && event.data.type === "ping") {
|
|
170
|
-
log("pong");
|
|
171
|
-
} else if (event.data === "skipWaiting") {
|
|
172
|
-
log(`skipWaiting received`);
|
|
173
|
-
event.waitUntil(sw.skipWaiting());
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
async function getClientsStatus() {
|
|
177
|
-
const windowClients = await sw.clients.matchAll({
|
|
178
|
-
type: "window",
|
|
179
|
-
includeUncontrolled: true
|
|
180
|
-
});
|
|
181
|
-
let atLeastOneVisible;
|
|
182
|
-
let atLeastOneFocused;
|
|
183
|
-
let atLeastOneVisibleAndFocused;
|
|
184
|
-
for (var i = 0; i < windowClients.length; i++) {
|
|
185
|
-
const windowClient = windowClients[i];
|
|
186
|
-
const visible = windowClient.visibilityState === "visible";
|
|
187
|
-
const hasFocus = windowClient.focused;
|
|
188
|
-
if (visible && !atLeastOneVisible) {
|
|
189
|
-
atLeastOneVisible = windowClient;
|
|
190
|
-
}
|
|
191
|
-
if (hasFocus && !atLeastOneFocused) {
|
|
192
|
-
atLeastOneFocused = windowClient;
|
|
193
|
-
}
|
|
194
|
-
if (hasFocus && visible) {
|
|
195
|
-
atLeastOneVisibleAndFocused = windowClient;
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return {
|
|
200
|
-
atLeastOneFocused,
|
|
201
|
-
atLeastOneVisible,
|
|
202
|
-
atLeastOneVisibleAndFocused
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
async function handlePush(data) {
|
|
206
|
-
const appActive = await getClientsStatus();
|
|
207
|
-
const notificationTuple = {
|
|
208
|
-
title: "Notification",
|
|
209
|
-
options: {
|
|
210
|
-
body: "You have a new notification",
|
|
211
|
-
icon: "/favicon.png",
|
|
212
|
-
// TODO template it ?
|
|
213
|
-
badge: "/favicon.png"
|
|
214
|
-
// TODO template it ?
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
if (data) {
|
|
218
|
-
try {
|
|
219
|
-
const json = JSON.parse(data);
|
|
220
|
-
if (json.web_push === 8030) {
|
|
221
|
-
const notif = json.notification;
|
|
222
|
-
notificationTuple.options = {
|
|
223
|
-
badge: notif.badge,
|
|
224
|
-
body: notif.body,
|
|
225
|
-
data: notif.data,
|
|
226
|
-
dir: notif.dir,
|
|
227
|
-
icon: notif.icon,
|
|
228
|
-
lang: notif.lang,
|
|
229
|
-
requireInteraction: notif.requireInteraction,
|
|
230
|
-
silent: notif.silent,
|
|
231
|
-
tag: notif.tag
|
|
232
|
-
};
|
|
233
|
-
notificationTuple.title = notif.title;
|
|
234
|
-
if (!notificationTuple.options.icon) {
|
|
235
|
-
notificationTuple.options.icon = notif.image;
|
|
236
|
-
}
|
|
237
|
-
if (notif.navigate) {
|
|
238
|
-
if (!notificationTuple.options.data) {
|
|
239
|
-
notificationTuple.options.data = { navigate: notif.navigate };
|
|
240
|
-
} else {
|
|
241
|
-
if (typeof notificationTuple.options.data === "object" && !notificationTuple.options.data.navigate) {
|
|
242
|
-
notificationTuple.options.data = {
|
|
243
|
-
...notificationTuple.options.data,
|
|
244
|
-
navigate: notif.navigate
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
} else {
|
|
250
|
-
notificationTuple.title = json.notification?.title || json.title || "Notification";
|
|
251
|
-
notificationTuple.options = json.notification || json.options;
|
|
252
|
-
}
|
|
253
|
-
} catch {
|
|
254
|
-
notificationTuple.options.body = data;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
log(`handlePush`, data, notificationTuple);
|
|
258
|
-
if (appActive.atLeastOneVisibleAndFocused) {
|
|
259
|
-
log(`posting notification to active app`, notificationTuple);
|
|
260
|
-
appActive.atLeastOneVisibleAndFocused.postMessage({
|
|
261
|
-
type: "notification",
|
|
262
|
-
notification: {
|
|
263
|
-
title: notificationTuple.title,
|
|
264
|
-
options: notificationTuple.options
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
} else {
|
|
268
|
-
await sw.registration.showNotification(
|
|
269
|
-
notificationTuple.title,
|
|
270
|
-
notificationTuple.options
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
sw.addEventListener("push", function(event) {
|
|
275
|
-
const data = event.data?.text();
|
|
276
|
-
event.waitUntil(handlePush(data));
|
|
277
|
-
});
|
|
278
|
-
async function handleNotificationClick(notification) {
|
|
279
|
-
const windowClients = await sw.clients.matchAll({
|
|
280
|
-
type: "window",
|
|
281
|
-
includeUncontrolled: true
|
|
282
|
-
});
|
|
283
|
-
const swPath = location.pathname;
|
|
284
|
-
const swFolder = swPath.substring(0, swPath.lastIndexOf("/") + 1);
|
|
285
|
-
let url = notification.data?.navigate;
|
|
286
|
-
if (url) {
|
|
287
|
-
if (!url.startsWith("/") && url.indexOf(":/") == -1) {
|
|
288
|
-
url = swFolder + url;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
for (const client of windowClients) {
|
|
292
|
-
log(`${"focus" in client ? "focus-available: " : ""}: ${client.url}`);
|
|
293
|
-
if ("focus" in client) {
|
|
294
|
-
if (url && "navigate" in client) {
|
|
295
|
-
return client.focus().then(() => client.navigate(url));
|
|
296
|
-
}
|
|
297
|
-
return client.focus();
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
if (sw.clients.openWindow) return sw.clients.openWindow(url || "/");
|
|
301
|
-
}
|
|
302
|
-
sw.addEventListener("notificationclick", function(event) {
|
|
303
|
-
event.notification.close();
|
|
304
|
-
event.waitUntil(handleNotificationClick(event.notification));
|
|
305
|
-
});
|
|
1
|
+
const a=location.pathname.split("/").slice(0,-1).join("/"),b=[a+"/_app/immutable/entry/start.sF1k4jCY.js",a+"/_app/immutable/entry/app.CklFlIiC.js",a+"/_app/immutable/nodes/0.BEHRw2jv.js",a+"/_app/immutable/assets/0.CgLKPJWX.css",a+"/_app/immutable/nodes/1.2gk2c-6t.js",a+"/_app/immutable/nodes/2.Dto-NrSs.js",a+"/_app/immutable/chunks/CEg8tgYI.js",a+"/_app/immutable/chunks/CTVuBuYH.js",a+"/_app/immutable/chunks/DBDAFnY6.js",a+"/_app/immutable/chunks/MtE7VtNZ.js",a+"/_app/immutable/chunks/S778j9fy.js",a+"/_app/immutable/chunks/vMsF8lo6.js",a+"/_app/immutable/chunks/ylfInSZr.js"],y=[a+"/logo.svg",a+"/pwa/apple-touch-icon.png",a+"/pwa/favicon-192.png",a+"/pwa/favicon-512.png",a+"/pwa/favicon.ico",a+"/pwa/favicon.png",a+"/pwa/favicon.svg",a+"/pwa/manifest.webmanifest",a+"/pwa/maskable-192.png",a+"/pwa/maskable-512.png",a+"/pwa/screenshot-desktop.png",a+"/pwa/screenshot-mobile.png",a+"/robots.txt"],v=[a+"/"],m="67da938",k=m,s=self;let w=[];w=b.concat(v).concat(y.filter(t=>t.indexOf("pwa/")===-1));let u=!0;function o(...t){u&&console.debug(`[Service Worker #${k}] ${t[0]}`,...t.slice(1))}const d=`cache-${m}`,g=[];g.push("localhost");const $=["/sessions(\\?|$|/)","/models(\\?|$|/)","/config(\\?|$|/)","/check-path(\\?|$|/)","/autocomplete-path(\\?|$|/)","/session/","/health(\\?|$)"];for(const t of $)g.push(t);const C=[],O=[s.location.origin,"cdn",".*\\.png$",".*\\.svg$"],j=[];o(`Origin: ${s.location.origin}`);s.addEventListener("install",t=>{o("Install"),t.waitUntil(caches.open(d).then(i=>(o(`Creating cache: ${d}`),i.addAll(w))).then(()=>{o("cache fully fetched!")}))});s.addEventListener("activate",t=>{o("Activate"),t.waitUntil(caches.keys().then(i=>Promise.all(i.map(e=>{if(e!==d)return o(`Deleting: ${e}`),caches.delete(e)})).then(()=>s.clients.claim())))});async function h(t,i){try{const e=await fetch(t);try{const c=await caches.open(d);return t.method==="GET"&&t.url.startsWith("http")&&c.put(t,e.clone()),e}catch(c){return o(`error: ${c}`),e}}catch{return i||new Response(`Could Not fetch ${t.url}`,{status:503,headers:{"Content-Type":"text/plain"}})}}const x={method:(t,i)=>{o(`Cache first: ${t.url}`);const e=h(t,i);return i||e},regexes:O},_={method:(t,i)=>(o(`Cache only: ${t.url}`),i||h(t,i)),regexes:j},f={method:(t,i)=>(o(`Online first: ${t.url}`),h(t,i)),regexes:g},E={method:t=>(o(`Online only: ${t.url}`),fetch(t)),regexes:C};async function A(t){const i=t.request,e=s.registration;if(t.request.mode==="navigate"&&t.request.method==="GET"&&e.waiting&&(await s.clients.matchAll()).length<2)return o("only one client, skipWaiting as we navigate the page"),e.waiting.postMessage("skipWaiting"),new Response("",{headers:{Refresh:"0"}});if(t.request.mode==="navigate"&&t.request.method==="GET"){const n=await caches.match(i);return f.method(i,n)}return await caches.match(i).then(n=>{const l=[f,E,x,_];for(const r of l)for(const p of r.regexes)if(RegExp(p).test(i.url))return r.method(i,n);return f.method(i,n)})}s.addEventListener("fetch",t=>{t.respondWith(A(t))});s.addEventListener("message",async function(t){t.data&&t.data.type==="debug"?(u=t.data.enabled&&t.data.level>=5,u&&o(`log enabled ${t.data.level}`)):t.data&&t.data.type==="ping"?o("pong"):t.data==="skipWaiting"&&(o("skipWaiting received"),t.waitUntil(s.skipWaiting()))});async function F(){const t=await s.clients.matchAll({type:"window",includeUncontrolled:!0});let i,e,c;for(var n=0;n<t.length;n++){const l=t[n],r=l.visibilityState==="visible",p=l.focused;if(r&&!i&&(i=l),p&&!e&&(e=l),p&&r){c=l;break}}return{atLeastOneFocused:e,atLeastOneVisible:i,atLeastOneVisibleAndFocused:c}}async function L(t){const i=await F(),e={title:"Notification",options:{body:"You have a new notification",icon:"/favicon.png",badge:"/favicon.png"}};if(t)try{const c=JSON.parse(t);if(c.web_push===8030){const n=c.notification;e.options={badge:n.badge,body:n.body,data:n.data,dir:n.dir,icon:n.icon,lang:n.lang,requireInteraction:n.requireInteraction,silent:n.silent,tag:n.tag},e.title=n.title,e.options.icon||(e.options.icon=n.image),n.navigate&&(e.options.data?typeof e.options.data=="object"&&!e.options.data.navigate&&(e.options.data={...e.options.data,navigate:n.navigate}):e.options.data={navigate:n.navigate})}else e.title=c.notification?.title||c.title||"Notification",e.options=c.notification||c.options}catch{e.options.body=t}o("handlePush",t,e),i.atLeastOneVisibleAndFocused?(o("posting notification to active app",e),i.atLeastOneVisibleAndFocused.postMessage({type:"notification",notification:{title:e.title,options:e.options}})):await s.registration.showNotification(e.title,e.options)}s.addEventListener("push",function(t){const i=t.data?.text();t.waitUntil(L(i))});async function W(t){const i=await s.clients.matchAll({type:"window",includeUncontrolled:!0}),e=location.pathname,c=e.substring(0,e.lastIndexOf("/")+1);let n=t.data?.navigate;n&&!n.startsWith("/")&&n.indexOf(":/")==-1&&(n=c+n);for(const l of i)if(o(`${"focus"in l?"focus-available: ":""}: ${l.url}`),"focus"in l)return n&&"navigate"in l?l.focus().then(()=>l.navigate(n)):l.focus();if(s.clients.openWindow)return s.clients.openWindow(n||"/")}s.addEventListener("notificationclick",function(t){t.notification.close(),t.waitUntil(W(t.notification))});
|