diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 87541432..d1f50dda 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,42 +1,51 @@ name: Bug report -description: Report an issue with the modpack in its unmodified state. For other issues, use Discord. +description: Something in BetterSEQTA+ is broken. For questions, ask in Discord instead. labels: bug -title: "[BUG]" +title: "[BUG] " type: "Bug" body: - type: markdown attributes: value: | - Before reporting an issue, [please search](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) to make sure it has not already been reported (make sure to search closed issues as well!). + Please [search existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues?q=is%3Aissue) first, including closed ones. For general help you'll get a faster answer in [Discord](https://discord.gg/YzmbnCDkat). - type: textarea attributes: - label: Describe the bug - description: Describe your issue. For general issues and questions you'll get a faster answer [from our Discord.](https://discord.gg/YzmbnCDkat) + label: What happened? + description: What went wrong, and what did you expect to happen instead? validations: required: true + - type: textarea + attributes: + label: Steps to reproduce + placeholder: | + 1. Open the timetable + 2. Click a class + 3. ... + validations: + required: false + - type: input attributes: label: Extension version - description: What version of the extension are you using? - placeholder: Find it by opening the config menu and clicking the about icon in the top right. + description: Shown on your browser's extensions page (`chrome://extensions` or `about:addons`). + placeholder: "1.0.0" validations: required: true - type: dropdown attributes: label: Browser - description: Which Browser are you using? options: - Chrome - - Firefox - - Brave - - Safari - - DuckDuckGO - Microsoft Edge - - Other Chromium-Based Browser - - Other Non-Chromium-Based Browser + - Brave + - Opera + - Other Chromium browser + - Firefox + - Safari + - Other validations: required: true @@ -44,14 +53,13 @@ body: attributes: label: Confirm options: - - label: This bug report is about an issue with the extension itself. I have not modified the extension nor added any unsupported plugins. If this is not the case, I know that I should post the issue to the extension's Discord support channel instead. + - label: I'm using an unmodified build from a store or GitHub release, without third-party plugins. required: true - type: textarea attributes: - label: Additional context - description: Screenshots, video or any other information. Include photos of the console if possible - placeholder: | - Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + label: Screenshots and console output + description: Screenshots, a video, or errors from the browser console all help. + placeholder: Drag images or log files into this box to attach them. validations: required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 5f2a3daf..5ede5004 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,7 @@ contact_links: - - name: BetterSEQTA Community Support + - name: Discord url: https://discord.gg/YzmbnCDkat - about: Join our discord for community updates, discussion, and more! + about: Questions, help and community chat. + - name: Documentation + url: https://docs.betterseqta.org + about: Guides for installing, making themes and writing plugins. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index d0830e40..fe1e2e15 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,52 +1,42 @@ name: Feature request -description: Suggest a new Feature to be added or replaced in BetterSeqtaPLUS +description: Suggest something new for BetterSEQTA+ or a change to an existing feature. labels: enhancement -title: "[FR]" - +title: "[FR] " body: - - type: checkboxes - attributes: - label: Confirm - options: - - label: "Is this feature request related to a Bug report?" - required: false - - - type: input - attributes: - label: Bug report link - description: "If this feature request is related to a bug report, please insert the link to the bug report here" - placeholder: "https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/..." - validations: - required: false - - type: markdown attributes: value: | - ## Feature details - Before you request a feature, [please search](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) if it has already been requested. (Make sure to check closed issues as well!) + Please [search existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues?q=is%3Aissue) first, including closed ones, in case it's already been suggested. + + - type: textarea + attributes: + label: What would you like? + description: Describe the feature in as much detail as you can, and the problem it solves. + placeholder: It would be great if... + validations: + required: true - type: dropdown attributes: - label: Feature type - multiple: false + label: Type options: - - Graphical - - Functional - - Not Sure + - Visual / design + - Functionality + - Not sure validations: required: true - type: input attributes: - label: Feature Details - description: Please write, with as much detail as possible, what you would like to see from this feature. - placeholder: it would be cool if + label: Related bug report + description: If this comes from a bug report, link it here. + placeholder: https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/... validations: required: false - type: textarea attributes: - label: Additional details - description: Anything else that would help describe your vision (reference images, descriptions, etc) + label: Anything else + description: Mockups, reference images, or examples from other apps. validations: required: false diff --git a/.github/ISSUE_TEMPLATE/new_contributor.yml b/.github/ISSUE_TEMPLATE/new_contributor.yml index 03a87c30..7ad524dd 100644 --- a/.github/ISSUE_TEMPLATE/new_contributor.yml +++ b/.github/ISSUE_TEMPLATE/new_contributor.yml @@ -1,114 +1,64 @@ -name: πŸ™‹ New Contributor - Need Help Getting Started -description: Perfect for first-time contributors who need guidance -labels: ["help wanted", "documentation"] +name: New contributor +description: First time contributing? Tell us what you'd like to work on and we'll help you get started. +labels: ["help wanted"] title: "[NEW CONTRIBUTOR] " - body: - type: markdown attributes: value: | - ## Hi there! πŸ‘‹ - Welcome to BetterSEQTA+! We're excited to have you join our community. + Welcome to BetterSEQTA+! Fill in what you can and a maintainer will point you in the right direction. For real-time help, join the [Discord](https://discord.gg/YzmbnCDkat). - type: checkboxes attributes: - label: Tell us about yourself (check all that apply) + label: About you options: - - label: "This is my first time contributing to open source" - required: false - - label: "I'm new to browser extensions" - required: false - - label: "I'm new to TypeScript/JavaScript" - required: false - - label: "I have some coding experience but new to this project" - required: false - - - type: checkboxes - attributes: - label: What would you like to work on? (check all that apply) - options: - - label: "Fix a bug πŸ›" - required: false - - label: "Add a new feature ✨" - required: false - - label: "Improve documentation πŸ“š" - required: false - - label: "Create a plugin 🧩" - required: false - - label: "Improve the UI/design 🎨" - required: false - - label: "Write tests πŸ§ͺ" - required: false - - label: "Not sure - I want to help but need guidance!" - required: false + - label: This is my first open source contribution + - label: I'm new to browser extensions + - label: I'm new to TypeScript or Svelte + - label: I've coded before but I'm new to this project - type: checkboxes attributes: - label: Have you read our guides? + label: What would you like to work on? options: - - label: "Contributing guide (see CONTRIBUTING.md)" - required: true - - label: "Architecture Guide (see docs/ARCHITECTURE.md)" - required: true - - label: "Plugin Development Guide (see docs/plugins/README.md)" + - label: Fixing a bug + - label: A new feature + - label: A plugin + - label: UI and design + - label: Tests + - label: Documentation + - label: Not sure yet, I'd like suggestions + + - type: checkboxes + attributes: + label: Have you read the guides? + options: + - label: "[CONTRIBUTING.md](https://github.com/BetterSEQTA/BetterSEQTA-Plus/blob/main/CONTRIBUTING.md)" required: true + - label: "The [architecture guide](https://docs.betterseqta.org/architecture/)" + - label: "The [plugin development guide](https://docs.betterseqta.org/plugin-development/), if you're writing a plugin" - - type: checkboxes + - type: dropdown attributes: - label: Have you set up the development environment yet? + label: Is your dev environment working? options: - - label: Yes, everything works! πŸŽ‰ - required: false - - label: Partially - I can run `npm run dev` but having some issues - required: false - - label: No, I need help with setup - required: false - - label: I tried but ran into errors (please describe below) - required: false + - Yes, `npm run dev` works + - Partly, I'm running into issues + - Not set up yet + validations: + required: true - - type: input + - type: textarea attributes: label: Errors - description: "Please list any encountered errors here:" - placeholder: "I am encountering issues with..." + description: Paste any errors you've hit. + render: shell validations: required: false - - type: input + - type: textarea attributes: - label: Questions or Issues - description: "Tell us: - 1. What specifically would you like help with? - 2. Are you stuck on anything? - 3. Do you have any questions about the codebase? - 4. Is there anything in our documentation that's unclear?" - placeholder: "I want help with..." + label: Questions + description: What would you like help with? Is anything in the docs unclear? validations: required: false - - - type: input - attributes: - label: Ideas or Suggestions - description: "If you have any ideas for features, improvements, or just want to share your thoughts:" - placeholder: "It would be cool if I could help add..." - validations: - required: false - - - type: markdown - attributes: - value: | - ## What happens next? - - A maintainer will respond within 24-48 hours to: - - Answer your questions - - Suggest some good issues to work on - - Help you with setup if needed - - Point you to relevant documentation - - Don't worry if you're new to this - we're here to help! Every expert was once a beginner. πŸš€ - - **Join our [Discord server](https://discord.gg/YzmbnCDkat) for real-time help and community chat!** - - - - diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md index 160104b1..57258976 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -1,14 +1,17 @@ -## Description +## What does this change? -Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. + -Fixes # (issue) +Fixes # ## Type of change -Please delete options that are not relevant. +- [ ] Bug fix +- [ ] New feature +- [ ] Breaking change +- [ ] Docs or tooling only -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) -- [ ] This change requires a documentation update +## Checklist + +- [ ] `npm run lint`, `npm test` and `npm run build` pass +- [ ] Tested on a SEQTA page diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 89a89926..43443acb 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,15 +1,11 @@ -# Nightly release workflow β€” updates the same "nightly" release with fresh builds from main. -# Runs only on BetterSEQTA/BetterSEQTA-Plus. Uses the default GITHUB_TOKEN. -# -# Scheduled at midnight Australia/Adelaide (ACST/ACDT). GitHub cron is UTC-only, so we -# trigger at 13:30 and 14:30 UTC and only proceed when Adelaide local time is 00:00. -# Builds on windows-latest (matches local dev; Linux nightly builds were failing on Vite/Svelte). +# Rebuilds main every night and replaces the assets on the "nightly" prerelease. +# Runs on Windows because the layerchart Svelte build fails on Linux. name: Nightly Release on: schedule: - # 13:30 UTC = 00:00 Adelaide during daylight saving (ACDT, UTC+10:30) + # Midnight in Adelaide during daylight saving (UTC+10:30). - cron: "30 13 * * *" permissions: diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index fca17b8b..761e980c 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -8,7 +8,7 @@ on: jobs: lint: - # windows-latest: Vite/Svelte build fails on Linux CI for layerchart vendor .svelte (see nightly.yml). + # The layerchart Svelte build fails on Linux, so CI runs on Windows. runs-on: windows-latest defaults: run: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e7774c7a..aa5f9a9d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,4 @@ -# Manual release workflow only β€” runs on BetterSEQTA/BetterSEQTA-Plus via workflow_dispatch. -# Bump package.json version on main, confirm when dispatching, then run. -# Uses the default GITHUB_TOKEN (contents: write). +# Manual stable release. Bump the version in package.json on main first. name: Release diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 60c06fef..ab0dae99 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -59,8 +59,9 @@ representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -N/A (literally sorry guys). +reported to the community leaders responsible for enforcement by emailing +[betterseqta.plus@gmail.com](mailto:betterseqta.plus@gmail.com) or messaging a +moderator in the [Discord](https://discord.gg/YzmbnCDkat). All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4bf05be3..f9f260d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ Thanks for helping out! For anything bigger than a small fix, open an issue or a You need Node.js 26+, Git and a Chromium browser (Chrome, Edge or Brave). ```bash -git clone https://github.com/YOUR_USERNAME/BetterSEQTA-Plus.git +git clone https://github.com/YOUR_USERNAME/BetterSEQTA-Plus cd BetterSEQTA-Plus npm install npm run dev @@ -33,7 +33,7 @@ For Firefox, run `npm run dev:firefox` and load `dist/firefox` from `about:debug | `src/css/` | Injected styles and the shared Tailwind setup | | `lib/`, `scripts/` | Vite plugins and build scripts | -[ARCHITECTURE.md](docs/ARCHITECTURE.md) goes into more detail. +The [architecture guide](https://docs.betterseqta.org/architecture/) goes into more detail. ## Making changes @@ -55,13 +55,9 @@ For Firefox, run `npm run dev:firefox` and load `dist/firefox` from `about:debug Search [existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) before opening a new one, and use the issue forms. [`good first issue`](https://github.com/BetterSEQTA/BetterSEQTA-Plus/labels/good%20first%20issue) and [`help wanted`](https://github.com/BetterSEQTA/BetterSEQTA-Plus/labels/help%20wanted) are good places to start. Issues aren't assigned, so just open a PR when you have a fix. -## Plugins - -- [Plugin development](https://docs.betterseqta.org/plugin-development/) -- [Plugin API](https://docs.betterseqta.org/plugin-api/) - ## More docs -- [Troubleshooting](docs/TROUBLESHOOTING.md) +- [Plugin development](https://docs.betterseqta.org/plugin-development/) and the [Plugin API](https://docs.betterseqta.org/plugin-api/) +- [Theme creation](https://docs.betterseqta.org/theme-creation/) +- [Troubleshooting](https://docs.betterseqta.org/troubleshooting/) - [Releases and CI](docs/RELEASES.md) -- [Theme creation](docs/THEME_CREATION.md) diff --git a/README.md b/README.md index e2844946..dde3df32 100644 --- a/README.md +++ b/README.md @@ -3,92 +3,61 @@

- A beautiful 🀩 browser extension that transforms SEQTA with modern themes, powerful customization, productivity tools, and an improved user experience. Contributions are always welcome! + A browser extension that makes SEQTA faster, nicer to look at and easier to use.

- ChromeDownload - + Available in the Chrome Web Store + Join the Discord

-
- - -
- -## Documentation - -Everything you need to get started with BetterSEQTA+ can be found in the [official documentation](https://docs.betterseqta.org). - -Includes: -- Getting Started -- Installation & Development -- Architecture -- Plugin System -- Theme Creation +

+ Chrome Web Store users + Chrome Web Store rating +

## Features -- Dark mode - - Custom Background/Themes -- Improved Styling/CSS - - Improved look for SEQTA Learn -- Custom Home Page including: - - Daily Lessons - - Shortcuts - - Easier Access Notices - - Assessments -- Options to remove certain items from the side menu -- Grades calculator -- Fully customisable themes and an official theme store -- Notification for next lesson (sent 5 minutes before end of the lesson) -- Browser Support - - Chrome, Edge, Brave, Opera and other Chromium-Based browsers are supported - - Firefox Supported: [here](https://addons.mozilla.org/en-US/firefox/addon/betterseqta-plus/)! - - Safari (Experimental and not recommended - only available via compilation) +- **Themes:** dark mode, custom colours and backgrounds, a community theme store and a theme creator. +- **Home page:** today's lessons, upcoming assessments, notices and your own shortcuts in one place. +- **Global search:** jump to assessments, messages, courses and notices from a keyboard shortcut. +- **Assessments:** an overview board grouped by status, averages and weightings on the assessments page, and grade analytics with trends and charts. +- **Timetable:** extra timetable tools, editable room and teacher names, calendar sync and opt-in classmates. +- **Messages and notifications:** custom message folders and a local archive of notifications that outlasts SEQTA's own history. +- **BetterSEQTA Cloud:** sign in to back up your settings and use your profile picture across devices. +- **Extras:** hide side menu items, animated backgrounds, background music and the classic kitten 404 page. -## Creating Custom Themes +Works in Chrome, Edge, Brave, Opera and other Chromium browsers, and in [Firefox](https://addons.mozilla.org/en-US/firefox/addon/betterseqta-plus/). Safari support is experimental and needs a build from source. -If you are looking to create custom themes, I would recommend you start at the official documentation [here](https://docs.betterseqta.org/theme-creation/). 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). +## Documentation -Don't worry- if you get stuck feel free to ask around in the [discord](https://discord.gg/YzmbnCDkat). We're open and happy to help out! Happy creating :) +Guides for installing, making themes and writing plugins are at **[docs.betterseqta.org](https://docs.betterseqta.org)**. If you get stuck, ask in the [Discord](https://discord.gg/YzmbnCDkat). -## πŸš€ Contributing -**New contributors welcome!** -- πŸ“– Start here: https://docs.betterseqta.org/install/ -- 🧠 Architecture: https://docs.betterseqta.org/architecture/ -- 🧩 Plugins: https://docs.betterseqta.org/plugins/ -- πŸ’¬ Discord: https://discord.gg/YzmbnCDkat +## Contributing - -## ⚑ Quick Start +Contributions are welcome. Setup takes a few minutes: ```bash -git clone https://github.com/YOUR_USERNAME_FORKED_WITH/BetterSEQTA-Plus +git clone https://github.com/YOUR_USERNAME/BetterSEQTA-Plus cd BetterSEQTA-Plus npm install npm run dev ``` -Then load `dist` in `chrome://extensions` (Developer Mode β†’ Load unpacked). +Then open `chrome://extensions`, turn on Developer mode, click **Load unpacked** and pick `dist/chrome`. +See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide. -Full development setup guide can be found [here](https://docs.betterseqta.org/install/#for-developers-development-environment). - -## Contributors - - - + + Contributors -Want to contribute? [Click Here!](https://docs.betterseqta.org/contributing/) - ## Credits -Originally developed by [Nulkem](https://github.com/Nulkem/betterseqta) -Ported to Manifest V3 by [MEGA-Dawg68](https://github.com/MEGA-Dawg68) -Maintained by [SethBurkart123](https://github.com/SethBurkart123), [Crazypersonalph](https://github.com/Crazypersonalph) & the rest of the BetterSEQTA team! +Originally developed by [Nulkem](https://github.com/Nulkem/betterseqta). +Ported to Manifest V3 by [MEGA-Dawg68](https://github.com/MEGA-Dawg68). +Maintained by [SethBurkart123](https://github.com/SethBurkart123), [Crazypersonalph](https://github.com/Crazypersonalph) and the rest of the BetterSEQTA team. -## Star History +## Star history [![Star History Chart](https://api.star-history.com/svg?repos=BetterSEQTA/BetterSEQTA-Plus&type=Date)](https://star-history.com/#BetterSEQTA/BetterSEQTA-Plus&Date) diff --git a/SECURITY.md b/SECURITY.md index d8e4e370..fb1c3ba3 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,16 +1,9 @@ -# Security Policy +# Security policy -## Supported Versions +## Supported versions -The following versions of BetterSEQTA+ are currently supported. +Only the latest release gets security fixes. Store installs update automatically. If you sideload from GitHub, grab the newest [release](https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases). -| Version | Supported | -| ------- | --------- | -| 3.4.3 or later | βœ… | -| Earlier than 3.4.3 | ❌ | +## Reporting a vulnerability -## Reporting a Vulnerability - -If you discover a security vulnerability, please report it responsibly through GitHub Security Advisories: - -https://github.com/BetterSEQTA/BetterSEQTA-Plus/security/advisories/new +Please report vulnerabilities privately through [GitHub Security Advisories](https://github.com/BetterSEQTA/BetterSEQTA-Plus/security/advisories/new), not in a public issue. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md deleted file mode 100644 index 3f67efc0..00000000 --- a/docs/ARCHITECTURE.md +++ /dev/null @@ -1,237 +0,0 @@ -# BetterSEQTA+ Architecture - -**Published version:** [docs.betterseqta.org/architecture/](https://docs.betterseqta.org/architecture/) - -Hey there! πŸ‘‹ New to the codebase and feeling a bit lost? Don't worry - this guide will help you understand how everything fits together! - -## Table of Contents - -- [Overview](#overview) -- [High-Level Architecture](#high-level-architecture) -- [Core Components](#core-components) -- [Plugin System](#plugin-system) -- [File Structure Explained](#file-structure-explained) -- [Data Flow](#data-flow) -- [Browser Extension Basics](#browser-extension-basics) - -## Overview - -BetterSEQTA+ is a browser extension that enhances SEQTA Learn by: -- Adding new features through a plugin system -- Providing customizable themes and UI improvements -- Offering better navigation and user experience - -Think of it like this: **SEQTA Learn + BetterSEQTA+ = Enhanced SEQTA Experience** - -## High-Level Architecture - -``` -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ BROWSER EXTENSION β”‚ -β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ Background β”‚ β”‚ Content Script β”‚ β”‚ -β”‚ β”‚ Script β”‚ β”‚ (SEQTA.ts) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ - Settings │◄──── - Page Detectionβ”‚ β”‚ -β”‚ β”‚ - Storage β”‚ β”‚ - Plugin Loadingβ”‚ β”‚ -β”‚ β”‚ - Updates β”‚ β”‚ - UI Injection β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ Plugin System β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ -β”‚ β”‚ β”‚ Built-in β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ Plugins β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ - Themes β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ - Search β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ - Timetable β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ - etc... β”‚ β”‚ β”‚ -β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ Settings UI β”‚ β”‚ -β”‚ β”‚ (Svelte App) β”‚ β”‚ -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ - Plugin Config β”‚ β”‚ -β”‚ β”‚ - Theme Creator β”‚ β”‚ -β”‚ β”‚ - General Settingsβ”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - β”‚ - β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” - β”‚ SEQTA Learn β”‚ - β”‚ Website β”‚ - β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -``` - -## Core Components - -### 1. Entry Point (`src/SEQTA.ts`) -This is where it all begins! When you visit a SEQTA page: -1. Detects if you're on a SEQTA Learn page -2. Injects our CSS styles -3. Changes the favicon to BetterSEQTA+ icon -4. Loads settings from storage -5. Initializes the plugin system - -### 2. Plugin System (`src/plugins/`) -The heart of BetterSEQTA+! This is what makes it extensible: -- **Plugin Manager**: Registers and manages all plugins -- **Built-in Plugins**: Pre-made plugins (themes, search, etc.) -- **Plugin API**: Provides plugins with tools to interact with SEQTA - -### 3. Settings UI (`src/interface/`) -A Svelte application that lets users: -- Enable/disable plugins -- Configure plugin settings -- Create custom themes -- Browse the theme store - -### 4. Background Script (`src/background.ts`) -Runs in the background and handles: -- Extension-wide settings storage -- Communication between different parts -- Update notifications - -## Plugin System - -Our plugin system is what makes BetterSEQTA+ so powerful. Here's how it works: - -### Plugin Lifecycle -``` -Plugin Registration β†’ Settings Loading β†’ Plugin Initialization β†’ Running β†’ Cleanup -``` - -### Built-in Plugins Overview - -| Plugin | What it does | Files | -|--------|-------------|-------| -| **Themes** | Custom CSS themes and backgrounds | `src/plugins/built-in/themes/` | -| **Global Search** | Search across all SEQTA content | `src/plugins/built-in/globalSearch/` | -| **Timetable** | Enhanced timetable features | `src/plugins/built-in/timetable/` | -| **Profile Picture** | Custom profile pictures | `src/plugins/built-in/profilePicture/` | -| **Animated Background** | Moving background animations | `src/plugins/built-in/animatedBackground/` | - -### Creating a Plugin -Every plugin follows this structure: -```typescript -const myPlugin: Plugin = { - id: "unique-plugin-id", - name: "Human Readable Name", - description: "What does this plugin do?", - version: "1.0.0", - settings: { /* user configurable options */ }, - run: async (api) => { - // Your plugin code goes here! - } -}; -``` - -## File Structure Explained - -``` -src/ -β”œβ”€β”€ SEQTA.ts # πŸš€ Main entry point - start reading here! -β”œβ”€β”€ background.ts # πŸ”§ Background script for extension -β”œβ”€β”€ manifests/ # πŸ“¦ Browser extension manifests -β”œβ”€β”€ plugins/ # 🧩 Plugin system (the magic happens here!) -β”‚ β”œβ”€β”€ core/ # πŸ—οΈ Plugin infrastructure -β”‚ β”œβ”€β”€ built-in/ # 🎁 Pre-made plugins -β”‚ └── index.ts # πŸ“‹ Plugin registration -β”œβ”€β”€ interface/ # 🎨 Settings UI (Svelte app) -β”‚ β”œβ”€β”€ pages/ # πŸ“„ Settings pages -β”‚ β”œβ”€β”€ components/ # 🧱 Reusable UI components -β”‚ └── main.ts # 🏠 Settings app entry point -β”œβ”€β”€ seqta/ # πŸ”— SEQTA-specific utilities -β”‚ β”œβ”€β”€ main.ts # 🎯 Core SEQTA modifications -β”‚ β”œβ”€β”€ ui/ # 🎨 UI manipulation helpers -β”‚ └── utils/ # πŸ› οΈ Helper functions -└── css/ # πŸ’„ Styles and themes -``` - -### Where to Start Reading? -1. **New to the project?** Start with `src/SEQTA.ts` -2. **Want to understand plugins?** Look at `src/plugins/core/types.ts` -3. **Want to see a simple plugin?** Check out `src/plugins/built-in/profilePicture/` -4. **Interested in the UI?** Explore `src/interface/main.ts` - -## Data Flow - -Here's how data flows through the system: - -``` -User visits SEQTA β†’ SEQTA.ts detects page β†’ Loads settings from storage - β”‚ - β–Ό -Plugin Manager initializes β†’ Each plugin gets API access β†’ Plugins modify SEQTA - β”‚ - β–Ό -User opens settings β†’ Svelte UI loads β†’ Settings changed β†’ Storage updated - β”‚ - β–Ό -Storage change detected β†’ Plugins notified β†’ UI updates automatically -``` - -## Browser Extension Basics - -Never worked on a browser extension before? Here's what you need to know: - -### Content Scripts vs Background Scripts -- **Content Script** (`SEQTA.ts`): Runs on SEQTA pages, can access and modify the page -- **Background Script** (`background.ts`): Runs in the background, handles storage and messaging - -### Manifest Files -Each browser needs a slightly different manifest file: -- `manifests/chrome.ts` - Chrome, Edge, Brave -- `manifests/firefox.ts` - Firefox -- `manifests/safari.ts` - Safari (experimental) - -### Communication -Different parts of the extension communicate using: -- `browser.runtime.sendMessage()` - Send messages -- `browser.storage` - Shared storage, but we have created a custom storage system that is easier to use: -```ts -settingsState.[the setting name] = [whatever you want to set it to] -console.log(settingsState.[the setting name]) -``` -- Custom events for plugin communication - -## Development Tips - -### Debugging -1. **Chrome DevTools**: Right-click β†’ Inspect β†’ Console tab -2. **Extension Console**: `chrome://extensions` β†’ BetterSEQTA+ β†’ "Inspect views: background page" -3. **Look for logs**: We log everything with `[BetterSEQTA+]` prefix - -### Making Changes -1. Edit code β†’ Save β†’ Browser auto-reloads extension β†’ Refresh SEQTA page -2. For UI changes: The dev server hot-reloads automatically -3. For plugin changes: May need to disable/enable the plugin in settings - -### Common Gotchas -- Settings take a moment to load (use `api.settings.loaded` promise) -- Some SEQTA elements load dynamically (use `api.seqta.onMount()`) -- Plugin cleanup is important (always return a cleanup function) - -## Next Steps - -Ready to contribute? Here's what to do next: - -1. **Read the code**: Start with `src/SEQTA.ts` and follow the flow -2. **Try creating a simple plugin**: Follow the [plugin documentation](https://docs.betterseqta.org/plugins/) -3. **Look at existing issues**: Check our [GitHub issues](https://github.com/BetterSEQTA/BetterSEQTA-plus/issues) for "good first issue" labels -4. **Join our Discord**: Get help from the community! - -## Questions? - -Still confused about something? That's totally normal! Here are your options: -- πŸ’¬ Ask in our [Discord server](https://discord.gg/YzmbnCDkat) -- πŸ› Open an issue on GitHub -- πŸ“§ Email us at betterseqta.plus@gmail.com - -Remember: **Every expert was once a beginner!** We're here to help you learn and contribute. πŸš€ \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index c23c0940..b68cdc15 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,56 +1,19 @@ -# BetterSEQTA+ Documentation +# Docs -**Canonical documentation lives at [docs.betterseqta.org](https://docs.betterseqta.org/).** The pages below are the same topics; use the site for search, navigation, and the latest updates. +The main documentation lives at **[docs.betterseqta.org](https://docs.betterseqta.org/)**, built from [BetterSEQTA-Docs](https://github.com/BetterSEQTA/BetterSEQTA-Docs). Send fixes for those pages there. -## Table of Contents +| Topic | Where | +|-------|-------| +| Installing | [docs.betterseqta.org/install](https://docs.betterseqta.org/install/) | +| Architecture | [docs.betterseqta.org/architecture](https://docs.betterseqta.org/architecture/) | +| Writing plugins | [Plugin development](https://docs.betterseqta.org/plugin-development/), [Plugin API](https://docs.betterseqta.org/plugin-api/), [Example plugin](https://docs.betterseqta.org/example-plugin/) | +| Making themes | [docs.betterseqta.org/theme-creation](https://docs.betterseqta.org/theme-creation/) | +| Troubleshooting | [docs.betterseqta.org/troubleshooting](https://docs.betterseqta.org/troubleshooting/) | -### Getting Started +These pages only live in this repo because they track the code closely: -- [Documentation home](https://docs.betterseqta.org/) -- [Installation](https://docs.betterseqta.org/install/) -- [Contributing](https://docs.betterseqta.org/contributing/) -- [GitHub releases & CI](RELEASES.md) β€” workflows, nightly builds, update detector -- [Architecture](https://docs.betterseqta.org/architecture/) -- [Contribution guidelines (repository)](../CONTRIBUTING.md) -- [Troubleshooting](https://docs.betterseqta.org/troubleshooting/) +- [RELEASES.md](RELEASES.md): CI, stable and nightly releases, and the update badge. +- [CLOUD_SETTINGS_SYNC_SERVER.md](CLOUD_SETTINGS_SYNC_SERVER.md): the HTTP API the extension expects for cloud settings backup. +- [CLOUD_SETTINGS_SYNC_OPTIONS.md](CLOUD_SETTINGS_SYNC_OPTIONS.md): every value that goes into a cloud backup and how it is stored. -### Features & customization - -- [Features](https://docs.betterseqta.org/features/) -- [Themes & customization](https://docs.betterseqta.org/customization/) -- [Theme creation](https://docs.betterseqta.org/theme-creation/) - -### Plugin system - -- [Plugins overview](https://docs.betterseqta.org/plugins/) -- [Plugin development](https://docs.betterseqta.org/plugin-development/) -- [Plugin API](https://docs.betterseqta.org/plugin-api/) -- [Example plugin](https://docs.betterseqta.org/example-plugin/) - -## Core Concepts - -BetterSEQTA+ is built around several core concepts: - -1. **Plugin System**: BetterSEQTA+ uses a plugin system to extend SEQTA with new features. Plugins are self-contained pieces of code that can be enabled or disabled by the user. See the [plugins documentation](https://docs.betterseqta.org/plugins/). - -2. **Type-Safe Settings**: Each plugin can define settings that are type-safe and automatically rendered in the settings UI. The settings system uses TypeScript decorators to make it easy to define settings with proper typing. - -3. **Storage API**: Plugins can use the Storage API to persist data between sessions. The Storage API is also type-safe, ensuring that plugins can only access their own data. - -4. **SEQTA Integration**: BetterSEQTA+ integrates with SEQTA Learn by injecting code into the page. This allows plugins to modify the SEQTA UI and add new features. - -## Getting Help - -If you need help with BetterSEQTA+, you can: - -- [Open an Issue](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) - Report bugs or request features -- [Join the Discord](https://discord.gg/YzmbnCDkat) - Chat with the community -- [Email the Maintainers](mailto:betterseqta.plus@gmail.com) - Contact the maintainers directly - -## Contributing to the Documentation - -We welcome contributions to the documentation. The published site is built from the documentation repository; see [Contributing](https://docs.betterseqta.org/contributing/) for how to help. - -## License - -BetterSEQTA+ is licensed under the [MIT License](../LICENSE). +For contributing, see [CONTRIBUTING.md](../CONTRIBUTING.md). diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 296f098c..dd85c7c7 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -1,267 +1,57 @@ -# GitHub releases, CI, and the update detector +# Releases, CI and the update badge -BetterSEQTA+ is distributed on the Chrome Web Store and Firefox Add-ons, but some users sideload builds from GitHub. This document explains how automated builds, releases, and the in-extension update badge work. +BetterSEQTA+ ships through the Chrome Web Store and Firefox Add-ons. GitHub also hosts sideload builds, and those builds can tell users when a newer one is out. This page covers how all of that is built. -All published releases target the upstream repository: **[BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus)**. +## Workflows ---- +| Workflow | Runs on | What it does | +|----------|---------|--------------| +| [`pr-ci.yml`](../.github/workflows/pr-ci.yml) | Every pull request and push to `main` | Lint, unit tests, then build and smoke test. Uploads the zips as an artifact. | +| [`nightly.yml`](../.github/workflows/nightly.yml) | Daily at 13:30 UTC (midnight in Adelaide during daylight saving) | Builds `main` and replaces the assets on the `nightly` prerelease. | +| [`release.yml`](../.github/workflows/release.yml) | Manually only | Builds the version in `package.json` and publishes it as a release with that tag. | -## Overview +Every build goes through the shared [`build-extension`](../.github/actions/build-extension/action.yml) action: install with `npm ci`, run `npm run build` for Chrome and Firefox, then zip `dist/chrome` and `dist/firefox`. The release workflows publish with the default `GITHUB_TOKEN`, so they need no extra secrets. -```mermaid -flowchart TB - subgraph ci [Continuous integration] - PrCi[pr-ci.yml β€” every PR] - Mvp[mvp.yml β€” push to main] - end +## Publishing a stable release - subgraph releases [GitHub releases] - Manual[release.yml β€” manual stable] - Nightly[nightly.yml β€” daily cron] - end +1. Bump `version` in `package.json` on `main` and push it. +2. Go to Actions β†’ **Release** β†’ **Run workflow** and tick the confirmation box. +3. On the first run for a version, edit the release title and notes on GitHub afterwards. - subgraph output [Outputs] - Zips["betterseqtaplus-VERSION-chrome.zip\nbetterseqtaplus-VERSION-firefox.zip"] - GhStable["Release tag: 3.7.0"] - GhNightly["Release tag: nightly"] - Badge[Update badge in settings] - end +Running it again for the same version only replaces the zips (`betterseqtaplus@{version}-chrome.zip` and `-firefox.zip`). - PrCi -->|build only| NoRelease[No release] - Mvp -->|artifact| DistZip[dist.zip artifact] +## Nightly builds - Manual --> Zips - Manual --> GhStable - Manual --> Badge +The `nightly` tag always points at the latest build of `main`. Each run renames the release to `Nightly (YYYY-MM-DD)` and replaces its zips (`betterseqtaplus-nightly-{date}-chrome.zip` and `-firefox.zip`). The release text comes from [`nightly-release-notes.md`](../.github/nightly-release-notes.md) when the release is first created. - Nightly --> Zips - Nightly --> GhNightly - Nightly --> Badge -``` +Get it from [releases/tag/nightly](https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases/tag/nightly). -| Workflow | Trigger | Creates a release? | Update detector in build? | -|----------|---------|------------------|---------------------------| -| `pr-ci.yml` | Every pull request to `main` | No | No | -| `mvp.yml` | Every push to `main` | No | No | -| `release.yml` | Manual (`workflow_dispatch`) | Yes β€” stable version tag | Yes β€” stable channel | -| `nightly.yml` | Daily at 03:00 UTC + manual | Yes β€” reuses `nightly` tag | Yes β€” nightly channel | +GitHub builds are for sideloading only. Never upload them to an extension store. ---- +## Build-time flags -## Shared build action +Release workflows pass these into Vite, which bakes them in through `define` in [`vite.config.ts`](../vite.config.ts). Their types live in [`src/env.d.ts`](../src/env.d.ts). -All release and CI builds that need packaged extensions use the composite action at [`.github/actions/build-extension/action.yml`](../.github/actions/build-extension/action.yml). - -It: - -1. Installs dependencies (`npm ci`) -2. Runs `npm run build` (Chrome then Firefox via Vite) -3. Zips each unpacked folder into sideload-ready archives: - - `dist/betterseqtaplus-{version}-chrome.zip` - - `dist/betterseqtaplus-{version}-firefox.zip` - -The `{version}` comes from `package.json`. - -### Build-time flags (release builds only) - -Release and nightly workflows pass environment variables into Vite, which bakes them into the extension at compile time via `define` in [`vite.config.ts`](../vite.config.ts): - -| Variable | Stable release | Nightly | PR / local dev | -|----------|----------------|---------|----------------| -| `GH_RELEASE_UPDATE_CHECK` | `true` | `true` | `false` / unset | -| `UPDATE_CHANNEL` | `stable` | `nightly` | `stable` (unused) | +| Variable | Stable | Nightly | PRs and local builds | +|----------|--------|---------|----------------------| +| `GH_RELEASE_UPDATE_CHECK` | `true` | `true` | unset | +| `UPDATE_CHANNEL` | `stable` | `nightly` | unset | | `GH_RELEASE_REPO` | `BetterSEQTA/BetterSEQTA-Plus` | same | same | -| `BUILD_LABEL` | empty | UTC build date (`YYYY-MM-DD`) | empty | +| `BUILD_LABEL` | empty | UTC build date | empty | -When `GH_RELEASE_UPDATE_CHECK` is not `true`, the update-checker code is tree-shaken out of the bundle. PR CI builds and local `npm run build` do **not** include the update badge. - -To test a release-style build locally: +Without `GH_RELEASE_UPDATE_CHECK=true`, the update checker is removed from the bundle entirely. To try a release-style build locally: ```bash -# PowerShell -$env:GH_RELEASE_UPDATE_CHECK="true" -$env:UPDATE_CHANNEL="stable" -npm run build - -# bash GH_RELEASE_UPDATE_CHECK=true UPDATE_CHANNEL=stable npm run build ``` ---- +## Update badge -## Stable release (`release.yml`) +Release builds show an amber **Update β€” {version}** pill at the bottom of the settings sidebar when a newer build exists. Clicking it opens the releases page. The logic is in [`src/utils/githubReleaseUpdate.ts`](../src/utils/githubReleaseUpdate.ts): -**Purpose:** A safe, manual way to publish versioned builds that users can download from GitHub. +- **Stable** compares the highest semver release tag (ignoring `nightly`) with the installed version. +- **Nightly** compares the `nightly` release's publish time with the last one seen, stored as `lastSeenNightlyPublishedAt`. The first check after install only records it. -**Trigger:** Manual only β€” Actions β†’ **Release** β†’ **Run workflow**. There is no schedule or automatic trigger. +Checks run at most every 6 hours (`localStorage` key `bsplus_lastGhReleaseCheck`). -When dispatching, check **β€œI have already updated the version in package.json”**. The workflow will not run without that confirmation. - -### Before you run it - -1. Merge your changes to `main`. -2. Bump `version` in [`package.json`](../package.json) (e.g. `3.7.0` β†’ `3.8.0`). -3. Commit and push that bump. - -### What the workflow does - -1. Aborts if the version confirmation was not checked. -2. Reads the version from `package.json`. -3. Builds Chrome and Firefox with the update detector enabled (stable channel). -4. If no release exists for that tag: creates one (e.g. `3.8.0`) with a placeholder description. -5. If a release already exists for that tag: **only replaces the zip assets** (`--clobber`). Title and body are left unchanged. -6. Uploads `betterseqtaplus-{version}-chrome.zip` and `-firefox.zip`. - -On first publish, edit the **title** and **release notes** on GitHub afterward. Re-running for the same version refreshes the files only. - -### Downloading and installing - -1. Open [github.com/BetterSEQTA/BetterSEQTA-Plus/releases](https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases). -2. Pick the version you want. -3. Download `betterseqtaplus-{version}-chrome.zip` or `-firefox.zip`. -4. Unzip and load the unpacked folder as a temporary extension (Chrome: Extensions β†’ Load unpacked; Firefox: `about:debugging` β†’ Load Temporary Add-on). - -**These GitHub builds are for sideloading only. Do not upload them to the Chrome Web Store or Firefox Add-ons.** - ---- - -## Nightly release (`nightly.yml`) - -**Purpose:** Continuous experimental builds from `main` so testers always have a single place to get the latest code. - -**Trigger:** - -- Automatically every day at **03:00 UTC** -- Manually via Actions β†’ **Nightly Release** β†’ **Run workflow** - -### What the workflow does - -1. Builds from the current `main` branch with the update detector enabled (nightly channel). -2. Uses a fixed release tag: **`nightly`** (marked as prerelease). -3. On first run: creates the `nightly` release with the text in [`.github/nightly-release-notes.md`](../.github/nightly-release-notes.md). -4. On every run: sets the release title to **`Nightly (YYYY-MM-DD)`** (UTC build date) and **replaces** the zip assets on the same release (`--clobber`). The release body is not rewritten. -5. Packages zips as `betterseqtaplus-nightly-{date}-chrome.zip` / `-firefox.zip`. - -The nightly release body warns that builds are experimental and must not be uploaded to extension stores. - ---- - -## PR CI (`pr-ci.yml`) - -**Purpose:** Verify that every pull request builds cleanly in a fresh environment. - -**Trigger:** Every pull request targeting `main`. - -**Steps:** - -1. `npm ci` -2. `npm run lint` (ESLint on `src/**/*.{js,ts}`) -3. Build via the shared action with **no** update detector - -No release is created and no artifacts are published for end users. - ---- - -## Push CI (`mvp.yml`) - -**Purpose:** Build verification when code lands on `main`. - -**Trigger:** Push to `main` only (not pull requests β€” those use `pr-ci.yml`). - -Uploads a `dist.zip` artifact containing the full `dist/` folder for debugging. No release, no update detector. - ---- - -## Authentication - -Release workflows run **only on [BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus)**. They use the default `GITHUB_TOKEN` with `contents: write` β€” no extra secrets or PATs required. - ---- - -## Update detector (in-extension) - -GitHub release builds include a small feature that tells sideload users when a newer build is available, so they do not have to check GitHub manually. - -### Where it appears - -In the **settings popup** header (top-right): an amber **β€œUpdate available β€” X.X.X”** pill when an update exists, plus a muted line: - -> GitHub release build β€” do not upload to extension stores. - -Clicking the badge opens the relevant GitHub releases page. - -### How it checks for updates - -Implementation: [`src/utils/githubReleaseUpdate.ts`](../src/utils/githubReleaseUpdate.ts) - -**Stable channel** (from `release.yml` builds): - -1. Fetches releases from the GitHub API for `BetterSEQTA/BetterSEQTA-Plus`. -2. Ignores the `nightly` tag and any non-semver tags. -3. Finds the highest semver tag. -4. Compares it to `browser.runtime.getManifest().version`. -5. Shows the badge if the remote version is newer. - -**Nightly channel** (from `nightly.yml` builds): - -1. Fetches the `nightly` release. -2. Compares its `published_at` timestamp to `lastSeenNightlyPublishedAt` in extension storage. -3. On first install, records the current publish time without showing a badge. -4. Shows **β€œUpdate available β€” nightly (YYYY-MM-DD)”** when a newer nightly has been published. - -Checks are throttled to once every **6 hours** per browser profile (`localStorage` key `bsplus_lastGhReleaseCheck`). Recent results are cached in memory for the session. - -### Dev override (testing) - -To test the badge without publishing a real release: - -1. Open settings and unlock **dev mode** (click the logo, type `dev`). -2. In the developer section, set **GitHub latest version override** to a version higher than your installed one (e.g. `9.9.9`). -3. Reopen settings β€” the badge should appear. - -This only applies when dev mode is on. Clear the field to return to normal API checks. - ---- - -## File reference - -| Path | Role | -|------|------| -| `.github/actions/build-extension/action.yml` | Shared install, build, zip | -| `.github/workflows/release.yml` | Manual stable releases | -| `.github/workflows/nightly.yml` | Nightly releases | -| `.github/workflows/pr-ci.yml` | PR lint + build | -| `.github/workflows/mvp.yml` | Push-to-main build artifact | -| `.github/nightly-release-notes.md` | Static body for the `nightly` release | -| `vite.config.ts` | Injects build-time `define` flags | -| `src/env.d.ts` | TypeScript declarations for those flags | -| `src/utils/githubReleaseUpdate.ts` | Update check logic | -| `src/interface/pages/settings.svelte` | Badge and disclaimer UI | -| `src/interface/pages/settings/general.svelte` | Dev override input | -| `src/types/storage.ts` | `devGhReleaseVersionOverride`, `lastSeenNightlyPublishedAt` | - ---- - -## Quick reference - -### Publish a stable release - -```text -1. Bump version in package.json on main -2. Actions β†’ Release β†’ Run workflow β†’ confirm version checkbox -3. Edit release title/notes on GitHub (first time only) -4. Re-run with same version to refresh zips without changing release text -``` - -### Get the latest nightly - -```text -https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases/tag/nightly -``` - -### Verify a PR locally - -```bash -npm run lint -npm run build -``` +To test the badge without publishing, turn on dev mode (click the settings logo and type `dev`), then set **GitHub latest version override** in the Advanced section to a higher version such as `9.9.9`. diff --git a/docs/THEME_CREATION.md b/docs/THEME_CREATION.md deleted file mode 100644 index cd72cfd6..00000000 --- a/docs/THEME_CREATION.md +++ /dev/null @@ -1,587 +0,0 @@ -# Theme Creation Guide - -**Published version:** [docs.betterseqta.org/theme-creation/](https://docs.betterseqta.org/theme-creation/) - -This guide covers everything you need to know about creating custom themes for BetterSEQTA+. - -## Table of Contents - -1. [Overview](#overview) -2. [Theme Structure](#theme-structure) -3. [CSS Variables](#css-variables) -4. [CSS Selectors & Classes](#css-selectors--classes) -5. [Custom Images](#custom-images) -6. [Theme Settings](#theme-settings) -7. [Best Practices](#best-practices) -8. [Examples](#examples) - -## Overview - -Themes in BetterSEQTA+ allow you to completely customize the appearance of SEQTA Learn. A theme consists of: - -- **Custom CSS**: CSS rules that override default styles -- **Custom Images**: Images that can be referenced via CSS variables -- **Theme Metadata**: Name, description, default color, etc. -- **Theme Settings**: Options like forcing dark/light mode - -Themes are applied by injecting CSS into the SEQTA page and setting CSS custom properties (variables) on the document root. - -## CSS Variables - -BetterSEQTA+ provides a comprehensive set of CSS variables that you can use in your themes. These variables automatically adapt to light/dark mode and user preferences. - -### Core Background Variables - -| Variable | Light Mode | Dark Mode | Description | -|----------|------------|-----------|-------------| -| `--background-primary` | `#ffffff` | `#232323` | Main background color | -| `--background-secondary` | `#e5e7eb` | `#1a1a1a` | Secondary background color | -| `--theme-primary` | `#ffffff` | `#232323` | Primary theme color (same as background-primary) | -| `--theme-secondary` | `#e5e7eb` | `#1a1a1a` | Secondary theme color (same as background-secondary) | -| `--text-primary` | `black` | `white` | Primary text color | -| `--text-color` | `black` | `white` | Text color (alias for text-primary) | - -### BetterSEQTA+ Specific Variables - -| Variable | Description | Notes | -|----------|-------------|-------| -| `--better-main` | User's selected accent color | Dynamically set based on color picker | -| `--better-sub` | Dark navy color | Always `#161616` | -| `--better-pale` | Lightened version of accent color | Only available in light mode | -| `--better-light` | Lighter version of accent color | Calculated based on brightness | -| `--better-alert-highlight` | Alert/highlight color | `#c61851` | -| `--betterseqta-logo` | Logo URL | Changes based on dark/light mode | -| `--auto-background` | Auto background color | Falls back to `--better-pale` or `--background-secondary` | -| `--navy` | Navy color | `#1a1a1a` | -| `--theme-fg-parts` | Theme foreground parts | `white` | - -### Subject/Item Color Variables - -| Variable | Description | -|----------|-------------| -| `--item-colour` | Subject/item color | Set dynamically per subject/item | -| `--colour` | Generic color variable | Used in various contexts | -| `--person-colour` | Person/avatar color | `var(--better-light)` for staff | - -### Transparency Effects - -When transparency effects are enabled, background variables become semi-transparent: - -| Variable | Light Mode (Transparent) | Dark Mode (Transparent) | -|----------|--------------------------|-------------------------| -| `--background-primary` | `rgba(255, 255, 255, 0.6)` | `rgba(35, 35, 35, 0.6)` | -| `--background-secondary` | `rgba(229, 231, 235, 0.6)` | `rgba(26, 26, 26, 0.6)` | - -### Using CSS Variables - -You can use these variables in your custom CSS: - -```css -/* Example: Style a custom element */ -.my-custom-element { - background: var(--background-primary); - color: var(--text-primary); - border: 1px solid var(--better-main); -} - -/* Example: Create a gradient */ -.gradient-box { - background: linear-gradient( - to bottom, - var(--better-main), - var(--background-secondary) - ); -} -``` - -## CSS Selectors & Classes - -BetterSEQTA+ uses specific CSS selectors and classes that you can target in your themes. Here are the most important ones: - -### Main Layout Elements - -| Selector | Description | -|----------|-------------| -| `#container` | Main container element | -| `#content` | Content area | -| `#main` | Main content wrapper | -| `#title` | Top title bar | -| `#menu` | Sidebar menu | - -### Dark Mode - -The `dark` class is added to `html` when dark mode is active: - -```css -/* Target dark mode specifically */ -html.dark #main { - background: var(--background-primary); -} - -/* Target light mode */ -html:not(.dark) #main { - background: var(--background-primary); -} -``` - -### Transparency Effects - -When transparency effects are enabled, the `transparencyEffects` class is added to `html`: - -```css -html.transparencyEffects .notice { - backdrop-filter: blur(80px); -} -``` - -### Common SEQTA Classes - -| Class/Selector | Description | -|----------------|-------------| -| `.notice` | Notice cards | -| `.day` | Day containers in timetable | -| `.dashboard` | Dashboard sections | -| `.dashlet` | Dashboard widgets | -| `.document` | Document elements | -| `.quickbar` | Quick action bar | -| `.calendar` | Calendar elements | -| `.message` | Message elements | -| `.thread` | Forum threads | -| `.shortcut` | Shortcut buttons | -| `.upcoming-assessment` | Upcoming assessments | -| `.entry.class` | Timetable entries | - -### BetterSEQTA+ Specific Classes - -| Class | Description | -|-------|-------------| -| `.addedButton` | BetterSEQTA+ added buttons | -| `.tooltip` | Tooltip elements | -| `.notice-unified-content` | Unified notice content | -| `.home-container` | Home page container | -| `.timetable-container` | Timetable container | -| `.notices-container` | Notices container | - -### Attribute Selectors - -SEQTA uses data attributes that you can target: - -```css -/* Target specific data types */ -[data-type="student"] .header { - color: var(--text-primary); -} - -/* Target specific labels */ -[data-label="inbox"] { - /* Styles */ -} -``` - -### CSS Modules - -SEQTA uses CSS modules with hashed class names. You can target them using attribute selectors: - -```css -/* Target CSS module classes */ -[class*="MessageList__MessageList___"] { - background: var(--background-primary); -} - -[class*="BasicPanel__BasicPanel___"] { - border-radius: 16px; -} -``` - -## Custom Images - -Themes can include custom images that are made available as CSS variables. - -### Adding Images - -1. Upload an image in the theme creator -2. Set a CSS variable name (e.g., `custom-background`) -3. The image will be available as `var(--custom-background)` - -### Using Image Variables - -```css -/* Use as background */ -.my-element { - background-image: var(--custom-background); - background-size: cover; - background-position: center; -} - -/* Use in content */ -.my-icon::before { - content: ''; - background-image: var(--custom-icon); - width: 24px; - height: 24px; -} -``` - -### Image Variable Format - -Images are stored as `url()` values: - -```css -/* The variable contains: url(blob:...) */ ---custom-background: url(blob:chrome-extension://...); -``` - -## Theme Settings - -### Force Dark/Light Mode - -You can force a theme to always use dark or light mode: - -```typescript -forceDark: true // Force dark mode -forceDark: false // Force light mode -forceDark: undefined // Use user's preference (default) -``` - -When `forceDark` is set, users cannot toggle dark/light mode while the theme is active. - -### Default Color - -Set a default accent color for your theme: - -```typescript -defaultColour: "rgba(0, 123, 255, 1)" // Blue -defaultColour: "#ff6b6b" // Red (hex format) -``` - -### Allow Color Changes - -Control whether users can change the accent color: - -```typescript -CanChangeColour: true // Users can change color -CanChangeColour: false // Color is locked -``` - -## Best Practices - -### 1. Use CSS Variables - -Always use CSS variables instead of hardcoded colors: - -```css -/* Good */ -.my-element { - background: var(--background-primary); - color: var(--text-primary); -} - -/* Bad */ -.my-element { - background: #ffffff; - color: #000000; -} -``` - -### 2. Support Both Light and Dark Modes - -Unless your theme forces a specific mode, ensure it works in both: - -```css -/* Use variables that adapt automatically */ -.my-element { - background: var(--background-primary); - color: var(--text-primary); -} - -/* Or explicitly handle both modes */ -html.dark .my-element { - background: #1a1a1a; -} - -html:not(.dark) .my-element { - background: #ffffff; -} -``` - -### 3. Use !important Sparingly - -Only use `!important` when necessary to override SEQTA's default styles: - -```css -/* Good - necessary override */ -#title { - background: var(--background-primary) !important; -} - -/* Bad - unnecessary */ -.my-element { - color: var(--text-primary) !important; -} -``` - -### 4. Test Responsive Design - -SEQTA is responsive. Test your theme at different screen sizes: - -```css -/* Example: Mobile-specific styles */ -@media (max-width: 900px) { - #menu { - transform: translate(-270px); - } -} -``` - -### 5. Use Semantic Selectors - -Prefer semantic selectors over fragile ones: - -```css -/* Good - stable selector */ -#main > .dashboard > section { - border-radius: 16px; -} - -/* Caution - CSS module classes may change */ -[class*="Dashboard__Dashboard___"] { - border-radius: 16px; -} -``` - -### 6. Optimize Images - -Keep image file sizes reasonable: - -- Use appropriate formats (PNG for transparency, JPG for photos) -- Compress images before uploading -- Consider using CSS for simple graphics instead of images - -### 7. Document Your Theme - -Include comments in your CSS explaining complex styles: - -```css -/* - * Custom gradient background for dashboard - * Uses the user's accent color for a cohesive look - */ -#main > .dashboard { - background: linear-gradient( - 135deg, - var(--better-main), - var(--background-secondary) - ); -} -``` - -## Examples - -### Example 1: Simple Color Theme - -```css -/* Change accent color throughout */ -:root { - --better-main: #ff6b6b; -} - -/* Style the menu */ -#menu { - background: var(--background-primary); - border-right: 3px solid var(--better-main); -} - -/* Style buttons */ -.uiButton { - background: var(--better-main); - color: var(--text-color); - border-radius: 8px; -} -``` - -### Example 2: Custom Background Image - -```css -/* Use a custom background image */ -body { - background-image: var(--custom-background); - background-size: cover; - background-attachment: fixed; -} - -/* Add overlay for readability */ -#main::before { - content: ''; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0, 0, 0, 0.3); - z-index: -1; -} -``` - -### Example 3: Rounded Corners Theme - -```css -/* Make everything more rounded */ -#main > .dashboard > section, -.dashlet, -.notice, -.document { - border-radius: 20px !important; -} - -/* Round buttons */ -.uiButton { - border-radius: 25px !important; -} -``` - -### Example 4: Minimal Theme - -```css -/* Remove shadows and borders */ -#main > .dashboard > section, -.dashlet, -.notice { - box-shadow: none !important; - border: 1px solid var(--background-secondary) !important; -} - -/* Simplify colors */ -#menu { - background: var(--background-primary) !important; -} - -/* Remove gradients */ -.day { - background: var(--background-primary) !important; -} -``` - -### Example 5: High Contrast Theme - -```css -/* Increase contrast */ -:root { - --background-primary: #000000; - --background-secondary: #1a1a1a; - --text-primary: #ffffff; -} - -html:not(.dark) { - --background-primary: #ffffff; - --background-secondary: #f0f0f0; - --text-primary: #000000; -} - -/* Add borders for clarity */ -.dashlet, -.notice, -.document { - border: 2px solid var(--better-main) !important; -} -``` - -## Advanced Techniques - -### CSS Custom Properties Override - -You can override CSS variables in your theme: - -```css -/* Override a variable */ -:root { - --better-main: #your-color; -} - -/* Override conditionally */ -html.dark { - --background-primary: #your-dark-color; -} -``` - -### Animations - -Add smooth transitions: - -```css -/* Smooth color transitions */ -#menu li { - transition: background-color 0.3s ease; -} - -/* Hover effects */ -.dashlet:hover { - transform: translateY(-2px); - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); - transition: all 0.3s ease; -} -``` - -### Pseudo-elements - -Use pseudo-elements for decorative elements: - -```css -/* Add decorative border */ -.notice::before { - content: ''; - position: absolute; - left: 0; - top: 0; - bottom: 0; - width: 4px; - background: var(--better-main); -} -``` - -## Troubleshooting - -### Theme Not Applying - -1. Check browser console for CSS errors -2. Verify CSS syntax is correct -3. Ensure selectors are specific enough -4. Check if `!important` is needed - -### Colors Not Changing - -1. Verify you're using CSS variables -2. Check if `forceDark` is overriding your styles -3. Ensure variables are set on `:root` or `html` - -### Images Not Showing - -1. Verify image variable name matches CSS -2. Check image format is supported -3. Ensure image size is reasonable -4. Verify `url()` wrapper in CSS - -### Dark Mode Issues - -1. Test with `forceDark: true` and `forceDark: false` -2. Check if transparency effects are interfering -3. Verify `html.dark` selector is correct - -## Resources - -- **Theme Creator**: Access via BetterSEQTA+ settings -- **CSS Variables Reference**: See [CSS Variables](#css-variables) section above -- **SEQTA DOM Structure**: Inspect SEQTA pages in browser DevTools -- **BetterSEQTA+ Source**: Check `src/css/injected.scss` for default styles - -## Contributing Themes - -If you create a great theme, consider sharing it: - -1. Export your theme (Share button in theme creator) -2. Submit to the BetterSEQTA+ theme store -3. Or share on GitHub/Discord - ---- - -**Note**: This documentation is based on BetterSEQTA+ v3.4.13. Some details may change in future versions. - diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md deleted file mode 100644 index 75dbfc49..00000000 --- a/docs/TROUBLESHOOTING.md +++ /dev/null @@ -1,350 +0,0 @@ -# Troubleshooting Guide - -**Published version:** [docs.betterseqta.org/troubleshooting/](https://docs.betterseqta.org/troubleshooting/) - -Having issues with BetterSEQTA+ development? This guide covers the most common problems and their solutions. - -## Table of Contents - -- [Installation Issues](#installation-issues) -- [Development Server Issues](#development-server-issues) -- [Browser Extension Issues](#browser-extension-issues) -- [Plugin Development Issues](#plugin-development-issues) -- [Build Issues](#build-issues) -- [Still Stuck?](#still-stuck) - -## Installation Issues - -### ❌ "npm install" fails with peer dependency errors - -**Problem**: You see errors about peer dependencies or conflicting packages. - -**Solution**: -```bash -rm -rf node_modules -npm install -``` - -### ❌ "Cannot find module" errors - -**Problem**: Node.js can't find required packages. - -**Solutions**: -1. **Clear and reinstall**: - ```bash - rm -rf node_modules - npm install - ``` - -2. **Check Node.js version**: - ```bash - node --version # Should be v26 or higher - ``` - -3. **Try with npm cache clean**: - ```bash - npm cache clean --force - npm install - ``` - -### ❌ Permission errors on macOS/Linux - -**Problem**: "EACCES" or permission denied errors. - -**Solution**: -```bash -sudo chown -R $(whoami) ~/.npm -sudo chown -R $(whoami) /usr/local/lib/node_modules -``` - -## Development Server Issues - -### ❌ "npm run dev" fails - -**Problem**: Development server won't start. - -**Solutions**: -1. **Check if port is in use**: - ```bash - lsof -i :5173 # Kill the process using the port - ``` - -2. **Clear dist folder**: - ```bash - rm -rf dist - npm run dev - ``` - -3. **Check for TypeScript errors**: - ```bash - npx tsc --noEmit # Check for type errors - ``` - -### ❌ Changes not reflecting in browser - -**Problem**: You make code changes but don't see them in the browser. - -**Solutions**: -1. **Reload the extension**: - - Go to `chrome://extensions` - - Find BetterSEQTA+ and click the refresh icon - - Refresh your SEQTA page - -2. **Check if dev server is running**: - - Look for "Build completed" in your terminal - - If not, restart `npm run dev` - -3. **Hard refresh the page**: - - Press `Ctrl+Shift+R` (or `Cmd+Shift+R` on Mac) - -## Browser Extension Issues - -### ❌ Extension doesn't load in Chrome - -**Problem**: Extension appears in `chrome://extensions` but doesn't work. - -**Solutions**: -1. **Check for errors**: - - Go to `chrome://extensions` - - Click "Errors" button on BetterSEQTA+ - - Fix any JavaScript errors shown - -2. **Verify manifest**: - - Check if `dist/manifest.json` exists - - Ensure it has proper structure - -3. **Check permissions**: - - Extension needs permission to access SEQTA pages - - Click "Details" β†’ "Site access" β†’ "On all sites" - -### ❌ Extension doesn't appear on SEQTA pages - -**Problem**: Extension loads but doesn't modify SEQTA. - -**Solutions**: -1. **Check if you're on a SEQTA Learn page**: - - URL should contain "seqta" or "learn" - - Page title should include "SEQTA Learn" - -2. **Check browser console**: - - Press `F12` β†’ Console tab - - Look for "[BetterSEQTA+]" messages - - If no messages, extension isn't running - -3. **Verify page detection**: - - Extension only runs on actual SEQTA Learn pages - - Test on a real SEQTA instance - -### ❌ Settings page won't open - -**Problem**: Clicking the extension icon doesn't open settings. - -**Solutions**: -1. **Check popup errors**: - - Right-click extension icon β†’ "Inspect popup" - - Look for JavaScript errors - -2. **Clear extension storage**: - ```javascript - // In browser console on any page: - chrome.storage.local.clear() - ``` - -3. **Reload extension and try again** - -## Plugin Development Issues - -### ❌ My plugin doesn't appear in settings - -**Problem**: Created a plugin but it's not showing up. - -**Solutions**: -1. **Check plugin registration**: - - Ensure your plugin is imported in `src/plugins/index.ts` - - Verify `pluginManager.registerPlugin(yourPlugin)` is called - -2. **Check plugin structure**: - ```typescript - // Ensure your plugin has all required fields - const myPlugin: Plugin = { - id: "unique-id", // Must be unique - name: "Display Name", - description: "What it does", - version: "1.0.0", - run: async (api) => { - // Your code here - } - }; - ``` - -3. **Check for errors**: - - Look in browser console for plugin loading errors - -### ❌ Plugin settings not working - -**Problem**: Plugin settings don't save or load properly. - -**Solutions**: -1. **Check settings definition**: - ```typescript - import { defineSettings, booleanSetting } from "@/plugins/core/settingsHelpers"; - - const settings = defineSettings({ - myOption: booleanSetting({ - default: true, - title: "My Option", - description: "What this does" - }) - }); - ``` - -2. **Wait for settings to load**: - ```typescript - run: async (api) => { - await api.settings.loaded; // Wait for settings to load - console.log(api.settings.myOption); // Now you can use settings - } - ``` - -### ❌ Plugin API functions not working - -**Problem**: `api.seqta.onMount()` or other API functions don't work. - -**Solutions**: -1. **Check selector specificity**: - ```typescript - // Be specific with selectors - api.seqta.onMount(".home-page", (element) => { - // Your code - }); - ``` - -2. **Wait for elements**: - ```typescript - // Some elements load after page navigation - api.seqta.onPageChange((page) => { - if (page === "home") { - api.seqta.onMount(".home-content", (element) => { - // Now element should exist - }); - } - }); - ``` - -## Build Issues - -### ❌ "npm run build" fails - -**Problem**: Production build fails with errors. - -**Solutions**: -1. **Check TypeScript errors**: - ```bash - npx tsc --noEmit - ``` - -2. **Clear cache and rebuild**: - ```bash - rm -rf dist node_modules - npm install - npm run build - ``` - -3. **Check for import errors**: - - Ensure all imports use correct paths - - Check for missing files - -### ❌ Built extension doesn't work - -**Problem**: `npm run build` succeeds but extension doesn't work. - -**Solutions**: -1. **Test the built extension**: - - Load the `dist` folder as unpacked extension - - Check console for errors - -2. **Compare with dev version**: - - If dev works but build doesn't, there might be a build configuration issue - -3. **Check manifest generation**: - - Verify `dist/manifest.json` looks correct - - Compare with working version - -## Common Error Messages - -### "Cannot access contents of the URL" -- **Cause**: Extension permissions issue -- **Fix**: Go to `chrome://extensions` β†’ BetterSEQTA+ β†’ Details β†’ Site access β†’ "On all sites" - -### "Extension context invalidated" -- **Cause**: Extension was reloaded while page was open -- **Fix**: Refresh the SEQTA page - -### "Uncaught ReferenceError: browser is not defined" -- **Cause**: Missing webextension-polyfill import -- **Fix**: Add `import browser from "webextension-polyfill";` at top of file - -### "Module not found: Can't resolve '@/...' " -- **Cause**: TypeScript path mapping issue -- **Fix**: Check `tsconfig.json` and `vite.config.ts` for path configuration - -## Performance Issues - -### Extension makes SEQTA slow -1. **Check for memory leaks**: - - Use Chrome DevTools β†’ Performance tab - - Look for growing memory usage - -2. **Optimize plugin code**: - - Remove unnecessary listeners - - Clean up intervals/timeouts - - Use efficient selectors - -3. **Profile your changes**: - - Test with extension disabled vs enabled - - Identify which plugin is causing issues - -## Still Stuck? - -If none of these solutions work: - -1. **πŸ” Search existing issues**: [GitHub Issues](https://github.com/BetterSEQTA/BetterSEQTA-plus/issues) - -2. **πŸ’¬ Ask on Discord**: [Join our server](https://discord.gg/YzmbnCDkat) - fastest way to get help! - -3. **πŸ“ Create a new issue**: Include: - - Your operating system - - Node.js version (`node --version`) - - Browser version - - Exact error message - - Steps to reproduce - - What you've already tried - -4. **πŸ“§ Email us**: betterseqta.plus@gmail.com for urgent issues - -## Getting More Debug Info - -### Enable verbose logging -Add this to your plugin's `run` function: -```typescript -console.log("[DEBUG] Plugin starting:", api); -``` - -### Check extension background page -1. Go to `chrome://extensions` -2. Click "Details" on BetterSEQTA+ -3. Click "Inspect views: background page" -4. Check console for background script errors - -### Export debug info -Run this in browser console on a SEQTA page: -```javascript -console.log("Extension info:", { - version: chrome.runtime.getManifest().version, - url: window.location.href, - userAgent: navigator.userAgent, - storage: await chrome.storage.local.get() -}); -``` - -Remember: **Don't give up!** Every developer faces these issues. The community is here to help, and solving these problems makes you a better developer. πŸ’ͺ \ No newline at end of file diff --git a/docs/installation.md b/docs/installation.md deleted file mode 100644 index 82867946..00000000 --- a/docs/installation.md +++ /dev/null @@ -1,153 +0,0 @@ -# Installing BetterSEQTA+ - -**Published version:** [docs.betterseqta.org/install/](https://docs.betterseqta.org/install/) - -This guide will walk you through the process of installing and setting up BetterSEQTA+ for development or usage. - -## Prerequisites - -Before you begin, make sure you have the following installed: - -- [Node.js](https://nodejs.org/) v26 or higher -- A modern web browser (Chrome, Firefox, Edge, etc.) - -## Installation Methods - -There are two ways to install BetterSEQTA+: - -1. **For Users**: Install the browser extension -2. **For Developers**: Clone the repository and set up the development environment - -## For Users: Installing the Browser Extension - -BetterSEQTA+ is available as a browser extension for Chrome, Firefox, and Edge. - -### Chrome/Edge - -1. Visit the [Chrome Web Store page for BetterSEQTA+](https://chrome.google.com/webstore/detail/betterseqta) -2. Click the "Add to Chrome" button -3. Confirm the installation when prompted -4. The extension will be installed and ready to use - -### Firefox - -1. Visit the [Firefox Add-ons page for BetterSEQTA+](https://addons.mozilla.org/en-US/firefox/addon/betterseqta) -2. Click the "Add to Firefox" button -3. Confirm the installation when prompted -4. The extension will be installed and ready to use - -## For Developers: Setting Up the Development Environment - -If you want to develop for BetterSEQTA+ or modify the code, follow these steps: - -### 1. Clone the Repository - -```bash -git clone https://github.com/BetterSEQTA/BetterSEQTA-Plus.git -cd BetterSEQTA-Plus -``` - -### 2. Install Dependencies - -```bash -npm install -``` - -### 3. Set Up Environment Variables - Only required for pushing to extension stores from the command line - -Copy the example environment file: - -```bash -cp .env.submit.example .env -``` - -Edit the `.env` file with your SEQTA credentials and settings. - -### 4. Start the Development Server - -```bash -npm run dev -``` - -This will start a development server and build the extension in watch mode. - -### 5. Load the Extension in Your Browser - -#### Chrome/Edge - -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/chrome` folder in your BetterSEQTA+ directory -4. The extension should now appear in your extensions list - -#### Firefox - -1. Open Firefox and navigate to `about:debugging#/runtime/this-firefox` -2. Click "Load Temporary Add-on..." -3. Select the `manifest.json` file in the `dist` folder -4. The extension should now appear in your add-ons list - -### 6. Test Your Changes - -After making changes to the code, the development server will automatically rebuild the extension. However, you may need to reload the extension in your browser to see the changes: - -1. Go to the extensions page in your browser -2. Find BetterSEQTA+ and click the reload icon -3. Refresh any SEQTA Learn pages you have open - -## Troubleshooting Installation - -### Common Issues - -#### "Cannot find module" errors - -If you see errors about missing modules, try: - -```bash -rm -rf node_modules -npm install -``` - -#### Extension not appearing in SEQTA - -Make sure: - -- You're visiting a SEQTA Learn page -- The extension is enabled -- You've refreshed the page after installing the extension - -#### Development build not updating - -Try: - -1. Stopping the development server -2. Clearing your browser cache -3. Removing the extension from your browser -4. Rebuilding the extension -5. Loading it again - -## Updating BetterSEQTA+ - -### For Users - -Browser extensions update automatically, but you can manually check for updates: - -- **Chrome/Edge**: Go to `chrome://extensions` or `edge://extensions`, enable Developer mode, and click "Update" -- **Firefox**: Go to `about:addons`, click the gear icon, and select "Check for Updates" - -### For Developers - -If you're working on the code, pull the latest changes and reinstall dependencies: - -```bash -git pull -npm install -npm run dev -``` - -## Next Steps - -Now that you have BetterSEQTA+ installed, you can: - -- [Plugins](https://docs.betterseqta.org/plugins/) -- [Contribute to the project](https://docs.betterseqta.org/contributing/) Β· [Repository CONTRIBUTING.md](../CONTRIBUTING.md) diff --git a/docs/plugins/EXAMPLE_PLUGIN.md b/docs/plugins/EXAMPLE_PLUGIN.md deleted file mode 100644 index f26acd78..00000000 --- a/docs/plugins/EXAMPLE_PLUGIN.md +++ /dev/null @@ -1,337 +0,0 @@ -# Example Plugin Template - -**Published version:** [docs.betterseqta.org/example-plugin/](https://docs.betterseqta.org/example-plugin/) - -This is a complete, working example of a simple BetterSEQTA+ plugin. You can copy this code and modify it to create your own plugin! - -## What This Example Does - -This plugin adds a friendly welcome message to the SEQTA homepage and lets users customize the message through settings. - -## Complete Plugin Code - -Create a new file in `src/plugins/built-in/my-first-plugin/index.ts`: - -```typescript -import type { Plugin } from "@/plugins/core/types"; -import { BasePlugin } from "@/plugins/core/settings"; -import { - defineSettings, - booleanSetting, - stringSetting -} from "@/plugins/core/settingsHelpers"; -import { Setting } from "@/plugins/core/settingsHelpers"; - -// Define the plugin settings -const settings = defineSettings({ - enabled: booleanSetting({ - default: true, - title: "Show Welcome Message", - description: "Display a welcome message on the SEQTA homepage" - }), - customMessage: stringSetting({ - default: "Welcome to SEQTA! πŸŽ‰", - title: "Custom Message", - description: "The message to display on the homepage", - maxLength: 100 - }), - showEmoji: booleanSetting({ - default: true, - title: "Show Emoji", - description: "Include emojis in the welcome message" - }) -}); - -// Create settings class -class MyFirstPluginSettings extends BasePlugin { - @Setting(settings.enabled) - enabled!: boolean; - - @Setting(settings.customMessage) - customMessage!: string; - - @Setting(settings.showEmoji) - showEmoji!: boolean; -} - -// Create settings instance -const settingsInstance = new MyFirstPluginSettings(); - -// Define the plugin -const myFirstPlugin: Plugin = { - id: "my-first-plugin", - name: "My First Plugin", - description: "Adds a customizable welcome message to the SEQTA homepage", - version: "1.0.0", - - // Link our settings - settings: settingsInstance.settings, - - // Mark as beta (optional) - beta: true, - - // Add some CSS styles (optional) - styles: ` - .my-plugin-welcome { - background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); - color: white; - padding: 20px; - border-radius: 12px; - margin: 20px; - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); - text-align: center; - font-size: 18px; - animation: slideIn 0.5s ease-out; - } - - @keyframes slideIn { - from { - opacity: 0; - transform: translateY(-20px); - } - to { - opacity: 1; - transform: translateY(0); - } - } - - .my-plugin-welcome .close-btn { - float: right; - background: rgba(255, 255, 255, 0.2); - border: none; - color: white; - padding: 5px 10px; - border-radius: 20px; - cursor: pointer; - font-size: 12px; - } - - .my-plugin-welcome .close-btn:hover { - background: rgba(255, 255, 255, 0.3); - } - `, - - // Main plugin function - run: async (api) => { - console.log("[My First Plugin] Starting up! πŸš€"); - - // Wait for settings to load - await api.settings.loaded; - - let welcomeElement: HTMLElement | null = null; - - // Function to create the welcome message - const createWelcomeMessage = () => { - // Only show if enabled in settings - if (!api.settings.enabled) { - return; - } - - // Remove existing message if it exists - if (welcomeElement) { - welcomeElement.remove(); - } - - // Create the message element - welcomeElement = document.createElement("div"); - welcomeElement.className = "my-plugin-welcome"; - - // Build the message content - let message = api.settings.customMessage; - if (!api.settings.showEmoji) { - // Remove emojis if disabled - message = message.replace(/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/gu, ''); - } - - welcomeElement.innerHTML = ` - -
${message}
- - Powered by My First Plugin - - `; - - return welcomeElement; - }; - - // Function to add message to homepage - const addToHomepage = () => { - api.seqta.onMount(".home-page, .dashboard, [class*='home']", (homePage) => { - console.log("[My First Plugin] Found homepage, adding welcome message"); - - const message = createWelcomeMessage(); - if (message) { - // Add to the top of the homepage - homePage.insertBefore(message, homePage.firstChild); - } - }); - }; - - // Add message when plugin starts - addToHomepage(); - - // Re-add message when user navigates to homepage - api.seqta.onPageChange((page) => { - console.log("[My First Plugin] Page changed to:", page); - if (page.includes("home") || page.includes("dashboard")) { - // Small delay to let the page load - setTimeout(addToHomepage, 500); - } - }); - - // Listen for settings changes and update the message - api.settings.onChange("enabled", (enabled) => { - console.log("[My First Plugin] Enabled setting changed:", enabled); - if (enabled) { - addToHomepage(); - } else if (welcomeElement) { - welcomeElement.remove(); - welcomeElement = null; - } - }); - - api.settings.onChange("customMessage", (newMessage) => { - console.log("[My First Plugin] Message changed:", newMessage); - if (welcomeElement && api.settings.enabled) { - // Update existing message - addToHomepage(); - } - }); - - api.settings.onChange("showEmoji", (showEmoji) => { - console.log("[My First Plugin] Show emoji changed:", showEmoji); - if (welcomeElement && api.settings.enabled) { - // Update existing message - addToHomepage(); - } - }); - - // Return cleanup function (called when plugin is disabled) - return () => { - console.log("[My First Plugin] Cleaning up..."); - if (welcomeElement) { - welcomeElement.remove(); - welcomeElement = null; - } - }; - } -}; - -export default myFirstPlugin; -``` - -## How to Use This Example - -### Step 1: Create the Plugin File -1. Create a new folder: `src/plugins/built-in/my-first-plugin/` -2. Create `index.ts` in that folder -3. Copy the code above into `index.ts` - -### Step 2: Register the Plugin -Add this to `src/plugins/index.ts`: - -```typescript -// Add this import at the top -import myFirstPlugin from "./built-in/my-first-plugin"; - -// Add this line where other plugins are registered -pluginManager.registerPlugin(myFirstPlugin); -``` - -### Step 3: Test It -1. Run `npm run dev` -2. Reload your extension in Chrome -3. Visit a SEQTA page -4. You should see your welcome message! -5. Open BetterSEQTA+ settings to customize it - -## Key Concepts Explained - -### 1. Plugin Structure -```typescript -const myPlugin: Plugin = { - id: "unique-id", // Must be unique across all plugins - name: "Display Name", // Shown in settings - description: "What it does", // Shown in settings - version: "1.0.0", // Plugin version - settings: settingsObject, // User-configurable options - styles: "/* CSS here */", // Optional CSS styles - run: async (api) => { // Main plugin code - // Your code here - } -}; -``` - -### 2. Settings System -```typescript -// Define what settings your plugin has -const settings = defineSettings({ - myOption: booleanSetting({ - default: true, - title: "My Option", - description: "What this option does" - }) -}); - -// Use in your plugin -if (api.settings.myOption) { - // Do something -} -``` - -### 3. SEQTA Integration -```typescript -// Wait for elements to appear -api.seqta.onMount(".some-selector", (element) => { - // Modify the element -}); - -// Detect page changes -api.seqta.onPageChange((page) => { - if (page === "home") { - // User navigated to homepage - } -}); -``` - -### 4. Cleanup -Always return a cleanup function to remove your changes when the plugin is disabled: - -```typescript -run: async (api) => { - // Add your features - - return () => { - // Remove your features - }; -} -``` - -## Customization Ideas - -Want to modify this example? Here are some ideas: - -1. **Change the styling**: Modify the CSS to use different colors, animations, or layouts -2. **Add more settings**: Number settings, select dropdowns, hotkeys -3. **Different trigger**: Show on different pages, or based on time of day -4. **Add interactions**: Buttons that do things when clicked -5. **Store data**: Use `api.storage` to remember user preferences -6. **Communicate with other plugins**: Use `api.events` to send/receive events - -## Next Steps - -Once you've got this working: - -1. **Experiment**: Try changing things and see what happens -2. **Read other plugins**: Look at the built-in plugins for inspiration -3. **Check the API docs**: Learn about all available API functions -4. **Share your creation**: Show it off in Discord! - -## Need Help? - -- πŸ’¬ Ask in our [Discord server](https://discord.gg/YzmbnCDkat) -- πŸ“š Read the [plugin documentation](https://docs.betterseqta.org/plugins/) -- πŸ› Check the [troubleshooting guide](https://docs.betterseqta.org/troubleshooting/) -- πŸ“ Open an issue on GitHub - -Happy coding! πŸŽ‰ \ No newline at end of file diff --git a/docs/plugins/README.md b/docs/plugins/README.md deleted file mode 100644 index 7e64853f..00000000 --- a/docs/plugins/README.md +++ /dev/null @@ -1,299 +0,0 @@ -# Creating Plugins for BetterSEQTA+ - -**Published version:** [docs.betterseqta.org/plugins/](https://docs.betterseqta.org/plugins/) Β· [Plugin development](https://docs.betterseqta.org/plugin-development/) Β· [Plugin API](https://docs.betterseqta.org/plugin-api/) - -Hey there! πŸ‘‹ So you want to create a plugin for BetterSEQTA+? That's awesome! This guide will walk you through everything you need to know, from the very basics to more advanced features. Don't worry if you're new to this - we'll explain everything step by step. - -## What is a Plugin? - -In BetterSEQTA+, a plugin is like a mini-app that adds new features to SEQTA. Think of it as a piece of LEGO that you can snap onto SEQTA to make it do new things. For example, you could create a plugin that: - -- Changes how SEQTA looks -- Adds new buttons or features -- Shows extra information on your timetable -- Collects notifications in a better way -- Really, anything you can imagine! - -## Your First Plugin - -Let's create a super simple plugin together. We'll make one that adds a friendly message to the SEQTA homepage. Here's what we'll need: - -```typescript -import type { Plugin } from "@/plugins/core/types"; - -const myFirstPlugin: Plugin = { - // Every plugin needs these basic details - id: "my-first-plugin", - name: "My First Plugin", - description: "Adds a friendly message to SEQTA", - version: "1.0.0", - - // This tells BetterSEQTA+ that users can turn our plugin on/off - disableToggle: true, - - // Optional: Mark your plugin as beta to show a "Beta" tag in settings - beta: true, - - // This is where the magic happens! - run: async (api) => { - // Wait for the homepage to load - api.seqta.onMount(".home-page", (homePage) => { - // Create our message - const message = document.createElement("div"); - message.textContent = "Hello from my first plugin! πŸŽ‰"; - message.style.padding = "20px"; - message.style.backgroundColor = "#e9f5ff"; - message.style.borderRadius = "8px"; - message.style.margin = "20px"; - - // Add it to the page - homePage.prepend(message); - }); - - // Return a cleanup function that removes our message when the plugin is disabled - return () => { - const message = document.querySelector(".home-page > div"); - message?.remove(); - }; - }, -}; - -export default myFirstPlugin; -``` - -Let's break down what's happening here: - -1. First, we import the `Plugin` type that tells TypeScript what a plugin should look like -2. We create our plugin object with some basic information: - - `id`: A unique name for your plugin (use lowercase and dashes) - - `name`: A friendly name that users will see - - `description`: Explain what your plugin does - - `version`: Your plugin's version number -3. We set `disableToggle: true` so users can turn our plugin on/off in settings -4. We set `beta: true` to mark the plugin as beta -5. The `run` function is where we put our plugin's code -6. We use `api.seqta.onMount` to wait for the homepage to load -7. We create and style a message element -8. We return a cleanup function that removes our changes when the plugin is disabled - -## The Plugin API - -When your plugin runs, it gets access to a powerful API that lets you do all sorts of things. Let's look at what you can do: - -### SEQTA API (`api.seqta`) - -This helps you interact with SEQTA's pages: - -```typescript -// Wait for an element to appear on the page -api.seqta.onMount(".some-class", (element) => { - // Do something with the element -}); - -// Know when the user changes pages -api.seqta.onPageChange((page) => { - console.log("User went to:", page); -}); - -// Get the current page -const currentPage = api.seqta.getCurrentPage(); -``` - -### Settings API (`api.settings`) - -Want to let users customize your plugin? Use settings! - -```typescript -import { BasePlugin } from "@/plugins/core/settings"; -import { - booleanSetting, - defineSettings, - Setting, -} from "@/plugins/core/settingsHelpers"; - -// Define your settings -const settings = defineSettings({ - showMessage: booleanSetting({ - default: true, - title: "Show Welcome Message", - description: "Show a friendly message on the homepage", - }), -}); - -// Create a class for your plugin -class MyPluginClass extends BasePlugin { - @Setting(settings.showMessage) - showMessage!: boolean; -} - -// Create your plugin -const settingsInstance = new MyPluginClass(); - -const myPlugin: Plugin = { - // ... other plugin details ... - settings: settingsInstance.settings, - - run: async (api) => { - // Use the setting - if (api.settings.showMessage) { - // Show the message - } - - // Listen for setting changes - api.settings.onChange("showMessage", (newValue) => { - if (newValue) { - // Show the message - } else { - // Hide the message - } - }); - }, -}; -``` - -### Storage API (`api.storage`) - -Need to save some data? The storage API has got you covered: - -```typescript -// Save some data -await api.storage.set("lastVisit", new Date().toISOString()); - -// Get it back later -const lastVisit = await api.storage.get("lastVisit"); - -// Listen for changes -api.storage.onChange("lastVisit", (newValue) => { - console.log("Last visit updated:", newValue); -}); -``` - -### Events API (`api.events`) - -Want your plugin to be able to interface with other plugins? Then use events! - -```typescript -// Listen for an event -api.events.on("myCustomEvent", (data) => { - console.log("Got event:", data); -}); - -// Send an event -api.events.emit("myCustomEvent", { some: "data" }); -``` - -## Adding Styles - -Want to make your plugin look pretty? You can add CSS styles: - -```typescript -const myPlugin: Plugin = { - // ... other plugin details ... - - // Add your CSS here - styles: ` - .my-plugin-message { - background: linear-gradient(135deg, #6e8efb, #a777e3); - color: white; - padding: 20px; - border-radius: 12px; - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); - margin: 20px; - animation: slide-in 0.3s ease-out; - } - - @keyframes slide-in { - from { transform: translateY(-20px); opacity: 0; } - to { transform: translateY(0); opacity: 1; } - } - `, - - run: async (api) => { - // Your plugin code here - }, -}; -``` - -## Best Practices - -Here are some tips to make your plugin awesome: - -1. **Always Clean Up**: When your plugin is disabled, clean up any changes you made: - - ```typescript - run: async (api) => { - // Add stuff to the page - const element = document.createElement("div"); - document.body.appendChild(element); - - // Return a cleanup function - return () => { - element.remove(); - }; - }; - ``` - -2. **Use TypeScript**: It helps catch errors before they happen and makes your code easier to understand. - -3. **Test Your Plugin**: Make sure it works in different situations: - - - When SEQTA is loading - - When the user switches pages - - When the plugin is enabled/disabled - - When settings are changed - -4. **Keep It Fast**: Don't slow down SEQTA: - - - Use `onMount` instead of intervals or timeouts - - Clean up event listeners when they're not needed - - Don't do heavy calculations on the main thread - -5. **Make It User-Friendly**: - - Add clear settings with good descriptions - - Use `disableToggle: true` so users can turn it off if needed - - Add helpful error messages if something goes wrong - - Use `beta: true` for experimental features to let users know they're trying something new - -## Plugin Metadata Options - -Your plugin object supports several optional flags to customize how it appears and behaves: - -```typescript -const myPlugin: Plugin = { - id: "my-plugin", - name: "My Plugin", - description: "What my plugin does", - version: "1.0.0", - - // Optional flags: - disableToggle: true, // Show enable/disable toggle in settings - defaultEnabled: false, // Start disabled by default (requires disableToggle: true) - beta: true, // Show "Beta" tag in settings UI - - // Your plugin code... - run: async (api) => { /* ... */ }, -}; -``` - -- **`disableToggle`**: When `true`, users can enable/disable your plugin in settings -- **`defaultEnabled`**: When `false`, your plugin starts disabled (only works with `disableToggle: true`) -- **`beta`**: When `true`, shows an orange "Beta" tag next to your plugin name in settings - -## Examples - -Want to see more examples? Check out our built-in plugins: - -- [themes](../../src/plugins/built-in/themes/index.ts): Shows how to change SEQTA's appearance -- [notificationCollector](../../src/plugins/built-in/notificationCollector/index.ts): Shows how to work with SEQTA's notifications -- [timetable](../../src/plugins/built-in/timetable/index.ts): Shows how to modify SEQTA's timetable view -- [assessmentsAverage](../../src/plugins/built-in/assessmentsAverage/index.ts): Shows how to add new features to existing pages - -## Need Help? - -Got stuck? No worries! Here's where you can get help: - -- Join our [Discord server](https://discord.gg/YzmbnCDkat) -- Check out the built-in plugins in the `src/plugins/built-in` folder -- Open an issue on our [GitHub page](https://github.com/betterseqta/betterseqta-plus/issues) - -Happy coding and feel free to check out the [plugin API](https://docs.betterseqta.org/plugin-api/) on the documentation site. diff --git a/docs/plugins/api-reference.md b/docs/plugins/api-reference.md deleted file mode 100644 index 620106a4..00000000 --- a/docs/plugins/api-reference.md +++ /dev/null @@ -1,368 +0,0 @@ -# Plugin API Reference - -**Published version:** [docs.betterseqta.org/plugin-api/](https://docs.betterseqta.org/plugin-api/) - -This document provides detailed technical information about BetterSEQTA+'s plugin APIs. For a beginner-friendly introduction, see the [plugins section](https://docs.betterseqta.org/plugins/) at [docs.betterseqta.org](https://docs.betterseqta.org/). - -## Plugin Structure - -Here's how a plugin is structured: - -```typescript -import type { Plugin } from "@/plugins/core/types"; -import { BasePlugin } from "@/plugins/core/settings"; -import { - booleanSetting, - defineSettings, - Setting, -} from "@/plugins/core/settingsHelpers"; - -// First, define your settings -const settings = defineSettings({ - enabled: booleanSetting({ - default: true, - title: "Enable Feature", - description: "Turn this feature on or off", - }), -}); - -// Create a class to handle your settings -class MyPluginClass extends BasePlugin { - @Setting(settings.enabled) - enabled!: boolean; -} - -// Create an instance of your settings -const settingsInstance = new MyPluginClass(); - -// Create your plugin -const myPlugin: Plugin = { - id: "my-plugin", - name: "My Plugin", - description: "A cool plugin that does things", - version: "1.0.0", - settings: settingsInstance.settings, - disableToggle: true, - beta: true, - - run: async (api) => { - console.log("Plugin is running!"); - - // Do stuff when settings change - api.settings.onChange("enabled", (enabled) => { - if (enabled) { - console.log("Feature enabled!"); - } - }); - - // Return a cleanup function - return () => { - console.log("Plugin cleanup"); - }; - }, -}; - -export default myPlugin; -``` - -## Plugin Metadata - -The plugin object supports several metadata fields and options: - -```typescript -interface Plugin { - // Required fields - id: string; // Unique identifier (lowercase, dashes) - name: string; // Display name shown to users - description: string; // Brief description of what the plugin does - version: string; // Semantic version (e.g., "1.0.0") - settings: PluginSettings; // Plugin settings object - run: (api: PluginAPI) => void; // Main plugin function - - // Optional fields - styles?: string; // CSS styles to inject - disableToggle?: boolean; // Show enable/disable toggle in settings - defaultEnabled?: boolean; // Start enabled/disabled (requires disableToggle) - beta?: boolean; // Show "Beta" tag in settings UI -} -``` - -### Metadata Options - -- **`disableToggle`**: When `true`, users can enable/disable your plugin in the settings page -- **`defaultEnabled`**: When `false`, your plugin starts disabled by default (only works with `disableToggle: true`) -- **`beta`**: When `true`, displays an orange "Beta" tag next to your plugin name in the settings UI -- **`styles`**: CSS string that gets injected into the page when your plugin runs - -## SEQTA API - -The SEQTA API helps you interact with SEQTA's pages: - -```typescript -import type { Plugin } from "@/plugins/core/types"; - -const seqtaPlugin: Plugin = { - id: "seqta-example", - name: "SEQTA Example", - description: "Shows how to use the SEQTA API", - version: "1.0.0", - settings: {}, - disableToggle: true, - - run: async (api) => { - // Wait for elements to appear - const { unregister: timetableUnregister } = api.seqta.onMount( - ".timetable", - (timetable) => { - const button = document.createElement("button"); - button.textContent = "Export"; - timetable.appendChild(button); - }, - ); - - // Track page changes - const { unregister: pageUnregister } = api.seqta.onPageChange((page) => { - console.log("User went to:", page); - }); - - // Clean up when disabled - return () => { - timetableUnregister(); - pageUnregister(); - }; - }, -}; - -export default seqtaPlugin; -``` - -## Settings API - -Here's how to add settings to your plugin: - -```typescript -import type { Plugin } from "@/plugins/core/types"; -import { BasePlugin } from "@/plugins/core/settings"; -import { - booleanSetting, - stringSetting, - numberSetting, - selectSetting, - defineSettings, - Setting, -} from "@/plugins/core/settingsHelpers"; - -// Define your settings -const settings = defineSettings({ - darkMode: booleanSetting({ - default: false, - title: "Dark Mode", - description: "Enable dark mode", - }), - userName: stringSetting({ - default: "", - title: "User Name", - description: "Your display name", - placeholder: "Enter your name...", - }), - theme: selectSetting({ - default: "light", - title: "Theme", - description: "Choose your theme", - options: [ - { value: "light", label: "Light" }, - { value: "dark", label: "Dark" }, - ], - }), -}); - -// Create your settings class -class ThemePluginClass extends BasePlugin { - @Setting(settings.darkMode) - darkMode!: boolean; - - @Setting(settings.userName) - userName!: string; - - @Setting(settings.theme) - theme!: string; -} - -// Create the plugin -const themePlugin: Plugin = { - id: "theme-example", - name: "Theme Example", - description: "Shows how to use settings", - version: "1.0.0", - settings: new ThemePluginClass().settings, - disableToggle: true, - - run: async (api) => { - // Apply initial settings - if (api.settings.darkMode) { - document.body.classList.add("dark"); - } - - // Listen for changes - const { unregister } = api.settings.onChange("darkMode", (enabled) => { - document.body.classList.toggle("dark", enabled); - }); - - return () => { - unregister(); - document.body.classList.remove("dark"); - }; - }, -}; - -export default themePlugin; -``` - -## Storage API - -Here's how to use storage in your plugin: - -```typescript -import type { Plugin } from "@/plugins/core/types"; - -const storagePlugin: Plugin = { - id: "storage-example", - name: "Storage Example", - description: "Shows how to use storage", - version: "1.0.0", - settings: {}, - disableToggle: true, - - run: async (api) => { - // Wait for storage to be ready - await api.storage.loaded; - - // Save some data - await api.storage.set("lastVisit", new Date().toISOString()); - - // Get saved data - const lastVisit = await api.storage.get("lastVisit"); - console.log("Last visit:", lastVisit); - - // Listen for changes - const { unregister } = api.storage.onChange("lastVisit", (newValue) => { - console.log("Last visit updated:", newValue); - }); - - return () => { - unregister(); - }; - }, -}; - -export default storagePlugin; -``` - -## Events API - -Here's how to use events in your plugin: - -```typescript -import type { Plugin } from "@/plugins/core/types"; - -const eventsPlugin: Plugin = { - id: "events-example", - name: "Events Example", - description: "Shows how to use events", - version: "1.0.0", - settings: {}, - disableToggle: true, - - run: async (api) => { - // Listen for theme changes - const { unregister: themeListener } = api.events.on( - "theme.changed", - (theme) => { - console.log("Theme changed to:", theme); - }, - ); - - // Listen for notifications - const { unregister: notifyListener } = api.events.on( - "notification.new", - (notification) => { - console.log("New notification:", notification); - }, - ); - - // Clean up listeners - return () => { - themeListener(); - notifyListener(); - }; - }, -}; - -export default eventsPlugin; -``` - -## Performance Tips - -Here's how to write efficient plugins: - -```typescript -import type { Plugin } from "@/plugins/core/types"; - -const efficientPlugin: Plugin = { - id: "efficient-example", - name: "Efficient Example", - description: "Shows performance best practices", - version: "1.0.0", - settings: {}, - disableToggle: true, - - run: async (api) => { - // βœ… Good: Use onMount - const { unregister } = api.seqta.onMount(".timetable", (el) => { - el.classList.add("enhanced"); - }); - - // ❌ Bad: Don't use intervals - // const interval = setInterval(() => { - // const el = document.querySelector('.timetable'); - // if (el) el.classList.add('enhanced'); - // }, 100); - - // βœ… Good: Cache DOM elements - const header = document.querySelector(".header"); - if (header) { - // Reuse header instead of querying again - } - - // βœ… Good: Batch DOM updates - const fragment = document.createDocumentFragment(); - for (let i = 0; i < 10; i++) { - const div = document.createElement("div"); - fragment.appendChild(div); - } - document.body.appendChild(fragment); - - return () => { - unregister(); - // clearInterval(interval); // If you used the bad approach - }; - }, -}; - -export default efficientPlugin; -``` - -Each plugin should be in its own file and exported as the default export. The plugin should: - -1. Import necessary types and helpers -2. Define settings if needed -3. Create a settings class if using settings -4. Create the plugin object with proper type annotation -5. Export the plugin as default - -Remember to always: - -- Use proper TypeScript types -- Clean up when your plugin is disabled -- Handle errors gracefully -- Follow the plugin structure shown above diff --git a/lib/touchGlobalCSS.ts b/lib/touchGlobalCSS.ts deleted file mode 100644 index 0065a3f0..00000000 --- a/lib/touchGlobalCSS.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { Plugin } from "vite"; - -/** - * Previously touched CSS mtimes on JS HMR to force style refresh. - * That raced with CRXJS runtime reload and corrupted Vite's module graph - * (missing named/`default` exports until `npm run dev` was restarted). - * - * Style updates are now covered by `stabilizeCrxDevHmr` full reloads. - */ -export default function touchGlobalCSSPlugin(): Plugin { - return { - name: "touch-global-css", - apply: "serve", - }; -} diff --git a/src/background.ts b/src/background.ts index 93fe310a..fb86099a 100644 --- a/src/background.ts +++ b/src/background.ts @@ -183,7 +183,6 @@ function isTrustedSender(sender?: browser.Runtime.MessageSender): boolean { try { if (isSeqtaOrigin(new URL(pageUrl).origin)) return true; } catch { - // try next URL } } return false; @@ -335,7 +334,6 @@ function initCloudLoginCallbackListener() { const userId = url.searchParams.get("user_id"); if (token && refreshToken) { - // Store tokens void (async () => { try { await browser.storage.local.set({ @@ -343,7 +341,6 @@ function initCloudLoginCallbackListener() { bsplus_refresh_token: refreshToken, }); - // Fetch full user info const userRes = await fetch("https://accounts.betterseqta.org/api/auth/me", { headers: { Authorization: `Bearer ${token}` }, }); @@ -354,7 +351,6 @@ function initCloudLoginCallbackListener() { await browser.storage.local.set({ bsplus_user: { id: userId } }); } - // Trigger cloud settings download void performCloudSettingsDownloadWithRetry(token).catch((err) => { console.warn("[Background] Cloud settings download after login:", err); }); @@ -363,7 +359,6 @@ function initCloudLoginCallbackListener() { } })(); - // Close the callback tab void browser.tabs.remove(tabId); } } catch (err) { diff --git a/src/interface/components/CodeEditor.svelte b/src/interface/components/CodeEditor.svelte index d8e469e5..1097afa2 100644 --- a/src/interface/components/CodeEditor.svelte +++ b/src/interface/components/CodeEditor.svelte @@ -11,10 +11,8 @@ import { color } from '@uiw/codemirror-extensions-color' import { Compartment } from '@codemirror/state'; - // Theme import { githubLight, githubDark } from '@uiw/codemirror-theme-github'; - // Language import { css } from "@codemirror/lang-css"; let editor = $state(null) diff --git a/src/interface/components/HotkeyInput.svelte b/src/interface/components/HotkeyInput.svelte index 11465f1a..a6c7738f 100644 --- a/src/interface/components/HotkeyInput.svelte +++ b/src/interface/components/HotkeyInput.svelte @@ -33,7 +33,6 @@ }; const formatKeyForDisplay = (key: string): string => { - // Map keys to their display format const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0; const keyMap: Record = { 'ctrl': isMac ? 'βŒƒ' : 'Ctrl', @@ -70,7 +69,6 @@ if (parsed.alt) parts.push('alt'); if (parsed.shift) parts.push('shift'); - // Add the main key if (parsed.key) parts.push(parsed.key); return parts; @@ -92,7 +90,6 @@ return; } - // Build the hotkey string const modifiers: string[] = []; let mainKey = ''; @@ -131,7 +128,6 @@ const key = formatKeyForHotkey(e.key); - // Add modifiers if (e.ctrlKey) addRecordedKey('ctrl'); if (e.metaKey) addRecordedKey('cmd'); if (e.altKey) addRecordedKey('alt'); @@ -166,7 +162,6 @@ } }); - // Get the parts to display const hotkeyParts = $derived(isRecording ? Array.from(recordedKeys).map(formatKeyForDisplay) : getHotkeyParts(value).map(formatKeyForDisplay)); diff --git a/src/interface/components/store/Backgrounds.svelte b/src/interface/components/store/Backgrounds.svelte index 344bcfb1..80da352a 100644 --- a/src/interface/components/store/Backgrounds.svelte +++ b/src/interface/components/store/Backgrounds.svelte @@ -14,7 +14,6 @@ onCategoriesChange: (categories: string[]) => void; }>(); - // Existing states let backgrounds = $state([]); let error = $state(null); let selectedBackground = $state(null); @@ -22,11 +21,9 @@ let savedBackgrounds = $state([]); let installingBackgrounds = $state>(new Set()); let debugInfo = $state(''); - // New state variables let activeTab = $state<'all' | 'installed' | 'photos' | 'videos'>('all'); let sortBy = $state<'newest' | 'popular' | 'name'>('newest'); - // Existing functions const loadStore = async () => { try { debugInfo = 'Fetching backgrounds...'; @@ -60,10 +57,8 @@ } } - // Load data on mount loadStore(); - // Derived states let filteredBackgrounds = $derived((() => { let filtered = backgrounds; @@ -74,7 +69,6 @@ ); } - // Apply category filtering filtered = filtered.filter((bg: Background) => { return selectedCategory === 'All' ? true @@ -83,7 +77,6 @@ : bg.category === selectedCategory; }); - // Apply sorting filtered.sort((a: Background, b: Background) => { switch (sortBy) { case 'name': @@ -101,7 +94,6 @@ })()); let categories = $derived([...new Set(backgrounds.map(bg => bg.category))]); - // Background management functions async function saveBackgroundFromUrl(url: string, id: string, fileType: string): Promise { try { if (!isIndexedDBSupported()) { diff --git a/src/interface/hooks/BackgroundUpdates.ts b/src/interface/hooks/BackgroundUpdates.ts index 7710a7c3..892695ae 100644 --- a/src/interface/hooks/BackgroundUpdates.ts +++ b/src/interface/hooks/BackgroundUpdates.ts @@ -1,40 +1,3 @@ -type BackgroundUpdateCallback = () => void; +import { createUpdateSignal } from "./updateSignal"; -/** - * A singleton class used to notify listeners about generic background updates or events. - * These updates typically signify that UI components or other parts of the application - * might need to refresh or re-evaluate background-related data (e.g., after a new background - * image is added, removed, or changed). - */ -class BackgroundUpdates { - private static instance: BackgroundUpdates; - private listeners: Set = new Set(); - - private constructor() {} - - public static getInstance(): BackgroundUpdates { - if (!BackgroundUpdates.instance) { - BackgroundUpdates.instance = new BackgroundUpdates(); - } - return BackgroundUpdates.instance; - } - - public addListener(callback: BackgroundUpdateCallback): void { - this.listeners.add(callback); - } - - public removeListener(callback: BackgroundUpdateCallback): void { - this.listeners.delete(callback); - } - - /** - * Invokes all registered listener callbacks, signifying that a background update has occurred. - * This method should be called whenever a change to background data happens that requires - * other parts of the application to be notified. - */ - public triggerUpdate(): void { - this.listeners.forEach((callback) => callback()); - } -} - -export const backgroundUpdates = BackgroundUpdates.getInstance(); +export const backgroundUpdates = createUpdateSignal(); diff --git a/src/interface/hooks/ThemeUpdates.ts b/src/interface/hooks/ThemeUpdates.ts index b6c60461..b74c9ded 100644 --- a/src/interface/hooks/ThemeUpdates.ts +++ b/src/interface/hooks/ThemeUpdates.ts @@ -1,40 +1,3 @@ -type ThemeUpdateCallback = () => void; +import { createUpdateSignal } from "./updateSignal"; -/** - * A singleton class used to notify listeners about theme-related updates. - * These updates can include events like theme changes, custom theme modifications, - * or any other event that might require UI components to refresh their appearance - * or re-apply theme styles. - */ -class ThemeUpdates { - private static instance: ThemeUpdates; - private listeners: Set = new Set(); - - private constructor() {} - - public static getInstance(): ThemeUpdates { - if (!ThemeUpdates.instance) { - ThemeUpdates.instance = new ThemeUpdates(); - } - return ThemeUpdates.instance; - } - - public addListener(callback: ThemeUpdateCallback): void { - this.listeners.add(callback); - } - - public removeListener(callback: ThemeUpdateCallback): void { - this.listeners.delete(callback); - } - - /** - * Invokes all registered listener callbacks, signifying that a theme-related update has occurred. - * This method should be called whenever a change related to themes happens that requires - * other parts of the application to be notified. - */ - public triggerUpdate(): void { - this.listeners.forEach((callback) => callback()); - } -} - -export const themeUpdates = ThemeUpdates.getInstance(); +export const themeUpdates = createUpdateSignal(); diff --git a/src/interface/hooks/updateSignal.ts b/src/interface/hooks/updateSignal.ts new file mode 100644 index 00000000..cc040c36 --- /dev/null +++ b/src/interface/hooks/updateSignal.ts @@ -0,0 +1,8 @@ +export function createUpdateSignal() { + const listeners = new Set<() => void>(); + return { + addListener: (callback: () => void) => void listeners.add(callback), + removeListener: (callback: () => void) => void listeners.delete(callback), + triggerUpdate: () => listeners.forEach((callback) => callback()), + }; +} diff --git a/src/interface/pages/settings/theme.svelte b/src/interface/pages/settings/theme.svelte index b7ee799d..55d32fc8 100644 --- a/src/interface/pages/settings/theme.svelte +++ b/src/interface/pages/settings/theme.svelte @@ -8,7 +8,6 @@ section?: "all" | "themes" | "backgrounds"; }>(); - // backgrounds let selectedBackground = $state(null); let selectNoBackground = $state<() => void>(() => { }); diff --git a/src/interface/pages/store.svelte b/src/interface/pages/store.svelte index b3d80f82..78f902ca 100644 --- a/src/interface/pages/store.svelte +++ b/src/interface/pages/store.svelte @@ -1,7 +1,6 @@