diff --git a/biome.json b/biome.json index 55fad2f..a66d882 100644 --- a/biome.json +++ b/biome.json @@ -41,6 +41,7 @@ "formatter": { "quoteStyle": "single", "semicolons": "asNeeded" - } + }, + "globals": ["chrome", "browser"] } } diff --git a/public/background.js b/public/background.js index ec6b2a2..2a5405e 100644 --- a/public/background.js +++ b/public/background.js @@ -1,13 +1,23 @@ -console.log("background.js loaded 55555") +console.log('background.js loaded 55555') chrome.webRequest.onBeforeRequest.addListener( - function(details) { - console.log("onBeforeRequest MAIN_FRAME:", details.url, details.type, details.frameId, details.tabId) - if (details.url === "https://monster-siren.hypergryph.com/manifest.json" && details.type === "other" && details.frameId === 0) { - console.log("onBeforeRequest - REDIRECTING MAIN_FRAME") - chrome.tabs.create({ url: chrome.runtime.getURL("index.html") }) + (details) => { + console.log( + 'onBeforeRequest MAIN_FRAME:', + details.url, + details.type, + details.frameId, + details.tabId, + ) + if ( + details.url === 'https://monster-siren.hypergryph.com/manifest.json' && + details.type === 'other' && + details.frameId === 0 + ) { + console.log('onBeforeRequest - REDIRECTING MAIN_FRAME') + chrome.tabs.create({ url: chrome.runtime.getURL('index.html') }) chrome.tabs.remove(details.tabId) } }, - { urls: ["https://monster-siren.hypergryph.com/manifest.json"] } -) \ No newline at end of file + { urls: ['https://monster-siren.hypergryph.com/manifest.json'] }, +) diff --git a/public/manifest.json b/public/manifest.json index 1d6fe3b..18e182a 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -20,4 +20,4 @@ "service_worker": "background.js" }, "permissions": ["tabs", "webRequest"] -} \ No newline at end of file +} diff --git a/src/main.ts b/src/main.ts index 179561a..2425c0f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,29 +1,5 @@ -import { createApp } from 'vue'; -import './style.css'; -import App from './App.vue'; - -// unregister the service worker -if ('serviceWorker' in navigator) { - navigator.serviceWorker.getRegistrations().then(function(registrations) { - for(let registration of registrations) { - // 可以根据 scope 判断是否是目标网站的 Service Worker - console.log('Unregistering service worker:', registration.scope) - registration.unregister() - } - }) -} - -// Replace the body content with the Vue app -document.getElementsByTagName('html')[0].innerHTML = ` - - - - MSR Mod - - -
- -`; +import { createApp } from 'vue' +import './style.css' +import App from './App.vue' createApp(App).mount('#app') -