diff --git a/.vscode/extensions.json b/.vscode/extensions.json index a7cea0b..7e0dd92 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["Vue.volar"] + "recommendations": ["Vue.volar"] } diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..55fad2f --- /dev/null +++ b/biome.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, + "files": { + "ignoreUnknown": false, + "ignore": [] + }, + "formatter": { + "enabled": true, + "indentStyle": "tab" + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "correctness": { + "noUnusedVariables": "error", + "noUndeclaredVariables": "error", + "noUnreachable": "error", + "noUnsafeFinally": "error" + }, + "security": { + "noDangerouslySetInnerHtml": "error", + "noGlobalEval": "error" + }, + "style": { + "noVar": "error", + "useBlockStatements": "error", + "useConst": "error" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "single", + "semicolons": "asNeeded" + } + } +} diff --git a/package-lock.json b/package-lock.json index 57b2aa4..9a72cfb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "vue": "^3.5.13" }, "devDependencies": { + "@biomejs/biome": "1.9.4", "@vitejs/plugin-vue": "^5.2.1", "typescript": "~5.6.2", "vite": "^6.0.1", @@ -78,6 +79,170 @@ "node": ">=6.9.0" } }, + "node_modules/@biomejs/biome": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz", + "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", + "dev": true, + "hasInstallScript": true, + "license": "MIT OR Apache-2.0", + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.9.4", + "@biomejs/cli-darwin-x64": "1.9.4", + "@biomejs/cli-linux-arm64": "1.9.4", + "@biomejs/cli-linux-arm64-musl": "1.9.4", + "@biomejs/cli-linux-x64": "1.9.4", + "@biomejs/cli-linux-x64-musl": "1.9.4", + "@biomejs/cli-win32-arm64": "1.9.4", + "@biomejs/cli-win32-x64": "1.9.4" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz", + "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz", + "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz", + "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz", + "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz", + "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz", + "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz", + "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz", + "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.4", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.4.tgz", diff --git a/package.json b/package.json index 602e988..45ec998 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,25 @@ { - "name": "msr-mod", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "vue-tsc -b && vite build && cp -r public/* dist/", - "build:watch": "vite build --watch", - "preview": "vite preview" - }, - "dependencies": { - "@tailwindcss/vite": "^4.1.7", - "tailwindcss": "^4.1.7", - "vue": "^3.5.13" - }, - "devDependencies": { - "@vitejs/plugin-vue": "^5.2.1", - "typescript": "~5.6.2", - "vite": "^6.0.1", - "vue-tsc": "^2.1.10" - } + "name": "msr-mod", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc -b && vite build && cp -r public/* dist/", + "build:watch": "vite build --watch", + "preview": "vite preview", + "lint": "biome format --write ." + }, + "dependencies": { + "@tailwindcss/vite": "^4.1.7", + "tailwindcss": "^4.1.7", + "vue": "^3.5.13" + }, + "devDependencies": { + "@biomejs/biome": "1.9.4", + "@vitejs/plugin-vue": "^5.2.1", + "typescript": "~5.6.2", + "vite": "^6.0.1", + "vue-tsc": "^2.1.10" + } } diff --git a/public/content.js b/public/content.js index 913b134..4f26e78 100644 --- a/public/content.js +++ b/public/content.js @@ -1,38 +1,3 @@ -// Replace the body content with the Vue app -function replaceBodyContent() { - console.log('replaceBodyContent') - // Remove existing body content - document.body.innerHTML = '' - // Create a new container for the Vue app - const container = document.createElement('div') - container.id = 'app' - document.body.appendChild(container) - - console.log('content.js') - -// Run the replacement -replaceBodyContent() - -// remove all script and link tags -const scripts = document.getElementsByTagName('script') -console.log(scripts) -const links = document.getElementsByTagName('link') -for (let i in scripts) { - console.log(scripts[i]) - scripts[i].remove() -} -for (let i in links) { - console.log(links[i]) - links[i].remove() -} - -// insert assets/index.js and assets/index.css -const script = document.createElement('script') -script.src = chrome.runtime.getURL('assets/index.js') -document.head.appendChild(script) -const link = document.createElement('link') -link.rel = 'stylesheet' -link.href = chrome.runtime.getURL('assets/index.css') -document.head.appendChild(link) -} - +// redirect to extension's index.html +const extensonUrl = chrome.extension.getURL('index.html') +const url = window.location.href diff --git a/public/manifest.json b/public/manifest.json index e20846e..6bdff86 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,19 +1,19 @@ { - "manifest_version": 3, - "name": "MSR Mod", - "version": "0.0.1", - "description": "A Vue-based browser extension.", - "content_scripts": [ - { - "matches": ["https://monster-siren.hypergryph.com/"], - "js": ["assets/index.js"], - "run_at": "document_end" - } - ], - "icons": { - "16": "vite.svg", - "48": "vite.svg", - "128": "vite.svg" - }, - "permissions": [] -} \ No newline at end of file + "manifest_version": 3, + "name": "MSR Mod", + "version": "0.0.1", + "description": "A Vue-based browser extension.", + "content_scripts": [ + { + "matches": ["https://monster-siren.hypergryph.com/"], + "js": ["content.js"], + "run_at": "document_end" + } + ], + "permissions": ["webRequest", "webRequestBlocking"], + "icons": { + "16": "vite.svg", + "48": "vite.svg", + "128": "vite.svg" + } +} diff --git a/src/main.ts b/src/main.ts index a98c6ef..2425c0f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,26 +2,4 @@ import { createApp } from 'vue' import './style.css' import App from './App.vue' -// Replace the body content with the Vue app -// Remove existing body content -document.getElementsByTagName('html')[0].innerHTML = ` -
- - -