diff --git a/database_assets/com.nebula.test-2/index.js b/database_assets/com.nebula.test-2/index.js new file mode 100644 index 0000000..9e0ef2d --- /dev/null +++ b/database_assets/com.nebula.test-2/index.js @@ -0,0 +1,10 @@ +function gyatt2() { + return { + host: 'example.com', + html: '', + injectTo: 'head' + } +} + +//We need to return the refrence to the function and NOT the function itself +self.entryFunc = gyatt2; diff --git a/database_assets/com.nebula.test/index.js b/database_assets/com.nebula.test/index.js new file mode 100644 index 0000000..5a3d82c --- /dev/null +++ b/database_assets/com.nebula.test/index.js @@ -0,0 +1,10 @@ +function gyatt() { + return { + host: 'example.com', + html: '', + injectTo: 'head' + } +} + +//We need to return the refrence to the function and NOT the function itself +self.entryFunc = gyatt; diff --git a/public/sw.js b/public/sw.js index 70647f7..32ea8cb 100644 --- a/public/sw.js +++ b/public/sw.js @@ -5,26 +5,20 @@ const uv = new UVServiceWorker(); //where we handle our plugins!!! self.addEventListener("message", function(event) { - //console.log(event.data); - if (uv.config.inject === undefined) { - uv.config.inject = []; - } + console.log(event.data); + uv.config.inject = []; //loop over the required data (we don't verify here as types will take care of us :D) - event.data.forEach((data) => { + event.data.forEach((data) => { if (data.remove) { - if (uv.config.inject.find(({ host }) => host === data.host)) { - const idx = uv.config.inject.indexOf(data.host); - uv.config.inject.splice(idx, 1); - } + const idx = uv.config.inject.indexOf(data.host); + uv.config.inject.splice(idx, 1); } else { - if (!uv.config.inject.find(({ host }) => host === data.host)) { - uv.config.inject.push({ - host: data.host, - html: data.html, - injectTo: data.injectTo - }); - } + uv.config.inject.push({ + host: data.host, + html: data.html, + injectTo: data.injectTo + }); } }); console.log(uv.config.inject); diff --git a/server/dbSetup.ts b/server/dbSetup.ts index 01b49ea..e6311f3 100644 --- a/server/dbSetup.ts +++ b/server/dbSetup.ts @@ -73,7 +73,29 @@ async function setupDB(db: ModelStatic) { tags: ["Theme", "Simple", "Dark", "Retro"], payload: "retro.css", type: "theme", - } + }, + { + package_name: "com.nebula.test", + title: 'GYATT', + image: 'gyatt.png', + author: 'NBS', + version: '0.0.0', + description: 'gyatt', + tags: [], + payload: 'index.js', + type: 'plugin' + }, + { + package_name: "com.nebula.test-2", + title: 'GYATT...2', + image: 'gyatt.png', + author: 'NBS', + version: '0.0.0', + description: 'gyatt', + tags: [], + payload: 'index.js', + type: 'plugin' + } ]; const dbItems = await db.findAll(); if (dbItems.length === 0) { diff --git a/src/pages/[lang]/games.astro b/src/pages/[lang]/games.astro index c1536c4..1d3d3ec 100644 --- a/src/pages/[lang]/games.astro +++ b/src/pages/[lang]/games.astro @@ -11,17 +11,15 @@ export const prerender = true; diff --git a/src/pages/[lang]/index.astro b/src/pages/[lang]/index.astro index 7db0f74..c0adbce 100644 --- a/src/pages/[lang]/index.astro +++ b/src/pages/[lang]/index.astro @@ -46,21 +46,18 @@ import { VERSION } from "astro:env/client";