mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-16 21:10:02 -04:00
parent
0738ec8547
commit
6d99559768
6 changed files with 4 additions and 60 deletions
|
@ -8,17 +8,12 @@
|
||||||
<title>Nebula</title>
|
<title>Nebula</title>
|
||||||
<script src="/uv/uv.bundle.js"></script>
|
<script src="/uv/uv.bundle.js"></script>
|
||||||
<script src="/uv/uv.config.js"></script>
|
<script src="/uv/uv.config.js"></script>
|
||||||
<script src="/dynamic/dynamic.worker.js"></script>
|
|
||||||
<script src="/dynamic/dynamic.config.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
if ("serviceWorker" in navigator) {
|
if ("serviceWorker" in navigator) {
|
||||||
window.addEventListener("load", () => {
|
window.addEventListener("load", () => {
|
||||||
navigator.serviceWorker.register("/sw.js", {
|
navigator.serviceWorker.register("/sw.js", {
|
||||||
scope: __uv$config.prefix
|
scope: __uv$config.prefix
|
||||||
});
|
});
|
||||||
navigator.serviceWorker.register("/dynsw.js", {
|
|
||||||
scope: '/dyn/'
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
"react-helmet": "^6.1.0",
|
"react-helmet": "^6.1.0",
|
||||||
"react-i18next": "^13.5.0",
|
"react-i18next": "^13.5.0",
|
||||||
"react-icons": "^4.12.0",
|
"react-icons": "^4.12.0",
|
||||||
"tsx": "^4.7.0",
|
"tsx": "^4.7.0"
|
||||||
"dynamic-npm": "github:notplayingallday383/dynamic-npm"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@preact/preset-vite": "^2.5.0",
|
"@preact/preset-vite": "^2.5.0",
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
self.__dynamic$config = {
|
|
||||||
prefix: '/dyn/',
|
|
||||||
encoding: 'xor',
|
|
||||||
mode: 'production',
|
|
||||||
logLevel: 0,
|
|
||||||
bare: {
|
|
||||||
version: 3,
|
|
||||||
path: '/bare/',
|
|
||||||
},
|
|
||||||
tab: {
|
|
||||||
title: 'Service',
|
|
||||||
icon: null,
|
|
||||||
ua: null,
|
|
||||||
},
|
|
||||||
assets: {
|
|
||||||
prefix: '/dynamic/',
|
|
||||||
files: {
|
|
||||||
handler: 'dynamic.handler.js',
|
|
||||||
client: 'dynamic.client.js',
|
|
||||||
worker: 'dynamic.worker.js',
|
|
||||||
config: 'dynamic.config.js',
|
|
||||||
inject: null,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
block: [
|
|
||||||
|
|
||||||
]
|
|
||||||
};
|
|
|
@ -1,19 +0,0 @@
|
||||||
importScripts('/dynamic/dynamic.config.js');
|
|
||||||
importScripts('/dynamic/dynamic.worker.js');
|
|
||||||
|
|
||||||
const sw = new UVServiceWorker();
|
|
||||||
const dynamic = new Dynamic();
|
|
||||||
self.dynamic = dynamic;
|
|
||||||
self.addEventListener('fetch',
|
|
||||||
event => {
|
|
||||||
event.respondWith(
|
|
||||||
(async function() {
|
|
||||||
if (await dynamic.route(event)) {
|
|
||||||
return await dynamic.fetch(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
return await fetch(event.request);
|
|
||||||
})()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
|
@ -2,4 +2,6 @@ importScripts("/uv/uv.bundle.js");
|
||||||
importScripts("/uv/uv.config.js");
|
importScripts("/uv/uv.config.js");
|
||||||
importScripts(__uv$config.sw || "/uv/uv.sw.js");
|
importScripts(__uv$config.sw || "/uv/uv.sw.js");
|
||||||
|
|
||||||
|
const sw = new UVServiceWorker();
|
||||||
|
|
||||||
self.addEventListener("fetch", (event) => event.respondWith(sw.fetch(event)));
|
self.addEventListener("fetch", (event) => event.respondWith(sw.fetch(event)));
|
||||||
|
|
|
@ -3,21 +3,16 @@ import { defineConfig } from "vite";
|
||||||
import preact from "@preact/preset-vite";
|
import preact from "@preact/preset-vite";
|
||||||
import { viteStaticCopy } from "vite-plugin-static-copy";
|
import { viteStaticCopy } from "vite-plugin-static-copy";
|
||||||
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
|
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
|
||||||
import { dynPath } from "dynamic-npm";
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
viteStaticCopy({
|
viteStaticCopy({
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
|
// .replace fixes weird paths on Windows
|
||||||
src: `${uvPath}/uv.*.js`.replace(/\\/g, "/"),
|
src: `${uvPath}/uv.*.js`.replace(/\\/g, "/"),
|
||||||
dest: "uv",
|
dest: "uv",
|
||||||
overwrite: false
|
overwrite: false
|
||||||
},
|
|
||||||
{
|
|
||||||
src: `${dynPath}/dynamic.*.js`.replace(/\\/g, "/"),
|
|
||||||
dest: "dynamic",
|
|
||||||
overwrite: false
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue