mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
fix: keep existing users settings and tidy defaults
This commit is contained in:
20 files changed
+46
-77
No files matched your search
@@ -1,5 +1,5 @@
|
||||
name: Setup Node and dependencies
|
||||
description: Install Node.js 22.x and npm dependencies from the lockfile.
|
||||
description: Install Node.js 22.x and npm dependencies.
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
@@ -66,9 +66,9 @@ Don't worry- if you get stuck feel free to ask around in the [discord](https://d
|
||||
```bash
|
||||
git clone https://github.com/YOUR_USERNAME_FORKED_WITH/BetterSEQTA-Plus
|
||||
cd BetterSEQTA-Plus
|
||||
npm install --legacy-peer-deps
|
||||
npm install
|
||||
npm run dev
|
||||
````
|
||||
```
|
||||
|
||||
Then load `dist` in `chrome://extensions` (Developer Mode → Load unpacked).
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Welcome to BetterSEQTA+! 🎉 This guide will walk you through making your first
|
||||
## Before You Start
|
||||
|
||||
### What You'll Need
|
||||
- **Node.js** (v16 or higher) - [Download here](https://nodejs.org/)
|
||||
- **Node.js** (v22.12 or higher) - [Download here](https://nodejs.org/)
|
||||
- **Git** - [Download here](https://git-scm.com/)
|
||||
- **A code editor** - We recommend [VS Code](https://code.visualstudio.com/)
|
||||
- **A Chromium browser** (Chrome, Edge, Brave) for testing (recommended, however you can use firefox although it requires being built every time you make a change)
|
||||
|
||||
+4
-35
@@ -8,7 +8,7 @@ This guide will walk you through the process of installing and setting up Better
|
||||
|
||||
Before you begin, make sure you have the following installed:
|
||||
|
||||
- [npm](https://www.npmjs.com/) (v7 or higher) or [Bun](https://bun.sh/) (recommended)
|
||||
- [Node.js](https://nodejs.org/) v22.12 or higher
|
||||
- A modern web browser (Chrome, Firefox, Edge, etc.)
|
||||
|
||||
## Installation Methods
|
||||
@@ -43,24 +43,16 @@ If you want to develop for BetterSEQTA+ or modify the code, follow these steps:
|
||||
### 1. Clone the Repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/SeqtaLearning/betterseqta-plus.git
|
||||
cd betterseqta-plus
|
||||
git clone https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
|
||||
cd BetterSEQTA-Plus
|
||||
```
|
||||
|
||||
### 2. Install Dependencies
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
Using Bun (recommended):
|
||||
|
||||
```bash
|
||||
bun install
|
||||
```
|
||||
|
||||
### 3. Set Up Environment Variables - Only required for pushing to extension stores from the command line
|
||||
|
||||
Copy the example environment file:
|
||||
@@ -73,18 +65,10 @@ Edit the `.env` file with your SEQTA credentials and settings.
|
||||
|
||||
### 4. Start the Development Server
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Using Bun:
|
||||
|
||||
```bash
|
||||
bun run dev
|
||||
```
|
||||
|
||||
This will start a development server and build the extension in watch mode.
|
||||
|
||||
### 5. Load the Extension in Your Browser
|
||||
@@ -93,7 +77,7 @@ This will start a development server and build the extension in watch mode.
|
||||
|
||||
1. Open Chrome/Edge and navigate to `chrome://extensions` or `edge://extensions`
|
||||
2. Enable "Developer mode" using the toggle in the top right
|
||||
3. Click "Load unpacked" and select the `dist` folder in your BetterSEQTA+ directory
|
||||
3. Click "Load unpacked" and select the `dist/chrome` folder in your BetterSEQTA+ directory
|
||||
4. The extension should now appear in your extensions list
|
||||
|
||||
#### Firefox
|
||||
@@ -124,13 +108,6 @@ rm -rf node_modules
|
||||
npm install
|
||||
```
|
||||
|
||||
Or with Bun:
|
||||
|
||||
```bash
|
||||
rm -rf node_modules
|
||||
bun install
|
||||
```
|
||||
|
||||
#### Extension not appearing in SEQTA
|
||||
|
||||
Make sure:
|
||||
@@ -168,14 +145,6 @@ npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Or with Bun:
|
||||
|
||||
```bash
|
||||
git pull
|
||||
bun install
|
||||
bun run dev
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
Now that you have BetterSEQTA+ installed, you can:
|
||||
|
||||
Generated
+8
@@ -60,6 +60,7 @@
|
||||
"@types/qrcode": "^1.5.6",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@types/semver": "^7.8.0",
|
||||
"@types/sortablejs": "^1.15.9",
|
||||
"@types/webextension-polyfill": "^0.12.6",
|
||||
"cross-env": "^10.1.0",
|
||||
@@ -4328,6 +4329,13 @@
|
||||
"@types/react": "^19.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.8.0.tgz",
|
||||
"integrity": "sha512-1mAINjtQCXXeLkJ9ehXkwOcBpqtLxiVtKhpUf83DdRNdQKV0iXZpaHYqRr7nj+wvxuJzoAmAwXI+sCNMv1CzLQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/sortablejs": {
|
||||
"version": "1.15.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/sortablejs/-/sortablejs-1.15.9.tgz",
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
"@types/qrcode": "^1.5.6",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@types/semver": "^7.8.0",
|
||||
"@types/sortablejs": "^1.15.9",
|
||||
"@types/webextension-polyfill": "^0.12.6",
|
||||
"cross-env": "^10.1.0",
|
||||
|
||||
+9
-2
@@ -26,7 +26,7 @@ import {
|
||||
refreshRemoteConfig,
|
||||
} from "./background/remoteConfig";
|
||||
import { BSPLUS_INSTALL_REGISTERED_AT_KEY } from "@/seqta/utils/remoteConfig/storageKeys";
|
||||
import { DEFAULT_BACKGROUND_PENDING_KEY } from "@/seqta/ui/defaultBackground";
|
||||
import { DEFAULT_BACKGROUND_PENDING_KEY } from "@/seqta/ui/defaultBackgroundKey";
|
||||
import { handleSearchThemeStockPhotos } from "./background/searchThemeStockPhotos";
|
||||
import { bsplusApiQueryParams, withBsplusApiQuery } from "@/seqta/utils/bsplusClientContext";
|
||||
import { initTimetableClassmatesBackgroundSync } from "./background/timetableClassmatesSync";
|
||||
@@ -769,11 +769,17 @@ async function resetThemeOfTheMonthDismissalFor370Upgrade(
|
||||
}
|
||||
}
|
||||
|
||||
async function disableAnimatedBackground(): Promise<void> {
|
||||
const key = "plugin.animated-background.settings";
|
||||
const stored = await browser.storage.local.get(key);
|
||||
await browser.storage.local.set({ [key]: { ...(stored[key] as object), enabled: false } });
|
||||
}
|
||||
|
||||
browser.runtime.onInstalled.addListener(function (event) {
|
||||
browser.storage.local.remove(["justupdated"]);
|
||||
browser.storage.local.remove(["data"]);
|
||||
|
||||
void ensureSyncableStorageDefaults();
|
||||
const defaultsReady = ensureSyncableStorageDefaults();
|
||||
|
||||
if (event.reason == "install" || event.reason == "update") {
|
||||
browser.storage.local.set({ justupdated: true });
|
||||
@@ -792,6 +798,7 @@ browser.runtime.onInstalled.addListener(function (event) {
|
||||
if (event.reason === "install") {
|
||||
void refreshRemoteConfig(apiBase);
|
||||
void browser.storage.local.set({ [DEFAULT_BACKGROUND_PENDING_KEY]: true });
|
||||
void defaultsReady.catch(() => undefined).then(disableAnimatedBackground);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Shared Tailwind setup for every stylesheet that uses utilities. */
|
||||
@import "tailwindcss" source("../");
|
||||
|
||||
@plugin "@tailwindcss/forms";
|
||||
@@ -35,7 +34,6 @@
|
||||
}
|
||||
|
||||
@layer base {
|
||||
/* Tailwind 4 defaults borders to `currentcolor`; keep the v3 look. */
|
||||
*,
|
||||
::after,
|
||||
::before,
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<button
|
||||
type="button"
|
||||
data-theme-favorite
|
||||
class="pointer-events-none absolute right-2 top-2 z-20 flex h-10 w-10 scAle-[0.25] items-center justify-center rounded-full bg-black/50 text-white opacity-0 blur-xs transition-[opacity,transform,filter,background-color] duration-200 ease-[cubic-bezier(0.2,0,0,1)] hover:bg-black/70 active:scale-[0.96] group-hover:pointer-events-auto group-hover:scale-100 group-hover:opacity-100 group-hover:blur-0 focus-visible:pointer-events-auto focus-visible:scale-100 focus-visible:opacity-100 focus-visible:blur-0 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-white"
|
||||
class="pointer-events-none absolute right-2 top-2 z-20 flex h-10 w-10 scale-[0.25] items-center justify-center rounded-full bg-black/50 text-white opacity-0 blur-xs transition-[opacity,transform,filter,background-color] duration-200 ease-[cubic-bezier(0.2,0,0,1)] hover:bg-black/70 active:scale-[0.96] group-hover:pointer-events-auto group-hover:scale-100 group-hover:opacity-100 group-hover:blur-0 focus-visible:pointer-events-auto focus-visible:scale-100 focus-visible:opacity-100 focus-visible:blur-0 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-white"
|
||||
onclick={handleFavoriteClick}
|
||||
aria-label={isLoggedIn
|
||||
? theme.is_favorited
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import './components/ColourPicker.css' layer(base);
|
||||
@import "./components/ColourPicker.css" layer(base);
|
||||
|
||||
@import "../css/tailwind.css";
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import contentShadowStyle from "./contentShadow.css?inline";
|
||||
|
||||
const shadowStyles = {
|
||||
// Registered properties are document-wide, including inside shadow roots.
|
||||
// Keep our gradient variables separate from a host page's own Tailwind registrations.
|
||||
settings: settingsStyle.replaceAll("--tw-gradient", "--bs-gradient"),
|
||||
content: contentShadowStyle.replaceAll("--tw-gradient", "--bs-gradient"),
|
||||
} as const;
|
||||
|
||||
@@ -37,7 +37,6 @@ const animatedBackgroundPlugin: Plugin<typeof settings> = {
|
||||
description: "Adds an animated background to BetterSEQTA+",
|
||||
version: "1.0.0",
|
||||
disableToggle: true,
|
||||
defaultEnabled: false,
|
||||
styles: styles,
|
||||
settings: instance.settings,
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@
|
||||
tabindex="0">
|
||||
|
||||
<div class="relative p-2 border-b border-zinc-900/5 dark:border-zinc-100/5">
|
||||
<div class="absolute top-1/2 translate-y-[calc(-50%-3px)] scale-105 left-5 w-6 h-6 text-[1.3rem] text-zinc-900 dark:text-zinc-400 text-opacity-40 pointer-events-none font-IconFamily">
|
||||
<div class="absolute top-1/2 translate-y-[calc(-50%-3px)] scale-105 left-5 w-6 h-6 text-[1.3rem] text-zinc-900/40 dark:text-zinc-400/40 pointer-events-none font-IconFamily">
|
||||
{'\ueca5'}
|
||||
</div>
|
||||
<input
|
||||
@@ -429,7 +429,7 @@
|
||||
<div class="mx-auto w-8 h-8 rounded-full border-2 animate-spin border-zinc-300 dark:border-zinc-700 border-t-zinc-600 dark:border-t-zinc-300"></div>
|
||||
<p class="mt-4 text-lg dark:text-zinc-300">Searching...</p>
|
||||
{:else}
|
||||
<svg class="mx-auto w-8 h-8 text-opacity-40 dark:text-opacity-60" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<svg class="mx-auto w-8 h-8" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z" />
|
||||
</svg>
|
||||
<p class="mt-6 text-lg dark:text-zinc-300">No matches found. Try something else.</p>
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
import tailwindcss from "@tailwindcss/postcss";
|
||||
|
||||
/**
|
||||
* Tailwind 4 gives its `--tw-*` variables initial values through `@property`, which
|
||||
* browsers ignore inside shadow roots — and most of our UI lives in one. Tailwind
|
||||
* already emits a `*`-scoped fallback for browsers without `@property`, gated behind an
|
||||
* `@supports` check; unwrapping it makes those defaults apply everywhere.
|
||||
*/
|
||||
const shadowDomPropertyFallbacks = {
|
||||
postcssPlugin: "shadow-dom-property-fallbacks",
|
||||
AtRule: {
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
*/
|
||||
import browser from "webextension-polyfill";
|
||||
import { writeData } from "@/interface/hooks/BackgroundDataLoader";
|
||||
import {
|
||||
applyDefaultBackgroundOnce,
|
||||
DEFAULT_BACKGROUND_PENDING_KEY,
|
||||
} from "./defaultBackground";
|
||||
import { applyDefaultBackgroundOnce } from "./defaultBackground";
|
||||
import { DEFAULT_BACKGROUND_PENDING_KEY } from "./defaultBackgroundKey";
|
||||
|
||||
jest.mock("@/resources/backgrounds/default-background.webp", () => "default-background.webp", {
|
||||
virtual: true,
|
||||
|
||||
@@ -2,14 +2,10 @@ import browser from "webextension-polyfill";
|
||||
import defaultBackgroundUrl from "@/resources/backgrounds/default-background.webp";
|
||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||
import { writeData } from "@/interface/hooks/BackgroundDataLoader";
|
||||
import { DEFAULT_BACKGROUND_PENDING_KEY } from "./defaultBackgroundKey";
|
||||
|
||||
/** Set by the background script on a fresh install; consumed on the first SEQTA page load. */
|
||||
export const DEFAULT_BACKGROUND_PENDING_KEY = "defaultBackgroundPending";
|
||||
|
||||
/** Theme store id of the bundled image, so the store lists it as installed. */
|
||||
const DEFAULT_BACKGROUND_ID = "image-116";
|
||||
|
||||
/** Install and select the bundled background once, unless the user already picked one. */
|
||||
export async function applyDefaultBackgroundOnce(): Promise<void> {
|
||||
const stored = await browser.storage.local.get(DEFAULT_BACKGROUND_PENDING_KEY);
|
||||
if (!stored[DEFAULT_BACKGROUND_PENDING_KEY]) return;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export const DEFAULT_BACKGROUND_PENDING_KEY = "defaultBackgroundPending";
|
||||
@@ -1,4 +1,4 @@
|
||||
export const DEFAULT_FONT_ID = "inter";
|
||||
export const DEFAULT_FONT_ID = "rubik";
|
||||
|
||||
export interface FontPreset {
|
||||
id: string;
|
||||
@@ -9,14 +9,6 @@ export interface FontPreset {
|
||||
}
|
||||
|
||||
export const FONT_PRESETS: FontPreset[] = [
|
||||
{
|
||||
id: "inter",
|
||||
name: "Inter",
|
||||
stack: "Inter, sans-serif",
|
||||
googleUrl:
|
||||
"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",
|
||||
sample: "Assessment due tomorrow at 3:30pm",
|
||||
},
|
||||
{
|
||||
id: "rubik",
|
||||
name: "Rubik",
|
||||
@@ -25,6 +17,14 @@ export const FONT_PRESETS: FontPreset[] = [
|
||||
"https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap",
|
||||
sample: "Assessment due tomorrow at 3:30pm",
|
||||
},
|
||||
{
|
||||
id: "inter",
|
||||
name: "Inter",
|
||||
stack: "Inter, sans-serif",
|
||||
googleUrl:
|
||||
"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",
|
||||
sample: "Assessment due tomorrow at 3:30pm",
|
||||
},
|
||||
{
|
||||
id: "poppins",
|
||||
name: "Poppins",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { SettingsState } from "@/types/storage";
|
||||
import { DEFAULT_FONT_ID } from "@/seqta/ui/fonts/presets";
|
||||
|
||||
function detectLowEndDevice(): boolean {
|
||||
const lowCoreCount =
|
||||
@@ -18,7 +17,7 @@ export function getDefaultSettingsState(): SettingsState {
|
||||
return {
|
||||
onoff: true,
|
||||
settingsPopupExpanded: false,
|
||||
animatedbk: false,
|
||||
animatedbk: true,
|
||||
bksliderinput: "50",
|
||||
transparencyEffects: true,
|
||||
lessonalert: true,
|
||||
@@ -80,7 +79,7 @@ export function getDefaultSettingsState(): SettingsState {
|
||||
themeOfTheMonthDisabled: false,
|
||||
autoCloudSettingsSync: true,
|
||||
showTitlebarFounderBadge: true,
|
||||
selectedFont: DEFAULT_FONT_ID,
|
||||
selectedFont: "rubik",
|
||||
timeFormat: "24",
|
||||
privacyStatementShown: false,
|
||||
bsCloudAutoSyncAnnouncementShown: false,
|
||||
|
||||
@@ -95,7 +95,7 @@ export interface SettingsState {
|
||||
adaptiveThemeColour?: boolean;
|
||||
adaptiveThemeGradient?: boolean;
|
||||
adaptiveThemeColourTransition?: boolean;
|
||||
/** Google Font preset id for SEQTA interface typography (`inter` default). */
|
||||
/** Google Font preset id for SEQTA interface typography (`rubik` default). */
|
||||
selectedFont?: string;
|
||||
|
||||
// depreciated keys
|
||||
|
||||
Reference in new issue
Block a user