diff --git a/README.md b/README.md index ec7d0bb4..d85958e3 100644 --- a/README.md +++ b/README.md @@ -53,12 +53,13 @@ Please don't use this in a production environment - it is quite buggy and is not - Brave Supported - Opera Supported - Vivaldi Supported - - Firefox (Experimental - available [here](https://addons.mozilla.org/en-US/firefox/addon/betterseqta-plus/)) + - Chromium-based browsers are supported + - Firefox (Experimental - available [here](https://addons.mozilla.org/en-US/firefox/addon/betterseqta-plus/) - Safari (Experimental - only available via compilation) ## Creating Custom Themes -If you are looking to create custom themes, I would recommend you start at the official documentation [here](https://betterseqta.gitbook.io/betterseqta-docs). You can see some premade examples along with a compilation script that can be used to allow for CSS frameworks and libraries such as SCSS to be used [here](https://github.com/SethBurkart123/BetterSEQTA-theme-generator). +If you are looking to create custom themes, I would recommend you start at the official documentation [here](https://betterseqta.gitbook.io/betterseqta-docs). You can see some premade examples along with a compilation script that can be used to allow for CSS frameworks and libraries such as SCSS to be used [here](https://github.com/BetterSEQTA/BetterSEQTA-Theme-Generator). Don't worry- if you get stuck feel free to ask around in the discord. We're open and happy to help out! Happy creating :) diff --git a/lib/patchPackage.ts b/lib/patchPackage.ts new file mode 100644 index 00000000..ab59850b --- /dev/null +++ b/lib/patchPackage.ts @@ -0,0 +1,65 @@ +/* + TEMPORARY FIX FOR CHROME 130+ builds +*/ + +import path from 'node:path'; +import fs from 'fs'; +import { PluginOption } from 'vite'; +import { ManifestV3Export } from '@crxjs/vite-plugin'; + +const manifestPath = path.resolve('dist/chrome/manifest.json'); + +export function updateManifestPlugin(): PluginOption { + return { + name: 'update-manifest-plugin', + enforce: 'post', + closeBundle() { + forceDisableUseDynamicUrl(); + }, + + configureServer(server) { + server.httpServer?.once('listening', () => { + const updated = forceDisableUseDynamicUrl(); + if (updated) { + server.ws.send({ type: 'full-reload' }); + console.log('** updated **'); + } + + fs.watchFile(manifestPath, () => { + console.log('** watchFile ** '); + const manifestContents = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); + if (manifestContents.web_accessible_resources.some((resource: any) => resource.use_dynamic_url)) { + const updated = forceDisableUseDynamicUrl(); + if (updated) { + server.ws.send({ type: 'full-reload' }); + console.log('** updated **'); + } + } + }); + }); + }, + + writeBundle() { + console.log('### writeBundle ##'); + forceDisableUseDynamicUrl(); + }, + }; +} + +function forceDisableUseDynamicUrl() { + if (!fs.existsSync(manifestPath)) { + return false; + } + + const manifestContents = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as Awaited; + + if (typeof manifestContents === 'function' || !manifestContents.web_accessible_resources) return false; + if (manifestContents.web_accessible_resources.every((resource) => !resource.use_dynamic_url)) return false; + + manifestContents.web_accessible_resources.forEach((resource) => { + if (resource.use_dynamic_url) resource.use_dynamic_url = false; + }); + + fs.writeFileSync(manifestPath, JSON.stringify(manifestContents, null, 2)); + return true; +} diff --git a/package.json b/package.json index 9d211b09..71e06735 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "betterseqtaplus", - "version": "3.3.1", + "version": "3.3.2", "type": "module", "description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development, while incorporating a plethora of new and improved features!", "browserslist": "> 0.5%, last 2 versions, not dead", diff --git a/src/css/injected.scss b/src/css/injected.scss index e31bab32..3dca2557 100644 --- a/src/css/injected.scss +++ b/src/css/injected.scss @@ -118,6 +118,10 @@ html { z-index: 10000; } +.modaliser-container { + backdrop-filter: none !important; +} + .connectedNotificationsWrapper > div > button > svg > g { fill: var(--theme-primary) !important; } diff --git a/src/manifests/manifest.json b/src/manifests/manifest.json index 0087ca16..ae034904 100644 --- a/src/manifests/manifest.json +++ b/src/manifests/manifest.json @@ -22,6 +22,9 @@ "background": { "service_worker": "background.ts" }, + "content_security_policy": { + "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'" + }, "content_scripts": [ { "matches": ["*://*/*"], diff --git a/vite.config.ts b/vite.config.ts index 5416051b..d17d4087 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from 'vite'; import { join, resolve } from 'path'; +import { updateManifestPlugin } from './lib/patchPackage'; import { base64Loader } from './lib/base64loader'; import type { BuildTarget } from './lib/types'; @@ -36,7 +37,8 @@ export default defineConfig({ crx({ manifest: targets.find(t => t.browser === mode.toLowerCase())?.manifest ?? chrome.manifest, browser: mode.toLowerCase() === "firefox" ? "firefox" : "chrome" - }) + }), + updateManifestPlugin() ], root: resolve(__dirname, './src'), resolve: {