Compare commits

...
Author SHA1 Message Date
Aden Lindsay e2a37b3ed3 Merge pull request #465 from StroepWafel/fix-external-video-loading
fix(ext video): Fix loading of external video by internalising
2026-10-29 12:52:15 +10:30
AdenMGB 3224f64875 chore: update vid 2026-10-29 12:49:46 +10:30
SethBurkart123 0090368707 feat: new version 2026-10-29 12:10:28 +11:00
SethBurkart123 767c3b9e98 fix(sidebar): Strip rows span the full sidebar width 2026-10-29 11:48:21 +11:00
SethBurkart123 b55415c93b refactor(ui): shared SettingsCard and Button variants, pill dropdowns, consistent sidebar text sizes, tidy classmate sharing 2026-10-29 11:29:20 +11:00
SethBurkart123 38f934c01f fix(ui): shared Button states, Theme of the Month inside its card, reuse Button for Generate QR 2026-10-29 11:03:46 +11:00
SethBurkart123 0f9b8efc40 refactor(ui): merge Downloaded/Custom themes into My themes; space folder button like siblings 2026-10-29 10:59:45 +11:00
SethBurkart123 9bfc0989c1 fix(ui): dedupe custom theme buttons, background list spacing, folder icon colour 2026-10-29 10:59:45 +11:00
SethBurkart123 a967e2c2fb fix: only show terms of service popup once signed in to Cloud 2026-10-29 10:59:45 +11:00
AdenMGB 74fdd079dd Merge branch 'main' of https://github.com/BetterSEQTA/BetterSEQTA-Plus 2026-10-29 09:55:25 +10:30
AdenMGB 29c31a2a22 chore: update changelog 2026-10-29 09:55:14 +10:30
SethBurkart123 0e3297636d fix: raise themeCreator sticky footer above popups (z-50) 2026-10-29 10:24:52 +11:00
SethBurkart123 d3fc4b0afd fix: sidebar glass and compact rail polish
- Compact (icon-only) rail tiles stay rounded for strip/sharp style
  presets; they follow --bsplus-sidebar-radius like the folder arcs
  (pill keeps its capsule)
- Glass style now fills closed folder rows (no backdrop-filter, which
  breaks the drill .sub clip on Chromium/Edge); open folders remain
  transparent
- Glass rows use 4px top/bottom margins so the first row no longer
  hugs the menu top and drill panel headers (8px rhythm preserved)
2026-10-29 10:24:52 +11:00
SethBurkart123 4d8445d7da fix(css): center .addedButton icons with real flex layout
The button had "justify-content: center" without display: flex, so it was
inert and the svg sat in inline flow; 24px svg + 6px margins + 6px padding
(48px) also could never fit the 35px button, letting the icon spill
asymmetrically. Center properly with flex, drop the dead padding and svg
margins, and blockify the svg (also fixes the sun icon off-centering).
2026-10-29 10:24:52 +11:00
SethBurkart123 29bdb0064d fix(whatsnew): group each release in a section so sticky headers stop overlapping
All changelog h1 headers pinned to top: 0 inside the whole scroll container and
never unstuck, so a shorter title painted over a taller neighbour and its
lower lines peeked out underneath. Confining each sticky header to its own
<section class="whatsnewRelease"> makes the next release push the previous
header away cleanly, no matter each title's height.
2026-10-29 10:24:52 +11:00
AdenMGB efa4f8b85c feat: fix TOS look and make correct API 2026-10-29 09:54:19 +10:30
AdenMGB fea017bbd7 feat: add TOS popup and new update vid 2026-10-29 09:44:12 +10:30
AdenMGB 95908baa8e feat: minor fixes 2026-10-23 10:14:26 +10:30
Aden Lindsay 6868964366 Merge pull request #494 from BetterSEQTA/sync-test
TimeTable P2P Sync Test Idea
2026-10-22 16:27:46 +10:30
Aden Lindsay 4943d441e1 Merge branch 'main' into sync-test 2026-10-22 16:27:22 +10:30
AdenMGB fb80457bd3 chore: appease code factor 2026-10-22 16:24:08 +10:30
AdenMGB 4e6978d860 chore: fix merge conflicts 2026-10-22 16:22:30 +10:30
AdenMGB db69e902ca chore: update changelogs 2026-10-22 16:20:26 +10:30
AdenMGB 9e16eaa543 feat: improve and add timetable pill to sync with friends 2026-10-22 16:18:55 +10:30
AdenMGB 8165b431e5 fix: fix dark mode in cloud/qr code modals 2026-10-14 12:32:48 +10:30
AdenMGB e3581bc940 fix: fix scrolling issues 2026-10-14 12:00:43 +10:30
SethBurkart123 47077f77d7 fix: isolate shadow gradient variables from host styles 2026-10-06 11:58:08 +11:00
SethBurkart123 e78a03c4ad fix: improve grade analytics states and accessibility 2026-10-06 11:58:07 +11:00
SethBurkart123 776c1e98d9 feat: add compact expandable settings popup 2026-10-06 11:58:07 +11:00
SethBurkart123 bd29ab62c6 feat: keep icon sidebar rail visible during folder navigation 2026-10-06 11:58:07 +11:00
SethBurkart123 5928414a1e fix: persist master switch before reloading tabs 2026-10-06 11:58:06 +11:00
SethBurkart123 d97cc86ab3 fix: make startup notices dismiss consistently 2026-10-06 11:58:06 +11:00
SethBurkart123 4d9b17df37 fix: address release regressions in startup, analytics and sync 2026-09-30 22:39:46 +10:00
AdenMGBandCursor eb2bdbec2f fix: remove stale SettingsClicked import after settings popup fix
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 19:48:10 +09:30
AdenMGBandCursor 5623c12904 fix: settings popup reopen race after async open
Use DOM visibility and an open generation counter so in-flight opens cannot leave stale state after close, and dedupe opens per generation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 19:47:57 +09:30
AdenMGB b3b3763fc8 fix: minor fixes 2026-09-30 19:46:27 +09:30
AdenMGB 7eac66b2b0 feat: test timetable syncing 2026-09-30 19:39:14 +09:30
AdenMGB 242e4f3ff8 feat: optimise recent changes 2026-09-29 16:13:47 +09:30
AdenMGB 1ba5f1ef49 feat: sync assement due dates to calendar 2026-09-29 16:04:18 +09:30
AdenMGB 56571b7597 fix: fix duplictae previews in theme builder 2026-09-29 15:50:05 +09:30
AdenMGB 80287caacb feat: combining subjects, percentage bands and advanced analytics custoisation 2026-09-29 15:43:49 +09:30
AdenMGB 6f4728aa18 fix: fix not being able to switch tabs for community themes 2026-09-29 15:34:52 +09:30
AdenMGB 9d8f0613cb fix: fix the empty state for community themes 2026-09-29 15:31:37 +09:30
Aden Lindsay aaf03129a5 Merge pull request #476 from StroepWafel/better-looking-theme-tab
User-generated themes support
2026-09-29 11:03:43 +09:30
AdenMGBandCursor 7bc4c55619 fix(test): mock DevApiBase in feedback client tests for Jest ESM
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-29 10:54:35 +09:30
AdenMGB e11358d728 feat: polish, enhance, cleanup and finilse theme builder for community themes 2026-09-29 10:49:49 +09:30
AdenMGBandCursor 80a1f7a7ba Merge main into better-looking-theme-tab and trim PR scope
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-29 09:02:47 +09:30
AdenMGB ef781a78ff fix: fix 404 on everypage 2026-09-29 08:56:40 +09:30
Aden Lindsay d4cd2affe2 Merge pull request #482 from StroepWafel/patch-5
Update nightly.yml
2026-09-07 16:57:52 +09:30
Aden Lindsay c1151cf501 Merge pull request #488 from StroepWafel/patch-6
Update jest.setup.ts
2026-09-07 16:45:12 +09:30
StroepWafel 74bdf3b07d Update jest.setup.ts 2026-09-07 16:40:44 +09:30
AdenMGB 6d33ef88aa chore: squash down to 3.7.3 2026-09-07 10:39:10 +09:30
AdenMGB 7a8a3cb70e fix: remove svelte sidebar but keep customisations 2026-09-07 10:28:11 +09:30
AdenMGB 2c0642f418 emerg: critical fix in course and assessments @SethBurkart123 2026-09-03 14:22:56 +09:30
AdenMGB 4fbb75ac3f feat: update update videos 2026-09-03 13:16:37 +09:30
AdenMGB c150e79e1c feat: combining classes for analyitics and some other chores 2026-09-03 11:56:21 +09:30
AdenMGB a19b43ef37 chore: cleanup and optmise size 2026-09-03 10:43:44 +09:30
AdenMGB 5dba4ba8b5 feat: performance mode AND fix background image bug. 2026-09-03 10:36:04 +09:30
Aden Lindsay d9c0fee06d Merge pull request #484 from StroepWafel/courses-stuck-fix
UI watcher for courses
2026-09-02 15:14:07 +09:30
StroepWafel b8a9721f1f UI watcher 2026-09-02 14:41:35 +09:30
SethBurkart123 a760a152dc perf: reduce extension package size 2026-09-02 11:38:37 +10:00
Alphons Joseph 72cce2cc55 Merge pull request #483 from StroepWafel/fix-failing-tests-due-to-jsdom
Fix failing tests due to jsdom
2026-09-01 20:14:48 +08:00
StroepWafel da6a0f2ad3 revert changes from lockheed 2026-09-01 21:39:50 +09:30
StroepWafel 6523238eed Configure Jest environment for stringToHTML tests
Added Jest environment setup for testing.
2026-09-01 21:39:07 +09:30
StroepWafel 1f0163b775 Update nightly.yml 2026-09-01 21:23:12 +09:30
AdenMGB d35ee91d90 chore: update whats new 2026-09-01 18:15:49 +09:30
AdenMGB 545069aa88 feat: tweaks to working 2026-09-01 18:08:41 +09:30
AdenMGB 9dfe38a483 feat: pull in tags from accounts 2026-09-01 18:07:43 +09:30
Alphons Joseph 364db59d17 fix: also change teacher names on lessons with assessments 2026-09-01 16:07:23 +08:00
Alphons Joseph 06777702fa fix: course and assessment buttons not working due to deleted handler 2026-09-01 15:55:26 +08:00
Alphons Joseph 8df7edcb75 fix: regression caused by security hardening causing clickable icons to not work. 2026-09-01 15:39:19 +08:00
SethBurkart123 9f80ba11f1 fix: stabilize custom sidebar active state 2026-08-27 09:39:56 +10:00
StroepWafel b064f2df8f fix(customthemessettings): box order 2026-08-26 21:32:32 +09:30
StroepWafel dc3b77f82b fix(settings): issues with new themes systems 2026-08-26 21:11:53 +09:30
StroepWafel d980c01c81 add custom user themes! 2026-08-26 20:41:51 +09:30
StroepWafel 1ce95f64e9 feat(themes): various UI/UX tweaks 2026-08-26 18:01:16 +09:30
StroepWafel 95acfc139d feat(themes): theme layout and rearrangements 2026-08-26 17:29:53 +09:30
AdenMGB 8ccddc1ae0 feat: search bar in settings & update changelog 2026-08-26 17:24:55 +09:30
AdenMGB de75cb4666 chore: code cleanup & optimisation 2026-08-26 17:01:41 +09:30
AdenMGB e1408fe35d fix: fix animations on analyitics page when setting disabled (#474) 2026-08-26 16:55:14 +09:30
AdenMGB a93c3ccda7 feat: light mode variations for the loading screen 2026-08-26 16:47:41 +09:30
SethBurkart123 7685df564d Merge colour picker dark mode fix 2026-08-26 11:46:40 +10:00
SethBurkart123 57a80d6b54 fix: restore colour picker dark mode styles 2026-08-26 11:43:33 +10:00
AdenMGB 3c90498e4d chore: update changelog 2026-08-26 11:05:07 +09:30
AdenMGB 4f10930f24 fix: fix login issue and improve google caledar flow 2026-08-24 14:25:41 +09:30
AdenMGB dde5096d1c fix: fix sidebar animation weirdness in sidebar folders 2026-08-24 14:04:08 +09:30
AdenMGB a411d646ae fix: fix minor bug 404 every page lmao) 2026-08-24 13:33:52 +09:30
AdenMGB 6688a53acc feat: cleanup and improve detection delay on kitten plugin 2026-08-24 13:29:02 +09:30
Aden Lindsay d47658ed59 Merge pull request #473 from Jaxx7594/bring-back-the-cat
feat(bring back the cat!): Brings back the legacy 404 page
2026-08-24 13:13:58 +09:30
Jaxon Lewis-Wilson a8fe3e57f1 feat(bring back the cat!): Brings back the legacy 404 page, kitten and all. Perfect replica 2026-08-23 23:11:14 +08:00
Aden Lindsay d4ff9d2567 fix(AssessmentAverage): Collect 'Feedback Released' assessment weights (#472) 2026-08-23 08:01:35 +09:30
Jaxon Lewis-Wilson 8e453d3877 fix(AssessmentAverage): Collect 'Feedback Released' assessment weights 2026-08-22 23:54:59 +08:00
StroepWafel b7ee5a54da Export timezone and enhance date logging (#471)
Updated timezone variable export and improved logging format.
2026-08-22 15:24:37 +09:30
AdenMGB 12833f9270 feat: some nice animations for settings areas missing it & fix update video 2026-08-21 17:38:11 +09:30
AdenMGB f0247428a0 fix: fix fat thumb 2026-08-21 09:45:13 +09:30
AdenMGB f35b715f4e fix: update update video compress later 2026-08-21 09:44:23 +09:30
AdenMGB 574de5ccbf feat: add this year option, custom time range and adjust layout of analyitics for #468 2026-08-20 12:00:42 +09:30
AdenMGB 0333f24a60 chore: update changelog 2026-08-20 11:52:50 +09:30
AdenMGB 5d9821a642 fix: fix arrows not removing from courses body 2026-08-20 11:51:27 +09:30
AdenMGB b830f53069 feat: background resuming for calendar syncing 2026-08-20 08:22:41 +09:30
SethBurkart123 eaf89d3f12 fix: prevent extension freezes and stale builds 2026-08-19 18:30:36 +10:00
AdenMGB 653b1d23c2 fix: fix update vid url 2026-08-19 17:50:15 +09:30
AdenMGB c2ddd67021 feat: final fixes and chores 2026-08-19 17:44:53 +09:30
AdenMGB 835620fd67 feat: fixes and improvements to app store icons plugins 2026-08-19 12:25:42 +09:30
s3ntricall 3b41fef253 fix: unthemed app icons in SEQTA settings page (#469)
* ork

ork

* add appicons plugin.ork

* Add files via upload
2026-08-19 12:14:20 +09:30
AdenMGB 07b29c8d31 feat: add performant webgl loading screens 2026-08-18 18:47:12 +09:30
SethBurkart123 ddbccecda2 feat: refine settings, stores, and message folders 2026-08-04 11:05:51 +10:00
AdenMGB defaf76144 fix: fix feedback looks 2026-07-27 13:37:06 +09:30
AdenMGB d5882e2d66 feat: final bug fixes 2026-07-26 16:31:06 +09:30
AdenMGB 318000009f feat: extension feedback built in 2026-07-26 15:58:03 +09:30
AdenMGB fe7127a83c chore: changelog 2026-07-26 11:33:18 +09:30
AdenMGB c5ab69ba82 feat: sidebar customisaitons and settings fixes 2026-07-26 11:32:04 +09:30
AdenMGB 88926aaee7 feat: ensure engage works withh changes 2026-07-24 10:11:18 +09:30
AdenMGB 928f05ec8e feat: new settings popup 2026-07-24 10:08:03 +09:30
AdenMGB b5347e2732 feat: minor fixes before update 2026-07-24 09:32:00 +09:30
AdenMGB f926127687 feat: fix github remote url 2026-07-22 08:29:10 +09:30
AdenMGB 17e077d531 feat: compress and use new update video 2026-07-22 08:25:50 +09:30
AdenMGB 87c320a1aa feat: update video plus colour syncing 2026-07-21 09:45:49 +09:30
AdenMGB e732011f1e feat: sidebar cleanup + fixes 2026-07-21 09:20:53 +09:30
AdenMGB c439d8d88f fix: fix builds not lazy loadin 2026-07-20 16:38:16 +09:30
AdenMGB c231a00db3 feat: replace sidebar with svelte alternative 2026-07-20 16:33:23 +09:30
StroepWafel 344458cc6f Merge branch 'main' into fix-external-video-loading 2026-07-20 14:26:17 +09:30
AdenMGB 824cedca2f feat: optimisations 2026-07-19 18:08:52 +09:30
Aden Lindsay 10db972ef4 Merge pull request #458 from StroepWafel/various-bugfixes
Various bugfixes
2026-07-19 09:49:26 +09:30
AdenMGB a48d71ddd8 feat: final fixes and improvements 2026-07-19 09:44:11 +09:30
AdenMGB cf6e797510 fix: fix dev command not loading assets and scripts + fix assement averages 2026-07-19 09:34:59 +09:30
AdenMGBandCursor c015c8a162 fix: restore verboseLog/parseCssColor after main merge and bump glob
CI merge with main dropped verboseInfo/parseCssColor exports and broke the Vite build. Restore the PR logger and colour helpers, reinstate the Jest color mock map, and update glob to v13 with overrides.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 09:09:40 +09:30
AdenMGB 3ef1add585 Merge remote-tracking branch 'origin/main' into various-bugfixes 2026-07-19 09:03:50 +09:30
AdenMGBandCursor 3bac45032d refactor: further trim PR #458 debloat across patches, notices, Select, music, archive, search
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 08:58:31 +09:30
AdenMGB b1fb8e8f10 fix: fix minor bugs 2026-07-13 16:30:08 +09:30
AdenMGB fdf941b968 feat: implement proper remote event checking for sync 2026-07-13 16:03:27 +09:30
AdenMGB 34c536c2d8 fix: tweak the oauth scope to be a little bit better 2026-07-02 14:50:34 +09:30
Aden Lindsay ef9d7cf7f8 Merge pull request #467 from Jones8683/main
Readme polish & cleanup
2026-06-29 18:55:42 +09:30
Jones Jankovic 27c8c3c24f feat: remove stray footnote and simplify vulnerability reporting instructions 2026-06-29 14:09:35 +09:30
Jones Jankovic b2187f4c61 feat: update second webstore link to modern format 2026-06-29 13:58:59 +09:30
Jones Jankovic 1c3d1b745e feat: generalise seqta naming and update link 2026-06-29 13:56:48 +09:30
Jones Jankovic 2697b92981 feat: polish and cleanup readme 2026-06-29 13:45:20 +09:30
Jones Jankovic 5502f07721 fix: remove duplicate credits 2026-06-29 13:36:44 +09:30
AdenMGBandCursor 4fda63dedd refactor: trim PR debloat and fix transformers build
Extract shared helpers for home notices, timetable subtitles, and theme images; dedupe global search, Select, and build scripts while preserving behaviour.

Add @huggingface/transformers as a direct dependency and resolve ORT WASM paths via require.resolve so pnpm postinstall and Vite can bundle vector search.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 10:30:25 +09:30
SethBurkart123 7779edb063 refactor: consolidate and debloat calendar sync implementation
Merge duplicated Google/Outlook engines, background handlers, and API
layers into shared calendarSync modules to cut complexity without changing
user-facing sync behavior.
2026-06-28 10:45:45 +10:00
AdenMGB f4230e02b9 feat: tweak calendar syncing for final release 2026-06-28 09:52:17 +09:30
StroepWafel dcb4dd2f5e fix(build): commas in wrong place 2026-06-27 15:53:41 +09:30
StroepWafel 6c9bec4a99 Merge branch 'main' into various-bugfixes 2026-06-27 15:42:51 +09:30
StroepWafel 6518999ac5 fix(global Search): duped indexes 2026-06-27 15:38:53 +09:30
Aden Lindsay 01223c466e Merge pull request #466 from BetterSEQTA/calendar-syncing
Calendar syncing
2026-06-27 15:33:35 +09:30
AdenMGB 95da84ff16 fix: appease the ci godas 2026-06-27 15:31:12 +09:30
StroepWafel bdb1911e74 feat(CI): modular testing and linting system + cursor rule 2026-06-27 15:20:52 +09:30
StroepWafel 3213d0ca28 fix(global search): CSS preload killed plugin load 2026-06-27 15:10:24 +09:30
AdenMGB d34333ca38 feat: support outlook for calendar plus minor fixes 2026-06-27 15:07:10 +09:30
AdenMGB 2163f06de9 tweak: update rolling perofrmance 2026-06-27 14:24:08 +09:30
AdenMGB eae2e0587c feat: tweak calendar and clean it up 2026-06-27 14:19:28 +09:30
AdenMGBandCursor fe1c2f0250 fix: add missing parseCssColor and verboseLog modules for calendar sync build
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 12:03:56 +09:30
AdenMGBandCursor e6b8be6821 feat: add Google Calendar timetable sync via accounts OAuth
OAuth flows through accounts.betterseqta.org with token exchange server-side. Sync runs in the content script to avoid MV3 service worker timeouts. Adds Svelte calendar sync UI on the timetable page, extension asset URL helper, and excludes calendar tokens from cloud sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 11:51:48 +09:30
Aden Lindsay bd13042fe4 Merge pull request #464 from AdoLovesChicken/gradeSliderRange-input
feat(GradeRangeSlider): add typeable min/max inputs
2026-06-27 07:39:33 +09:30
StroepWafel 1045d38f47 fix(test): Wrong runner import 2026-06-26 22:27:46 +09:30
StroepWafel 9a9eb91a2d fix(BGImages): BG images wouldn't load on either browser 2026-06-26 22:20:20 +09:30
StroepWafel 2135349038 fix(filesize): use an iframe 2026-06-26 22:01:33 +09:30
AdenMGB b4aca7277b fix: fix RGBA issue 2026-06-26 21:38:54 +09:30
AdenMGB e0ee41c270 fix: fix igdb issues at times 2026-06-26 21:38:54 +09:30
StroepWafel e10c5fe2c4 fix(actions): workflow files get passed correct GH token 2026-06-26 21:24:09 +09:30
StroepWafel 06be15b0ef fix(content): make size smaller 2026-06-26 21:21:25 +09:30
AdoLovesChicken 174f47f8c2 feat(GradeRangeSlider): add typeable min/max inputs
- Add inputs alongside the slider so values can be
  typed directly, not just dragged
- Clamp typed/dragged values to [min, max]
- Animate the slider with a sine ease when a value is typed,
  keeping the drag unanimated
- Meet min/max values instead of letting fields swap mid-keystroke
- Combine min/max handlers into one `onInput` function
2026-06-26 20:59:33 +10:00
AdenMGBandCursor 006589ca76 chore: merge main and release 3.7.3 bugfix bundle
Resolve conflicts with deep-reform (PR #452) while keeping bugfix branch
changes: sidebar visibility, verbose logging, device login name, and
notification archive. Bump to 3.7.3 with What's New release notes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 20:12:58 +09:30
AdenMGBandCursor abcbca3745 fix: restore theme edit label and add Select keyboard a11y
Restore the theme settings toggle copy to Edit/Done and add listbox keyboard navigation with aria-activedescendant for the custom Select.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 20:02:29 +09:30
Aden Lindsay c368d89295 Merge pull request #452 from BetterSEQTA/deep-reform
fix: harden extension security and plugin reliability
2026-06-26 19:46:56 +09:30
AdenMGB ca4cbea0f0 chore: reduce complexity 2026-06-26 19:41:27 +09:30
StroepWafel 13f974d652 fix(ext video): Fix loading of external video by internalising 2026-06-26 19:12:18 +09:30
StroepWafel 75c65b1d5e fix(theme):sun/moon icons 2026-06-26 16:31:19 +09:30
StroepWafel c02388750c fix(upcoming assessments): max assessments option 2026-06-26 16:18:20 +09:30
StroepWafel e400890eee fix(accounts): login with account give device name 2026-06-25 19:32:53 +09:30
StroepWafel 969c3bbdd5 fix(cloud PFP): button placement 2026-06-25 19:01:00 +09:30
StroepWafel 670f9d73f3 fix(cloud PFP): Not pulling from cloud on page load 2026-06-25 18:36:57 +09:30
Aden Lindsay fc124e71ed Merge pull request #461 from AdoLovesChicken/fontpicker-option-font
feat: each font option in the font picker uses its own font
2026-06-25 08:42:53 +09:30
AdoLovesChicken a409dc3f20 feat(FontPickerModal): each font option uses own font 2026-06-24 20:35:32 +10:00
StroepWafel c9b9ad250e sun vs moon 2026-06-23 14:25:47 +09:30
StroepWafel 74a6ae5108 fix zipping 2026-06-23 09:38:22 +09:30
StroepWafel 6b6a383159 CI uploads artifacts 2026-06-23 09:24:23 +09:30
StroepWafel 410c953933 Fix CI errors 2026-06-23 09:20:42 +09:30
StroepWafel 5df9169705 fix(sidebar): analytics not showing when disabled 2026-06-22 23:10:49 +09:30
StroepWafel fadc06aa27 fix(plugins): music/BG after reload 2026-06-22 22:26:20 +09:30
StroepWafel a106033b87 fix(home): notices via labels API 2026-06-22 22:23:56 +09:30
StroepWafel d99198ea12 fix(GH): nightly release workflow issues 2026-06-22 22:14:47 +09:30
StroepWafel 79d68c812c feat(notifications): local per-user archive 2026-06-22 21:54:32 +09:30
StroepWafel 37ae32be59 fix(assessments): show letter grades not undefined%
cannot triple confirm that this works for all schools but it works for my assessments that are letter-based
2026-06-22 21:47:03 +09:30
StroepWafel 6f7788497a fix(home): show all active subjects in upcoming assessments
Use shared active-subject helpers from assessments overview instead of
the first folder with an active flag and code-only filtering.
2026-06-22 21:22:19 +09:30
StroepWafel 4b7aa8da75 fix(themes): theme wallpapers dont apply on firefox 2026-06-22 21:08:12 +09:30
StroepWafel 2be27299a5 fix(timetable): reopen colour picker
+ some quick fixes to dropdowns again
2026-06-22 20:19:17 +09:30
StroepWafel fadbca5969 refactor(sidebar): analytics start below courses 2026-06-22 18:09:28 +09:30
StroepWafel f570e47e27 fix(sidebar): hide Analytics via toggle 2026-06-22 18:02:24 +09:30
StroepWafel e3ec6c80d0 fix(ui): improve select dropdown contrast 2026-06-22 15:49:21 +09:30
SethBurkart123 ecc89e864c chore: bump version to 3.7.2 and update changelog 2026-06-19 15:00:29 +10:00
AdenMGB a3bdb0fe09 fix: fix assement overview 2026-06-17 18:52:35 +09:30
AdenMGB 5d8cb55b94 fix: fix settings not scrolling all the way 2026-06-17 18:12:03 +09:30
AdenMGBandCursor d10fca6c0f perf: reduce startup work and fix grade analytics bar chart animation
Batch settings storage writes, tier plugin startup, lazy-load heavy UI
chunks, and optimize global search indexing. Stop tweening bar height in
grade analytics to prevent invalid negative SVG rect values.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:33:30 +09:30
AdenMGBandCursor 62ed702e64 fix: escape backslashes in PDF script injection strings
Resolve CodeQL incomplete string escaping alerts by centralizing escJsSingleQuoted for all values embedded in injected script content.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:06:17 +09:30
AdenMGB 8a5424c5a4 fix: harden extension security and plugin reliability
Address audit findings across background handlers, openers,
plugins, and UI: URL allowlists, XSS reductions, popup lifecycle
fixes, plugin dispose/cleanup, cloud sync hardening, global search
mathjs sandbox, and settings storage fixes.
2026-06-17 10:52:43 +09:30
AdenMGB 0e696e0175 fix: add safer dom for analytics 2026-06-17 10:09:21 +09:30
AdenMGB b8709f6391 fix: fix analytics page breaking built @sethBurkart123 2026-06-16 17:29:30 +09:30
SethBurkart123 20a4078f60 feat: update update image 2026-06-16 17:37:09 +10:00
AdenMGB ce3468e2ab chore: update image for new layout 2026-06-16 16:56:32 +09:30
AdenMGB b3a4182a52 fix: allow hovering tooltip for forcast analyitics 2026-06-16 16:53:34 +09:30
SethBurkart123 7d18b2483f Remove the one-time SEQTA Engage support startup toast. 2026-06-16 16:25:33 +10:00
SethBurkart123 9bfd1bbf0e Improve grade analytics layout, controls, and forecast chart rendering.
Move filters into a left sidebar, tighten spacing, match homepage checkboxes, fix forecast line domain/looping, and remove the redundant page subtitle. Also fix crxjs dev service worker live reload after Vite upgrade.
2026-06-16 14:32:29 +10:00
SethBurkart123 feaf4dced5 Fix crxjs dev service worker crashes after Vite upgrade.
Downgrade to Vite 6 with crxjs 2.6, add dev-only CSP for HMR, and stop the background script from importing Svelte plugin UI into the service worker.
2026-06-16 12:45:56 +10:00
Seth Burkart 5c195f1148 Merge pull request #451 from StroepWafel/fixcloudsync
all settings sync
2026-06-15 10:55:38 +10:00
SethBurkart123 70ccf89756 Merge origin/main into fixcloudsync
Resolve grade analytics conflicts by keeping grade forecast UI from main
and combining layout fixes from both branches.
2026-06-15 10:38:17 +10:00
AdenMGB 62a3d56bed feat: grade forecast 2026-06-13 21:22:50 +09:30
AdenMGB 14a322a128 fix: fix analyitics page for @SethBurkart123 2026-06-13 19:36:04 +09:30
AdenMGBandCursor 160407dde6 Merge origin/main and combine changelog updates in OpenWhatsNewPopup.
EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-13 19:27:06 +09:30
AdenMGB c024fa1e5d chore: stuff 2026-06-13 19:25:18 +09:30
StroepWafel 57a1965a6d add aden's requested changes 2026-06-10 11:00:09 +09:30
StroepWafel ec94376e1f nightly build 2026-06-10 01:25:51 +09:30
StroepWafel 9166bebef7 all settings sync 2026-06-10 01:17:13 +09:30
Aden Lindsay c9672b4d85 Merge pull request #450 from Jaxx7594/assessmentsAverage-reindex
feat(assessmentsAverage): fingerprint-based reindex to harden against changed weightings
2026-06-09 10:28:03 +09:30
Seth Burkart 7a867ec8f4 Merge pull request #447 from StroepWafel/Popout-TOTM
super clean popout for TOTM + PFP caching
2026-06-08 17:33:21 +10:00
Jaxx7594 ad67903b2d chore: Add weighting fingerprint reindexing to changelog 2026-06-07 23:25:26 +08:00
Jaxx7594 8b470d6817 feat(assessmentsAverage): fingerprint-based reindex with non-blocking refresh
- Add WEIGHTING_SCHEMA_VERSION constant; bump to force a global lazy reindex
 - Migrate legacy Record<id, string> storage to { weight, fingerprint, pluginVersion }
 - Fingerprint per-assessment on status, graded, availability, score, due, title (sourced from the React fiber)
 - Refetch weighting only when fingerprint or schema version mismatches
 - Preserve previous weight as refreshing placeholder during background refetch
 - Render subject average immediately from cache; run parseAssessments off the critical path
 - Coalesce concurrent renderSubjectAverage calls instead of dropping them
 - Dispatch betterseqta:weightingsChanged on refetch start and completion
 - Show row-level refresh indicator and "Refreshing weightings" notice while refreshing
 - Leave weightingOverrides untouched by all reindex paths
2026-06-07 23:14:15 +08:00
Aden Lindsay 6ab1f8a6a4 Merge pull request #449 from Jaxx7594/courses-better-navigation 2026-06-07 08:12:45 +09:30
Jaxx7594 984719ce28 feat: Improved navigation in courses (via a plugin)
What it does:
 - Makes the course navigator focused on the currently selected lesson instead of the top upon opening
 - Adds arrows to the course page, to allow for easier navigation.
2026-06-06 23:12:30 +08:00
Seth Burkart f75d2566dd Merge pull request #448 from StroepWafel/Releases-Updater-forsideload
release build and other CI
2026-06-06 19:29:04 +10:00
StroepWafel 3f1910f610 release build and other CI 2026-06-05 16:58:11 +09:30
AdenMGB b535e87023 chore: update changelog 2026-06-05 10:00:38 +09:30
AdenMGB dd0830d349 feat: add new copy rubric button 2026-06-05 09:31:42 +09:30
AdenMGB b4a59330c5 fix: fix assement overview not choosing actuve subjects and improve styling 2026-06-05 09:18:33 +09:30
AdenMGB 314c555d87 fix: ensure the ability to override weightings 2026-06-05 08:55:06 +09:30
StroepWafel bc75c9a2c7 PFP caching 2026-06-04 20:05:34 +09:30
StroepWafel a755d442bc Merge branch 'BetterSEQTA:main' into Popout-TOTM 2026-06-04 19:53:08 +09:30
StroepWafel 824812ea9e super clean popout 2026-06-04 14:33:52 +09:30
Aden Lindsay 24e38870a9 Merge pull request #446 from StroepWafel/SyncPFP
Sync PFP on change
2026-06-04 13:36:57 +09:30
StroepWafel 0878910043 Sync PFP on change 2026-06-04 12:44:34 +09:30
SethBurkart123 ce18412405 fix: text on analytics page reload button 2026-06-03 10:32:36 +10:00
AdenMGB 4f6c978043 finalise compat 2026-06-02 13:33:45 +09:30
AdenMGB 9093553ff1 compat: improve compat for nueromphic theme 2026-06-02 13:11:34 +09:30
AdenMGB acb2c682f3 tweak: tweak priv policy placement and style 2026-06-02 12:52:52 +09:30
SethBurkart123 3987871a6a fix: theme store stuck on loading skeleton after fetch failures
Harden theme list fetching with normalized API responses, timeouts, retries,
and a visible error state so the store no longer stays blank when messaging
or payloads fail (common after extension updates without a SEQTA tab reload).
2026-06-02 12:43:35 +10:00
SethBurkart123 9000cb28cd Replace analytics grade filter with dual-handle range slider.
Use a single track with min/max thumbs instead of two separate sliders for clearer filtering UX.
2026-06-02 12:32:07 +10:00
AdenMGB 337f85c3cc feat: prep fopr v3.7.0 as well as minor tweaks 2026-06-02 08:42:24 +09:30
AdenMGB 9e521722f1 Merge branch 'main' of https://github.com/BetterSEQTA/BetterSEQTA-Plus 2026-06-01 19:53:58 +09:30
AdenMGB 2b7c5e17b6 feat: analytics page 2026-06-01 19:43:47 +09:30
Aden Lindsay 21bc6078d7 Merge pull request #441 from StroepWafel/main
fix: TOTM
2026-06-01 18:37:59 +09:30
Aden Lindsay 6c966a8c38 Merge pull request #444 from StroepWafel/theme-stuff
feat: handlers for night city theme's features
2026-06-01 18:37:24 +09:30
StroepWafel 774be0ceed fix issues with injected sidebar 2026-06-01 14:16:38 +09:30
codefactor-io 2356a49fcd [CodeFactor] Apply fixes to commit 3d13202 2026-05-29 02:01:49 +00:00
StroepWafel efbc734d61 Merge branch 'main' of https://github.com/StroepWafel/BetterSEQTA-Plus 2026-05-29 11:30:05 +09:30
StroepWafel f5034ca0bc clean up TOTM popup. properly remember closes 2026-05-29 11:29:50 +09:30
StroepWafel a1d95ebd40 Update package.json 2026-05-29 11:02:36 +09:30
StroepWafel 943623e0fb Update OpenWhatsNewPopup.ts 2026-05-29 11:02:29 +09:30
StroepWafel a23eda1162 show TOTM popup until dismissed - forgotten commit
i forgot to commit this
basically just shows until dismissed even persistent over reloads so the user doesn't lose it the moment they navigate away or if they load the page and close it immediately
2026-05-29 10:55:55 +09:30
StroepWafel 3d13202779 feat: handlers for night city theme's features 2026-05-29 00:44:02 +09:30
StroepWafel 9f263c8c02 Update package.json 2026-05-28 15:17:38 +09:30
StroepWafel e8d1dadfa7 Update OpenWhatsNewPopup.ts 2026-05-28 15:16:43 +09:30
StroepWafel 7a3cbb50cc fix style 2026-05-25 13:49:46 +09:30
StroepWafel eb49e8d7f1 fix up TOTM 2026-05-25 13:26:33 +09:30
Aden Lindsay 65cd0a1c4f Merge pull request #435 from StroepWafel/improved-global-search
Improved global search
2026-05-25 13:18:28 +09:30
StroepWafel 0007b55c03 Merge branch 'main' into improved-global-search 2026-05-25 13:13:57 +09:30
StroepWafel 93e0a2b123 Update OpenWhatsNewPopup.ts 2026-05-25 13:11:46 +09:30
AdenMGB 1a8f025a04 feat: engage shortcuts on homepage 2026-05-24 17:30:03 +09:30
AdenMGB f0358bec07 feat: make assement overview for SEQTA Engage 2026-05-24 17:28:20 +09:30
AdenMGB 4f6916d8b3 feat: bring assement weighting to engage 2026-05-24 17:21:21 +09:30
AdenMGB fee79e8623 temp: disable global search on engage 2026-05-24 17:14:06 +09:30
AdenMGB 475b865000 feat: apply our exisitng icons to engage sidebar 2026-05-24 17:11:47 +09:30
SethBurkart123 304ce2e128 feat: refine startup announcement cards 2026-05-23 22:53:06 +10:00
AdenMGB 0bc6beb0f1 chore: bump ver & release notes 2026-05-23 09:08:31 +09:30
AdenMGB 68173a8b75 fix: fix custom teacher names not applying to popup 2026-05-23 08:58:21 +09:30
Aden Lindsay 7583d0ee47 Merge pull request #439 from StroepWafel/main
feat: Theme of the Month
2026-05-19 20:36:01 +09:30
codefactor-io 6c79fe3588 [CodeFactor] Apply fixes 2026-05-19 10:53:27 +00:00
StroepWafel c0a8a76105 feat: Theme Of The Month 2026-05-19 20:19:50 +09:30
StroepWafel 6ad214bb09 Merge branch 'main' of https://github.com/StroepWafel/BetterSEQTA-Plus 2026-05-18 20:29:35 +09:30
AdenMGB b4598668d4 feat: re enable message folders with improvments 2026-05-13 13:30:27 +09:30
AdenMGB 01e679eab6 Revert "fix: add some better detection logic for assements widget #429"
This reverts commit 01cd5d1428.
2026-05-06 17:31:41 +09:30
Aden Lindsay f57bd107b9 Merge pull request #436 from Jaxx7594/asessment-average-manual-input
Feat: ability to manually input weightings for assessments
2026-05-05 19:51:00 +09:30
Jaxon Lewis-Wilson aa5d193e55 assessmentsAverage: Fix inaccurate weight when a weight == N/A
N/A weights were automatically set to a weight of 1 for some reason. I removed it from the calculations completely with this commit.
2026-05-05 18:14:06 +08:00
Jaxon Lewis-Wilson da5bc7ab11 assessmentsAverage: Fix weight display upon setting override 2026-05-05 18:10:13 +08:00
Jaxon Lewis-Wilson b0857054eb assessmentsAverage: Fix unmarked/upcoming assessment indexing and weight display 2026-05-05 17:56:06 +08:00
Jaxon Lewis-Wilson f721bf6609 Revert "feat: dont inject weightings page in assements without results"
This reverts commit 2aecd63850.
Reverting so that I can solve the indexing issue. Only marked assessments are getting indexed, which is incorrect behaviour that slipped testing when the plugin was first made.
2026-05-05 16:32:12 +08:00
AdenMGB 2aecd63850 feat: dont inject weightings page in assements without results 2026-05-05 17:44:58 +09:30
Jaxx7594 f35520029f assessmentAverage: Remove remnant comment 2026-05-04 22:53:05 +08:00
Jaxx7594 95994fcd3a Merge branch 'main' into asessment-average-manual-input 2026-05-04 22:46:29 +08:00
Jaxon Lewis-Wilson 999f12e958 assessmentsAverage: Add changes to changelog 2026-05-04 22:39:53 +08:00
Jaxon Lewis-Wilson 260afac294 assessmentsAverage: Fix display of missing weighting, and minor change to override section. 2026-05-04 18:36:16 +08:00
Jaxon Lewis-Wilson 678a958351 assessmentsAverage: Add ability to override/set weighting per assessment. 2026-05-04 18:32:32 +08:00
SethBurkart123 608fc96c4e chore: temporarily disable message folders plugin and remove from changelog 2026-05-01 15:39:20 +10:00
StroepWafel 577478ba7e titles > Content 2026-05-01 14:34:15 +09:30
SethBurkart123 23ccac4836 update bun.lock 2026-05-01 12:15:53 +10:00
AdenMGB f6472ea9bd fix: add timeout lock to ensure completion of vecotrisation 2026-05-01 08:49:00 +09:30
StroepWafel f3f4491f04 fix @SethBurkart123 's comments 2026-04-30 21:17:48 +09:30
StroepWafel c987e4d54e patch: default to on
Forgot to make it default to on
2026-04-30 18:40:32 +09:30
StroepWafel cc7f2bc634 update what's new 2026-04-30 18:30:19 +09:30
StroepWafel 189a30a611 fix: various ui/ux improvements and duplicate rm'd 2026-04-30 18:20:19 +09:30
StroepWafel 710c03f463 Feat: Updated global search
- Add shared SEQTA fetch layer, extract helpers, passive JSON capture, many new index jobs
- Schema version + shared reset; auto-reset on extension update; fix manual reset (no dynamic import)
- Stabilize hybrid search: lexical title scoring, stale-query guard, vector guardrails, drop route from Fuse keys
- Improve passive titles/routing; tighten message/people handling
- Fix assignment/course indexing (lenient envelopes, subjects mode:list, student id fallback)
- Top bar: indexing label + stacked progress bar under quick search trigger
2026-04-30 17:09:34 +09:30
Aden Lindsay a875f35f1a Merge pull request #432 from StroepWafel/patch-3 2026-04-29 22:25:18 +09:30
StroepWafel e2cf9afbf9 Fix typos in WhatsNewPopup text 2026-04-29 22:05:46 +09:30
StroepWafel a1131cf6cd Merge branch 'main' of https://github.com/StroepWafel/BetterSEQTA-Plus 2026-04-29 21:47:11 +09:30
Aden Lindsay 3f493ac716 chore: add forgoten custom messages editor to whatsnew 2026-04-29 18:53:13 +09:30
Aden Lindsay e64ef7f95c Custom Message Folders (#431)
* feat: start custom messages plugin

* feat: finish custom message folders
2026-04-29 18:51:05 +09:30
AdenMGB c118b5b8dd chore: update whats new 2026-04-29 11:59:21 +09:30
AdenMGB 6535ec6932 feat: update whatsnew and update video 2026-04-29 11:59:03 +09:30
AdenMGB fba5d09c75 feat: theme flavours for theme varients 2026-04-29 11:13:32 +09:30
AdenMGB b88d29967d fix: ensure the theme store triggers the cloud sync upon install 2026-04-29 10:25:41 +09:30
AdenMGB 1b87d20a27 feat: auto install themes if not present locally with BS Cloud 2026-04-29 10:21:45 +09:30
Aden Lindsay 7bd3158b05 fix: fix wording 2026-04-29 09:56:00 +09:30
StroepWafelandAden Lindsay 7a4fa1e5bf feat: add RGB handler for alpine theme (#427)
* add handlers for individual Channels

* add notes

* patch fix theme overrides for adaptive colour

* idk

* Update package.json

* fix issue spelling

* Update OpenWhatsNewPopup.ts

* Update OpenWhatsNewPopup.ts

* fix: remove debug line from .gitignore

* chore: fix up patch notes to be a bit more user friendly

* chore: finalise patch notes and fix grammer

* Add empty line to .gitignore

---------

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
2026-04-29 09:54:26 +09:30
Jaxon Lewis-Wilson f7d9199500 assessmentsAverage: Minor WEIGHT label styling fixes 2026-04-27 00:28:51 +08:00
AdenMGB 01cd5d1428 fix: add some better detection logic for assements widget #429 2026-04-23 17:26:58 +09:30
StroepWafel 5178408f39 Update OpenWhatsNewPopup.ts 2026-04-22 06:28:48 +09:30
StroepWafel 0b51db5434 Update OpenWhatsNewPopup.ts 2026-04-22 06:27:01 +09:30
StroepWafel 9c47fa38ae fix issue spelling 2026-04-22 06:25:47 +09:30
StroepWafel 5c4d7e1be3 Update package.json 2026-04-21 21:35:41 +09:30
StroepWafel acbbac8266 Merge branch 'main' into main 2026-04-21 21:34:17 +09:30
StroepWafel fa8f36f3d5 idk 2026-04-21 20:31:06 +09:30
SethBurkart123 fcc856e798 fix: resolve assessments overview failing to load in production builds
Replace dynamic import of ./ui with static import to prevent Vite from
code-splitting into a separate chunk that CRXJS cannot resolve at runtime.

Bumps version to 3.6.3.
2026-04-21 19:08:30 +10:00
StroepWafel 44116edca5 patch fix theme overrides for adaptive colour 2026-04-20 22:50:39 +09:30
StroepWafel 37be31859f add notes 2026-04-20 21:47:05 +09:30
StroepWafel 10667f17b4 Merge branch 'main' of https://github.com/StroepWafel/BetterSEQTA-Plus 2026-04-20 21:43:15 +09:30
StroepWafel 0ca0c7cf43 add handlers for individual Channels 2026-04-20 21:43:05 +09:30
SethBurkart123 a0038ac871 chore: bump version to 3.6.2 2026-04-20 15:53:20 +10:00
SethBurkart123 49824e9eab refactor: remove alarms permission, throttle cloud sync to once per day on page load 2026-04-20 15:47:22 +10:00
SethBurkart123 01eeb18638 perf: throttle theme update check to daily and remove redundant cloud poll on page load 2026-04-20 15:39:37 +10:00
SethBurkart123 3702443ece chore: bump version to 3.6.1 2026-04-20 15:33:04 +10:00
SethBurkart123 87ba75ff41 feat: simplify startup popups and convert engage announcement to toast
Remove auto-showing privacy statement and BS Cloud announcement from
startup queue. Convert SEQTA Engage announcement from a blocking modal
to a subtle bottom-right dismissable toast.
2026-04-20 14:59:24 +10:00
SethBurkart123 f9406fb469 feat: redesign Cloud settings UI and switch to OAuth redirect login
- Move Cloud section inline with other settings, remove dedicated header bar
- Replace in-extension login form with browser redirect to accounts.betterseqta.org
- Background script intercepts OAuth callback URL to capture tokens
- Add animated CloudPanel overlay (same pattern as ColourPicker)
- Hide cloud sync details and profile picture setting when not signed in
- Simplify CloudSettingsSync UI, reduce text verbosity
- Fix settings download to merge keys instead of clear+set
- Add legacy-to-plugin settings migration for cloud sync
- Shorten profile picture and default page descriptions
- Make DisclaimerModal title/message dynamic
- Update CloudHeader button styling to match other buttons
2026-04-20 13:42:49 +10:00
AdenMGB 690792fd62 chore: update chaneglog 2026-04-17 15:59:04 +09:30
AdenMGB f6ac112329 fix: fix the timetable edit plugin 2026-04-17 15:55:32 +09:30
AdenMGB ec68cec0ca feat: add smooth animation to notifications opening like settings 2026-04-17 15:51:25 +09:30
AdenMGB e2270602a3 feat: finish custom message folders 2026-04-17 15:39:58 +09:30
AdenMGB 8b1e5b2ee7 feat: start custom messages plugin 2026-04-16 20:22:00 +09:30
AdenMGB 44a029057a feat: auto download settings upon login 2026-04-13 19:42:11 +09:30
AdenMGB 249d1c1b4a feat: auto sync popoup 2026-04-13 19:39:57 +09:30
AdenMGB 6748b15024 feat: tweak engage popup 2026-04-13 19:33:28 +09:30
Aden Lindsay 8b26d07865 Merge pull request #426 from StroepWafel/main
update video (and edit notes)
2026-04-13 19:12:35 +09:30
Aden Lindsay 55d96a5e8f Update theme name in WhatsNewPopup 2026-04-13 19:12:18 +09:30
StroepWafel 133a5197aa Update update-video.webm 2026-04-13 19:10:32 +09:30
StroepWafel c0fa1576f3 Update update-video.webm 2026-04-12 23:28:30 +09:30
AdenMGB 48fbcde6ae fix: fix last two engage bugs 2026-04-12 20:14:52 +09:30
AdenMGB 89f50f774f feat: image full screen overlay for popoups 2026-04-12 20:06:03 +09:30
AdenMGB 1d9b8f3747 feat: queue popups and new engage popup 2026-04-12 19:54:43 +09:30
StroepWafel 0a5359df72 update video (and edit notes) 2026-04-12 19:19:19 +09:30
AdenMGB 2e9a643a8c fix: fix engage not always applying 2026-04-10 21:21:19 +09:30
AdenMGB 39d0b60024 feat: engage homepag 2026-04-08 11:27:38 +09:30
AdenMGB c7a6bf051c chore: bump ver and changelog 2026-04-08 08:49:37 +09:30
AdenMGB ea4a2c1ff0 feat: auto sync for cloud and fix some firefox weirdness 2026-04-08 08:29:25 +09:30
AdenMGB 71b7c9eb64 tweak: tweak cloud UI a lil bit 2026-04-08 07:40:20 +09:30
Aden Lindsay 0cac3022f5 Merge pull request #425 from StroepWafel/cloud-settings-backup
Cloud settings backup
2026-04-08 07:25:09 +09:30
StroepWafel 8b16a21d48 tweaks and fixes to UI 2026-04-07 22:39:09 +09:30
Aden Lindsay 2085ebe189 Upgrade project to Vite 8 + some cleanup (#424)
* Upgrade project to Vite 8

* Fix vite
2026-04-07 21:29:20 +09:30
AdenMGB 01c657d247 Merge branch 'main' of https://github.com/BetterSEQTA/BetterSEQTA-Plus 2026-04-07 21:25:15 +09:30
AdenMGB 1f26fb26d7 fix: somehwat fix overlap with vanilla seqta averages 2026-04-07 21:25:07 +09:30
Jones8683 dbd8e2be8e Merge branch 'main' of https://github.com/Jones8683/BetterSEQTA-Plus 2026-04-07 21:22:47 +09:30
Jones8683 6b5f00add0 Fix vite 2026-04-07 21:22:45 +09:30
Jones Jankovic 1f5eef2fb1 Merge branch 'BetterSEQTA:main' into main 2026-04-07 21:21:42 +09:30
StroepWafel 1e6e57ddcd feat: bs cloud header in settings, cloud pfp as local pfp option & doc updates
updates to docs and also profile
2026-04-07 21:15:29 +09:30
Aden Lindsay e18853ba3a Merge pull request #422 from StroepWafel/patch-2
Update README.md
2026-04-07 21:10:43 +09:30
Aden Lindsay 140cd66c9b chore: update old and non existant links 2026-04-07 21:09:55 +09:30
Jones8683 5684857456 Upgrade project to Vite 8 2026-04-07 20:13:47 +09:30
StroepWafel 24fee7a743 updates to docs and also profile 2026-04-07 20:02:30 +09:30
StroepWafel cef99b7278 Update README.md 2026-04-07 19:55:06 +09:30
StroepWafel aad5bcd97e Update README.md 2026-04-07 19:50:24 +09:30
StroepWafel 423aaa6b84 Update README.md 2026-04-07 19:41:45 +09:30
AdenMGB 97a1226eaf feat(engage): add icon-only sidebar support and Engage-specific titlebar styles
Made-with: Cursor
2026-04-07 15:11:26 +09:30
AdenMGB 72cab5905e fix(engage): disable assessments overview plugin on Engage
Made-with: Cursor
2026-04-07 15:11:15 +09:30
AdenMGB 088b745600 feat(engage): inject settings button, dark/light toggle, and user info with logout
Made-with: Cursor
2026-04-07 15:11:07 +09:30
AdenMGB 8801d5a435 feat(engage): fix loading screen hang and handle login/logout flow
Made-with: Cursor
2026-04-07 15:10:58 +09:30
Aden Lindsay b63a3d95f3 fix today's lessons tweaking out (#420) 2026-04-07 09:14:08 +09:30
StroepWafel eca8327420 fix today's lessons tweaking out 2026-04-07 09:05:13 +09:30
AdenMGB 05cf380e86 feat: some messed up stuff to fix some stuff 2026-04-07 08:46:28 +09:30
StroepWafel 73f005d645 Better theme displaying (#419)
* add more data

add more info for users about themes and also make related themes actually show related themes

* sorting and similar
2026-04-07 08:22:56 +09:30
StroepWafel f2fa9c39a9 Merge pull request #418 from StroepWafel/theme-updates
Theme updates
2026-04-07 08:13:27 +09:30
Aden Lindsay 783ff65fb5 Merge pull request #417 from StroepWafel/updated-sign-in
feat: Unified portaled sign-in overlay
2026-04-06 17:22:10 +09:30
Aden Lindsayandcodefactor-io 3e7ea3bc03 Adaptive custom themes (#416)
* feat: Smooth change in colour, no hard cut

Added option smoothing on colour change so there is no hard cut made when switching subjects

* feat: Themes can adapt to colour

* quick fix to forced mode as well

* [CodeFactor] Apply fixes

---------

Co-authored-by: codefactor-io <support@codefactor.io>
2026-04-06 17:21:38 +09:30
StroepWafel 398029eecd Merge branch 'main' into adaptive-custom-themes 2026-04-06 15:01:38 +09:30
StroepWafel a55cb84a69 feat: Smooth change in colour, no hard cut (#415)
Added option smoothing on colour change so there is no hard cut made when switching subjects
2026-04-06 14:58:09 +09:30
StroepWafel 94d54f65bf feat: Unified portaled sign-in overlay
Updated the sign-in overlay to be unified across the site, improving UX
2026-04-06 14:48:03 +09:30
codefactor-io 8123c5dd33 [CodeFactor] Apply fixes 2026-04-06 04:55:44 +00:00
StroepWafel ac1ee702ae quick fix to forced mode as well 2026-04-06 14:24:08 +09:30
StroepWafel e657152e3f feat: Themes can adapt to colour 2026-04-06 14:11:19 +09:30
StroepWafel f667ff9e9b feat: Smooth change in colour, no hard cut
Added option smoothing on colour change so there is no hard cut made when switching subjects
2026-04-06 13:39:25 +09:30
AdenMGB 3c613f4938 chore: bump ver 2026-04-03 10:55:41 +10:30
AdenMGB 04843a90fe fix: fix adaptive themeing to support current year subjects 2026-04-03 10:47:56 +10:30
AdenMGB 834d585ac7 chore: release ntoe 2026-03-29 20:26:19 +10:30
AdenMGB 343fa7ca9f feat: migrate pdfjs to local & bump ver 2026-03-29 20:25:06 +10:30
AdenMGB e049f34a5e feat: WIP Engage progress 2026-03-28 09:06:54 +10:30
AdenMGB d692f60291 fix: fix qr code to use safer methoed & bump ver 2026-03-25 08:48:47 +10:30
a0367be686 feat: Group settings better and make their descriptions more consistent (#405)
* Reorder and make description mroe consistent of settings

* Make soft gradient description consistent

* Consistent description for music plugin descriptionns

* Update src/plugins/built-in/profilePicture/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Update src/plugins/built-in/backgroundMusic/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Update src/plugins/built-in/backgroundMusic/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Update src/plugins/built-in/backgroundMusic/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Update src/plugins/built-in/backgroundMusic/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Update src/plugins/built-in/backgroundMusic/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Update src/plugins/built-in/backgroundMusic/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Update src/plugins/built-in/backgroundMusic/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Update src/plugins/built-in/profilePicture/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Formatting

* Formatting

* Formatting

* Formatting

* Formatting

* Prettier ignore

* Formatting

* format

* Update src/plugins/built-in/timetableEdit/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Update src/plugins/built-in/timetableEdit/index.ts

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>

* Surely thats it

* Finally

* Add back stuff

* fix: fix formatting

---------

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Co-authored-by: Aden Lindsay <lindsaya542@gmail.com>
2026-03-24 12:22:53 +10:30
Aden Lindsay aa6b15aa1b Merge pull request #410 from Jaxx7594/qr
Fix: QR code gen issues on Firefox
2026-03-21 09:10:44 +10:30
Jaxon Lewis-Wilson 08342c3873 Fix: QR code in embedded settings (firefox)
Firefox has an issue where a backdrop filter within a shadow dom breaks the drawing of the popup. This disables the filter only in the embedded menu to avoid this issue altogether.
2026-03-20 19:43:40 +08:00
Aden Lindsay 6527a33e38 Merge pull request #407 from Jaxx7594/background
Fix: Animated background race condition
2026-03-20 08:05:58 +10:30
Jaxon Lewis-Wilson 43f125e45d Fix: QR code gen in extension settings (firefox) 2026-03-19 23:24:51 +08:00
Jaxon Lewis-Wilson 49cc1e26c0 Fix: Animated background race condition 2026-03-19 23:09:53 +08:00
SethBurkart123 809a82f31d fix: update publish-extension 2026-03-18 13:01:55 +11:00
SethBurkart123 3c8c68ce2f fix: re-enable clicks on menu items during sidebar editing 2026-03-18 11:54:19 +11:00
SethBurkart123 18603026a3 fix: update aspect ratio for WhatsNew image 2026-03-18 11:52:27 +11:00
SethBurkart123 52d13cbdc2 fix: dropdowns on windows hopefully 2026-03-18 11:47:46 +11:00
SethBurkart123 26c04f1c24 feat: update changelog 2026-03-18 11:43:42 +11:00
SethBurkart123 e11e402c80 fix: improve dropdown styling on windows 2026-03-18 11:35:23 +11:00
SethBurkart123 bcc7d58ddd fix: keep compact sidebar items icon-only on focus 2026-03-18 11:31:50 +11:00
SethBurkart123 685c6ad771 fix: sidebar breaking on tab 2026-03-18 11:19:54 +11:00
SethBurkart123 4b0372aa56 fix: hide empty titlebar metadata 2026-03-18 10:45:12 +11:00
SethBurkart123 27aa28740e fix: reduce unnecessary notice modal scrolling 2026-03-18 10:45:12 +11:00
AdenMGB 6291b7d0a7 feat: add the RIGHT blurred update video 2026-03-18 10:07:14 +10:30
SethBurkart123 d9f0d89450 fix: align news loader animation 2026-03-18 10:29:50 +11:00
SethBurkart123 6ad221fcb5 fix: use iconfamily eye for timetable toggle 2026-03-18 10:26:56 +11:00
SethBurkart123 f1c55e127c fix: adaptive theme colour looking all wonky 2026-03-18 10:21:37 +11:00
SethBurkart123 2f6e551e22 fix: align home empty state sizing 2026-03-18 10:06:17 +11:00
SethBurkart123 6edffd0306 fix: icons not loading on seqta pages 2026-03-18 09:52:43 +11:00
SethBurkart123 50de668d01 style: add iconfamily icon to cloud signin 2026-03-18 09:52:30 +11:00
SethBurkart123 8a05d85344 fix: news not loading 2026-03-18 09:43:32 +11:00
SethBurkart123 915ce6f5f1 chore: clean up debug logging 2026-03-18 09:27:08 +11:00
SethBurkart123 67f98b13ad feat: add empty state to notices 2026-03-18 09:26:11 +11:00
SethBurkart123 2a147c1d3a fix: auto apply icon only sidebar on load 2026-03-18 09:17:53 +11:00
Aden Lindsay aae9aa6073 Merge pull request #403 from StroepWafel/main
actually do merge well
2026-03-18 08:46:00 +10:30
StroepWafel 9a9885066f actually do WISP correctly 2026-03-18 08:44:49 +10:30
StroepWafel 760d3349c2 Merge branch 'BetterSEQTA:main' into main 2026-03-18 08:43:55 +10:30
StroepWafel ec0dd70a4b ok ONL:Y wisp content this time 2026-03-18 08:42:02 +10:30
Aden Lindsay 4b2184955a Merge pull request #401 from BetterSEQTA/revert-400-main
Revert "automatic WISP content support"
2026-03-18 08:41:26 +10:30
StroepWafel 8d214ff6a3 Revert "Update monofile.ts"
This reverts commit 725d2b2987.
2026-03-18 08:41:17 +10:30
Aden Lindsay 441df9cdf2 Revert "automatic WISP content support" 2026-03-18 08:41:09 +10:30
SethBurkart123 e6e2789a82 fix: transparent background on rich text composer controls 2026-03-18 09:11:05 +11:00
Seth Burkart 70ceb50acd Merge pull request #400 from StroepWafel/main
automatic WISP content support
2026-03-18 09:08:02 +11:00
SethBurkart123 46d5c2e9fc fix: inter font overriden by seqta 2026-03-18 09:07:01 +11:00
StroepWafel 725d2b2987 Update monofile.ts 2026-03-18 08:36:09 +10:30
SethBurkart123 9581b793b5 feat: render floating popup at extension root 2026-03-18 08:44:20 +11:00
Seth Burkart 3fc3f1191c Merge pull request #399 from StroepWafel/hide-more-sensitive-info
Update hideSensitiveContent.ts
2026-03-18 08:19:07 +11:00
StroepWafel 098c79bc99 Update hideSensitiveContent.ts
hides more info
2026-03-18 01:56:42 +10:30
AdenMGB 45b558373b feat: bump to 3.5.0 and minor fixes 2026-03-17 21:38:10 +10:30
AdenMGB 3a2c438223 feat: adaptive themeing 2026-03-16 15:40:16 +10:30
AdenMGB 577287b8a8 feat: timetable editor plugin 2026-03-16 15:16:02 +10:30
Aden Lindsay 1d13b054ee Merge pull request #396 from AdenMGB/assement-overview
Assement overview improvements, notices fix and icon only sidebar
2026-03-15 10:59:35 +10:30
AdenMGB dc3423df13 feat: icon only sidebar 2026-03-15 10:58:48 +10:30
AdenMGB 9791454d62 fix: fix colouring on assement details result bars 2026-03-15 10:39:43 +10:30
AdenMGB 17f648f3ce fix: fix notices on the homepage not being scrollable 2026-03-15 10:30:22 +10:30
AdenMGB 7d89733f96 feat: add more sorting options to kaban view 2026-03-15 10:28:55 +10:30
Aden Lindsay a0e6bdfb20 Merge pull request #391 from BetterSEQTA/revert-390-fix-389
Revert "Fix notice modal scrolling on Home tab (#389)"
2026-03-10 08:26:13 +10:30
Aden Lindsay ac76ce3f03 Revert "Fix notice modal scrolling on Home tab (#389)" 2026-03-10 08:25:51 +10:30
Aden Lindsay 4bef51a3be Merge pull request #390 from jsodf78h823f/fix-389 2026-03-10 08:20:25 +10:30
FemtoClaw Bot 781171d60a Fix notice modal scrolling on home tab 2026-03-09 20:44:01 +00:00
AdenMGB c01342a86c feat: add desqta qr code instant sign in for schools without normal qr code 2026-03-08 09:18:04 +10:30
Aden Lindsay d73a9b2acf Merge pull request #384 from AdenMGB/theme-store
Online Enhanced Theme store
2026-02-25 12:59:59 +10:30
AdenMGB 1d3643a1fc chore: remove unused code 2026-02-25 12:46:36 +10:30
AdenMGB e50de00d08 feat: move bs cloud to a more out of the way location and some theme store tweaks 2026-02-25 10:55:36 +10:30
Alphons Joseph 8c87278850 Merge pull request #385 from AdenMGB/reload-fix
fix: fix bug in Vanilla SEQTA Causing unesasary reloads
2026-02-22 18:49:21 +08:00
AdenMGB 520da46daf fix: fix bug in Vanilla SEQTA Causing unesasary reloads 2026-02-22 19:23:48 +10:30
AdenMGB 01f5e8f61d fix: cf is very annoying 2026-02-20 19:13:06 +10:30
AdenMGB 2faef2ae8d fix: fix cf like too many times 2026-02-20 19:08:36 +10:30
AdenMGB 9d24d07c12 chore: appease codefactor AGAIN 2026-02-20 18:43:02 +10:30
AdenMGB d21ce90a5c feat: download & like count + UI tweaks and cleanup 2026-02-20 18:29:11 +10:30
AdenMGB 889175f3de chore: appease codefactor 2026-02-20 18:06:43 +10:30
AdenMGB 7a70b008c8 feat: betterseqta cloud for favouriting items and future stuff 2026-02-20 10:49:38 +10:30
AdenMGB 4b251e0ea4 feat: add github fallback 2026-02-20 10:28:13 +10:30
AdenMGB f242928682 feat: query the download api for download counts 2026-02-20 10:27:53 +10:30
AdenMGB d64962147a feat: implement cloud store 2026-02-20 10:27:17 +10:30
SethBurkart123 c2cd034556 feat: update to 3.4.16 2026-02-20 07:36:01 +11:00
SethBurkart123 1039ea8137 feat: update publish-browser-extension 2026-02-20 07:31:01 +11:00
Seth Burkart ead8cf80f3 Merge pull request #383 from Jaxx7594/fix_pdfjs_api_mismatch
fix: PDF.js api mismatch
2026-02-20 07:30:15 +11:00
Jaxon Lewis-Wilson 1f0b2d6627 fix: dynamically get the correct pdfjs worker version based on pdfjs package version 2026-02-19 18:07:56 +08:00
SethBurkart123 40d7ece12b fix: patch new SEQTA UI compatibility in 3.4.15 2026-02-19 20:32:14 +11:00
Seth Burkart 098ab27a01 Merge pull request #382 from AdenMGB/font-fix
fix: fix the dodge stying by seqta
2026-02-19 17:56:49 +11:00
SethBurkart123 170b1cf5c3 fix: patch sidebar item hover and font family 2026-02-19 17:56:34 +11:00
AdenMGB 004c3cc61d fix: fix the dodge stying by seqta 2026-02-19 17:01:19 +10:30
SethBurkart123 1b938e2748 feat: 3.4.14 update details 2026-02-16 13:44:15 +11:00
Seth Burkart 652e84783b Merge pull request #369 from StroepWafel/globalSearch-improvements
Global search improvements
2026-02-16 12:30:22 +11:00
StroepWafel 17c2685cae replaced loading font 2026-02-03 15:07:58 +10:30
Seth Burkart 5e89507276 Merge pull request #378 from Jones8683/main
Fix tutorial room not showing in the upcoming lessons block on homepage
2026-02-01 15:00:54 +11:00
Jones8683 0204b97de8 Merge branch 'main' of https://github.com/Jones8683/BetterSEQTA-Plus 2026-02-01 11:37:11 +10:30
Jones8683 d849951a66 fix: tutorial room doesn't show on upcoming lessons 2026-02-01 11:37:05 +10:30
Seth Burkart 1531afd046 Merge pull request #375 from Jones8683/main
Add tutorial room to home page and begin cleaning up some stuff
2026-02-01 10:45:58 +11:00
Jones Jankovic add8a90c77 Merge branch 'BetterSEQTA:main' into main 2026-02-01 09:51:38 +10:30
Jones8683 b9c3c2b5c5 Reset LoadHomePage.ts to upstream version 2026-02-01 09:51:11 +10:30
Seth Burkart 1cc34c38a8 Merge pull request #377 from StroepWafel/theme-docs
Update THEME_CREATION.md
2026-02-01 10:02:21 +11:00
Seth Burkart e5859f419a Merge pull request #374 from Jaxx7594/weightings
feat: Assessments Average weightings
2026-02-01 10:00:25 +11:00
Seth Burkart aadc295bdb Merge branch 'main' into weightings 2026-02-01 09:59:48 +11:00
Seth Burkart af2ef23078 Merge pull request #373 from Jaxx7594/icon-race
fix: Favicon race condition
2026-02-01 09:53:14 +11:00
StroepWafel 7150f03d77 Update THEME_CREATION.md 2026-01-31 21:46:36 +10:30
Jones8683 a381de7c9b final shorthand fix 2026-01-30 20:27:59 +10:30
Jones8683 ce6a5cfdc4 fix: background shorthand warning 2026-01-30 20:11:09 +10:30
Jones8683 de75468f2b most of the rest of the dups 2026-01-30 20:00:30 +10:30
Jones8683 011c1eddb4 remove more duplicates and slight css touch ups 2026-01-30 19:45:44 +10:30
Jones8683 c9443bad27 git please work 2026-01-30 19:29:14 +10:30
Jones8683 445aa9d071 Revert "resolve codefactor warnings about animation shorthand"
This reverts commit e0009ad8dc.
2026-01-30 19:26:38 +10:30
Jones8683 14a2e93b3a styff 2026-01-30 19:25:47 +10:30
Jones8683 3746b05af2 Reapply "Add back GPL license header to iframe.scss"
This reverts commit 1d215d8c75.
2026-01-30 19:19:07 +10:30
Jones8683 1d215d8c75 Revert "Add back GPL license header to iframe.scss"
This reverts commit 401947031b.
2026-01-30 19:17:50 +10:30
Jones8683 b4b1fed576 Merge branch 'main' of https://github.com/Jones8683/BetterSEQTA-Plus 2026-01-30 19:16:14 +10:30
Jones8683 e0009ad8dc resolve codefactor warnings about animation shorthand 2026-01-30 19:16:01 +10:30
Jones Jankovic 401947031b Add back GPL license header to iframe.scss 2026-01-30 16:41:39 +10:30
Jones JankovicandAden Lindsay 9da8e104a8 Update src/seqta/utils/Loaders/LoadHomePage.ts
Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
2026-01-30 16:37:52 +10:30
SethBurkart123 3aef2312d0 feat: cleanup and comment removal 2026-01-30 16:07:12 +11:00
Jones8683 b402221477 fix build 2026-01-30 14:58:24 +10:30
Jones8683 8b6bda6dff more cleanup 2026-01-30 08:37:38 +10:30
Jones8683 eed8bac45a fix: clean up more duplicate selectors 2026-01-29 20:53:12 +10:30
Jones Jankovic 3b7bbc9bc6 Merge Codefactor fixes
Apply fixes from CodeFactor
2026-01-29 20:29:52 +10:30
codefactor-io 9820595a70 [CodeFactor] Apply fixes 2026-01-29 09:56:34 +00:00
Jones8683 0a33ca7f6e trigger codefactor for fork 2026-01-29 20:25:22 +10:30
Jones8683 bba96d5159 format: remove some duplicate selectors 2026-01-29 20:21:30 +10:30
Jones8683 d9fe70f442 fix: remove duplicate css block 2026-01-29 20:07:13 +10:30
Jones8683 32c5c8392b fix: tutorials show room as N/A even if room is specified on timetable 2026-01-29 19:40:28 +10:30
Jaxon Lewis-Wilson cc3f06b383 Small refactor (hopefully appease CodeFactor?) 2026-01-29 14:50:48 +08:00
codefactor-io 9ad90e9416 [CodeFactor] Apply fixes to commit 87fdda4 2026-01-28 16:08:12 +00:00
Jaxon Lewis-Wilson 87fdda459a Small refactor 2026-01-29 00:07:36 +08:00
Jaxx7594 6c11bb8143 Merge pull request #2 from StroepWafel/weightings
fix try catch error
2026-01-28 23:16:42 +08:00
Jaxon Lewis-Wilson 391fcfb9dd Various changes/fixes/polish
- Adds weight label below each assessment
 - Correlates assessment name with its ID, so each dom element can be identified: {trimmed_title: assessmentID}
 - Slightly changed regex to be a little more permissive
 - Changed pdfjs src/type due to CORS issues on firefox
 - Permitted weightings to be zero, but not less than zero
 - Modified how assessment items are iterated through, as the previous approach assumed they're in the same order as they are in react
 - Changed parseAssessments() to immediately dispatch parsing for all pdfs asynchronously, as doing it serially is painstakingly slow
 - Discard useless decimals when displaying weight (.0)
2026-01-28 23:06:02 +08:00
StroepWafel 355c5f2d46 fix try catch error 2026-01-28 19:38:20 +10:30
Jaxx7594 afdb4336f8 Merge pull request #1 from StroepWafel/weightings
Weightings
2026-01-28 16:01:51 +08:00
StroepWafel 7a04b22b22 Update index.ts 2026-01-28 17:21:32 +10:30
StroepWafel f594ed4902 i think i fixed it? 2026-01-28 17:19:08 +10:30
StroepWafel f1afa74ee6 Add average grade display and Fix CORS violation
Add average grade display and also fix the CORS violation caused by pdfjs trying to load PDFs from URLs that Firefox extensions can't access.

fixed by instead:
- Fetching the PDF as an ArrayBuffer directly from the URL
- Passing the ArrayBuffer to pdfjs using { data: arrayBuffer } instead of passing a URL
2026-01-28 16:36:16 +10:30
StroepWafel db3f0e0d81 Merge pull request #2 from Jaxx7594/weightings
feat: Assessments Average weightings parsing
2026-01-28 16:12:16 +10:30
Jaxon Lewis-Wilson aceefa16c0 feat: Assessments Average weightings parsing
ONLY PARSING SIDE IS COMPLETE. Does not factor into the average yet.
2026-01-28 13:25:58 +08:00
StroepWafel 89589fe3dc Merge branch 'BetterSEQTA:main' into globalSearch-improvements 2026-01-27 21:25:07 +10:30
Jaxon Lewis-Wilson 2afe2364e4 Narrowed trigger criteria
Instead of running every time document.head mutates, only run when mutation is an attribute change, target is a link, rel includes icon, and attribute is href.
2026-01-27 16:09:15 +08:00
Jaxon Lewis-Wilson 2c0f48877f Appease codefactor 2026-01-27 14:40:02 +08:00
Jaxon Lewis-Wilson 8791038bcf fix: Favicon race condition
Fixes a race condition due to the way the Tes logo has been implemented.
2026-01-27 14:31:33 +08:00
Alphons Joseph aba2ba5bfa Merge pull request #371 from BetterSEQTA/tutor-fix
fix [BUG] Seqta Tutor Lessons Color Not In Home Page And Assesments/Courses showing when not meant to
2026-01-24 18:02:42 +08:00
Alphons Joseph 2b01834765 Merge pull request #372 from BetterSEQTA/copilot/sub-pr-371
[WIP] Fix Seqta Tutor lessons color and course visibility
2026-01-24 12:27:58 +08:00
copilot-swe-agent[bot]andCrazypersonalph 79c4fb511b Remove console.info(lesson) to prevent logging sensitive data
Co-authored-by: Crazypersonalph <93847055+Crazypersonalph@users.noreply.github.com>
2026-01-24 04:26:14 +00:00
Alphons JosephandCopilot 14823dcc91 Update src/seqta/utils/Loaders/LoadHomePage.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-24 12:24:14 +08:00
copilot-swe-agent[bot] 9d3494eb56 Initial plan 2026-01-24 04:23:49 +00:00
Alphons Joseph 6af7c32c88 fix [BUG] Seqta Tutor Lessons Color Not In Home Page And Assesments/Courses showing when not meant to
Fixes #343
2026-01-24 12:14:39 +08:00
Seth Burkart c205a52f03 Merge pull request #370 from Jaxx7594/icon
fix: Favicon not showing
2026-01-23 15:33:17 +11:00
SethBurkart123 a6d95f27ed chore: update publish-browser extension 2026-01-23 14:13:11 +11:00
Jaxon Lewis-Wilson f05cd66e88 fix: Favicon not showing 2026-01-23 09:27:14 +08:00
SethBurkart123 a151e7a07e feat: 3.4.13 2026-01-23 08:10:38 +11:00
StroepWafelandAden Lindsay 1f49fa4bae Update src/plugins/built-in/globalSearch/src/indexing/actions.ts
Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
2026-01-22 19:35:26 +10:30
StroepWafelandAden Lindsay 86d9cfe50c Update src/plugins/built-in/globalSearch/src/core/index.ts
Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
2026-01-22 19:34:55 +10:30
StroepWafelandAden Lindsay ae59640162 Update src/plugins/built-in/globalSearch/src/indexing/actions.ts
Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
2026-01-22 19:34:30 +10:30
StroepWafelandAden Lindsay 5f935cd819 Update src/plugins/built-in/globalSearch/src/indexing/actions.ts
Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
2026-01-22 19:34:18 +10:30
codefactor-io 90e3a946bf [CodeFactor] Apply fixes 2026-01-22 08:42:29 +00:00
StroepWafel 51c940cdd9 Fixed CSS Preload Error 2026-01-22 19:07:48 +10:30
StroepWafel 07ff6d25ca indexing progressbar fixes 2026-01-22 19:05:39 +10:30
StroepWafel 89fd9bbd89 styles 2026-01-22 18:58:33 +10:30
StroepWafel c7033e61fb show indexing progress 2026-01-22 18:58:20 +10:30
StroepWafel 39f8cb1634 include all past assessments 2026-01-22 18:58:03 +10:30
StroepWafel 705c106da8 updates reset cache (clears dead cache from old updates causing issues)
YESS I FINALLY GOT DATABASE INDEXING WORKING TOO
2026-01-22 18:42:45 +10:30
StroepWafel 9b52bae404 update search to hopefully index correctly this time 2026-01-22 18:42:23 +10:30
StroepWafel 9a002d18b0 audit command 2026-01-22 18:42:13 +10:30
StroepWafel 3847ef4269 hopefully fix the issues 2026-01-22 18:41:42 +10:30
StroepWafel f0d0068a2e Add command for compile 2026-01-22 18:40:57 +10:30
StroepWafel b89a6c634c fix vector initialisation? 2026-01-22 11:37:09 +10:30
StroepWafel 29cfb4c792 improve global search 2026-01-22 11:28:43 +10:30
Seth Burkart 5b590512ee Merge pull request #365 from Jaxx7594/line
fix: House/year box hard failing when house_colour does not exist
2026-01-21 21:52:43 +11:00
Seth Burkart 3ff8ef144a Merge pull request #366 from Jones8683/main
Fix the message of the day being unreadable in light mode
2026-01-21 21:52:20 +11:00
Seth Burkart d9abed1c5d Merge pull request #367 from Jaxx7594/bar
fix: Incorrect styling due to SEQTA update
2026-01-21 21:51:40 +11:00
Jaxon Lewis-Wilson 82a789bbec fix: Global fonts
Prior commit was not actually functional upon review
2026-01-21 12:22:45 +08:00
Jaxon Lewis-Wilson ce6538f850 fix: Global font
Overrides SEQTA's new important tag for font under *{}
2026-01-21 11:40:16 +08:00
Jaxon Lewis-Wilson 979ae7149f fix: Incorrect styling due to SEQTA update 2026-01-21 11:17:49 +08:00
codefactor-io 6e71437fe8 [CodeFactor] Apply fixes to commit 940ecf8 2026-01-19 01:41:43 +00:00
Jones8683 940ecf8714 fix: message of the day unreadable in light mode 2026-01-19 12:09:57 +10:30
Jaxon Lewis-Wilson e0cc2e0fdf fix: House/year box hard failing when house_colour does not exist 2026-01-18 00:11:09 +08:00
SethBurkart123 5a19ef92e8 feat: v3.4.12 2025-12-19 17:04:08 +11:00
SethBurkart123 0a3781e9c2 fix: video aspect changing on load 2025-12-19 16:30:38 +11:00
SethBurkart123 a2e39c9d84 feat: add DisclaimerModal component to assessment averages switch 2025-12-19 14:50:55 +11:00
SethBurkart123 520abbb5c3 chore: hide the minecraft server icon 2025-12-19 14:30:26 +11:00
SethBurkart123 d0a11da15f feat: updated privacy statement 2025-12-19 14:29:11 +11:00
Seth Burkart fd5802f9a3 Merge pull request #362 from Jones8683/main
Fix some popup stuff
2025-12-12 13:26:52 +11:00
Jones8683 380d829d19 fix: bad spacing and ordering of popup buttons 2025-12-04 11:52:48 +10:30
Alphons Joseph 702528fb0c Merge pull request #361 from StroepWafel/Privacy-statement
re-add Privacy statement stuff
2025-12-03 18:17:28 +08:00
StroepWafel 2c077bc755 Add dynamic privacy policy notification with API fetch
Implements fetching the privacy policy from the BetterSEQTA+ API and displays a notification if the policy has been updated. Adds sanitization for HTML content, updates settings state to track last shown timestamp, and provides a manual trigger in settings. Refactors notification logic for improved security and maintainability.
2025-11-29 19:47:30 +10:30
StroepWafel fd86e57442 re-add privacy statement
Re-Added privacy statement and ported it over to jones' new system
2025-11-29 16:51:59 +10:30
Alphons Joseph 60ce18280e Merge pull request #357 from Jones8683/main 2025-11-29 09:38:26 +08:00
Jones8683 668dbfd78b fix: remove a comment 2025-11-29 11:57:58 +10:30
Jones8683 810aa17f15 Merge branch 'main' of https://github.com/Jones8683/BetterSEQTA-Plus 2025-11-29 11:46:22 +10:30
Jones8683 b64558e50a fix: whatsnew not scrolling 2025-11-29 11:46:14 +10:30
Jones 9b969bd708 fix: add back the contribute link
Added a section inviting contributions to the README.
2025-11-29 11:37:43 +10:30
Jones 1945f7c592 Merge branch 'BetterSEQTA:main' into main 2025-11-29 11:31:13 +10:30
Alphons Joseph 3e26d9af3c Merge pull request #360 from BetterSEQTA/revert-359-Privacy-statement
Revert "add privacy statement popup"
2025-11-29 08:54:03 +08:00
Alphons Joseph 3c8d7e246b Revert "add privacy statement popup" 2025-11-29 08:53:50 +08:00
Alphons Joseph 2e56518330 Merge pull request #359 from StroepWafel/Privacy-statement
add privacy statement popup
2025-11-29 07:42:45 +08:00
Alphons Joseph e67f3110e0 Update monofile.ts 2025-11-28 22:24:37 +08:00
Alphons Joseph a67f4d2e25 Update monofile.ts 2025-11-28 22:22:11 +08:00
StroepWafel d6025140fd add privacy statement popup 2025-11-28 14:03:17 +10:30
Jones8683 88e9ddf29c fix: uneven spacing on popup buttons 2025-11-18 10:59:43 +10:30
Jones8683 11adc4f933 Merge branch 'main' of https://github.com/Jones8683/BetterSEQTA-Plus 2025-11-12 13:53:47 +10:30
Jones8683 15691e8d94 fix: bottom corners of custom timetable events arent roudned 2025-11-12 13:52:28 +10:30
Jones 754b8d0589 fix: indent in readme 2025-11-11 11:30:40 +10:30
Jones8683 1d634d0da1 feat: seperate file to manage the 3 popups 2025-11-10 19:05:08 +10:30
Jones8683 7136de90be fix: crash in notificatio fetcher 2025-11-10 17:10:53 +10:30
Jones8683 466628479e feat: import close popup function from whatsnew instead of having its own 2025-11-10 16:57:53 +10:30
Jones8683 9c08d0bac2 fix: spam clicking outside a popup restarts closing animation, and remove multiple close popup functions 2025-11-10 16:57:14 +10:30
Jones8683 6c5320007f fix: empty scrollbar in about server popup 2025-11-10 16:29:41 +10:30
Jones8683 4734a443b4 fix: border applying to bottom most item 2025-11-10 16:18:55 +10:30
Jones 7c38e1dc29 fix: no border between submissions when transparency effects on 2025-11-10 11:26:53 +10:30
SethBurkart123 f3f90ef2a8 bump(version): 3.4.11 2025-10-13 15:00:08 +11:00
SethBurkart123 9bcc94aa8a feat(homepage): add empty state for assessments 2025-10-13 14:36:23 +11:00
SethBurkart123 ff2431f269 style(homepage): increased max width on days timetable 2025-10-13 14:28:44 +11:00
SethBurkart123 b442194bc5 fix: move custom shortcuts above regular shortcuts 2025-10-13 14:24:27 +11:00
SethBurkart123 b59c0eae25 feat: make edit mode on themes tab more plain #240 2025-10-13 14:11:55 +11:00
SethBurkart123 e895ce9f6b feat: add colorPicker hex/rgba controls back #351 2025-10-13 13:37:26 +11:00
SethBurkart123 7192f41535 feat: improvements to background music plugin 2025-10-13 13:26:15 +11:00
SethBurkart123 f1b707ab25 style: add line clamp 2025-09-15 11:28:18 +10:00
Seth Burkart 7f47cb8183 Merge pull request #348 from BetterSEQTA/goto-fix
Go to popup not scrolling #342
2025-09-15 11:27:09 +10:00
SethBurkart123 7f5d138bc9 fix: Go to popup not scrolling #342 2025-09-15 11:26:31 +10:00
Seth Burkart cef0f29640 Merge pull request #346 from StroepWafel/Fix-dropdowns
fix: Drop down menu styling
2025-09-15 11:20:32 +10:00
SethBurkart123 157343dda9 fix: remove excess arrow 2025-09-15 11:20:22 +10:00
Seth Burkart 7705c0a3cd Merge pull request #347 from StroepWafel/Fix-wrapping
fix: Text now wraps correctly in most divs
2025-09-15 11:11:24 +10:00
SethBurkart123 7def7b190c fix: duplicate #menu selectors 2025-09-15 11:11:05 +10:00
Alphons Joseph c294fb7369 Merge pull request #344 from StroepWafel:main
feat(plugin):Background Music plugin
2025-09-14 09:29:43 +08:00
StroepWafel 0dbbef0eb1 fix: Text now wraps correctly in most divs
Adjusted divs to wrap text, this can cause some issues where substantially long words get chopped up, but scaling down the font size makes it look weird.
2025-09-12 16:17:18 +09:30
StroepWafel c3c747d996 fix: Drop down menu styling
Fix for drop down menu styling so it doesn't look abhorrent
2025-09-12 15:50:24 +09:30
SethBurkart123 cdc8062275 fix: broken shortcut rendering logic #345 2025-09-11 19:14:53 +10:00
codefactor-io 1857b5ff01 [CodeFactor] Apply fixes to commit 700e3eb 2025-09-08 10:21:47 +00:00
StroepWafel 700e3ebb48 feat(plugin):Background Music plugin
Added a plugin so users can upload and play a .wav audio file as background music. added volume setting, made sure the file is stored across version updates/downdates, made the music stop when the tab is unfocussed, and registered the plugin as official.
2025-09-08 19:12:35 +09:30
Seth Burkart 16b9610301 Merge pull request #340 from Jones8683/main
Bump crxjs version
2025-08-28 14:56:35 +10:00
Jones8683 7d11e203a6 bump: more packages 2025-08-27 19:58:54 +09:30
Jones8683 530f07e640 bump(deps): bump more deps 2025-08-23 10:52:42 +09:30
Jones8683 08586781ce feat: proper gramatical naming for news sources 2025-08-19 12:24:03 +09:30
Jones8683 3ca5a49769 bump(deps): updated deps to match 2025-08-19 11:49:19 +09:30
Jones8683 886c79b3ee fix(deps): crxjs beta being used 2025-08-19 11:39:28 +09:30
Jones 30aa39142d fix: icons not loading 2025-08-19 11:26:59 +09:30
Jones8683 4188ef0d67 format: remove extra lines 2025-08-19 08:14:12 +09:30
Jones8683 ad9a013b00 update injected.scss 2025-08-19 08:13:20 +09:30
Jones8683 cd1f954cc7 feat: remove ugly line in transparency effects 2025-08-18 16:24:02 +09:30
Jones8683 6ef6c986dc fix (build): stop duplicate icon bundling warnings temp 2025-08-18 16:04:53 +09:30
Jones8683 f2e28175a0 feat: update crxjs 2025-08-18 15:53:35 +09:30
SethBurkart123 3ddcb204ef bump(version): 3.4.10.2 2025-08-17 21:27:57 +10:00
Alphons Joseph 766f0e6d3f undebump it 2025-08-17 18:48:09 +08:00
Alphons Joseph f1fcba58ef debump vite plugin 2025-08-17 18:30:19 +08:00
SethBurkart123 dba2d13bb3 bump(deps): publish-browser-extension to 3.0.1 2025-08-17 16:17:24 +10:00
SethBurkart123 30bf345b86 feat: add changelog for 3.4.10 2025-08-17 14:29:26 +10:00
SethBurkart123 0e98f52058 fix: UIfile styling applying on documents 2025-08-17 14:15:24 +10:00
SethBurkart123 f89508deb2 bump(version): 3.4.10 2025-08-17 14:14:44 +10:00
SethBurkart123 c7b69ad97b chore: import updates 2025-08-17 11:27:23 +10:00
SethBurkart123 2ef8bb215a perf: improved efficiency of element scanning in eventmanager 2025-08-17 11:02:41 +10:00
SethBurkart123 16273cf012 style: show icon on image files 2025-08-17 09:07:26 +10:00
Seth Burkart 13d3ccd8e4 Merge pull request #334 from Jones8683/main
Fix windows dev script???
2025-08-17 09:05:29 +10:00
SethBurkart123 7ebc4db9db fix: global search missing styles #335 2025-08-17 09:00:37 +10:00
Jones ed9d662ba4 Update README.md 2025-08-16 20:16:45 +09:30
Jones8683 8647e0b272 feat: update crxjs to out of beta 2025-08-16 19:51:38 +09:30
SethBurkart123 d93abec615 docs: update architecture 2025-08-15 17:32:05 +10:00
Seth Burkart 339b409937 Merge pull request #333 from Jones8683/main
Apply rounded corners when dragging event
2025-08-15 17:28:19 +10:00
SethBurkart123 0fb05c7f26 bump(version): 3.4.9 2025-08-15 17:16:32 +10:00
SethBurkart123 b866dde6e2 style: file pills 2025-08-15 17:13:43 +10:00
SethBurkart123 a42d781955 perf: lazy loading improvements 2025-08-15 16:12:27 +10:00
SethBurkart123 b03e99faa2 perf: only load svelte app on click 2025-08-15 11:04:31 +10:00
SethBurkart123 c87cbce218 perf: only enable sensitive hider in devmode 2025-08-15 10:51:44 +10:00
SethBurkart123 0d6aa1e5fd perf: settingsstate storage performance improvements 2025-08-15 10:49:41 +10:00
SethBurkart123 a396aa8a9d perf: settingstate caching improvements 2025-08-15 10:44:14 +10:00
SethBurkart123 f3048d0cae feat: mc popup on update, improved styles 2025-08-15 10:37:33 +10:00
SethBurkart123 adb3beb2b1 perf: limit notice length in preview 2025-08-15 10:22:10 +10:00
Jones8683 860916a5b8 feat: apply rounded corners when dragging event 2025-08-13 10:16:05 +09:30
Seth Burkart 21e0b0a05e Merge pull request #330 from Jones8683/main
Advertisement of MC in extension
2025-08-07 08:56:59 +10:00
Jones8683 f7ca1c7ddd chore: update all code to correct repo 2025-08-05 17:56:20 +09:30
Jones8683 3fb70f280a feat: replace image with mc trailer vid 2025-08-05 17:50:07 +09:30
Jones8683 58b1a70cc9 feat: youtube link in popups 2025-08-05 14:58:48 +09:30
Jones8683 ce2b376469 feat: add version number 2025-08-05 09:32:19 +09:30
Jones8683 2ded9b3f83 fixes 2025-08-04 14:36:26 +09:30
Jones8683 a0e8fc2233 fix: images pull from repo fork 2025-08-04 13:46:50 +09:30
Jones8683 3527817ed1 feat: update list content 2025-08-04 12:47:24 +09:30
Jones8683 5cf0a928c9 fix: apply fix for all popups 2025-08-04 12:45:07 +09:30
Jones8683 ae84a22128 fix: official website icon not displaying properly in light mode 2025-08-04 12:42:44 +09:30
Jones8683 b16a48c26c feat: make new icon work for dark mode 2025-08-04 10:04:41 +09:30
Jones8683 ceb9424ab9 fix: use font instead of image for ip adress 2025-08-04 09:57:51 +09:30
Jones8683 52192002e7 fix: content not showing properly 2025-08-04 08:40:34 +09:30
Jones8683 4160f6ee10 new image 2025-08-03 20:32:44 +09:30
Jones8683 028c011a98 feat: finalise content 2025-08-03 20:31:05 +09:30
Jones8683 bb6bf7bfb2 fix errors 2025-08-03 20:10:35 +09:30
Jones8683 c5cef0c9a7 feat: image 2025-08-03 20:09:19 +09:30
Jones8683 e6d418d569 feat: template prepped for styling 2025-08-03 19:55:09 +09:30
Jones8683 c4ff994e38 feat: finalise icon 2025-08-03 19:41:35 +09:30
Jones8683 da9a1e8c0b feat: placeholder popup & icon 2025-08-03 19:00:50 +09:30
Jones8683 6eebb6911a feat: image for mc popup 2025-08-01 15:12:26 +09:30
Jones8683 c0271968e2 settings 2025-08-01 15:08:35 +09:30
Jones8683 871b893532 fix: popup casuing error, removed until ready 2025-08-01 14:55:23 +09:30
Jones8683 0cad870c28 feat: template for mc server popup 2025-08-01 14:54:00 +09:30
Jones8683 4f38a28d9c feat: prep for mc popup 2025-08-01 14:47:51 +09:30
Jones8683 f3029d6d9a Merge branch 'main' of https://github.com/jones8683/BetterSEQTA-Plus 2025-08-01 14:15:29 +09:30
Jones8683 10f67c8d60 feat: betterseqta.org in whats new and about page 2025-08-01 14:15:12 +09:30
Seth Burkart 9030f20540 Merge pull request #329 from Jones8683/main
Update about page for 14 contributers
2025-07-30 19:34:31 +10:00
Jones e12a724ab8 Update about page for 14 contributers 2025-07-30 13:47:42 +09:30
Seth Burkart b5f418938a Merge pull request #327 from NNIDNHU/main
Make new-contributor.md a yaml file to fit with other files
2025-07-23 09:34:45 +10:00
NNIDNHU 743deb9fe0 Delete .github/ISSUE_TEMPLATE/new-old-contributor.md 2025-07-22 14:01:41 +09:30
NNIDNHU a696f5b333 Update and rename new-contributor.md to new-old-contributor.md 2025-07-22 14:01:12 +09:30
NNIDNHU 397e440b6f Update new_contributor.yml 2025-07-22 14:00:47 +09:30
NNIDNHU a6f0e5bc55 Update new_contributor.yml 2025-07-22 13:59:57 +09:30
NNIDNHU cadb8f6269 Update new_contributor.yml 2025-07-22 13:59:13 +09:30
NNIDNHU 0f3f5fca83 Create new_contributor.yml 2025-07-22 13:57:50 +09:30
Seth Burkart e12fe43ed8 Merge pull request #324 from Jones8683/main
feat: Apply 12-hour time to more elements and restyle motd
2025-07-19 18:26:00 +10:00
Jones 5b94c2c9b5 fix: put back message box on dashboard 2025-07-18 16:11:24 +09:30
Jones f2d748baf9 Merge branch 'main' of https://github.com/jones8683/BetterSEQTA-Plus 2025-07-17 20:17:05 +09:30
Jones 5dfd738848 restyle motd 2025-07-17 20:16:53 +09:30
Jones e88b2e0404 Merge branch 'BetterSEQTA:main' into main 2025-07-16 18:08:41 +09:30
Jones 10f3c1e942 fix: remove ID that wont work 2025-07-16 18:07:57 +09:30
Jones 9911966fe7 feat: apply 12 hour time while event is being made and give rounded corners while creating new event 2025-07-16 17:58:31 +09:30
Seth Burkart d49f4c539c Merge pull request #323 from Jones8683/main
Add rounded corners for custom timetable events while editor is open
2025-07-16 18:03:43 +10:00
Jones 77074f085a Merge branch 'main' of https://github.com/jones8683/BetterSEQTA-Plus 2025-07-16 16:46:29 +09:30
Jones ae8b890282 feat: apply rounded corners to custom timetable events while they are being edited (It has a different ID to once its been added) 2025-07-16 16:45:39 +09:30
Jones 3d5aa7ebd9 Update README.md 2025-07-10 16:44:32 +09:30
SethBurkart123 7251e4eee5 fix: weird colouring on courses cover page button #303 2025-07-04 14:03:08 +10:00
SethBurkart123 ad0a329331 fix: auto read message on notification click 2025-07-02 06:39:40 +10:00
SethBurkart123 43a780de8e fix: retrieval of state 2025-07-02 06:34:45 +10:00
SethBurkart123 de9c6bc481 style: improve transparency effects 2025-07-01 16:09:34 +10:00
Seth Burkart bf1fe51e94 Merge pull request #321 from Jones8683/main
feat: apply 12 hour time to timetable details
2025-07-01 16:03:32 +10:00
SethBurkart123 1f3dea55bb fix: more reliable zoom buttons on timetable page 2025-07-01 13:15:11 +10:00
Jones8683 980432c501 feat: apply 12 hour time to timetable details 2025-06-30 19:42:33 +09:30
Seth Burkart b5c3a0fce8 Merge pull request #319 from Jones8683/patch-1
Fix grammar
2025-06-29 15:45:10 +10:00
SethBurkart123 64bc9e6cad fix: profile picture inverted with neumorphic theme 2025-06-29 15:14:17 +10:00
Jones 839366432e fix: add missing full stop to readme 2025-06-29 11:40:58 +09:30
SethBurkart123 e5a410ff58 docs: update email 2025-06-29 10:46:42 +10:00
SethBurkart123 26613beb02 docs: more comprehensive documentation 2025-06-29 09:44:39 +10:00
Seth Burkart db92af7405 Merge pull request #315 from Jones8683/main
fix: tell people to fork it from 'main' not 'master'
2025-06-25 13:49:58 +10:00
Jones 78909bc242 Merge branch 'BetterSEQTA:main' into main 2025-06-25 12:56:05 +09:30
SethBurkart123 b503363d64 fix: assessment tooltips on homepage 2025-06-25 09:46:35 +10:00
SethBurkart123 b69d5f47fc feat: update changelog 2025-06-25 09:17:23 +10:00
SethBurkart123 404d3c02f3 feat: new update video 2025-06-25 09:13:19 +10:00
Jones e28a3e1bc6 fix: missing word in changelog 2025-06-24 11:09:20 +09:30
Jones f1b7c3475e fix: tell people to fork it from 'main' not 'master'
since when was it called "master"???
2025-06-23 19:42:11 +09:30
SethBurkart123 964a026e7a feat: improved sensitive content hider (dev) 2025-06-23 12:33:37 +10:00
SethBurkart123 c7d9e1d955 feat: remove rounded corners on custom shortcut icons 2025-06-23 11:58:18 +10:00
SethBurkart123 e305b70035 chore: update changelog 2025-06-20 10:01:56 +10:00
SethBurkart123 c4140a2a9d feat: homepage styling improvements 2025-06-18 14:14:48 +10:00
SethBurkart123 566f326dce feat: modern and animated notices on homepage 2025-06-18 12:49:35 +10:00
SethBurkart123 c9fe4e0e1c feat: add loading animations to lessons on home page 2025-06-18 10:08:01 +10:00
SethBurkart123 fbd8d9e9e8 fix: Home page todays lessons not properly changing days #310 2025-06-18 09:41:21 +10:00
SethBurkart123 3f0d3f87fe fix: search bar searches being delayed 2025-06-13 10:59:15 +10:00
SethBurkart123 2292585e60 feat: add confetti and render overview with svelte 2025-06-13 09:06:56 +10:00
SethBurkart123 bb7c27dfea feat: hide empty overview columns + transparency effects support 2025-06-12 17:12:26 +10:00
SethBurkart123 8c1df8f829 fix (perf): background flickering on page load #305 2025-06-12 17:02:26 +10:00
SethBurkart123 7462e6ab5d fix: builds failing 2025-06-12 16:59:21 +10:00
SethBurkart123 66ff6e3468 fix: standalone settingsState not loading 2025-06-12 16:42:01 +10:00
SethBurkart123 8bd9b1dae7 perf: reduce timetable resource consuption and update notification collector 2025-06-12 16:24:28 +10:00
SethBurkart123 d377329bf9 chore: remove unused code 2025-06-12 15:15:34 +10:00
SethBurkart123 ec38502747 perf: only load vectorWorker when required 2025-06-12 15:15:07 +10:00
SethBurkart123 57b4daa9b7 feat: global search bug fixes and performance improvements 2025-06-12 14:45:36 +10:00
Seth Burkart fa37fe9d21 Merge pull request #307 from BlastedMeteor44/main
Added easter egg to AddBetterSEQTAElements.ts
2025-06-08 10:24:01 +10:00
SethBurkart123 ccb4354b26 feat: assessments overview mark as complete 2025-06-07 23:49:28 +10:00
SethBurkart123 841426d7ec fix: delayed flicker in 12 hour times on timetable 2025-06-07 18:24:52 +10:00
SethBurkart123 b9f0675c4f fix: oversized empty lessons image 2025-06-07 18:21:14 +10:00
BlastedMeteor44 8ff5fd8d2f Added easter egg to AddBetterSEQTAElements.ts
never gonna give you up shows if you toggle light/dark mode 10 times
2025-06-06 17:16:42 +08:00
SethBurkart123 ff01b44ead fix: flashing news sidebar button #303 2025-06-06 12:40:24 +10:00
SethBurkart123 72f7eeb935 fix: 12 hour time in timetable not applying correctly #303 2025-06-06 12:30:36 +10:00
SethBurkart123 a009f40ac2 feat: submitted column + bug fixes 2025-06-06 12:21:46 +10:00
SethBurkart123 c202af9688 feat: horizontal scrolling on timetable in homepage 2025-06-06 12:12:51 +10:00
SethBurkart123 7a91550de5 feat: cleanup assessmentsOverview 2025-06-06 11:52:24 +10:00
SethBurkart123 c4dc4b58b8 feat: assessment overview get letter grades from Assessment Averages plugin 2025-06-06 10:36:19 +10:00
SethBurkart123 d59802d4c3 fix: settings popup not appearing on disabled pages 2025-06-06 10:27:00 +10:00
SethBurkart123 074c2ff4bb feat: performance and visual improvements 2025-06-06 10:16:42 +10:00
Seth Burkart e94008efba Merge pull request #304 from Jones8683/main
Fix profile pic and add light mode styling
2025-06-05 23:18:03 +10:00
SethBurkart123 972783eb13 feat: assessments kanban overview 2025-06-05 23:14:34 +10:00
Jones 9af3ca4516 Merge branch 'BetterSEQTA:main' into main 2025-06-05 14:08:03 +09:30
Jones8683 60b4438552 remove e 2025-06-05 14:07:29 +09:30
Jones8683 d3dadad982 Fix profile pic and add light mode styling 2025-06-05 14:07:04 +09:30
SethBurkart123 bf01c0ca7b feat: custom shortcut icons #258 2025-06-04 21:42:32 +10:00
SethBurkart123 3821034a5c feat: profile picture add border 2025-06-04 17:13:12 +10:00
SethBurkart123 c218f184c0 feat: performance improvements to profile picture plugin 2025-06-04 16:14:54 +10:00
Seth Burkart 4b67736da2 Merge pull request #291 from AdenMGB/main
Add comments to code
2025-06-04 16:12:12 +10:00
Seth Burkart 8e107800f1 Merge branch 'main' into main 2025-06-04 16:12:05 +10:00
Seth Burkart f44d28c2b8 Merge pull request #301 from Jones8683/patch-1
Update injected.scss - Add rounded corners for music lessons/tutorial…
2025-06-04 16:10:36 +10:00
Seth Burkart 058cbb0bfa Merge pull request #300 from Jones8683/main
Remove "here" button and replace with contrib.rocks graph
2025-06-04 16:10:08 +10:00
SethBurkart123 9b13e7571a feat: profile picture plugin #256 2025-06-04 16:08:01 +10:00
SethBurkart123 6c12f5cf00 feat: apply 12 hour time to timetable #280 2025-06-04 15:44:51 +10:00
Jones df385775d9 Update injected.scss - Add rounded corners for music lessons/tutorials and custom events 2025-06-04 14:26:45 +09:30
Jones dce112d129 Merge branch 'BetterSEQTA:main' into main 2025-06-04 14:12:50 +09:30
SethBurkart123 f62d712549 fix: sidebar icons revert back to old style after reload #282 2025-06-04 12:02:00 +10:00
Jones8683 148559556a realign 'buy me a cofffeee! 2025-06-04 08:30:43 +09:30
Jones8683 0c2bdf36cf Align links for parity with openaboutpage.ts 2025-06-04 08:27:53 +09:30
Jones ee002991af Update injected.scss
remove CSS for old "here" button
2025-06-04 07:43:45 +09:30
Jones8683 c53de6ed8d Adjust alignment 2025-06-03 19:11:31 +09:30
Jones8683 98560af0a3 align links properly 2025-06-03 19:10:35 +09:30
Jones8683 f9fa334e40 fix 2025-06-03 18:58:02 +09:30
Jones8683 a7e250a86d commit 2025-06-03 18:57:00 +09:30
Jones8683 b3db85c565 Neaten pfps 2025-06-03 18:42:08 +09:30
Jones8683 c9d9611e3e Re-align 'All Contributers' to left 2025-06-03 18:32:51 +09:30
Jones Jankovic a1f480855e add contributer graph to openaboutpage.ts 2025-06-03 14:51:10 +09:30
Seth Burkart 9c3c63e497 Merge pull request #293 from Jones8683/main
Restyle "here" button in openaboutpage.ts
2025-06-03 13:35:37 +10:00
Jones 418c3c010e Delete Push Procedure.txt idk why this was here it was an acciadent 2025-06-02 19:13:00 +09:30
Jones Jankovic 4c55cf4331 Change name of class selector 2025-06-02 19:10:52 +09:30
Alphons Joseph 0b93223b84 capitalise here 2025-06-02 17:00:01 +08:00
Jones 84ab19eee7 Update injected.scss - fix indents 2025-06-01 10:13:24 +09:30
Jones 94b479519a Merge branch 'BetterSEQTA:main' into main 2025-06-01 10:11:34 +09:30
Seth Burkart af68eb5534 Merge pull request #298 from Jones8683/patch-1
Update README.md - Fix indents
2025-06-01 05:22:16 +10:00
Jones 94e527c73d Merge branch 'BetterSEQTA:main' into main 2025-05-31 19:45:22 +09:30
Jones 3b9f8124cf Update README.md - Fix indents 2025-05-31 19:39:03 +09:30
Seth Burkart 4c69ba7794 Merge pull request #295 from Jones8683/patch-1
Fix numbering in instructions
2025-05-31 19:50:25 +10:00
Jones 6e43be2a18 Update README.md - Fix numbering for instructions 2025-05-30 19:49:17 +09:30
Jones 37a13cba07 Update README.md - Fix numbering for instructions 2025-05-30 19:47:31 +09:30
Jones a855fbe9ec Update README.md - Fix spelling
Somehow "preferred" was misspelled three whole times
2025-05-30 18:45:26 +09:30
Jones8683 1206fb655d Update injected.scss - add styling for openaboutpage.ts 2025-05-30 12:33:40 +09:30
Jones8683 1ae9bd0652 Add about-here-link styles to injected.scss 2025-05-30 12:28:47 +09:30
Jones 280163111e Update OpenAboutPage.ts - Move css to injected.scss 2025-05-30 12:16:53 +09:30
Jones 59e195d2aa Update OpenAboutPage.ts - Fix coloring 2025-05-30 12:10:36 +09:30
Jones 37d62cf2a8 Neaten "here" button in openaboutpage.ts 2025-05-30 12:08:11 +09:30
Jones8683 6e5c3b4733 Neaten 'here' button 2025-05-30 12:05:23 +09:30
Seth Burkart ac9761286c Merge pull request #292 from Jones8683/main
Increase chunk size limit warning so that it doesn't appear
2025-05-30 11:59:51 +10:00
Jones d7fc7582d1 Remove chunk size warning 2025-05-30 09:57:22 +09:30
Aden Lindsay 425860c7cc Merge pull request #3 from AdenMGB/add-jsdoc-comments
Add jsdoc comments
2025-05-29 22:27:08 +09:30
google-labs-jules[bot] 69ac159bad I've added JSDoc comments to various files in the lib directory.
This change introduces JSDoc-style comments to several TypeScript and JavaScript files within the `lib` directory. These files primarily consist of Vite plugins, build scripts, and type definitions.

Comments were added or improved in:
- `lib/base64loader.ts`: I documented the Vite plugin for loading files as base64 data URLs.
- `lib/createManifest.ts`: I enhanced existing comments for functions that create extension manifest objects.
- `lib/inlineWorker.ts`: I documented the Vite plugin for bundling and inlining web worker scripts.
- `lib/utils.ts`: I added comments to utility types and the `createEnum` function, including a note on its type signature vs. runtime behavior.
- `lib/closePlugin.ts`: I documented the Vite plugin for handling build completion and exiting the process.
- `lib/publish.js`: I added comments to functions within the command-line script used for publishing the extension.
- `lib/touchGlobalCSS.ts`: I documented the Vite plugin for improving HMR reliability for global CSS files.
- `lib/types.ts`: I added comments to various type definitions, interfaces, and enum-like objects related to manifests, build configurations, and supported technologies.
2025-05-29 12:55:09 +00:00
google-labs-jules[bot] 4c93bcd0d7 I've added JSDoc comments to interface hooks and utils.
This change introduces JSDoc-style comments to several TypeScript files within your `src/interface` directory to improve code understanding and maintainability, focusing on hooks and utility functions.

- `src/interface/hooks/BackgroundDataLoader.ts`: I added comments to all exported functions and the `BackgroundDB` interface, detailing IndexedDB interactions for background image storage.
- `src/interface/hooks/SettingsPopup.ts`: I documented the public methods of the `SettingsPopup` singleton, which handles event notifications for settings popup closures.
- `src/interface/utils/themeImageHandlers.ts`: I added comments to all exported functions, explaining their roles in managing images within custom themes (uploading, removing, etc.).
- `src/interface/hooks/BackgroundUpdates.ts`: I documented the `BackgroundUpdates` singleton class and its methods, used for broadcasting generic background update events.
- `src/interface/hooks/ThemeUpdates.ts`: I documented the `ThemeUpdates` singleton class and its methods, responsible for broadcasting theme-related update events.
2025-05-29 12:41:31 +00:00
Aden Lindsay c596e65449 Merge pull request #2 from AdenMGB/add-jsdoc-comments
added JSDoc comments to background, plugin core, and settings fi…
2025-05-29 21:58:45 +09:30
google-labs-jules[bot] afdbfe3190 I've added JSDoc comments to background, plugin core, and settings files.
This change introduces JSDoc-style comments to several key areas of the extension to improve your code's understanding and maintainability:

- `src/background/news.ts`: I added comments to `fetchNews`, `fetchAustraliaNews`, and `rssFeedsByCountry` to explain news fetching logic.
- `src/plugins/core/manager.ts`: I added comprehensive JSDoc comments to the `PluginManager` class and its methods, detailing its role in the plugin lifecycle.
- `src/plugins/core/createAPI.ts`: I documented `createPluginAPI` (which creates the main API for plugins) and `createSettingsAPI` (responsible for plugin settings management, initially misidentified as `createPluginSettings`).
- `src/plugins/core/settingsHelpers.ts`: I added comments to functions that define the structure of plugin settings (e.g., `numberSetting`, `stringSetting`, `defineSettings`, `Setting` decorator), clarifying their definition-time role.
2025-05-29 12:27:47 +00:00
Aden Lindsay f1137763a6 Merge pull request #1 from AdenMGB/add-jsdoc-comments
Add JSDoc comments to various utility functions and core files.
2025-05-29 21:52:12 +09:30
google-labs-jules[bot] 074e73b0fd Add JSDoc comments to various utility functions and core files.
This change adds JSDoc-style comments to several functions and classes across the codebase to improve readability and maintainability.

Comments were added to:
- `src/SEQTA.ts`: Explained the `init()` function.
- `src/seqta/utils/waitForElm.ts`: Detailed the `waitForElm()` function, its parameters, and behavior.
- `src/seqta/utils/stringToHTML.ts`: Clarified the `stringToHTML()` function, including its sanitization and styling features.
- `src/seqta/utils/delay.ts`: Added a brief explanation for the `delay()` utility.
- `src/seqta/utils/mutex.ts`: Documented the `Mutex` class and its `acquire` method (renamed from `lock`), explaining its asynchronous locking mechanism and the role of the returned unlock function.
2025-05-29 12:19:57 +00:00
Seth Burkart fc4b121d30 Merge pull request #262 from ar-cyber/patch-27
add a type to bug and fr reports
2025-05-29 13:48:17 +10:00
Seth Burkart 55c48cbe5c Merge pull request #286 from BlastedMeteor44/main
OpenAboutPages.ts update to include all contributors
2025-05-29 13:47:56 +10:00
Seth Burkart 72b18dfb7d Merge branch 'main' into main 2025-05-29 13:47:32 +10:00
Seth Burkart d0cb352e74 Merge pull request #285 from Jones8683/main
Remove un-needed scrollbar in openaboutpage.ts
2025-05-29 13:46:34 +10:00
BlastedMeteor44 8fee6ddb76 OpenAboutPages.ts update to include all contributors 2025-05-28 10:42:33 +08:00
Jones 599f20e6d0 Add oxford comma 2025-05-28 10:00:22 +09:30
Jones 07af33eb78 Update OpenAboutPage.ts - Remove scrollbar to nowhere 2025-05-28 08:33:26 +09:30
Jones f03d25f918 Update OpenAboutPage.ts - Remove scrollbar to nowhere 2025-05-28 08:30:10 +09:30
SethBurkart123 1adb18ca42 feat: cleanup and changelog for update 2025-05-28 07:41:36 +10:00
Andrew R 8f7a9b655a Update feature_request.yml 2025-05-07 19:55:48 +09:30
Andrew R 899ba46995 Update feature_request.yml 2025-05-07 19:55:02 +09:30
Andrew R ccb465cc2d add a type to bug and fr reports 2025-05-07 19:54:18 +09:30
571 changed files with 77875 additions and 6865 deletions

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
# Optional OAuth client ID overrides (secrets live on accounts.betterseqta.org)
# GOOGLE_OAUTH_CLIENT_ID=your-id.apps.googleusercontent.com
# OUTLOOK_OAUTH_CLIENT_ID=your-azure-application-client-id
+21 -22
View File
@@ -5,31 +5,30 @@
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"extends": ["eslint:recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
// allow importing ts extensions
"sort-imports": [
"error",
{
"ignoreCase": true,
"ignoreDeclarationSort": true,
"ignoreMemberSort": false,
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
}
],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"ts": "never",
"tsx": "never"
}
]
"plugins": ["@typescript-eslint", "import"],
"ignorePatterns": ["**/*.d.ts"],
"globals": {
"__ENABLE_GH_RELEASE_UPDATE_CHECK__": "readonly",
"__GH_RELEASE_REPO__": "readonly",
"__UPDATE_CHANNEL__": "readonly",
"__BUILD_LABEL__": "readonly"
},
"plugins": ["import"]
"rules": {
"no-unused-vars": "off",
"no-undef": "off",
"no-useless-escape": "off",
"no-prototype-builtins": "off",
"no-empty": "off",
"no-case-declarations": "off",
"no-irregular-whitespace": "off",
"sort-imports": "off",
"import/extensions": "off",
"no-async-promise-executor": "off"
}
}
+1
View File
@@ -2,6 +2,7 @@ name: Bug report
description: Report an issue with the modpack in its unmodified state. For other issues, use Discord.
labels: bug
title: "[BUG]"
type: "Bug"
body:
- type: markdown
attributes:
@@ -2,6 +2,7 @@ name: Feature request
description: Suggest a new Feature to be added or replaced in BetterSeqtaPLUS
labels: enhancement
title: "[FR]"
body:
- type: checkboxes
attributes:
+114
View File
@@ -0,0 +1,114 @@
name: 🙋 New Contributor - Need Help Getting Started
description: Perfect for first-time contributors who need guidance
labels: ["help wanted", "documentation"]
title: "[NEW CONTRIBUTOR] "
body:
- type: markdown
attributes:
value: |
## Hi there! 👋
Welcome to BetterSEQTA+! We're excited to have you join our community.
- type: checkboxes
attributes:
label: Tell us about yourself (check all that apply)
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
- type: checkboxes
attributes:
label: Have you read our guides?
options:
- label: "Getting Started Guide (see docs/GETTING_STARTED_CONTRIBUTING.md)"
required: true
- label: "Architecture Guide (see docs/ARCHITECTURE.md)"
required: true
- label: "Plugin Development Guide (see docs/plugins/README.md)"
required: true
- type: checkboxes
attributes:
label: Have you set up the development environment yet?
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
- type: input
attributes:
label: Errors
description: "Please list any encountered errors here:"
placeholder: "I am encountering issues with..."
validations:
required: false
- type: input
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..."
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!**
@@ -0,0 +1,59 @@
name: Build Extension
description: Install dependencies, build Chrome and Firefox extensions, and package zips.
inputs:
gh_release_update_check:
description: Enable GitHub release update checker in the built extension.
required: false
default: "false"
update_channel:
description: Update channel baked into the build (stable or nightly).
required: false
default: stable
build_label:
description: Optional build label for nightly display (e.g. UTC build date).
required: false
default: ""
release_repo:
description: GitHub repo slug for the update checker (owner/name).
required: false
default: BetterSEQTA/BetterSEQTA-Plus
outputs:
version:
description: Version from package.json
value: ${{ steps.version.outputs.version }}
chrome_zip:
description: Path to the Chrome extension zip
value: ${{ steps.zip.outputs.chrome_zip }}
firefox_zip:
description: Path to the Firefox extension zip
value: ${{ steps.zip.outputs.firefox_zip }}
runs:
using: composite
steps:
- name: Setup Node and dependencies
uses: ./.github/actions/setup-node-deps
- name: Read version
id: version
shell: bash
run: echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
- name: Build extension
shell: bash
env:
GH_RELEASE_UPDATE_CHECK: ${{ inputs.gh_release_update_check }}
UPDATE_CHANNEL: ${{ inputs.update_channel }}
GH_RELEASE_REPO: ${{ inputs.release_repo }}
BUILD_LABEL: ${{ inputs.build_label }}
run: npm run build
- name: Package zips
id: zip
shell: bash
env:
UPDATE_CHANNEL: ${{ inputs.update_channel }}
BUILD_LABEL: ${{ inputs.build_label }}
run: node scripts/package-extension-zips.mjs "${{ steps.version.outputs.version }}"
+11
View File
@@ -0,0 +1,11 @@
name: Run lint
description: Run ESLint on src.
runs:
using: composite
steps:
- name: Lint
shell: bash
run: npm run lint
env:
ESLINT_USE_FLAT_CONFIG: "false"
@@ -0,0 +1,9 @@
name: Run smoke tests
description: Verify built extension dist output.
runs:
using: composite
steps:
- name: Smoke tests
shell: bash
run: npm run test:smoke
@@ -0,0 +1,9 @@
name: Run unit tests
description: Run Jest unit tests.
runs:
using: composite
steps:
- name: Unit tests
shell: bash
run: npm run test:unit
@@ -0,0 +1,14 @@
name: Setup Node and dependencies
description: Install Node.js 22.x and npm dependencies.
runs:
using: composite
steps:
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install dependencies
shell: bash
run: npm install --legacy-peer-deps
+1
View File
@@ -0,0 +1 @@
Experimental nightly build from `main`. May break. **Do not upload to Chrome Web Store or Firefox Add-ons.** Download, replace your sideloaded copy, and reload the extension.
-38
View File
@@ -1,38 +0,0 @@
name: NodeJS Build
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build
run: |
npm install --legacy-peer-deps
npm run build
- name: Zip dist folder
run: |
zip -r dist.zip dist
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist-zip
path: dist.zip
+62
View File
@@ -0,0 +1,62 @@
# 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).
name: Nightly Release
on:
schedule:
# 13:30 UTC = 00:00 Adelaide during daylight saving (ACDT, UTC+10:30)
- cron: "30 13 * * *"
permissions:
contents: write
env:
NIGHTLY_TAG: nightly
GH_TOKEN: ${{ github.token }}
jobs:
nightly:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Set build date
id: build_date
run: echo "date=$(TZ=Australia/Adelaide date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
- name: Build extension
id: build
uses: ./.github/actions/build-extension
with:
gh_release_update_check: "true"
update_channel: nightly
build_label: ${{ steps.build_date.outputs.date }}
release_repo: ${{ github.repository }}
- name: Ensure nightly release exists
run: |
TITLE="Nightly (${{ steps.build_date.outputs.date }})"
if ! gh release view "${{ env.NIGHTLY_TAG }}" 2>/dev/null; then
gh release create "${{ env.NIGHTLY_TAG }}" \
--prerelease \
--title "$TITLE" \
--notes-file .github/nightly-release-notes.md
else
gh release edit "${{ env.NIGHTLY_TAG }}" --title "$TITLE"
fi
- name: Upload nightly assets
run: |
gh release upload "${{ env.NIGHTLY_TAG }}" \
--clobber \
"${{ steps.build.outputs.chrome_zip }}" \
"${{ steps.build.outputs.firefox_zip }}"
+63
View File
@@ -0,0 +1,63 @@
name: CI
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
jobs:
lint:
# windows-latest: Vite/Svelte build fails on Linux CI for layerchart vendor .svelte (see nightly.yml).
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Setup Node and dependencies
uses: ./.github/actions/setup-node-deps
- name: Run lint
uses: ./.github/actions/run-lint
unit-tests:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Setup Node and dependencies
uses: ./.github/actions/setup-node-deps
- name: Run unit tests
uses: ./.github/actions/run-unit-tests
build-and-smoke:
needs: [lint, unit-tests]
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Build extension
id: build
uses: ./.github/actions/build-extension
with:
gh_release_update_check: "false"
- name: Upload extension zips
uses: actions/upload-artifact@v4
with:
name: extension-zips
path: |
${{ steps.build.outputs.chrome_zip }}
${{ steps.build.outputs.firefox_zip }}
- name: Run smoke tests
uses: ./.github/actions/run-smoke-tests
+59
View File
@@ -0,0 +1,59 @@
# 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).
name: Release
on:
workflow_dispatch:
inputs:
version_updated:
description: I have already updated the version in package.json
type: boolean
required: true
default: false
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Confirm version was updated
if: inputs.version_updated != true
run: |
echo "Check the confirmation box: you must update package.json version before releasing."
exit 1
- uses: actions/checkout@v4
- name: Read version
id: version
run: echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
- name: Build extension
id: build
uses: ./.github/actions/build-extension
with:
gh_release_update_check: "true"
update_channel: stable
release_repo: ${{ github.repository }}
- name: Create release if missing
run: |
if ! gh release view "${{ steps.version.outputs.version }}" 2>/dev/null; then
gh release create "${{ steps.version.outputs.version }}" \
--title "${{ steps.version.outputs.version }}" \
--notes "Edit this release description on GitHub."
fi
- name: Upload release assets
run: |
gh release upload "${{ steps.version.outputs.version }}" \
--clobber \
"${{ steps.build.outputs.chrome_zip }}" \
"${{ steps.build.outputs.firefox_zip }}"
+15 -6
View File
@@ -4,12 +4,14 @@ package-lock.json
bun.lockb
pnpm-lock.yaml
yarn.lock
bun.lock
.parcel-cache
.env
.env.submit
dependency-graph.svg
# PDF.js extension assets (copied by postinstall from pdfjs-dist)
src/public/resources/pdfjs/pdf.worker.min.mjs
src/public/resources/pdfjs/pdf.legacy.min.mjs
# ONNX Runtime WASM assets (copied by postinstall from @huggingface/transformers)
src/public/resources/ort/ort-wasm-simd-threaded.jsep.mjs
src/public/resources/ort/ort-wasm-simd-threaded.jsep.wasm
# Build
extension.zip
@@ -19,5 +21,12 @@ betterseqtaplus-safari/
.million/
.vscode/
.cursor/
**/.DS_Store
.parcel-cache
.env
.env.submit
dependency-graph.svg
update-videos/
**/.DS_Store
+1
View File
@@ -0,0 +1 @@
legacy-peer-deps=true
-5
View File
@@ -1,5 +0,0 @@
{
"transformers": {
"raw:*": ["@parcel/transformer-raw"]
}
}
+25 -7
View File
@@ -1,13 +1,31 @@
# Contributing
# Contributing to BetterSEQTA+
When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.
Hey there! 👋 Thanks for your interest in contributing to BetterSEQTA+! We're excited to have you join our community of contributors.
## 🚀 New Contributors Start Here!
**Never contributed to an open source project before?** No worries! We've made it super easy to get started:
- **📖 Read our [contributing guide](https://docs.betterseqta.org/contributing/)** - This walks you through everything step-by-step, from setting up your development environment to making your first pull request.
- **🏗️ Understand the codebase** with the [architecture guide](https://docs.betterseqta.org/architecture/)
- **🔧 Having issues?** Check the [troubleshooting guide](https://docs.betterseqta.org/troubleshooting/)
We have lots of [`good first issue`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/good%20first%20issue) labels that are perfect for beginners!
## Discussion Before Contributing
For significant changes, please first discuss what you'd like to change via:
- Opening an issue
- Joining our Discord server
- Emailing the maintainers
This helps ensure your contribution aligns with the project's goals and saves you time!
## Community
Join our community channels to discuss the project, get help, and connect with other contributors:
- **Discord Server**: [Join our Discord](https://discord.gg/betterseqta)
- **Discord Server**: [Join our Discord](https://discord.gg/YzmbnCDkat)
- **GitHub Discussions**: For longer-form conversations
- **GitHub Issues**: For bug reports and feature requests
@@ -15,13 +33,13 @@ Join our community channels to discuss the project, get help, and connect with o
If you're interested in creating plugins for BetterSEQTA+, check out our plugin development guides:
- [Creating Your First Plugin](./docs/plugins/creating-plugins.md)
- [Plugin API Reference](./docs/advanced/plugin-api.md)
- [Plugin development](https://docs.betterseqta.org/plugin-development/)
- [Plugin API](https://docs.betterseqta.org/plugin-api/)
## Pull Request Process
1. It is recommended to start by opening an issue to discuss the change you wish to make. This will allow us to discuss the change and ensure it is a good fit for the project.
2. Fork the repo and create your branch from `master`.
2. Fork the repo and create your branch from `main`.
3. When writing your pull request, make sure to use the pull request template.
### Pull Request Template
+32 -76
View File
@@ -1,16 +1,14 @@
#
<a href="https://chromewebstore.google.com/detail/betterseqta+/afdgaoaclhkhemfkkkonemoapeinchel">
<img src="https://socialify.git.ci/betterseqta/betterseqta-plus/image?description=1&font=Inter&forks=1&issues=1&logo=data%3Aimage%2Fsvg%2Bxml%2C%253Csvg%20height%3D%27656pt%27%20fill%3D%27white%27%20preserveAspectRatio%3D%27xMidYMid%20meet%27%20viewBox%3D%270%200%20658%20656%27%20width%3D%27658pt%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%253E%253Cg%20transform%3D%27matrix(.1%200%200%20-.1%200%20656)%27%253E%253Cpath%20d%3D%27m2960%206499c-918-100-1726-561-2278-1299-196-262-374-609-475-925-171-533-203-1109-91-1655%20228-1115%201030-2032%202104-2408%20356-124%20680-177%201080-176%20269%201%20403%2014%20650%2064%20790%20159%201503%20624%201980%201290%20714%20998%20799%202342%20217%203420-488%20902-1361%201515-2382%201671-113%2017-196%2022-430%2024-159%202-328-1-375-6zm566-1443c476-99%20885-385%201134-791%20190-309%20282-696%20250-1045-22-240-73-420-180-635-78-156-159-275-274-401l-77-84h445%20446v-235-236l-1162%204-1163%203-100%2023c-449%20101-812%20337-1071%20697-77%20107-193%20335-233%20459-115%20358-116%20726-1%201078%20209%20644%20766%201101%201446%201187%20128%2016%20405%204%20540-24z%27%2F%253E%253Cpath%20d%3D%27m3065%204604c-250-36-396-89-576-209-280-187-470-478-535-821-25-135-16-395%2019-525%2095-351%20331-644%20651-806%2098-49%20225-93%20331-114%2092-18%20368-18%20460%200%20481%2095%20853%20444%20982%20921%2035%20129%2044%20389%2019%20524-36%20191-121%20387-228%20531-186%20249-476%20428-783%20485-65%2012-291%2021-340%2014z%27%2F%253E%253C%2Fg%253E%253C%2Fsvg%253E&name=1&owner=1&pattern=Signal&stargazers=1&theme=Dark" />
</a>
<p align="center">
A beautiful 🤩 Chrome Extension that adds additional features and gives an overall better experience for <a href="https://educationhorizons.com/solutions/seqta/">SEQTA Learn.</a> <strong>Currently looking for contributors</strong> 🔥
A beautiful 🤩 browser extension that transforms <a href="https://www.tes.com/en-au/for-schools/seqta">SEQTA</a> with modern themes, powerful customization, productivity tools, and an improved user experience. Contributions are always welcome!
</p>
<p align="center">
<a target="_blank" href="https://chrome.google.com/webstore/detail/betterseqta%20/afdgaoaclhkhemfkkkonemoapeinchel"><img src="https://user-images.githubusercontent.com/95666457/149519713-159d7ef7-2c21-4034-a616-f037ff46d9a4.png" alt="ChromeDownload" width="250"></a>
<a target="_blank" href="https://discord.gg/YzmbnCDkat"><img src="https://github.com/SethBurkart123/EvenBetterSEQTA/assets/108050083/23055730-b16e-44c0-9bef-221d8545af92" width="240" style="border-radius:10%;" /></a>
<a target="_blank" href="https://chromewebstore.google.com/detail/betterseqta+/afdgaoaclhkhemfkkkonemoapeinchel"><img src="https://user-images.githubusercontent.com/95666457/149519713-159d7ef7-2c21-4034-a616-f037ff46d9a4.png" alt="ChromeDownload" width="250"></a>
<a target="_blank" href="https://discord.gg/YzmbnCDkat"><img src="https://github.com/BetterSEQTA/BetterSEQTA-Plus/assets/108050083/23055730-b16e-44c0-9bef-221d8545af92" width="240" style="border-radius:10%;" /></a>
</p>
<div>
@@ -18,17 +16,16 @@
<img src="https://img.shields.io/chrome-web-store/rating/afdgaoaclhkhemfkkkonemoapeinchel" />
</div>
## Table of contents
## Documentation
- [Features](#features)
- [Creating Custom Themes](#creating-custom-themes)
- [Getting Started](#getting-started)
- [Running Development](#running-development)
- [Building for production](#building-for-production)
- [Folder Structure](#folder-structure)
- [Contributors](#contributors)
- [Credits](#credits)
- [Star History](#star-history)
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
## Features
@@ -52,74 +49,31 @@
## Creating Custom Themes
If you are looking to create custom themes, I would recommend you start at the official documentation [here](https://betterseqta.gitbook.io/betterseqta-docs). You can see some premade examples along with a compilation script that can be used to allow for CSS frameworks and libraries such as SCSS to be used [here](https://github.com/BetterSEQTA/BetterSEQTA-Theme-Generator).
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).
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 :)
## Getting started
## 🚀 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
1. Clone the repository
```
git clone https://github.com/BetterSEQTA/BetterSEQTA-Plus
```
## ⚡ Quick Start
1. Install dependencies
```bash
git clone https://github.com/YOUR_USERNAME_FORKED_WITH/BetterSEQTA-Plus
cd BetterSEQTA-Plus
npm install --legacy-peer-deps
npm run dev
````
You may install the dependencies like below:
Then load `dist` in `chrome://extensions` (Developer Mode → Load unpacked).
```
npm install # or your preferred package manager like pnpm or yarn
```
But it is recommended to do it like this:
```
npm install --legacy-peer-deps # Only NPM supported
```
### Running Development
2. Run the dev script (it updates as you save files)
```
npm run dev # or use your perferred package manager
```
### Building for production
2. Run the build script
```
npm run build # or use your perferred package manager
```
2.1. Package it up (optional)
```
npm run zip # This REQUIRES 7-Zip to be installed in order to work. You can also use your perferred package manager
```
3. Load the extension into chrome
- Go to `chrome://extensions`
- Enable developer mode
- Click `Load unpacked`
- Select the `dist` folder
Just remember, in order to update changes to the extension if you are running in developer mode, you need to click the refresh button on the extension in `chrome://extensions` whenever anything's changed.
## Folder Structure
The folder structure is as follows:
- The `src` folder contains source files that are compiled to the build directory.
- The `src/plugins` folder contains vital loaders required for BetterSEQTA+ functionality.
- The `src/interface` folder contains source React & Svelte files that are required for the Settings page.
- The `dist` folder is where the compiled code ends up, this is the folder what you need to load into chrome as an unpacked extension for development.
Full development setup guide can be found [here](https://docs.betterseqta.org/install/#for-developers-development-environment).
## Contributors
@@ -127,11 +81,13 @@ The folder structure is as follows:
<img src="https://contrib.rocks/image?repo=betterseqta/betterseqta-plus" />
</a>
Want to contribute? [Click Here!](https://github.com/BetterSEQTA/BetterSEQTA-Plus/blob/main/CONTRIBUTING.md)
Want to contribute? [Click Here!](https://docs.betterseqta.org/contributing/)
## Credits
This extension was initially developed by [Nulkem](https://github.com/Nulkem/betterseqta), was ported to manifest V3 by [MEGA-Dawg68](https://github.com/MEGA-Dawg68) and is currently under active development from lead developers [SethBurkart123](https://github.com/SethBurkart123) and [Crazypersonalph](https://github.com/Crazypersonalph) with help from other volunteers
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!
## Star History
+6 -6
View File
@@ -2,15 +2,15 @@
## Supported Versions
Below here is the supported versions of BetterSEQTA+. Anything older than this is not supported and contains bugs.
The following versions of BetterSEQTA+ are currently supported.
| Version | Supported |
| ------- | --------- |
| 3.4.3 | ✅ |
| < 3.4.3 | :x: |
`*` May not work on other devices.
| 3.4.3 or later | ✅ |
| Earlier than 3.4.3 | ❌ |
## Reporting a Vulnerability
If you find vulnerabilities, REPORT IT IMMEDIATELY. open the [advisories tab](https://github.com/BetterSEQTA/BetterSEQTA-Plus/security/advisories) on the left and click the green "report a vulnerability" button or use [this quick-link](https://github.com/BetterSEQTA/BetterSEQTA-Plus/security/advisories/new) to create a new report
If you discover a security vulnerability, please report it responsibly through GitHub Security Advisories:
https://github.com/BetterSEQTA/BetterSEQTA-Plus/security/advisories/new
+3001
View File
File diff suppressed because it is too large. Load diff
+237
View File
@@ -0,0 +1,237 @@
# 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. 🚀
File diff suppressed because it is too large. Load diff
+146
View File
@@ -0,0 +1,146 @@
# BetterSEQTA Cloud — settings sync (server specification)
This document describes the HTTP API the BetterSEQTA+ extension expects for **cloud backup of extension settings**. The client is implemented in the extension repo; the accounts service (`accounts.betterseqta.org`) must implement these endpoints.
## Purpose
- Store **one JSON document per authenticated BetterSEQTA Cloud user** representing a snapshot of the extension’s `chrome.storage.local` data (theme, layout, plugin settings, `plugin.*` keys, etc.).
- The extension **does not upload OAuth tokens** (`bsplus_token`, `bsplus_refresh_token`, `bsplus_client_id`, `bsplus_user`). Those remain only on the client.
- **Download** replaces local storage with the stored snapshot, then the client reapplies the current device’s session tokens so the user stays signed in.
## Base URL
All routes below are relative to:
`https://accounts.betterseqta.org`
## Authentication
Every request must include:
```http
Authorization: Bearer <access_token>
```
Use the same **access tokens** issued by the existing BetterSEQTA+ OAuth flows (`/api/bsplus/login`, `/api/bsplus/refresh`). Resolve the user from the token; the document is scoped to that user.
## Endpoints
### `PUT /api/bsplus/settings/sync`
Upserts the caller’s settings backup. The server **merges** `data` into the stored JSON document; keys omitted from the patch are **not** deleted.
**Request body (JSON):**
```json
{
"schemaVersion": 1,
"themeId": "uuid-string-or-empty",
"data": {
"DarkMode": true,
"selectedTheme": "uuid-or-empty-string"
}
}
```
The extension sends a **sparse patch**: only keys that changed since the last successful upload (or, on first upload, keys that differ from schema defaults). A full snapshot is not required.
- **`schemaVersion`**: integer. The extension currently sends `1`. The server may reject unknown major versions or store it for future migrations.
- **`themeId`**: optional but recommended duplicate of **`data.selectedTheme`**. Should be the UUID of the **installed** BetterSEQTA store theme (`selectedTheme`). This may be a normal theme id **or** a **flavour (slave) variant** id from themes with **`flavours[]`** — the extension uses it after restore to prefetch `theme.json` when missing locally (same **`GET …/themes/{id}/download`** as the store UI). Persist and return **`themeId`** in sync with **`data.selectedTheme`**.
- **`data`**: object whose keys are storage keys (strings) and values are JSON-serializable values (same types as stored in `chrome.storage.local`).
**Success response:** HTTP `200` (or `201` if you prefer create semantics). Example:
```json
{
"updated_at": "2026-04-07T12:00:00.000Z",
"patch": { "DarkMode": true }
}
```
`updated_at` should be an ISO 8601 timestamp of the save time. The extension displays success without requiring extra fields. Optional `patch` may echo the merged keys applied server-side.
**Error responses:** Standard JSON error body if applicable, e.g. `{ "error": "message" }`, with appropriate HTTP status (`401`, `413`, `422`, etc.).
---
### `GET /api/bsplus/settings/sync`
Returns the caller’s latest settings backup.
**Success response:** HTTP `200` with body:
```json
{
"schemaVersion": 1,
"themeId": "uuid-string-or-empty",
"data": { },
"updated_at": "2026-04-07T12:00:00.000Z"
}
```
- **`data`**: required for restore; must be the same shape as accepted in `PUT` (flat map of storage keys).
- **`themeId`**: optional; if present must match **`data.selectedTheme`** (see `PUT`).
- **`schemaVersion`**: optional but recommended; should match what was stored.
- **`updated_at`**: optional; included for UX if the client shows “last backup” time.
The extension resolves **`themeId`** (if non-empty), else **`data.selectedTheme`,** to [`resolveThemeIdForPostSyncDownload`](../src/seqta/utils/cloudSettingsSync.ts) after downloading the envelope — used only to reinstall theme assets from **`betterseqta.org`** when IndexedDB lacks that id (see **BetterSEQTA Cloud** flavour note in **[THEME_STORE_FLAVOURS_API](./THEME_STORE_FLAVOURS_API.md)** section “Cloud settings sync compatibility”).
**No backup yet:** HTTP **`404`**. The extension treats this as “nothing in the cloud” and shows an error to the user.
**Error responses:** `401` if the token is invalid, etc.
---
## Suggested database shape
Example relational layout:
| Column | Type | Notes |
|---------------|-------------|--------|
| `user_id` | FK → users | Unique per backup row (one row per user). |
| `payload` | JSON / JSONB| Store `{ "schemaVersion", "data" }` or only `data` + separate `schema_version` column. |
| `updated_at` | timestamptz | Set on each successful `PUT`. |
Unique constraint on `user_id`.
## Semantics
- **Merge on PUT:** each `PUT` deep-merges `data` into the stored backup for that user. Keys not present in the request body remain unchanged on the server.
- **Full document on GET:** restore and poll download still receive the complete hydrated settings object.
- **Optional later:** `If-Unmodified-Since` or a `revision` field for conflict detection (not required for v1).
## Security and privacy
- **Encryption at rest** for `payload` is recommended.
- Payload may contain **school-related UI preferences** and plugin data; treat as **user data** under your privacy policy.
- **Do not require or store** refresh/access tokens in the payload; the extension already strips them on upload.
### Never included in the sync payload (`chrome.storage.local` only)
The backup is a flat JSON map of **`chrome.storage.local`** keys. It does **not** include:
- **IndexedDB** — e.g. the Global Search index (`betterseqta-index` and related DBs) lives outside extension storage and is never serialized here.
- **OAuth / session keys** — `bsplus_token`, `bsplus_refresh_token`, `bsplus_client_id`, `bsplus_user`, plus legacy `cloudAccessToken` / `cloudUsername`.
- **Assessment Averages caches** — `plugin.assessments-average.storage.assessments`, `plugin.assessments-average.storage.weightings` (school assessment data).
- **Keys under** `plugin.global-search.storage.*` — reserved so any future plugin storage cache there is not synced.
- **Grade Analytics** — keys under `bsplus.analytics.*` (synced assessment cache and per-school chart preferences).
- **`bsplus_cloud_settings_last_uploaded_snapshot`** — client-only normalized map last acked by PUT; used to compute sparse upload patches (not part of the cloud backup blob).
- **`bsplus_cloud_settings_known_remote_updated_at`** — client-only watermark for auto-sync (not part of the cloud backup blob).
On restore, those keys are **not** taken from the server; the device keeps its current local values.
## Related endpoint: `GET /api/user/cloud-summary`
The extension may call **`GET /api/user/cloud-summary`** (same host, `Authorization: Bearer`) for a **small** JSON summary (e.g. whether DesQTA / BetterSEQTA+ cloud settings exist and **`bsplus.updated_at`** / **`schemaVersion`**). It does **not** return the large settings `data` blob.
- **Auto-sync flow:** compare `bsplus.updated_at` to a **client-only** watermark stored in extension storage as **`bsplus_cloud_settings_known_remote_updated_at`** (never uploaded, never applied from the server payload; preserved on restore).
- If the server timestamp is newer (and `schemaVersion` is not ahead of the client), the client then calls **`GET /api/bsplus/settings/sync`** and applies the full envelope as usual.
This uses standard **WebExtension** APIs (`browser.alarms`, `runtime` messages, `storage`) and works on **Chromium and Firefox** builds (see `webextension-polyfill`).
## Client reference (extension)
- Upload (sparse patch): `buildUploadPatch` / `putSettingsOnce` in `src/background/cloudSettingsAutoSync.ts`; baseline from `bsplus_cloud_settings_last_uploaded_snapshot` or schema defaults; dev full export via `getSnapshotForUpload` / `buildUploadPayload` in `src/seqta/utils/cloudSettingsSync.ts` (strips OAuth-related keys, sensitive device keys, client-only metadata — includes **`themeId`** aligned with **`selectedTheme`**).
- Download: resolve id via **`resolveThemeIdForPostSyncDownload`** → **`applyDownloadedEnvelope`** after `GET` → prefetch theme blobs in page context if needed (**`prepareThemeAfterCloudSync`** in **`ThemeManager`**) → reload SEQTA tabs; local auth keys, sensitive device keys, client-only watermark, and **`bsplus_pending_theme_ensure_after_cloud`** semantics preserved as documented above.
- Auto sync (summary, debounced upload, alarms): `src/background/cloudSettingsAutoSync.ts`; content script triggers a poll on each verified SEQTA Learn/Engage page load (top frame) via `cloudSettingsPoll`.
+287
View File
@@ -0,0 +1,287 @@
# Getting Started as a Contributor
**Published version:** [docs.betterseqta.org/contributing/](https://docs.betterseqta.org/contributing/)
Welcome to BetterSEQTA+! 🎉 This guide will walk you through making your first contribution, even if you're completely new to the project.
## Table of Contents
- [Before You Start](#before-you-start)
- [Your First 30 Minutes](#your-first-30-minutes)
- [Making Your First Contribution](#making-your-first-contribution)
- [Types of Contributions](#types-of-contributions)
- [Finding Something to Work On](#finding-something-to-work-on)
- [Development Workflow](#development-workflow)
- [Getting Help](#getting-help)
## Before You Start
### What You'll Need
- **Node.js** (v16 or higher) - [Download here](https://nodejs.org/)
- **Git** - [Download here](https://git-scm.com/)
- **A code editor** - We recommend [VS Code](https://code.visualstudio.com/)
- **A Chromium browser** (Chrome, Edge, Brave) for testing (recommended, however you can use firefox although it requires being built every time you make a change)
### Helpful Background (but not required!)
- Basic JavaScript/TypeScript knowledge
- Some familiarity with HTML/CSS
- Understanding of browser extensions (we'll teach you!)
**Don't worry if you're missing some of these!** We're happy to help you learn. 🤗
## Your First 30 Minutes
Let's get you up and running quickly:
### 1. Get the Code (3 minutes)
```bash
# Fork the repository on GitHub first, then:
git clone https://github.com/YOUR_USERNAME/BetterSEQTA-plus.git
cd BetterSEQTA-plus
```
### 2. Install Dependencies (3 minutes)
```bash
npm install --legacy-peer-deps
```
### 3. Start Development Server (2 minutes)
```bash
npm run dev
```
### 4. Load Extension in Browser (4 minutes)
1. Open Chrome and go to `chrome://extensions`
2. Enable "Developer mode" (toggle in top right)
3. Click "Load unpacked"
4. Select the `dist` folder in your project
5. Visit a SEQTA Learn page to see BetterSEQTA+ in action!
### 5. Make a Tiny Change (5 minutes)
Let's prove everything works:
1. Open `src/SEQTA.ts`
2. Find the line that says `"[BetterSEQTA+] Successfully initialised"`
3. Change it to `"[BetterSEQTA+] Successfully initialised - Hello [YOUR_NAME]!"`
4. Save the file
5. Go to `chrome://extensions`, click the refresh icon on BetterSEQTA+
6. Refresh a SEQTA page and check the browser console (F12) - you should see your message!
### 6. Reset Your Change (3 minutes)
```bash
git checkout -- src/SEQTA.ts
```
**Congratulations! 🎉 You've successfully set up BetterSEQTA+ for development!**
## Making Your First Contribution
### Easy First Contributions
Here are some great starter contributions:
1. **Fix a typo in documentation** - Super easy and always appreciated!
2. **Improve error messages** - Make them more helpful
3. **Add comments to code** - Help other contributors understand
4. **Create a simple plugin** - Follow our plugin guide
5. **Fix a bug you found** - If you found a bug, fix it!
### Step-by-Step: Your First Pull Request
#### Step 1: Pick an Issue
- Go to our [Issues page](https://github.com/BetterSEQTA/BetterSEQTA-plus/issues)
- Look for labels like:
- `good first issue` - Perfect for beginners
- `help wanted` - We'd love help with these
- `documentation` - Improve our docs
- `bug` - Fix something broken
#### Step 2: Claim the Issue
Comment on the issue saying "I'd like to work on this!" We'll assign it to you.
#### Step 3: Create a Branch
```bash
git checkout -b fix-issue-123 # Replace 123 with the issue number
```
#### Step 4: Make Your Changes
- Follow the patterns you see in existing code
- Test your changes thoroughly
- Keep changes focused and small
#### Step 5: Test Everything
```bash
# Test the extension still loads
npm run dev
# Test in browser
# 1. Reload extension at chrome://extensions
# 2. Visit SEQTA page
# 3. Verify everything still works
```
#### Step 6: Commit Your Changes
```bash
git add .
git commit -m "Fix issue #123: Brief description of what you fixed"
```
#### Step 7: Push and Create Pull Request
```bash
git push origin fix-issue-123
```
Then go to GitHub and create a pull request with:
- **Clear title**: "Fix issue #123: Brief description"
- **Description**: Explain what you changed and why
- **Testing**: Describe how you tested it
## Types of Contributions
### 🐛 Bug Fixes
- Fix broken features
- Improve error handling
- Resolve compatibility issues
**Example**: "The theme selector doesn't work on Firefox"
### ✨ New Features
- Add new plugins
- Enhance existing functionality
- Improve user experience
**Example**: "Add keyboard shortcuts for common actions"
### 📚 Documentation
- Fix typos and unclear explanations
- Add examples and tutorials
- Improve code comments
**Example**: "Add more examples to the plugin guide"
### 🎨 Design & UI
- Improve the settings interface
- Make things more user-friendly
- Add animations and polish
**Example**: "Make the theme creator more intuitive"
### 🔧 Technical Improvements
- Refactor code for clarity
- Add tests
- Improve performance
**Example**: "Simplify the plugin loading logic"
## Finding Something to Work On
### Browse Issues by Label
- [`good first issue`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/good%20first%20issue) - Perfect for beginners
- [`help wanted`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/help%20wanted) - We need help with these
- [`documentation`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/documentation) - Improve our docs
- [`bug`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/bug) - Fix something broken
- [`enhancement`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/enhancement) - Add new features
### Create Your Own Issue
Found a bug or have an idea? Create an issue first to discuss it!
### Plugin Ideas
Want to create a plugin? Here are some ideas:
- **Study Timer**: Track study time across SEQTA pages
- **Grade Tracker**: Better visualization of grades over time
- **Quick Notes**: Add notes to any SEQTA page
- **Homework Reminder**: Smart notifications for upcoming due dates
- **Custom Shortcuts**: User-defined keyboard shortcuts
## Development Workflow
### Daily Development
```bash
# Start working
git pull origin main
npm run dev
# Make changes, test, commit
git add .
git commit -m "Descriptive commit message"
# Push when ready
git push origin your-branch-name
```
### Before Submitting PR
1. **Test thoroughly** - Make sure nothing breaks
2. **Check console** - No new errors
3. **Test in different browsers** - Chrome and Firefox
4. **Update documentation** - If you changed how something works
### Code Style
- Use TypeScript where possible
- Follow existing naming conventions
- Add comments for complex logic
- Keep functions small and focused
## Getting Help
### Stuck? Here's How to Get Unstuck
1. **Check the docs** - The [architecture guide](https://docs.betterseqta.org/architecture/) explains everything
2. **Search existing issues** - Someone might have had the same problem
3. **Ask in Discord** - Our community is super helpful
4. **Create an issue** - If you found a bug or need help
### Discord Community
Join our [Discord server](https://discord.gg/YzmbnCDkat) for:
- Real-time help and discussion
- Collaboration on features
- Sharing ideas and feedback
- Getting to know the community
### Code Review Process
- All contributions need code review
- We'll provide helpful feedback
- Don't worry about making mistakes - we're here to help!
- Reviews usually happen within 24-48 hours
## Common Questions
**Q: I'm new to browser extensions. Is this too advanced for me?**
A: Not at all! We have lots of beginner-friendly issues, and our plugin system makes it easy to add features without understanding all the browser extension complexities.
**Q: How long does it take to get my first PR merged?**
A: For simple fixes, usually 1-3 days. For larger features, it might take a week or two as we discuss the best approach.
**Q: I made a mistake in my PR. What do I do?**
A: No worries! Just push more commits to the same branch and they'll be added to your PR automatically.
**Q: Can I work on multiple issues at once?**
A: It's better to focus on one issue at a time, especially when starting out. This makes code review easier and reduces conflicts.
**Q: What if I start working on something and get stuck?**
A: Ask for help! Create a draft PR with what you have so far, and we'll help you figure out the next steps.
## Recognition
All contributors get:
- Recognition in our README
- Contributor badge in Discord
- Our eternal gratitude! 🙏
Significant contributors may also get:
- Special Discord roles
- Input on project direction
- Maintainer status
## Next Steps
Ready to contribute? Here's what to do:
1. ✅ **Set up your development environment** (follow the 30-minute guide above)
2. 🔍 **Find an issue to work on** (check the "good first issue" label)
3. 💬 **Join our Discord** and introduce yourself
4. 🚀 **Make your first contribution** and submit a PR
Remember: **Every expert was once a beginner!** We're excited to help you learn and grow as a contributor. Welcome to the team! 🎉
---
*Questions? Suggestions for improving this guide? Open an issue or message us on Discord!*
+22 -18
View File
@@ -1,27 +1,37 @@
# BetterSEQTA+ Documentation
🚧 DOCS UNDER CONSTRUCTION! 🚧
Welcome to the BetterSEQTA+ documentation! This documentation will help you understand how BetterSEQTA+ works and how to extend it with plugins and new features.
**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.
## Table of Contents
### Getting Started
- [Project Overview](./README.md) - This file
- [Installation Guide](./installation.md) - How to install and set up BetterSEQTA+
- [Contributing Guide](../CONTRIBUTING.md) - How to contribute to BetterSEQTA+
- [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/)
### Plugin System
### Features & customization
- [Creating Your First Plugin](./plugins/README.md) - A comprehensive, beginner-friendly guide to creating plugins
- [Plugin API Reference](./plugins/api-reference.md) - Detailed technical documentation of the plugin APIs
- [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. Check out our [plugin guide](./plugins/README.md) to learn how to create your own!
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.
@@ -33,19 +43,13 @@ BetterSEQTA+ is built around several core concepts:
If you need help with BetterSEQTA+, you can:
- [Open an Issue](https://github.com/SeqtaLearning/betterseqta-plus/issues) - Report bugs or request features
- [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! If you find something unclear or missing, please open an issue or submit a pull request.
To contribute to the documentation:
1. Fork the repository
2. Make your changes to the documentation files
3. Submit a pull request with a clear description of your changes
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
+267
View File
@@ -0,0 +1,267 @@
# GitHub releases, CI, and the update detector
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.
All published releases target the upstream repository: **[BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus)**.
---
## Overview
```mermaid
flowchart TB
subgraph ci [Continuous integration]
PrCi[pr-ci.yml — every PR]
Mvp[mvp.yml — push to main]
end
subgraph releases [GitHub releases]
Manual[release.yml — manual stable]
Nightly[nightly.yml — daily cron]
end
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
PrCi -->|build only| NoRelease[No release]
Mvp -->|artifact| DistZip[dist.zip artifact]
Manual --> Zips
Manual --> GhStable
Manual --> Badge
Nightly --> Zips
Nightly --> GhNightly
Nightly --> Badge
```
| 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 |
---
## Shared build action
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 install --legacy-peer-deps`)
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) |
| `GH_RELEASE_REPO` | `BetterSEQTA/BetterSEQTA-Plus` | same | same |
| `BUILD_LABEL` | empty | UTC build date (`YYYY-MM-DD`) | 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:
```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
```
---
## Stable release (`release.yml`)
**Purpose:** A safe, manual way to publish versioned builds that users can download from GitHub.
**Trigger:** Manual only — Actions → **Release** → **Run workflow**. There is no schedule or automatic trigger.
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 install --legacy-peer-deps`
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
```
+587
View File
@@ -0,0 +1,587 @@
# 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.
+350
View File
@@ -0,0 +1,350 @@
# 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 package-lock.json
npm install --legacy-peer-deps
```
### ❌ "Cannot find module" errors
**Problem**: Node.js can't find required packages.
**Solutions**:
1. **Clear and reinstall**:
```bash
rm -rf node_modules
npm install --legacy-peer-deps
```
2. **Check Node.js version**:
```bash
node --version # Should be v16 or higher
```
3. **Try with npm cache clean**:
```bash
npm cache clean --force
npm install --legacy-peer-deps
```
### ❌ 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 --legacy-peer-deps
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. 💪
+28 -6
View File
@@ -1,5 +1,7 @@
# Contributing to BetterSEQTA+
**Published version:** [docs.betterseqta.org/contributing/](https://docs.betterseqta.org/contributing/)
Thank you for your interest in contributing to BetterSEQTA+! This document provides guidelines and instructions for contributing to the project.
## Table of Contents
@@ -57,7 +59,7 @@ Key points:
5. **Install in Chrome/Firefox**
Follow the [installation instructions](./installation.md#development-installation) to load the development version into your browser.
Follow the [installation instructions](https://docs.betterseqta.org/install/) to load the development version into your browser.
### Project Structure
@@ -117,12 +119,13 @@ git checkout -b feature/my-new-feature
If your changes require documentation updates, include them in the same PR.
4. **Run Tests**
4. **Run CI checks locally**
Make sure all tests pass before submitting your PR:
Pull requests trigger **PR CI**, which lints and builds in a clean environment:
```bash
npm test
npm run lint
npm run build
```
5. **Submit Your PR**
@@ -137,6 +140,25 @@ git checkout -b feature/my-new-feature
Once approved, a maintainer will merge your PR.
### GitHub Actions workflows
See [RELEASES.md](RELEASES.md) for a full guide (workflows, sideload installs, and update detector).
| Workflow | Trigger | Purpose |
|----------|---------|---------|
| `pr-ci.yml` | Every PR to `main` | Typecheck, lint, and build (no release) |
| `mvp.yml` | Push to `main` | Build and upload `dist.zip` artifact |
| `release.yml` | Manual (`workflow_dispatch`) | Stable release on [BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus) tagged with `package.json` version |
| `nightly.yml` | Daily cron + manual | Updates the fixed `nightly` prerelease with latest `main` builds |
**Releasing a stable version:** bump `version` in `package.json` on `main`, then manually run the **Release** workflow and confirm the version checkbox. Edit the release title and notes on GitHub after the first publish. Re-running for the same tag only updates the zip files. Assets are `betterseqtaplus-{version}-chrome.zip` and `-firefox.zip`.
**Nightly builds** replace assets on the same `nightly` release. The release body warns that builds are experimental and must not be uploaded to extension stores.
**GitHub release builds** include an in-extension update checker (settings header badge). **PR CI and local dev builds do not.**
Release workflows are dispatched only on the main **BetterSEQTA/BetterSEQTA-Plus** repository and use the default `GITHUB_TOKEN`.
### Coding Standards
We follow TypeScript best practices and have a consistent code style:
@@ -246,8 +268,8 @@ Join our community channels to discuss the project, get help, and connect with o
If you're interested in creating plugins for BetterSEQTA+, check out our plugin development guides:
- [Creating Your First Plugin](./plugins/creating-plugins.md)
- [Plugin API Reference](./advanced/plugin-api.md)
- [Plugin development](https://docs.betterseqta.org/plugin-development/)
- [Plugin API](https://docs.betterseqta.org/plugin-api/)
## Recognition
+4 -2
View File
@@ -1,5 +1,7 @@
# 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
@@ -178,5 +180,5 @@ bun run dev
Now that you have BetterSEQTA+ installed, you can:
- [Getting Started with Plugins](./plugins/getting-started.md)
- [Contribute to the project](../CONTRIBUTING.md)
- [Plugins](https://docs.betterseqta.org/plugins/)
- [Contribute to the project](https://docs.betterseqta.org/contributing/) · [Repository CONTRIBUTING.md](../CONTRIBUTING.md)
+337
View File
@@ -0,0 +1,337 @@
# 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<typeof settings> {
@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<typeof settings> = {
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 = `
<button class="close-btn" onclick="this.parentElement.remove()">×</button>
<div>${message}</div>
<small style="opacity: 0.8; margin-top: 10px; display: block;">
Powered by My First Plugin
</small>
`;
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! 🎉
+3 -1
View File
@@ -1,5 +1,7 @@
# 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?
@@ -294,4 +296,4 @@ Got stuck? No worries! Here's where you can get help:
- 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 checkout the api reference [here](./api-reference.md)
Happy coding and feel free to check out the [plugin API](https://docs.betterseqta.org/plugin-api/) on the documentation site.
+3 -1
View File
@@ -1,6 +1,8 @@
# Plugin API Reference
This document provides detailed technical information about BetterSEQTA+'s plugin APIs. For a beginner-friendly introduction, see [Creating Your First Plugin](./README.md).
**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
+11 -1
View File
@@ -8,10 +8,20 @@ export default {
],
transform: {
'^.+\\.ts$': 'ts-jest',
'^.+\\.js$': ['ts-jest', { tsconfig: { allowJs: true } }],
},
transformIgnorePatterns: [
'/node_modules/(?!(color|color-string|color-convert|color-name)/)',
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^color$': '<rootDir>/src/test/mocks/color.ts',
'^webextension-polyfill$': '<rootDir>/src/test/mocks/webextension-polyfill.ts',
},
setupFilesAfterEnv: ['<rootDir>/src/test/jest.setup.ts'],
moduleFileExtensions: ['ts', 'js', 'json'],
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
],
};
};
+33
View File
@@ -1,8 +1,41 @@
import fs from "fs";
import mime from "mime-types";
/**
* A Vite plugin designed to load files as base64 encoded data URLs.
* This plugin intercepts module imports that have a `?base64` query parameter
* appended to the file path. It then reads the targeted file, converts its content
* to a base64 string, and constructs a data URL which is then exported as the
* default export of a new JavaScript module.
*
* @example
* // To use this loader, import a file with ?base64 query:
* // import myImageBase64 from './path/to/myimage.png?base64';
* // myImageBase64 will then be a string like "data:image/png;base64,..."
*/
export const base64Loader = {
/**
* The name of the Vite plugin.
* @type {string}
*/
name: "base64-loader",
/**
* The core transformation function of the Vite plugin.
* It is called by Vite for modules that might need transformation. This function
* checks if the module ID includes the `?base64` query. If so, it reads the
* specified file, converts it to a base64 data URL, and returns a new
* JavaScript module that default exports this data URL.
*
* @param {any} _ The original code of the file. This parameter is unused by this loader.
* @param {string} id The ID of the module being transformed. This string typically
* contains the absolute file path and any query parameters
* (e.g., "/path/to/file.png?base64").
* @returns {string | null} If the module ID does not contain `?base64` query,
* it returns `null` to indicate no transformation.
* Otherwise, it returns a string of JavaScript code
* that default exports the base64 data URL of the file.
* For example: `export default 'data:image/png;base64,xxxx';`
*/
transform(_: any, id: string) {
const [filePath, query] = id.split("?");
if (query !== "base64") return null;
-25
View File
@@ -1,25 +0,0 @@
// ref: https://stackoverflow.com/a/76920975
import type { Plugin } from "vite";
export default function ClosePlugin(): Plugin {
return {
name: "ClosePlugin", // required, will show up in warnings and errors
// use this to catch errors when building
buildEnd(error) {
if (error) {
console.error("Error bundling");
console.error(error);
process.exit(1);
} else {
console.log("Build ended");
}
},
// use this to catch the end of a build without errors
closeBundle() {
console.log("Bundle closed");
process.exit(0);
},
};
}
+23 -10
View File
@@ -1,12 +1,22 @@
import type { Browser, BuildTarget, Manifest } from "./types";
import type { AnyCase } from "./utils";
/**
*
* Packages a given manifest object with a specific target browser identifier.
* This function is typically used in multi-browser extension build processes
* to create a configuration object that pairs the manifest data with the browser
* it's intended for. The `AnyCase<Browser>` type for the browser parameter
* implies that browser names like 'chrome', 'firefox', etc., can be provided
* in various casings.
*
* @export
* @param {Manifest} manifest
* @param {AnyCase<Browser>} browser
* @return {*} {@link BuildTarget}
* @param {Manifest} manifest The core manifest data for the extension,
* compatible with `chrome.runtime.ManifestV3` as defined by the {@link Manifest} type.
* @param {AnyCase<Browser>} browser The target browser identifier (e.g., 'chrome', 'firefox', 'CHROME').
* Refers to the {@link Browser} type, allowing for flexible casing.
* @returns {BuildTarget} An object that pairs the `manifest` with its target `browser`.
* The structure is `{ manifest: Manifest; browser: AnyCase<Browser>; }`
* as defined by the {@link BuildTarget} type.
*/
export function createManifest(
manifest: Manifest,
@@ -19,14 +29,17 @@ export function createManifest(
}
/**
* create a base Manifest to inherit from
* type Manifest = chrome.runtime.ManifestV3
*
* use as shared base to extend inBrowser manifests
* Defines a base manifest object.
* This function is typically used to establish a common, shared foundation for an extension's manifest
* (compatible with `chrome.runtime.ManifestV3` as per the {@link Manifest} type).
* This base can then be extended or modified for different browsers or specific build configurations.
* For example, you might define core permissions and properties here, and then add
* browser-specific keys in subsequent steps.
*
* @export
* @param {Manifest} manifest
* @return {*} {@link Manifest}
* @param {Manifest} manifest The core manifest data to be used as a base.
* This should conform to the {@link Manifest} type structure.
* @returns {Manifest} The provided manifest object, intended to serve as a reusable base.
*/
export function createManifestBase(manifest: Manifest): Manifest {
return manifest;
+53
View File
@@ -0,0 +1,53 @@
import { createHash } from "node:crypto";
import { readFileSync, unlinkSync, writeFileSync } from "node:fs";
import { resolve } from "node:path";
import { dirname, relative } from "node:path/posix";
import { globSync } from "glob";
import type { Plugin } from "rollup";
const hash = (path: string) =>
createHash("sha256").update(readFileSync(path)).digest("hex");
/** Reuse identical files already copied to stable extension paths. */
export default (): Plugin => ({
name: "dedupe-public-assets",
writeBundle({ dir }) {
if (!dir) return;
const files = globSync("**/*", { cwd: dir, nodir: true });
const stable = new Map<string, string>();
const duplicates = new Map<string, string>();
for (const file of files) {
if (file.startsWith("resources/"))
stable.set(hash(resolve(dir, file)), file);
}
for (const file of files) {
const match = file.startsWith("assets/")
? stable.get(hash(resolve(dir, file)))
: undefined;
if (match) duplicates.set(file, match);
}
for (const file of files.filter((file) =>
/\.(?:css|html|js)$/.test(file),
)) {
const path = resolve(dir, file);
let output = readFileSync(path, "utf8");
for (const [asset, canonical] of duplicates) {
output = output.replaceAll(
relative(dirname(file), asset),
relative(dirname(file), canonical),
);
}
writeFileSync(path, output);
}
for (const file of duplicates.keys()) unlinkSync(resolve(dir, file));
const manifestPath = resolve(dir, "manifest.json");
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
for (const entry of manifest.web_accessible_resources ?? []) {
entry.resources = entry.resources.filter(
(file: string) => !duplicates.has(file),
);
}
writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
},
});
+25
View File
@@ -0,0 +1,25 @@
import type { Plugin } from "vite";
/** Relative chunk/CSS URLs via chrome.runtime.getURL for content-script dynamic imports. */
export function extensionChunkUrls(): Plugin {
return {
name: "extension-chunk-urls",
config() {
return {
base: "./",
experimental: {
renderBuiltUrl(filename, { hostType, type }) {
const path = filename.replace(/^\//, "");
if (type === "chunk" && hostType === "js") {
return { runtime: `chrome.runtime.getURL(${JSON.stringify(path)})` };
}
// JS-triggered CSS preloads only — extension HTML pages need static hrefs.
if (type === "asset" && hostType === "js" && path.endsWith(".css")) {
return { runtime: `chrome.runtime.getURL(${JSON.stringify(path)})` };
}
},
},
};
},
};
}
+43
View File
@@ -0,0 +1,43 @@
import type { Plugin } from "vite";
/**
* Firefox extension pages forbid eval / `Function` constructor. Some deps still emit:
* - `Function(\`return this\`)()` (lodash-style global)
* - `try { return Function(\`\`) / new Function("") … }` (feature probes, e.g. PDF.js / ORT)
*/
export function firefoxStripFunctionProbe(): Plugin {
return {
name: "firefox-strip-function-probe",
apply: "build",
enforce: "post",
generateBundle(_options, bundle) {
if ((process.env.MODE || "chrome").toLowerCase() !== "firefox") return;
const literalReplacements: [string, string][] = [
['try{return new Function(""),!0}catch{return!1}', "return!1"],
["try{return new Function(''),!0}catch{return!1}", "return!1"],
['try{return new Function(""),true}catch{return false}', "return false"],
["try{return new Function(''),true}catch{return false}", "return false"],
// Empty template literal probe (minifier output)
["try{return Function(``),!0}catch{return!1}", "return!1"],
];
for (const chunk of Object.values(bundle)) {
if (chunk.type !== "chunk" || typeof chunk.code !== "string") continue;
let { code } = chunk;
code = code.replace(/Function\(`return this`\)\(\)/g, "(globalThis)");
code = code.replace(/Function\("return this"\)\(\)/g, "(globalThis)");
code = code.replace(/Function\('return this'\)\(\)/g, "(globalThis)");
for (const [from, to] of literalReplacements) {
if (code.includes(from)) {
code = code.split(from).join(to);
}
}
chunk.code = code;
}
},
};
}
+19
View File
@@ -0,0 +1,19 @@
import type { Plugin } from "vite";
/**
* crxjs 2.6.x only replaces the first `__LIVE_RELOAD__` in `@crx/client-worker`,
* which crashes the service worker when the dev server reconnects.
*/
export default function fixCrxWorkerLiveReload(): Plugin {
return {
name: "fix-crx-worker-live-reload",
apply: "serve",
enforce: "post",
transform(code, id) {
if (!id.includes("@crx/client-worker") || !code.includes("__LIVE_RELOAD__")) {
return;
}
return code.replaceAll("__LIVE_RELOAD__", "true");
},
};
}
+28 -26
View File
@@ -1,37 +1,39 @@
// vite-plugin-inline-worker-dev.ts
import { Plugin } from "vite";
import fs from "fs/promises";
import { build, transform } from "esbuild";
import { build } from "esbuild";
import { resolve } from "node:path";
/** Bundle worker entry points imported with `?inlineWorker` as Blob-backed Workers in dev. */
export default function InlineWorkerDevPlugin(): Plugin {
return {
name: "vite:inline-worker-dev",
async load(id) {
if (id.includes("?inlineWorker")) {
const [cleanPath] = id.split("?");
console.log("cleanPath", cleanPath);
const code = await fs.readFile(cleanPath, "utf-8");
const result = await build({
entryPoints: [cleanPath],
bundle: true,
write: false,
platform: "browser",
format: "iife",
target: "esnext",
});
if (!id.includes("?inlineWorker")) return null;
const workerCode = result.outputFiles[0].text;
const [cleanPath] = id.split("?");
const result = await build({
entryPoints: [cleanPath],
bundle: true,
write: false,
platform: "browser",
format: "iife",
target: "esnext",
minify: true,
alias: {
"@huggingface/transformers": resolve(
"node_modules/@huggingface/transformers/dist/transformers.web.js",
),
},
external: ["webextension-polyfill"],
});
const workerBlobCode = `
const code = ${JSON.stringify(workerCode)};
export default function InlineWorker() {
const blob = new Blob([code], { type: 'application/javascript' });
return new Worker(URL.createObjectURL(blob), { type: 'module' });
}
`;
return workerBlobCode;
}
return null;
const workerCode = result.outputFiles[0].text;
return `
const code = ${JSON.stringify(workerCode)};
export default function InlineWorker() {
const blob = new Blob([code], { type: 'application/javascript' });
return new Worker(URL.createObjectURL(blob), { type: 'module' });
}
`;
},
};
}
+102 -19
View File
@@ -1,8 +1,33 @@
const glob = require("glob");
/**
* @fileoverview
* This script is a command-line utility for publishing the BetterSEQTA+ extension.
* It automates the process of finding the latest built extension ZIP files for specified
* browsers, zipping the project source code (for Firefox), and then invoking the
* `publish-extension` tool with the appropriate arguments.
*
* To use this script, invoke it with Node.js followed by browser arguments:
* e.g., `node lib/publish.js --b chrome firefox`
* or `node lib/publish.js --b chrome`
* or `node lib/publish.js --b firefox`
*/
const { globSync } = require("glob");
const semver = require("semver");
const { execSync } = require("child_process");
const path = require("path");
/**
* Determines the latest version string from a list of filenames that include version numbers.
* Filenames are expected to follow a pattern like `betterseqtaplus@3.4.5.1-chrome.zip`.
* This function handles potential 4-part versions (e.g., `3.4.5.1`) by trimming them
* to 3 parts (e.g., `3.4.5`) for comparison using the `semver` library. After identifying
* the latest semver-compatible version, it returns the original full version string
* (e.g., "3.4.5.1") that corresponds to this latest version.
*
* @param {string[]} files An array of filenames.
* @returns {string | null} The latest version string (e.g., "3.4.5.1") found among the files,
* or `null` if no valid version numbers are found or no files are provided.
*/
function getLatestVersion(files) {
console.log("Files passed to getLatestVersion:", files);
@@ -19,48 +44,89 @@ function getLatestVersion(files) {
if (!match) return null;
const fullVersion = match[1]; // Original version (e.g., 3.4.5.1)
const semverVersion = fullVersion.split(".").slice(0, 3).join("."); // Trim to 3.4.5
// Trim to 3 parts for semver comparison, as semver typically handles X.Y.Z
const semverVersion = fullVersion.split(".").slice(0, 3).join(".");
return { fullVersion, semverVersion };
})
.filter(Boolean);
.filter(Boolean); // Remove null entries if any file didn't match
console.log(
"Extracted versions:",
versions.map((v) => v.semverVersion),
);
if (versions.length === 0) {
console.log("No versions extracted.");
return null;
}
// Find latest version using the trimmed semver format
const latestSemver = semver.maxSatisfying(
versions.map((v) => v.semverVersion),
"*",
"*", // Satisfy any version, effectively finding the max
);
console.log("Latest SemVer-compatible version:", latestSemver);
// Get the full version that matches the latest SemVer version
const latestVersion =
versions.find((v) => v.semverVersion === latestSemver)?.fullVersion || null;
if (!latestSemver) {
console.log("Could not determine latest semver version.");
return null;
}
console.log("Final selected latest version:", latestVersion);
return latestVersion;
// Get the original full version string that matches the identified latest SemVer version
const latestVersionData = versions.find(
(v) => v.semverVersion === latestSemver,
);
const latestFullVersion = latestVersionData ? latestVersionData.fullVersion : null;
console.log("Final selected latest version:", latestFullVersion);
return latestFullVersion;
}
/**
* Finds the path to the latest built ZIP file for a specific browser.
* It constructs a glob pattern based on the browser name (e.g., `dist/betterseqtaplus@*-*chrome.zip`),
* finds all matching files, and then uses `getLatestVersion` to identify the version string
* of the most recent file. Finally, it returns the full path to that specific file.
*
* @param {string} browser A string indicating the target browser (e.g., "chrome", "firefox").
* @returns {string | undefined} The filepath string to the latest ZIP file for the specified browser,
* or `undefined` if no matching file is found or if the latest version
* cannot be determined.
*/
function getLatestFiles(browser) {
const pattern = `dist/betterseqtaplus@*-*${browser}.zip`;
console.log("Glob pattern:", pattern);
const files = glob.sync(pattern);
const files = globSync(pattern);
console.log("Files found for browser", browser, ":", files);
const latestVersion = getLatestVersion(files);
if (files.length === 0) {
console.log("No files found for browser", browser);
return undefined;
}
// Find the exact file by matching the original full version
const latestVersion = getLatestVersion(files);
if (!latestVersion) {
console.log("Could not determine latest version for browser", browser);
return undefined;
}
// Find the exact file by matching the original full version string
const latestFile = files.find((file) => file.includes(`@${latestVersion}-`));
console.log("Latest file for browser", browser, ":", latestFile);
return latestFile;
}
/**
* Creates a ZIP file of the project's source code, excluding specified development-related
* files and directories such as `node_modules`, `dist`, `.git`, etc.
* It uses the `7z` command-line tool to perform the archiving.
* The output filename is fixed as `dist/betterseqtaplus@latest-sources.zip`.
*
* @returns {string} The filename of the created ZIP file (e.g., `dist/betterseqtaplus@latest-sources.zip`).
*/
function zipSources() {
const zipFileName = `dist/betterseqtaplus@latest-sources.zip`;
@@ -74,17 +140,31 @@ function zipSources() {
"LICENSE",
"package.json",
]
.map((pattern) => `-x!${pattern}`)
.map((pattern) => `-x!${pattern}`) // Format for 7z exclude syntax
.join(" ");
// Command to zip the current directory's contents into zipFileName, applying exclude patterns
const zipCommand = `7z a ${zipFileName} . ${excludePatterns}`;
console.log("Zipping project sources with command:", zipCommand);
execSync(zipCommand, { stdio: "inherit" });
execSync(zipCommand, { stdio: "inherit" }); // Execute synchronously and show output
return zipFileName;
}
/**
* Orchestrates the extension publishing process for the specified browsers.
* This function performs the following steps:
* 1. Calls `getLatestFiles` to find the latest built ZIP for Chrome if "chrome" is in `browsers`.
* 2. Calls `getLatestFiles` to find the latest built ZIP for Firefox if "firefox" is in `browsers`.
* 3. Calls `zipSources` to create a source code ZIP if "firefox" is in `browsers` (required for Mozilla Add-ons).
* 4. Validates that all required files were found and that at least one browser was specified. Exits if not.
* 5. Constructs the `publish-extension` command-line string with the appropriate arguments
* based on the found ZIP files for the specified browsers.
* 6. Executes the constructed `publish-extension` command.
*
* @param {string[]} browsers An array of browser strings (e.g., ["chrome", "firefox"]) for which to publish the extension.
*/
function runPublishCommand(browsers) {
const chromeZip = browsers.includes("chrome")
? getLatestFiles("chrome")
@@ -92,6 +172,7 @@ function runPublishCommand(browsers) {
const firefoxZip = browsers.includes("firefox")
? getLatestFiles("firefox")
: null;
// Sources are typically only needed for Firefox submissions
const firefoxSourcesZip = browsers.includes("firefox") ? zipSources() : null;
console.log("Chrome zip:", chromeZip);
@@ -100,15 +181,16 @@ function runPublishCommand(browsers) {
if (browsers.length === 0) {
console.log("No browsers specified. Exiting.");
process.exit(0);
process.exit(0); // Exit gracefully if no action is needed
}
// Check if required files are missing for the specified browsers
if (
(browsers.includes("chrome") && !chromeZip) ||
(browsers.includes("firefox") && (!firefoxZip || !firefoxSourcesZip))
) {
console.error("Could not find required zip files for specified browsers.");
process.exit(1);
process.exit(1); // Exit with error status
}
let command = "publish-extension";
@@ -120,12 +202,13 @@ function runPublishCommand(browsers) {
}
console.log("Running command:", command);
execSync(command, { stdio: "inherit" });
execSync(command, { stdio: "inherit" }); // Execute and show output
}
// Parse command-line arguments
// Parse command-line arguments to determine which browsers to publish for
const args = process.argv.slice(2);
const browserIndex = args.indexOf("--b");
const browserIndex = args.indexOf("--b"); // Find the --b flag
// If --b is found, take all subsequent arguments as browser names
const browsers = browserIndex !== -1 ? args.slice(browserIndex + 1) : [];
runPublishCommand(browsers);
+53
View File
@@ -0,0 +1,53 @@
import type { Plugin, ViteDevServer } from "vite";
/**
* CRXJS + Vite 6 often corrupt content-script ESM bindings after HMR /
* `[crx] runtime reload` — modules load but named/`default` exports are missing
* until the dev server is restarted.
*
* Prefer invalidating the module graph + a full page reload over partial HMR.
*/
export default function stabilizeCrxDevHmr(): Plugin {
let reloadTimer: ReturnType<typeof setTimeout> | null = null;
const scheduleFullReload = (s: ViteDevServer) => {
if (reloadTimer) clearTimeout(reloadTimer);
// Debounce cascading invalidations (e.g. many files in one save).
reloadTimer = setTimeout(() => {
reloadTimer = null;
s.ws.send({ type: "full-reload", path: "*" });
}, 50);
};
return {
name: "stabilize-crx-dev-hmr",
apply: "serve",
enforce: "pre",
configureServer(s) {
s.ws.on("bsplus:reset-module-graph", () => {
s.moduleGraph.invalidateAll();
scheduleFullReload(s);
});
},
handleHotUpdate({ file, modules, server: viteServer }) {
if (!file.replace(/\\/g, "/").includes("/src/")) return;
if (file.includes("node_modules")) return;
const seen = new Set(modules);
const queue = [...modules];
while (queue.length) {
const mod = queue.pop()!;
viteServer.moduleGraph.invalidateModule(mod);
for (const importer of mod.importers) {
if (seen.has(importer)) continue;
seen.add(importer);
queue.push(importer);
}
}
scheduleFullReload(viteServer);
// Skip Vite's partial HMR for these modules — it is what leaves exports empty.
return [];
},
};
}
+10 -12
View File
@@ -1,17 +1,15 @@
import fs from "fs";
import type { Plugin } from "vite";
export default function touchGlobalCSSPlugin() {
/**
* 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",
handleHotUpdate({ modules }) {
// log all of the staticImportedUrls
const importers = modules[0]._clientModule.importers;
importers.forEach((importer) => {
if (importer.file.includes(".css")) {
console.log("touching", importer.file);
fs.utimesSync(importer.file, new Date(), new Date());
}
});
},
apply: "serve",
};
}
+144 -8
View File
@@ -1,6 +1,9 @@
import type { ManifestV3Export } from "@crxjs/vite-plugin";
import { type AnyCase, createEnum } from "./utils";
import { type AnyCase, createEnum, ObjectValues } from "./utils";
/**
* Enumerates supported JavaScript frameworks for project generation or configuration.
*/
export const FrameworkEnum = {
React: "React",
Vanilla: "Vanilla",
@@ -10,6 +13,9 @@ export const FrameworkEnum = {
Vue: "Vue",
} as const;
/**
* Enumerates supported web browsers, typically for targeting builds or configurations.
*/
export const BrowserEnum = {
Chrome: "Chrome",
Brave: "Brave",
@@ -19,15 +25,26 @@ export const BrowserEnum = {
Safari: "Safari",
} as const;
/**
* @private
* Enumerates supported programming languages for project setup.
* This enum is not exported, suggesting it's for internal use within this module or related modules.
*/
const LanguageEnum = {
TypeScript: "TypeScript",
JavaScript: "JavaScript",
} as const;
/**
* Enumerates supported styling options or libraries.
*/
export const StyleEnum = {
Tailwind: "Tailwind",
} as const;
/**
* Enumerates supported package managers.
*/
export const PackageManagerEnum = {
Bun: "Bun",
PnPm: "PnPm",
@@ -35,7 +52,21 @@ export const PackageManagerEnum = {
Yarn: "Yarn",
} as const;
// see: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/firefox-webext-browser/index.d.ts
/**
* Defines the structure for browser-specific settings within a web extension manifest.
* This is particularly used for Firefox (gecko) extensions to specify properties like
* an extension ID, and minimum/maximum supported browser versions.
* The structure is based on common manifest extensions for Firefox.
* See: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings
* The link in the original code (// see: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/firefox-webext-browser/index.d.ts)
* also points to type definitions that include this structure.
*
* @property {object} [browser_specific_settings] - Container for browser-specific settings.
* @property {object} [browser_specific_settings.gecko] - Settings specific to Gecko-based browsers (e.g., Firefox).
* @property {string} [browser_specific_settings.gecko.id] - The unique identifier for the extension in Firefox.
* @property {string} [browser_specific_settings.gecko.strict_min_version] - The minimum version of Firefox the extension is compatible with.
* @property {string} [browser_specific_settings.gecko.strict_max_version] - The maximum version of Firefox the extension is compatible with.
*/
export type BrowserSpecificSettings = {
browser_specific_settings?: {
gecko?: {
@@ -46,59 +77,164 @@ export type BrowserSpecificSettings = {
};
};
/**
* Represents the structure of a Chrome Manifest V3 file.
* This type is an alias for `ManifestV3Export` from the `@crxjs/vite-plugin`,
* which provides a comprehensive definition for Chrome extension manifests.
*/
export type Manifest = ManifestV3Export;
/** Alias for the `icons` property within a Chrome Manifest V3. */
export type ManifestIcons = chrome.runtime.ManifestIcons;
/** Alias for the `background` property within a Chrome Manifest V3. */
export type ManifestBackground = chrome.runtime.ManifestV3["background"];
/** Alias for the `content_scripts` property within a Chrome Manifest V3. */
export type ManifestContentScripts =
chrome.runtime.ManifestV3["content_scripts"];
/** Alias for the `web_accessible_resources` property within a Chrome Manifest V3. */
export type ManifestWebAccessibleResources =
chrome.runtime.ManifestV3["web_accessible_resources"];
/** Alias for the `commands` property within a Chrome Manifest V3. */
export type ManifestCommands = chrome.runtime.ManifestV3["commands"];
/** Alias for the `action` property (or `browser_action`/`page_action`) within a Chrome Manifest V3. */
export type ManifestAction = chrome.runtime.ManifestV3["action"];
/** Alias for the `permissions` property within a Chrome Manifest V3. */
export type ManifestPermissions = chrome.runtime.ManifestV3["permissions"];
/** Alias for the `options_ui` property within a Chrome Manifest V3. */
export type ManifestOptionsUI = chrome.runtime.ManifestV3["options_ui"];
/** Alias for the `chrome_url_overrides` property within a Chrome Manifest V3. */
export type ManifestURLOverrides =
chrome.runtime.ManifestV3["chrome_url_overrides"];
/**
* Creates a type that accepts a string literal `T` in either its capitalized or lowercase form.
* Useful for defining types that should be case-insensitive for specific known strings.
* @template T - A string literal type.
*/
export type BrowserName<T extends string> = Capitalize<T> | Lowercase<T>;
/**
* Creates a record type where both keys and values are derived from a string literal `T`,
* specifically using `BrowserName<T>` which allows for capitalized or lowercase forms.
* This could be used to define an object where, for example, keys are 'Chrome' or 'chrome'
* and values are also 'Chrome' or 'chrome'.
* @template T - A string literal type, typically representing a browser name.
*/
export type BrowserEnumType<T extends string> = {
[browser in BrowserName<T>]: BrowserName<T>;
};
/**
* Represents the target browser for a build, allowing for various casings of browser names
* (e.g., "chrome", "Chrome", "CHROME") through the `AnyCase<Browser>` utility type.
* `Browser` itself is a union of specific browser name strings (e.g., "Chrome" | "Firefox").
*/
export type BuildMode = AnyCase<Browser>;
/**
* Defines an object structure that pairs a web extension `Manifest`
* with its target `browser` (represented as `AnyCase<Browser>`).
* This is commonly used in build processes to manage configurations for different browsers.
*/
export type BuildTarget = {
manifest: Manifest;
browser: AnyCase<Browser>;
};
/**
* Defines the configuration options for a build process.
* @property {"build" | "serve"} [command] - The type of build command (e.g., 'build' for production, 'serve' for development).
* @property {AnyCase<Browser> | string | undefined} [mode] - The target build mode, typically a browser name (allowing various casings)
* or potentially other custom mode strings.
*/
export type BuildConfig = {
command?: "build" | "serve";
mode?: AnyCase<Browser> | string | undefined;
};
/**
* Defines the structure for repository information, commonly found in `package.json`.
* @property {string} type - The type of the repository (e.g., "git").
* @property {string} [url] - The URL of the repository.
* @property {Bugs} [bugs] - An object containing information about where to report bugs.
*/
export interface Repository {
type: string;
url?: string;
bugs?: Bugs;
}
/**
* Defines the structure for bug reporting information, often part of the `Repository` interface.
* @property {string} [url] - The URL of the issue tracker.
* @property {string} [email] - The email address for reporting bugs.
*/
export interface Bugs {
url?: string;
email?: string;
}
export type Browser = (typeof BrowserEnum)[keyof typeof BrowserEnum];
/**
* A string literal union type representing supported browser names, derived from the values of `BrowserEnum`.
* e.g., "Chrome" | "Firefox" | ...
*/
export type Browser = ObjectValues<typeof BrowserEnum>;
/**
* A constant intended to provide access to browser names, potentially in various casings.
* Its type `AnyCase<Browser>` suggests it can be used where case-insensitivity for browser names is needed.
* The `createEnum(BrowserEnum)` call aims to produce a representation of browser names from `BrowserEnum`.
* Note: `createEnum` from `lib/utils.ts` has a declared return type of `ObjectValues<T>` (a union of values),
* while its implementation uses `Object.values()` which returns an array. This constant will hold the
* runtime array value, but its JSDoc type refers to the more restrictive `AnyCase<Browser>` union type.
*/
export const Browser: AnyCase<Browser> = createEnum(BrowserEnum);
export type PackageManager =
(typeof PackageManagerEnum)[keyof typeof PackageManagerEnum];
/**
* A string literal union type representing supported package managers, derived from the values of `PackageManagerEnum`.
* e.g., "Bun" | "PnPm" | "Npm" | "Yarn"
*/
export type PackageManager = ObjectValues<typeof PackageManagerEnum>;
/**
* A constant intended to provide access to package manager names, potentially in various casings.
* Its type `AnyCase<PackageManager>` suggests it can be used where case-insensitivity for package manager names is needed.
* Utilizes `createEnum(PackageManagerEnum)`. Refer to notes on `Browser` constant regarding `createEnum` behavior.
*/
export const PackageManager: AnyCase<PackageManager> =
createEnum(PackageManagerEnum);
export type Framework = (typeof FrameworkEnum)[keyof typeof FrameworkEnum];
/**
* A string literal union type representing supported JavaScript frameworks, derived from the values of `FrameworkEnum`.
* e.g., "React" | "Vanilla" | ...
*/
export type Framework = ObjectValues<typeof FrameworkEnum>;
/**
* A constant intended to provide access to framework names, potentially in various casings.
* Its type `AnyCase<Framework>` suggests it can be used where case-insensitivity for framework names is needed.
* Utilizes `createEnum(FrameworkEnum)`. Refer to notes on `Browser` constant regarding `createEnum` behavior.
*/
export const Framework: AnyCase<Framework> = createEnum(FrameworkEnum);
export type Style = (typeof StyleEnum)[keyof typeof StyleEnum];
/**
* A string literal union type representing supported styling options, derived from the values of `StyleEnum`.
* e.g., "Tailwind"
*/
export type Style = ObjectValues<typeof StyleEnum>;
/**
* A constant intended to provide access to style option names, potentially in various casings.
* Its type `AnyCase<Style>` suggests it can be used where case-insensitivity for style names is needed.
* Utilizes `createEnum(StyleEnum)`. Refer to notes on `Browser` constant regarding `createEnum` behavior.
*/
export const Style: AnyCase<Style> = createEnum(StyleEnum);
export type Language = (typeof LanguageEnum)[keyof typeof LanguageEnum];
/**
* A string literal union type representing supported programming languages, derived from the values of `LanguageEnum`.
* e.g., "TypeScript" | "JavaScript"
*/
export type Language = ObjectValues<typeof LanguageEnum>;
/**
* A constant intended to provide access to programming language names, potentially in various casings.
* Its type `AnyCase<Language>` suggests it can be used where case-insensitivity for language names is needed.
* Utilizes `createEnum(LanguageEnum)`. Refer to notes on `Browser` constant regarding `createEnum` behavior.
*/
export const Language: AnyCase<Language> = createEnum(LanguageEnum);
+63
View File
@@ -1,21 +1,84 @@
/**
* Extracts a union type of all values from the properties of an object type `T`.
*
* @template T - An object type (typically a Record or an enum-like object).
* @example
* type MyObject = { a: "foo", b: "bar", c: 123 };
* type MyObjectValues = ObjectValues<MyObject>; // "foo" | "bar" | 123
*/
export type ObjectValues<T> = T[keyof T];
/**
* Creates a union of an object's string values, often used to represent the set of possible values for an enum-like object.
* Note: The implementation `Object.values(enumObj) as unknown as ObjectValues<T>` returns an array at runtime,
* but the declared return type `ObjectValues<T>` is a union of the object's property values.
* This type signature suggests it's intended to represent the set of possible string values from `enumObj`.
*
* @template T - An object type where keys are strings and values are strings (e.g., `const MyEnum = { VAL_A: "A", VAL_B: "B" }`).
* @param {T} enumObj - The object from which to extract values.
* @returns {ObjectValues<T>} A union type representing all possible string values of the `enumObj`.
* For example, if `enumObj` is `{ A: "valA", B: "valB" }`, the return type is `"valA" | "valB"`.
* (Runtime behavior of `Object.values()` is to return an array like `["valA", "valB"]`).
*/
export function createEnum<T extends Record<string, string>>(enumObj: T) {
return Object.values(enumObj) as unknown as ObjectValues<T>;
}
/**
* Creates a union type that includes various case formats (uppercase, lowercase, capitalized, uncapitalized)
* of a given string literal type `T`.
*
* @template T - A string literal type.
* @example
* type MyString = "example";
* type MyStringAnyCase = AnyCase<MyString>; // "EXAMPLE" | "example" | "Example" | "example" (Uncapitalize<"Example"> is "example")
*/
export type AnyCase<T extends string> =
| Uppercase<T>
| Lowercase<T>
| Capitalize<T>
| Uncapitalize<T>;
/**
* Creates a union type that includes various case formats (uppercase, lowercase, capitalized, uncapitalized)
* of the union of two given string literal types `T` and `K`.
* This is useful for representing a combined set of related string constants where case variations are permitted for each.
*
* @template T - A string literal type.
* @template K - Another string literal type.
* @example
* type Lang1 = "english";
* type Lang2 = "french";
* type CombinedLangsAnyCase = AnyCaseLanguage<Lang1, Lang2>;
* // Result includes: "ENGLISH" | "english" | "English" | "FRENCH" | "french" | "French" etc.
* // for all case variations of "english" and "french".
*/
export type AnyCaseLanguage<T extends string, K extends string> =
| Uppercase<T | K>
| Lowercase<T | K>
| Capitalize<T | K>
| Uncapitalize<T | K>;
/**
* Extracts a new object type containing only the keys of `T` whose properties are optional
* (i.e., their type includes `undefined`). The values associated with these keys retain their original types.
*
* @template T - An object type.
* @example
* type MyObject = {
* requiredProp: string;
* optionalProp?: number;
* anotherOptional?: boolean | undefined;
* nullProp: string | null;
* };
* type MyOptionalProps = OptionalKeys<MyObject>;
* // MyOptionalProps would be conceptually equivalent to:
* // {
* // optionalProp?: number;
* // anotherOptional?: boolean | undefined;
* // }
* // The actual resulting type is an object type with only these optional keys.
*/
export type OptionalKeys<T> = {
[K in keyof T as undefined extends T[K] ? K : never]: T[K];
};
+69 -60
View File
@@ -1,66 +1,81 @@
{
"name": "betterseqtaplus",
"version": "3.4.6.1",
"version": "3.7.4",
"type": "module",
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development add add heaps more features!",
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development and add heaps more features!",
"browserslist": "> 0.5%, last 2 versions, not dead",
"scripts": {
"compile:layerchart": "node scripts/compile-layerchart-vendor.mjs",
"postinstall": "node scripts/copy-runtime-assets.mjs && npm run compile:layerchart",
"autoaudit": "npm audit && npm audit fix && npm run build",
"dev": "cross-env MODE=chrome vite dev",
"dev:firefox": "cross-env MODE=firefox vite build --watch",
"build": "cross-env MODE=chrome vite build && cross-env MODE=firefox vite build",
"compile": "npm i && npm run build",
"build": "npm run compile:layerchart && cross-env MODE=chrome vite build && cross-env MODE=firefox vite build",
"build:chrome": "cross-env MODE=chrome vite build",
"build:firefox": "cross-env MODE=firefox vite build",
"build:safari": "cross-env MODE=safari vite build",
"build:dev": "cross-env MODE=chrome SOURCEMAP=true vite build && cross-env MODE=firefox SOURCEMAP=true vite build",
"convert:safari": "xcrun safari-web-extension-converter dist/safari --project-location . --app-name $npm_package_name-safari",
"dependency-graph": "depcruise src --include-only \"^src\" --output-type dot | dot -T svg > dependency-graph.svg",
"release": "gh release create $npm_package_name@$npm_package_version ./dist/*.zip --generate-notes",
"lint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint \"src/**/*.{js,ts}\"",
"test": "npm run test:unit",
"test:unit": "jest",
"test:smoke": "node scripts/smoke-test.mjs",
"test:ci": "npm run test:unit && npm run build && npm run test:smoke",
"release": "gh release create $npm_package_version --repo BetterSEQTA/BetterSEQTA-Plus ./dist/*.zip --generate-notes",
"publish": "bun lib/publish.js --b",
"zip": "bedframe zip",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
},
"targets": {
"prod": {
"sourceMap": {
"inline": false
}
}
"zip": "node scripts/package-extension-zips.mjs"
},
"keywords": [],
"author": {
"name": "SethBurkart123",
"email": "betterseqta@betterseqta.com",
"url": "https://github.com/BetterSEQTA/BetterSEQTA-plus"
"email": "betterseqta.plus@gmail.com",
"url": "https://github.com/BetterSEQTA/BetterSEQTA-Plus"
},
"license": "MIT",
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.26.9",
"@babel/runtime": "^7.26.9",
"@bedframe/cli": "^0.0.91",
"@crxjs/vite-plugin": "2.0.0-beta.32",
"@types/jest": "^29.5.14",
"@types/mime-types": "^2.1.4",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"cross-env": "^7.0.3",
"dependency-cruiser": "^16.10.0",
"eslint": "9.22.0",
"glob": "^11.0.1",
"jest": "^29.7.0",
"mime-types": "^2.1.35",
"@bedframe/cli": "^0.1.2",
"@crxjs/vite-plugin": "^2.6.1",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/forms": "^0.5.10",
"@tsconfig/svelte": "^5.0.4",
"@types/chrome": "^0.1.4",
"@types/color": "^4.2.0",
"@types/d3-scale": "^4.0.9",
"@types/d3-shape": "^3.1.8",
"@types/jest": "^30.0.0",
"@types/mime-types": "^3.0.1",
"@types/node": "^24.3.0",
"@types/qrcode": "^1.5.6",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/sortablejs": "^1.15.8",
"@types/webextension-polyfill": "^0.12.3",
"@typescript-eslint/eslint-plugin": "^8.60.1",
"@typescript-eslint/parser": "^8.60.1",
"autoprefixer": "^10.4.21",
"cross-env": "^10.0.0",
"dependency-cruiser": "^17.0.1",
"esbuild": "^0.25.3",
"eslint": "^9.33.0",
"eslint-plugin-import": "^2.31.0",
"glob": "^13.0.6",
"jest": "^30.4.2",
"jest-environment-jsdom": "^30.4.1",
"mime-types": "^3.0.1",
"postcss": "^8.5.3",
"prettier": "^3.5.3",
"process": "^0.11.10",
"publish-browser-extension": "^3.0.0",
"publish-browser-extension": "^4.0.4",
"sass": "^1.85.1",
"sass-loader": "^16.0.5",
"semver": "^7.7.1",
"tailwindcss": "3",
"ts-jest": "^29.3.4",
"url": "^0.11.4"
"ts-jest": "^29.4.11",
"typescript": "^5.8.2",
"vite": "^6.2.1"
},
"dependencies": {
"@bedframe/core": "^0.1.0",
"@codemirror/autocomplete": "^6.18.6",
"@codemirror/commands": "^6.8.0",
"@codemirror/lang-css": "^6.3.1",
@@ -68,45 +83,39 @@
"@codemirror/search": "^6.5.10",
"@codemirror/state": "^6.5.2",
"@codemirror/view": "^6.36.4",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/forms": "^0.5.10",
"@tsconfig/svelte": "^5.0.4",
"@types/chrome": "^0.0.308",
"@types/color": "^4.2.0",
"@types/lodash": "^4.17.16",
"@types/node": "^22.13.10",
"@types/sortablejs": "^1.15.8",
"@types/uuid": "^10.0.0",
"@types/webextension-polyfill": "^0.12.3",
"@huggingface/transformers": "^3.8.1",
"@uiw/codemirror-extensions-color": "^4.23.10",
"@uiw/codemirror-theme-github": "^4.23.10",
"autoprefixer": "^10.4.21",
"codemirror": "^6.0.1",
"canvas-confetti": "^1.9.3",
"color": "^5.0.0",
"d3-scale": "^4.0.2",
"d3-shape": "^3.2.0",
"dompurify": "^3.2.4",
"embeddia": "^1.2.1",
"embeddia": "^1.3.0",
"embla-carousel-autoplay": "^8.5.2",
"embla-carousel-svelte": "^8.5.2",
"esbuild": "^0.25.3",
"events": "^3.3.0",
"flexsearch": "^0.8.147",
"fuse.js": "^7.1.0",
"idb": "^8.0.2",
"layerchart": "2.0.0-next.27",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"mathjs": "^14.4.0",
"million": "^3.1.11",
"motion": "^12.4.12",
"postcss": "^8.5.3",
"pdfjs-dist": "^5.4.530",
"qrcode": "^1.5.4",
"react": "17",
"react-best-gradient-color-picker": "3.0.11",
"react-dom": "17",
"rss-parser": "^3.13.0",
"semver": "^7.7.1",
"sortablejs": "^1.15.6",
"svelte": "^5.22.6",
"typescript": "^5.8.2",
"uuid": "^11.1.0",
"vite": "^6.2.1",
"svelte": "^5.46.4",
"webextension-polyfill": "^0.12.0"
},
"overrides": {
"glob": "^13.0.6"
},
"pnpm": {
"overrides": {
"glob": "^13.0.6"
}
}
}
+180
View File
@@ -0,0 +1,180 @@
/**
* Chrome trace analyzer — aggregates hotspots for BetterSEQTA+ optimization.
* Usage: node scripts/analyze-trace.mjs <path-to-trace.json>
*/
import fs from "node:fs";
const path = process.argv[2];
if (!path) {
console.error("Usage: node scripts/analyze-trace.mjs <trace.json>");
process.exit(1);
}
const raw = fs.readFileSync(path, "utf8");
const { traceEvents } = JSON.parse(raw);
const DURATION_PHASES = new Set(["X", "b", "e"]);
const openStacks = new Map(); // key -> { name, cat, args, ts }
const byName = new Map();
const byCat = new Map();
const byUrl = new Map();
const byFunction = new Map();
const layoutEvents = [];
const paintEvents = [];
const longTasks = [];
const timers = [];
const observers = [];
const hitTests = [];
const betterseqtaHits = new Map();
const ipcMessages = new Map();
const gcEvents = [];
let minTs = Infinity;
let maxTs = -Infinity;
function add(map, key, dur, count = 1) {
const e = map.get(key) ?? { dur: 0, count: 0 };
e.dur += dur;
e.count += count;
map.set(key, e);
}
function stackKey(ev) {
return `${ev.pid}:${ev.tid}:${ev.name}:${ev.ts}`;
}
for (const ev of traceEvents) {
if (ev.ts != null) {
minTs = Math.min(minTs, ev.ts);
maxTs = Math.max(maxTs, ev.ts);
}
const ph = ev.ph;
const name = ev.name ?? "";
const cat = ev.cat ?? "";
const args = ev.args ?? {};
if (ph === "b") {
openStacks.set(`${ev.pid}:${ev.tid}:${ev.id ?? name}`, ev);
continue;
}
let dur = ev.dur ?? 0;
if (ph === "e" && ev.id != null) {
const start = openStacks.get(`${ev.pid}:${ev.tid}:${ev.id}`);
if (start) dur = ev.ts - start.ts;
}
if (dur <= 0 && ph !== "X") continue;
add(byName, name, dur);
const catParts = cat.split(",").filter(Boolean);
for (const c of catParts.length ? catParts : [cat || "(none)"]) {
add(byCat, c, dur);
}
const url =
args.data?.url ??
args.url ??
args.fileName ??
args.data?.scriptName ??
args.data?.frame ??
"";
if (url && typeof url === "string" && dur > 0) {
add(byUrl, url.slice(0, 200), dur);
}
const fn =
args.data?.functionName ??
args.functionName ??
args.data?.columnNumber != null
? `${args.data?.functionName ?? name}@${args.data?.url ?? ""}:${args.data?.lineNumber ?? "?"}`
: "";
if (fn && dur > 100) {
add(byFunction, String(fn).slice(0, 250), dur);
}
if (/Layout|UpdateLayoutTree|InvalidateLayout|LocalFrameView::performLayout/i.test(name)) {
layoutEvents.push({ name, dur, ts: ev.ts, cat });
}
if (/Paint|Raster|DrawFrame|CompositeLayers|UpdateLayer/i.test(name)) {
paintEvents.push({ name, dur, ts: ev.ts });
}
if (name === "RunTask" && dur > 50000) {
longTasks.push({ dur, ts: ev.ts, cat, args: JSON.stringify(args).slice(0, 300) });
}
if (/Timer|setTimeout|setInterval|FireIdleCallback|requestAnimationFrame|RequestAnimationFrame/i.test(name)) {
timers.push({ name, dur, ts: ev.ts });
}
if (/MutationObserver|ResizeObserver|IntersectionObserver|DeliverObservations|NotifyMutation/i.test(name)) {
observers.push({ name, dur, ts: ev.ts });
}
if (/HitTest|FindElement|ElementAt/i.test(name)) {
hitTests.push({ name, dur, ts: ev.ts });
}
if (/V8\.GC|GC_|MajorGC|MinorGC|IncrementalMarking/i.test(name)) {
gcEvents.push({ name, dur, ts: ev.ts });
}
if (/IPC|MessagePort|postMessage/i.test(name)) {
add(ipcMessages, name, dur);
}
const blob = JSON.stringify(args);
if (/betterseqta|BetterSEQTA|bsplus|SEQTA\.ts|monofile|AddBetterSEQTA/i.test(blob + name + url)) {
const key = `${name} | ${(url || blob).slice(0, 120)}`;
add(betterseqtaHits, key, dur);
}
}
function top(map, n = 40, minCount = 1) {
return [...map.entries()]
.filter(([, v]) => v.count >= minCount)
.sort((a, b) => b[1].dur - a[1].dur)
.slice(0, n)
.map(([k, v]) => ({
key: k,
totalMs: (v.dur / 1000).toFixed(1),
count: v.count,
avgMs: (v.dur / v.count / 1000).toFixed(2),
}));
}
const traceDurationMs = ((maxTs - minTs) / 1000).toFixed(0);
console.log(JSON.stringify({
summary: {
traceDurationMs,
eventCount: traceEvents.length,
layoutCount: layoutEvents.length,
layoutTotalMs: (layoutEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
paintCount: paintEvents.length,
paintTotalMs: (paintEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
longTaskCount: longTasks.length,
longTaskTotalMs: (longTasks.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
timerCount: timers.length,
timerTotalMs: (timers.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
observerCount: observers.length,
observerTotalMs: (observers.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
hitTestCount: hitTests.length,
hitTestTotalMs: (hitTests.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
gcCount: gcEvents.length,
gcTotalMs: (gcEvents.reduce((s, e) => s + e.dur, 0) / 1000).toFixed(1),
},
topEventNames: top(byName, 50),
topCategories: top(byCat, 30),
topUrls: top(byUrl, 40),
topFunctions: top(byFunction, 40, 1),
topBetterseqta: top(betterseqtaHits, 50),
topLongTasks: longTasks.sort((a, b) => b.dur - a.dur).slice(0, 20).map(e => ({
ms: (e.dur / 1000).toFixed(1),
cat: e.cat,
args: e.args,
})),
topLayout: layoutEvents.sort((a, b) => b.dur - a.dur).slice(0, 15).map(e => ({
name: e.name, ms: (e.dur / 1000).toFixed(2),
})),
topObservers: observers.sort((a, b) => b.dur - a.dur).slice(0, 15).map(e => ({
name: e.name, ms: (e.dur / 1000).toFixed(2), count: 1,
})),
}, null, 2));
+80
View File
@@ -0,0 +1,80 @@
/**
* Pre-compile layerchart `.svelte` sources to `.js` so Rollup/Vite CI builds succeed.
*/
import { compile } from "svelte/compiler";
import { readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
const layerchartRoot = join(root, "node_modules", "layerchart");
const layerchartDist = join(layerchartRoot, "dist");
const stampPath = join(layerchartDist, ".bsplus-compiled");
const COMPILE_ALGO_VERSION = "2";
const importSuffixPattern = /\.svelte(?=['"])/g;
const exists = (path) => {
try {
statSync(path);
return true;
} catch {
return false;
}
};
if (!exists(layerchartDist)) {
console.log("compile-layerchart-vendor: layerchart not installed, skipping");
process.exit(0);
}
const layerchartVersion = JSON.parse(
readFileSync(join(layerchartRoot, "package.json"), "utf8"),
).version;
const stampContent = `${layerchartVersion}\n${COMPILE_ALGO_VERSION}`;
if (exists(stampPath) && readFileSync(stampPath, "utf8").trim() === stampContent) {
console.log(`compile-layerchart-vendor: layerchart@${layerchartVersion} already compiled, skipping`);
process.exit(0);
}
const walkFiles = (dir, files = []) => {
for (const name of readdirSync(dir)) {
if (name === "node_modules") continue;
const path = join(dir, name);
if (statSync(path).isDirectory()) walkFiles(path, files);
else files.push(path);
}
return files;
};
const patchSvelteImports = (content) => content.replace(importSuffixPattern, ".js");
const stripRollupBreakingSyntax = (code) =>
code
.replace(/(\w+)\?(?=\s*[,)\]])/g, "$1")
.replace(/(\w+)\?(?=\s*:)/g, "$1");
const svelteFiles = walkFiles(layerchartDist).filter((f) => f.endsWith(".svelte"));
for (const sveltePath of svelteFiles) {
const source = readFileSync(sveltePath, "utf8");
if (!source.includes("<script")) continue;
const compiled = compile(source, {
filename: sveltePath,
generate: "client",
css: "injected",
});
writeFileSync(
sveltePath.replace(/\.svelte$/, ".js"),
stripRollupBreakingSyntax(patchSvelteImports(compiled.js.code)),
);
}
for (const filePath of walkFiles(layerchartDist).filter((f) => /\.(js|svelte|ts|mjs)$/.test(f))) {
const content = readFileSync(filePath, "utf8");
if (!content.includes(".svelte")) continue;
const patched = patchSvelteImports(content);
if (patched !== content) writeFileSync(filePath, patched);
}
writeFileSync(stampPath, stampContent);
console.log(`compile-layerchart-vendor: compiled ${svelteFiles.length} Svelte files`);
+24
View File
@@ -0,0 +1,24 @@
import { copyFileSync, mkdirSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
const resources = join(root, "src", "public", "resources");
const files = [
["pdfjs-dist/build/pdf.worker.min.mjs", "pdfjs/pdf.worker.min.mjs"],
["pdfjs-dist/legacy/build/pdf.min.mjs", "pdfjs/pdf.legacy.min.mjs"],
[
"@huggingface/transformers/dist/ort-wasm-simd-threaded.jsep.mjs",
"ort/ort-wasm-simd-threaded.jsep.mjs",
],
[
"@huggingface/transformers/dist/ort-wasm-simd-threaded.jsep.wasm",
"ort/ort-wasm-simd-threaded.jsep.wasm",
],
];
for (const [source, target] of files) {
const output = join(resources, target);
mkdirSync(dirname(output), { recursive: true });
copyFileSync(join(root, "node_modules", source), output);
}
+56
View File
@@ -0,0 +1,56 @@
/**
* Package Chrome/Firefox build folders into Windows-friendly zip files.
*/
import { execFileSync } from "node:child_process";
import { appendFileSync, existsSync, mkdirSync, readFileSync, unlinkSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
function zipDirectory(sourceRel, outRel) {
const sourceDir = join(root, sourceRel);
const outZip = join(root, outRel);
if (!existsSync(sourceDir)) throw new Error(`Missing build output: ${sourceRel}`);
mkdirSync(dirname(outZip), { recursive: true });
if (existsSync(outZip)) unlinkSync(outZip);
if (process.platform === "win32") {
const esc = (s) => s.replace(/'/g, "''");
execFileSync(
"powershell",
[
"-NoProfile",
"-Command",
[
"Add-Type -AssemblyName System.IO.Compression.FileSystem",
`[IO.Compression.ZipFile]::CreateFromDirectory('${esc(sourceDir)}', '${esc(outZip)}')`,
].join("; "),
],
{ stdio: "inherit" },
);
} else {
execFileSync("zip", ["-r", "-q", outZip, "."], { cwd: sourceDir, stdio: "inherit" });
}
}
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
const version = process.argv[2] || pkg.version;
const updateChannel = process.env.UPDATE_CHANNEL || "stable";
const buildLabel = process.env.BUILD_LABEL || "";
const base =
updateChannel === "nightly" && buildLabel
? `betterseqtaplus-nightly-${buildLabel}`
: `${pkg.name}@${version}`;
const chromeZip = `dist/${base}-chrome.zip`;
const firefoxZip = `dist/${base}-firefox.zip`;
zipDirectory("dist/chrome", chromeZip);
zipDirectory("dist/firefox", firefoxZip);
console.log(`Packaged ${chromeZip}\nPackaged ${firefoxZip}`);
if (process.env.GITHUB_OUTPUT) {
appendFileSync(process.env.GITHUB_OUTPUT, `chrome_zip=${chromeZip}\nfirefox_zip=${firefoxZip}\n`);
}
+49
View File
@@ -0,0 +1,49 @@
import fs from "node:fs";
import path from "node:path";
const root = process.cwd();
function fail(message) {
console.error(`[smoke-test] ${message}`);
process.exit(1);
}
function assertManifest(browserDir) {
const manifestPath = path.join(root, "dist", browserDir, "manifest.json");
if (!fs.existsSync(manifestPath)) {
fail(`Missing ${manifestPath} — run npm run build first`);
}
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
if (!manifest.manifest_version) fail(`${browserDir} manifest missing manifest_version`);
if (!manifest.name) fail(`${browserDir} manifest missing name`);
if (!manifest.version) fail(`${browserDir} manifest missing version`);
const sw =
manifest.background?.service_worker ??
manifest.background?.scripts?.[0] ??
null;
if (sw) {
const swPath = path.join(root, "dist", browserDir, sw);
if (!fs.existsSync(swPath)) {
fail(`${browserDir} service worker not found on disk: ${sw}`);
}
}
}
function assertAssets(browserDir) {
const assetsDir = path.join(root, "dist", browserDir, "assets");
if (!fs.existsSync(assetsDir)) {
fail(`Missing assets directory: dist/${browserDir}/assets`);
}
const jsFiles = fs.readdirSync(assetsDir).filter((f) => f.endsWith(".js"));
if (jsFiles.length === 0) {
fail(`No JS assets in dist/${browserDir}/assets`);
}
}
for (const browser of ["chrome", "firefox"]) {
assertManifest(browser);
assertAssets(browser);
}
console.log("[smoke-test] dist/chrome and dist/firefox look OK");
-126
View File
@@ -1,126 +0,0 @@
--- a/Users/sethburkart/Documents/Coding/betterseqta-plus/src/plugins/core/settings.ts
+++ b/Users/sethburkart/Documents/Coding/betterseqta-plus/src/plugins/core/settings.ts
@@ -2,7 +2,7 @@
// Base interfaces for our settings
interface BaseSettingOptions {
- title: string;
+ readonly title: string; // Mark as readonly where appropriate
description?: string;
}
@@ -11,21 +11,21 @@
}
interface StringSettingOptions extends BaseSettingOptions {
- default: string;
+ readonly default: string;
maxLength?: number;
pattern?: string;
}
interface NumberSettingOptions extends BaseSettingOptions {
- default: number;
+ readonly default: number;
min?: number;
max?: number;
step?: number;
}
interface SelectSettingOptions<T extends string> extends BaseSettingOptions {
- default: T;
- options: readonly T[];
+ readonly default: T;
+ readonly options: readonly T[];
}
// The actual decorators
@@ -34,14 +34,16 @@
// Ensure the settings property exists on the constructor's prototype
const proto = target.constructor.prototype;
if (!proto.hasOwnProperty('settings')) {
- proto.settings = {};
+ // Initialize with a base type that can be extended
+ Object.defineProperty(proto, 'settings', {
+ value: {},
+ writable: true, // Allows adding properties
+ configurable: true,
+ enumerable: true
+ });
}
-
+
// Add the setting to the prototype's settings object with const assertion
proto.settings[propertyKey] = {
type: 'boolean' as const,
...options
};
- };
-}
-
-export function StringSetting(options: StringSettingOptions): PropertyDecorator {
- return (target: Object, propertyKey: string | symbol) => {
- // Ensure the settings property exists on the constructor's prototype
- const proto = target.constructor.prototype;
- if (!proto.hasOwnProperty('settings')) {
- proto.settings = {};
- }
-
- // Add the setting to the prototype's settings object with const assertion
- proto.settings[propertyKey] = {
- type: 'string' as const,
- ...options
- };
};
}
@@ -50,14 +52,16 @@
// Ensure the settings property exists on the constructor's prototype
const proto = target.constructor.prototype;
if (!proto.hasOwnProperty('settings')) {
- proto.settings = {};
+ Object.defineProperty(proto, 'settings', {
+ value: {},
+ writable: true,
+ configurable: true,
+ enumerable: true
+ });
}
-
+
// Add the setting to the prototype's settings object with const assertion
proto.settings[propertyKey] = {
type: 'number' as const,
...options
};
- };
-}
-
-export function SelectSetting<T extends string>(options: SelectSettingOptions<T>): PropertyDecorator {
- return (target: Object, propertyKey: string | symbol) => {
- // Ensure the settings property exists on the constructor's prototype
- const proto = target.constructor.prototype;
- if (!proto.hasOwnProperty('settings')) {
- proto.settings = {};
- }
-
- // Add the setting to the prototype's settings object with const assertion
- proto.settings[propertyKey] = {
- type: 'select' as const,
- ...options
- };
};
}
// Base plugin class that handles settings
export abstract class BasePlugin<T extends PluginSettings = PluginSettings> {
// The settings property will be populated by decorators
- settings!: T;
-
+ // Keep the instance property and constructor logic as is,
+ // as changing it would require changing animated-background/index.ts
+ settings!: T; // Use definite assignment assertion
+
constructor() {
// Copy settings from the prototype to the instance
// This ensures that each instance has its own settings object
+54
View File
@@ -0,0 +1,54 @@
/** @jest-environment jsdom */
import { execFileSync } from "node:child_process";
import { runInNewContext } from "node:vm";
// Compile the actual Vite entry in Node (esbuild cannot run in jsdom's realm).
const bootScript = execFileSync(
process.execPath,
[
"--input-type=module",
"-e",
`
import { readFileSync } from "node:fs";
import { transformSync } from "esbuild";
process.stdout.write(transformSync(readFileSync("src/SEQTA.ts", "utf8"), {
loader: "ts", format: "cjs",
supported: { "dynamic-import": false },
define: { "import.meta.env.DEV": "false", "import.meta.hot": "undefined" },
}).code);
`,
],
{ encoding: "utf8" },
);
test.each([
{ onoff: false },
{ "plugin.error-page-kitten.settings": { enabled: false } },
])(
"disabled 404 customization preserves the native error message: %j",
async (stored) => {
document.head.innerHTML = "";
document.body.innerHTML = '<div class="message">Page not found</div>';
const mount = jest.fn();
runInNewContext(bootScript, {
document,
window,
console,
require: (module: string) => {
if (module === "webextension-polyfill") {
return { storage: { local: { get: async () => stored } } };
}
if (module.includes("errorPageKitten")) {
return { isSeqta404Page: () => true, mountErrorPageKitten: mount };
}
return {};
},
});
for (let i = 0; i < 10; i++) await Promise.resolve();
expect(mount).not.toHaveBeenCalled();
expect(
window.getComputedStyle(document.querySelector(".message")!).display,
).not.toBe("none");
},
);
+181 -18
View File
@@ -6,11 +6,36 @@ import documentLoadCSS from "@/css/documentload.scss?inline";
import icon48 from "@/resources/icons/icon-48.png?base64";
import browser from "webextension-polyfill";
import * as plugins from "@/plugins";
import { main } from "@/seqta/main";
import { delay } from "./seqta/utils/delay";
import { initializeHideSensitiveToggle } from "@/seqta/utils/hideSensitiveToggle";
import { installSeqtaMenuColourPatch } from "@/seqta/utils/patchSeqtaMenuUpdateColours";
import { installThemeImagePagePatch } from "@/seqta/utils/patchThemeImagesPageContext";
import { initVerboseLogging, verboseInfo } from "@/utils/verboseLog";
export let MenuOptionsOpen = false;
function registerFetchSeqtaAppLinkListener() {
browser.runtime.onMessage.addListener((request, _sender, sendResponse) => {
if (request?.type !== "fetchSeqtaAppLink") return false;
void (async () => {
try {
const res = await fetch(`${location.origin}/seqta/student/load/profile`, {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "include",
body: JSON.stringify({}),
});
const data = await res.json();
const statusOk = data?.status === "200" || data?.status === 200;
const raw = data?.payload?.app_link;
const appLink = typeof raw === "string" && raw.length > 0 ? raw : null;
sendResponse({ appLink: statusOk ? appLink : null });
} catch {
sendResponse({ appLink: null });
}
})();
return true;
});
}
var IsSEQTAPage = false;
let hasSEQTAText = false;
@@ -21,28 +46,66 @@ if (document.childNodes[1]) {
document.childNodes[1].textContent?.includes(
"Copyright (c) SEQTA Software",
) ?? false;
if (hasSEQTAText) {
installSeqtaMenuColourPatch();
installThemeImagePagePatch();
}
init();
}
async function init() {
const hasSEQTATitle = document.title.includes("SEQTA Learn");
// Standalone 404 documents never pass the SEQTA SPA gate above.
void bootErrorPage();
if (hasSEQTAText && hasSEQTATitle && !IsSEQTAPage) {
// Verify we are on a SEQTA page
if (import.meta.env.DEV) {
window.addEventListener("unhandledrejection", (event) => {
recoverFromStaleDevModuleGraph(event.reason);
});
}
async function init() {
if (
hasSEQTAText &&
(document.title.includes("SEQTA Learn") ||
document.title.includes("SEQTA Engage")) &&
!IsSEQTAPage
) {
IsSEQTAPage = true;
console.info("[BetterSEQTA+] Verified SEQTA Page");
verboseInfo("[BetterSEQTA+] Verified SEQTA Page");
registerFetchSeqtaAppLinkListener();
const documentLoadStyle = document.createElement("style");
documentLoadStyle.textContent = documentLoadCSS;
document.head.appendChild(documentLoadStyle);
const icon = document.querySelector(
'link[rel*="icon"]',
)! as HTMLLinkElement;
icon.href = icon48; // Change the icon
replaceIcons();
const observer = new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (
mutation.type === "attributes" &&
mutation.target instanceof HTMLLinkElement &&
mutation.target.rel.includes("icon") &&
mutation.attributeName === "href"
) {
replaceIcons();
return;
}
}
});
observer.observe(document.head, {
subtree: true,
attributes: true,
attributeFilter: ["href"],
});
try {
await initializeSettingsState();
initVerboseLogging();
if (typeof settingsState.onoff === "undefined") {
await browser.runtime.sendMessage({ type: "setDefaultStorage" });
@@ -52,19 +115,119 @@ async function init() {
await main();
if (settingsState.onoff) {
// Initialize legacy plugins
plugins.Monofile();
const { init: Monofile } = await import("@/plugins/monofile");
Monofile();
// Initialize new plugin system
await plugins.initializePlugins();
if (settingsState.onoff) {
const { initializePlugins } = await import("@/plugins/index");
await initializePlugins();
}
console.info(
if (settingsState.devMode) {
initializeHideSensitiveToggle();
}
if (import.meta.env.DEV) {
sessionStorage.removeItem("bsplus-dev-export-recovery");
}
verboseInfo(
"[BetterSEQTA+] Successfully initialised BetterSEQTA+, starting to load assets.",
);
} catch (error: any) {
} catch (error) {
console.error(error);
recoverFromStaleDevModuleGraph(error);
}
}
}
/** Hide the rebranded 404 before the kitten card mounts (removed after boot). */
function inject404FlashHide(): void {
if (document.getElementById("bsplus-404-flash-hide")) return;
const style = document.createElement("style");
style.id = "bsplus-404-flash-hide";
style.textContent =
"html,body{background:#333!important}.message{display:none!important}";
(document.head ?? document.documentElement).appendChild(style);
}
async function bootErrorPage() {
if (IsSEQTAPage) return;
const { isSeqta404Page, mountErrorPageKitten } = await import(
"@/plugins/built-in/errorPageKitten"
);
const storagePromise = browser.storage.local.get([
"onoff",
"plugin.error-page-kitten.settings",
]);
const watchTitle = () => {
if (isSeqta404Page()) inject404FlashHide();
};
watchTitle();
if (document.readyState === "loading") {
document.addEventListener("readystatechange", watchTitle);
}
if (document.readyState === "loading") {
await new Promise<void>((resolve) => {
document.addEventListener("DOMContentLoaded", () => resolve(), { once: true });
});
}
document.removeEventListener("readystatechange", watchTitle);
try {
if (!isSeqta404Page()) return;
const stored = await storagePromise;
if ((stored.onoff ?? true) === false) return;
const kittenSettings = stored["plugin.error-page-kitten.settings"] as
| { enabled?: boolean }
| undefined;
if (kittenSettings?.enabled === false) return;
mountErrorPageKitten();
} catch (error) {
document
.querySelectorAll(".bsplus-kitten-404-hidden")
.forEach((el) => el.classList.remove("bsplus-kitten-404-hidden"));
console.error("[BetterSEQTA+] Failed to boot 404 page:", error);
} finally {
document.getElementById("bsplus-404-flash-hide")?.remove();
}
}
function replaceIcons() {
document
.querySelectorAll<HTMLLinkElement>('link[rel*="icon"]')
.forEach((link) => {
if (link.href !== icon48) {
link.href = icon48;
}
});
}
/** Vite/CRX HMR can leave modules with missing named exports until the graph is cleared. */
function recoverFromStaleDevModuleGraph(error: unknown) {
if (!import.meta.env.DEV) return;
const message = error instanceof Error ? error.message : String(error);
if (!/does not provide an export named/.test(message)) return;
const key = "bsplus-dev-export-recovery";
if (!sessionStorage.getItem(key)) {
sessionStorage.setItem(key, "1");
import.meta.hot?.send("bsplus:reset-module-graph");
setTimeout(() => {
location.reload();
}, 80);
return;
}
sessionStorage.removeItem(key);
console.error(
"[BetterSEQTA+] Dev module graph is still stale after recovery. Restart `npm run dev`, then reload this page.",
);
}
+704 -150
View File
@@ -1,12 +1,53 @@
import browser from "webextension-polyfill";
import semver from "semver";
import type { SettingsState } from "@/types/storage";
import { getDefaultSettingsState } from "@/seqta/utils/defaultSettings";
import { ensureSyncableStorageDefaults } from "@/seqta/utils/ensureSyncableStorageDefaults";
import { fetchNews } from "./background/news";
import {
initCloudSettingsAutoSync,
performCloudSettingsDownloadWithRetry,
performCloudSettingsUploadWithRetry,
requestCloudSettingsDebouncedUpload,
runCloudSettingsPoll,
withSuppressedCloudAutoUpload,
} from "./background/cloudSettingsAutoSync";
import { getBsplusDeviceName } from "@/seqta/utils/bsplusDeviceName";
import { isAllowedFetchUrl } from "@/seqta/utils/allowedFetchUrl";
import { initCalendarBackground } from "./background/calendarBackground";
import {
registerGoogleCalendarMessageHandlers,
registerOutlookCalendarMessageHandlers,
} from "./background/calendarBackground";
import { createCustomThemesHandlers } from "./background/customThemesHandlers";
import { handleSearchThemeStockPhotos } from "./background/searchThemeStockPhotos";
import { initTimetableClassmatesBackgroundSync } from "./background/timetableClassmatesSync";
/**
* Session-only dev-mode override of the content API base.
*
* Stored in a module-level variable (not `chrome.storage`) so it is wiped
* automatically when the browser/service-worker process restarts. Content
* scripts re-sync this on every page load via `setDevApiBase` so the value
* survives transient service-worker terminations within the same browser
* session.
*/
const DEFAULT_API_BASE = "https://betterseqta.org";
let DEV_API_BASE: string | null = null;
function apiBase(): string {
// Extension dev builds always hit production (see DevApiBase.ts).
if (import.meta.env.DEV) return DEFAULT_API_BASE;
return DEV_API_BASE ?? DEFAULT_API_BASE;
}
function reloadSeqtaPages() {
const result = browser.tabs.query({});
function open(tabs: any) {
for (let tab of tabs) {
if (tab.title.includes("SEQTA Learn")) {
if (
tab.title?.includes("SEQTA Learn") ||
tab.title?.includes("SEQTA Engage")
) {
browser.tabs.reload(tab.id);
}
}
@@ -14,188 +55,701 @@ function reloadSeqtaPages() {
result.then(open, console.error);
}
// @ts-ignore
browser.runtime.onMessage.addListener(
(request: any, _: any, sendResponse: (response?: any) => void) => {
switch (request.type) {
case "reloadTabs":
reloadSeqtaPages();
break;
/** Callback for sending a response back to the message sender */
type MessageSender = { (response?: unknown): void };
case "extensionPages":
browser.tabs.query({}).then(function (tabs) {
for (let tab of tabs) {
if (tab.url?.includes("chrome-extension://")) {
browser.tabs.sendMessage(tab.id!, request);
}
}
});
break;
async function getAccessTokenFromStorage(): Promise<string | null> {
const { bsplus_token } = await browser.storage.local.get("bsplus_token");
return typeof bsplus_token === "string" && bsplus_token.length > 0 ? bsplus_token : null;
}
case "currentTab":
browser.tabs
.query({ active: true, currentWindow: true })
.then(function (tabs) {
browser.tabs
.sendMessage(tabs[0].id!, request)
.then(function (response) {
sendResponse(response);
});
/** Accept API + GitHub fallback shapes; always return `{ success, data?: { themes } }`. */
function normalizeFetchThemesResponse(json: unknown): {
success: boolean;
data?: { themes: unknown[] };
error?: string;
} {
if (!json || typeof json !== "object") {
return { success: false, error: "Invalid themes response" };
}
const body = json as Record<string, unknown>;
if (body.success === false) {
return {
success: false,
error: typeof body.error === "string" ? body.error : "Failed to fetch themes",
};
}
const data = body.data;
let themes: unknown[] | null = null;
if (data && typeof data === "object" && !Array.isArray(data)) {
const nested = (data as Record<string, unknown>).themes;
if (Array.isArray(nested)) themes = nested;
} else if (Array.isArray(data)) {
themes = data;
}
if (!themes && Array.isArray(body.themes)) {
themes = body.themes;
}
if (!themes) {
return { success: false, error: "Themes list missing from response" };
}
return { success: true, data: { themes } };
}
function handleFetchThemes(request: any, sendResponse: MessageSender): boolean {
void (async () => {
const token = await getAccessTokenFromStorage();
const apiUrl = `${apiBase()}/api/themes?type=betterseqta&limit=100&nocache=${Date.now()}`;
const githubUrl = `https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/themes.json?nocache=${Date.now()}`;
const headers: Record<string, string> = {};
if (token) headers["Authorization"] = `Bearer ${token}`;
fetch(apiUrl, { cache: "no-store", headers })
.then(async (r) => {
const json = await r.json();
if (!r.ok) {
throw new Error(
(json && typeof json === "object" && "error" in json && typeof (json as { error?: string }).error === "string"
? (json as { error: string }).error
: null) ?? `Themes API HTTP ${r.status}`,
);
}
return normalizeFetchThemesResponse(json);
})
.then(sendResponse)
.catch((err) => {
console.warn("[Background] fetchThemes API failed, trying GitHub fallback:", err?.message);
fetch(githubUrl, { cache: "no-store" })
.then(async (r) => {
if (!r.ok) throw new Error(`GitHub fallback HTTP ${r.status}`);
const data = await r.json();
const themes = Array.isArray(data) ? data : (data?.themes ?? []);
return normalizeFetchThemesResponse({ success: true, data: { themes } });
})
.then(sendResponse)
.catch((fallbackErr) => {
console.error("[Background] fetchThemes GitHub fallback error:", fallbackErr);
sendResponse({ success: false, error: fallbackErr?.message });
});
return true;
});
})();
return true;
}
case "githubTab":
browser.tabs.create({ url: "github.com/BetterSEQTA/BetterSEQTA-Plus" });
break;
function handleFetchThemeDetails(request: any, sendResponse: MessageSender): boolean {
const { themeId } = request;
if (!themeId || typeof themeId !== "string") {
sendResponse({ success: false, error: "Missing themeId" });
return false;
}
void (async () => {
const token = await getAccessTokenFromStorage();
const headers: Record<string, string> = {};
if (token) headers["Authorization"] = `Bearer ${token}`;
fetch(`${apiBase()}/api/themes/${themeId}`, { cache: "no-store", headers })
.then((r) => r.json())
.then(sendResponse)
.catch((err) => {
console.error("[Background] fetchThemeDetails error:", err);
sendResponse({ success: false, error: err?.message });
});
})();
return true;
}
case "setDefaultStorage":
SetStorageValue(DefaultValues);
break;
function isTrustedSender(sender?: browser.Runtime.MessageSender): boolean {
if (!sender) return false;
if (sender.id && sender.id !== browser.runtime.id) return false;
case "sendNews":
fetchNews(request.source ?? "australia", sendResponse);
return true;
default:
console.log("Unknown request type");
const urls = [sender.url, sender.tab?.url].filter(Boolean) as string[];
for (const pageUrl of urls) {
if (/^chrome-extension:\/\//.test(pageUrl) || /^moz-extension:\/\//.test(pageUrl)) {
return true;
}
try {
if (isSeqtaOrigin(new URL(pageUrl).origin)) return true;
} catch {
// try next URL
}
}
return false;
}
function handleFetchFromUrl(
request: any,
sendResponse: MessageSender,
sender?: browser.Runtime.MessageSender,
): boolean {
if (!isTrustedSender(sender)) {
sendResponse({ error: "Unauthorized sender" });
return false;
}
const { url } = request;
if (!url || typeof url !== "string") {
sendResponse({ error: "Missing url" });
return false;
}
if (!isAllowedFetchUrl(url)) {
sendResponse({ error: "URL not allowed" });
return false;
}
fetch(url, { cache: "no-store" })
.then((r) => r.json())
.then((data) => sendResponse({ data }))
.catch((err) => {
console.error("[Background] fetchFromUrl error:", err);
sendResponse({ error: err?.message });
});
return true;
}
async function parseJsonResponse(r: Response): Promise<any> {
const text = await r.text();
try {
return text ? JSON.parse(text) : {};
} catch {
return {};
}
}
function handleCloudReserveClient(request: any, sendResponse: MessageSender): boolean {
const redirect_uri = request.redirect_uri ?? "https://accounts.betterseqta.org/auth/bsplus/callback";
fetch("https://accounts.betterseqta.org/api/bsplus/client/reserve", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ redirect_uri }),
})
.then(async (r) => {
const data = await parseJsonResponse(r);
if (!r.ok) sendResponse({ error: data?.error ?? `Reserve failed (${r.status})` });
else sendResponse(data);
})
.catch((err) => {
console.error("[Background] cloudReserveClient error:", err);
sendResponse({ error: err?.message ?? "Network error" });
});
return true;
}
function handleCloudLogin(
request: any,
sendResponse: MessageSender,
sender?: browser.Runtime.MessageSender,
): boolean {
if (!isTrustedSender(sender)) {
sendResponse({ error: "Unauthorized sender" });
return false;
}
const { client_id, redirect_uri, login, password, device_name } = request;
if (!client_id || !redirect_uri || !login || !password) {
sendResponse({ error: "Missing client_id, redirect_uri, login, or password" });
return false;
}
void (async () => {
const loginBody: Record<string, string> = {
client_id,
redirect_uri,
login,
password,
device_name: device_name ?? await getBsplusDeviceName(),
};
try {
const r = await fetch("https://accounts.betterseqta.org/api/bsplus/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(loginBody),
});
const data = await parseJsonResponse(r);
if (!r.ok) sendResponse({ error: data?.error ?? "Login failed" });
else sendResponse(data);
} catch (err) {
console.error("[Background] cloudLogin error:", err);
sendResponse({ error: (err as Error)?.message ?? "Network error" });
}
})();
return true;
}
function handleCloudStartLogin(request: any, sendResponse: MessageSender): boolean {
const { client_id, redirect_uri } = request;
if (!client_id || !redirect_uri) {
sendResponse({ error: "Missing client_id or redirect_uri" });
return true;
}
const authorizeUrl = `https://accounts.betterseqta.org/login?redirect=${encodeURIComponent(`/oauth/authorize?client_id=${client_id}&redirect_uri=${encodeURIComponent(redirect_uri)}`)}`;
browser.tabs.create({ url: authorizeUrl }).then(() => {
sendResponse({ success: true });
}).catch((err) => {
console.error("[Background] cloudStartLogin error:", err);
sendResponse({ error: err?.message ?? "Failed to open login page" });
});
return true;
}
const CALLBACK_URL_PREFIX = "https://accounts.betterseqta.org/auth/bsplus/callback";
function initCloudLoginCallbackListener() {
browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.url && changeInfo.url.startsWith(CALLBACK_URL_PREFIX)) {
try {
const url = new URL(changeInfo.url);
const token = url.searchParams.get("token");
const refreshToken = url.searchParams.get("refresh_token");
const userId = url.searchParams.get("user_id");
if (token && refreshToken) {
// Store tokens
void (async () => {
try {
await browser.storage.local.set({
bsplus_token: token,
bsplus_refresh_token: refreshToken,
});
// Fetch full user info
const userRes = await fetch("https://accounts.betterseqta.org/api/auth/me", {
headers: { Authorization: `Bearer ${token}` },
});
if (userRes.ok) {
const user = await userRes.json();
await browser.storage.local.set({ bsplus_user: user });
} else if (userId) {
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);
});
} catch (err) {
console.error("[Background] Failed to process login callback:", err);
}
})();
// Close the callback tab
void browser.tabs.remove(tabId);
}
} catch (err) {
console.error("[Background] Error parsing callback URL:", err);
}
}
});
}
initCloudLoginCallbackListener();
function handleCloudRefresh(request: any, sendResponse: MessageSender): boolean {
const { refresh_token, client_id } = request;
if (!refresh_token || !client_id) {
sendResponse({ error: "Missing refresh_token or client_id" });
return false;
}
fetch("https://accounts.betterseqta.org/api/bsplus/refresh", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ refresh_token, client_id }),
})
.then(async (r) => {
const data = await parseJsonResponse(r);
if (!r.ok) sendResponse({ error: data?.error ?? "Refresh failed" });
else sendResponse(data);
})
.catch((err) => {
console.error("[Background] cloudRefresh error:", err);
sendResponse({ error: err?.message ?? "Network error" });
});
return true;
}
function handleCloudSettingsUpload(
request: any,
sendResponse: MessageSender,
sender?: browser.Runtime.MessageSender,
): boolean {
if (!isTrustedSender(sender)) {
sendResponse({ success: false, error: "Unauthorized sender" });
return false;
}
void (async () => {
try {
const token = await getAccessTokenFromStorage();
if (!token) {
sendResponse({ success: false, error: "Not authenticated" });
return;
}
const res = await performCloudSettingsUploadWithRetry(token);
sendResponse({
success: res.success,
error: res.error,
updated_at: res.updated_at,
});
} catch (err) {
console.error("[Background] cloudSettingsUpload error:", err);
sendResponse({
success: false,
error: err instanceof Error ? err.message : "Upload failed",
});
}
})();
return true;
}
function handleCloudSettingsDownload(
request: any,
sendResponse: MessageSender,
sender?: browser.Runtime.MessageSender,
): boolean {
if (!isTrustedSender(sender)) {
sendResponse({ success: false, error: "Unauthorized sender" });
return false;
}
void (async () => {
try {
const token = await getAccessTokenFromStorage();
if (!token) {
sendResponse({ success: false, error: "Not authenticated" });
return;
}
const res = await performCloudSettingsDownloadWithRetry(token);
sendResponse({
success: res.success,
notFound: res.notFound,
error: res.error,
updated_at: res.updated_at,
});
} catch (err) {
console.error("[Background] cloudSettingsDownload error:", err);
sendResponse({
success: false,
error: err instanceof Error ? err.message : "Download failed",
});
}
})();
return true;
}
function handleCloudFavorite(request: any, sendResponse: MessageSender): boolean {
const { themeId, action } = request;
if (!themeId) {
sendResponse({ success: false, error: "Theme ID required" });
return false;
}
void (async () => {
const token = await getAccessTokenFromStorage();
if (!token) {
sendResponse({ success: false, error: "Not authenticated" });
return;
}
const isFavorite = action === "favorite";
fetch(`${apiBase()}/api/themes/${themeId}/favorite`, {
method: isFavorite ? "POST" : "DELETE",
headers: { Authorization: `Bearer ${token}` },
})
.then((r) => r.json())
.then(sendResponse)
.catch((err) => {
console.error("[Background] cloudFavorite error:", err);
sendResponse({ success: false, error: err?.message });
});
})();
return true;
}
/** Handler for a message type; receives request, sendResponse, and optional sender (for tab routing) */
type MessageHandler = {
(request: any, sendResponse: MessageSender, sender?: browser.Runtime.MessageSender): boolean | void;
};
function isSeqtaOrigin(origin: string): boolean {
try {
const u = new URL(origin);
return u.hostname.includes("seqta") || u.hostname.endsWith(".edu.au");
} catch {
return false;
}
}
function handleSetDevApiBase(
request: any,
_sendResponse: MessageSender,
sender?: browser.Runtime.MessageSender,
): boolean {
if (!isTrustedSender(sender)) return false;
if (import.meta.env.DEV) {
DEV_API_BASE = null;
return false;
}
const url = typeof request?.url === "string" ? request.url.trim() : null;
if (url && /^https?:\/\//.test(url)) {
DEV_API_BASE = url.replace(/\/$/, "");
} else {
DEV_API_BASE = null;
}
return false;
}
const customThemesHandlers = createCustomThemesHandlers({
apiBase,
getAccessTokenFromStorage,
});
const MESSAGE_HANDLERS: Record<string, MessageHandler> = {
...customThemesHandlers,
searchThemeStockPhotos: handleSearchThemeStockPhotos,
reloadTabs: () => reloadSeqtaPages(),
setDevApiBase: handleSetDevApiBase,
extensionPages: (req) => {
browser.tabs.query({}).then((tabs) => {
for (const tab of tabs) {
if (tab.url?.includes("chrome-extension://")) browser.tabs.sendMessage(tab.id!, req);
}
});
},
currentTab: (req, sendResponse) => {
browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => {
browser.tabs.sendMessage(tabs[0].id!, req).then(sendResponse);
});
return true;
},
githubTab: () => {
void browser.tabs.create({ url: "github.com/BetterSEQTA/BetterSEQTA-Plus" });
},
setDefaultStorage: () => SetStorageValue(getDefaultValues()),
ensureStorageDefaults: (_req, sendResponse) => {
void ensureSyncableStorageDefaults()
.then(() => sendResponse({ ok: true }))
.catch((e) => {
console.warn("[BetterSEQTA+] ensureStorageDefaults failed:", e);
sendResponse({ ok: false });
});
return true;
},
sendNews: (req, sendResponse, sender) => {
if (!isTrustedSender(sender)) {
sendResponse({ error: "Unauthorized sender" });
return false;
}
fetchNews(req.source ?? "australia", sendResponse);
return true;
},
fetchThemes: handleFetchThemes,
fetchThemeDetails: handleFetchThemeDetails,
fetchFromUrl: handleFetchFromUrl,
cloudReserveClient: handleCloudReserveClient,
cloudLogin: handleCloudLogin,
cloudStartLogin: handleCloudStartLogin,
cloudRefresh: handleCloudRefresh,
cloudFavorite: handleCloudFavorite,
cloudSettingsUpload: handleCloudSettingsUpload,
cloudSettingsDownload: handleCloudSettingsDownload,
cloudSettingsPoll: () => {
void runCloudSettingsPoll();
return false;
},
cloudSettingsRequestDebouncedUpload: () => {
requestCloudSettingsDebouncedUpload();
return false;
},
getSeqtaSession: (req: { baseUrl?: string }, sendResponse: MessageSender, sender?: browser.Runtime.MessageSender) => {
(async () => {
try {
let tabId = sender?.tab?.id;
let originForCheck: string | undefined = req.baseUrl;
if (tabId == null) {
const tabs = await browser.tabs.query({ active: true, lastFocusedWindow: true });
const tab = tabs[0];
if (!tab?.id || !tab.url) {
sendResponse({ appLink: null });
return;
}
tabId = tab.id;
if (!originForCheck) originForCheck = new URL(tab.url).origin;
} else if (!originForCheck && sender?.tab?.url) {
originForCheck = new URL(sender.tab.url).origin;
}
if (!originForCheck || !isSeqtaOrigin(originForCheck)) {
sendResponse({ appLink: null });
return;
}
const reply = (await browser.tabs.sendMessage(tabId, { type: "fetchSeqtaAppLink" })) as
| { appLink?: string | null }
| undefined;
const appLink = typeof reply?.appLink === "string" && reply.appLink.length > 0 ? reply.appLink : null;
sendResponse({ appLink });
} catch (err) {
console.error("[Background] getSeqtaSession error:", err);
sendResponse({ appLink: null });
}
})();
return true;
},
};
registerGoogleCalendarMessageHandlers(MESSAGE_HANDLERS, isTrustedSender);
registerOutlookCalendarMessageHandlers(MESSAGE_HANDLERS, isTrustedSender);
initCalendarBackground();
browser.runtime.onMessage.addListener(
// @ts-ignore - OnMessageListener expects literal true for async, we return boolean
(request: any, sender: browser.Runtime.MessageSender, sendResponse: MessageSender) => {
const handler = MESSAGE_HANDLERS[request.type];
if (handler) {
const result = handler(request, sendResponse, sender);
return result === true;
}
console.log("Unknown request type");
return false;
},
);
const DefaultValues: SettingsState = {
onoff: true,
animatedbk: true,
bksliderinput: "50",
transparencyEffects: false,
lessonalert: true,
defaultmenuorder: [],
menuitems: {
assessments: { toggle: true },
courses: { toggle: true },
dashboard: { toggle: true },
documents: { toggle: true },
forums: { toggle: true },
goals: { toggle: true },
home: { toggle: true },
messages: { toggle: true },
myed: { toggle: true },
news: { toggle: true },
notices: { toggle: true },
portals: { toggle: true },
reports: { toggle: true },
settings: { toggle: true },
timetable: { toggle: true },
welcome: { toggle: true },
},
menuorder: [],
subjectfilters: {},
selectedTheme: "",
selectedColor:
"linear-gradient(40deg, rgba(201,61,0,1) 0%, RGBA(170, 5, 58, 1) 100%)",
originalSelectedColor: "",
DarkMode: true,
animations: true,
assessmentsAverage: true,
defaultPage: "home",
shortcuts: [
{
name: "Outlook",
enabled: true,
},
{
name: "Office",
enabled: true,
},
{
name: "Google",
enabled: true,
},
],
customshortcuts: [],
lettergrade: false,
newsSource: "australia",
};
function getDefaultValues(): SettingsState {
return getDefaultSettingsState();
}
function SetStorageValue(object: any) {
for (var i in object) {
browser.storage.local.set({ [i]: object[i] });
function SetStorageValue(object: SettingsState) {
void withSuppressedCloudAutoUpload(() =>
browser.storage.local.set(object as Record<string, unknown>),
);
}
/** One-time migration for 3.6.5: opt upgraders into Global Search + indexing + transparency defaults. */
const GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY = "plugin.global-search.settings";
const GLOBAL_SEARCH_MIGRATION_VERSION = "3.6.5";
async function migrateGlobalSearchDefaultsFor365Upgrade(
previousVersion: string,
): Promise<void> {
try {
const currRaw = browser.runtime.getManifest().version;
const prev = semver.coerce(previousVersion);
const curr = semver.coerce(currRaw);
if (
prev == null ||
curr == null ||
semver.lt(curr, GLOBAL_SEARCH_MIGRATION_VERSION) ||
!semver.lt(prev, GLOBAL_SEARCH_MIGRATION_VERSION)
) {
return;
}
const got = await browser.storage.local.get(GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY);
const existing = (got[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY] ?? {}) as Record<
string,
unknown
>;
await browser.storage.local.set({
[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY]: {
...existing,
enabled: true,
transparencyEffects: true,
runIndexingOnLoad: true,
passiveIndexing: true,
},
});
console.info(
`[BetterSEQTA+] Migration ${GLOBAL_SEARCH_MIGRATION_VERSION}: Global Search and related settings enabled (from ${previousVersion}).`,
);
} catch (e) {
console.warn("[BetterSEQTA+] Global Search 3.6.5 settings migration failed:", e);
}
}
function convertBksliderToSpeed(bksliderinput: number): number {
const minBase = 50;
const maxBase = 150;
/** One-time reset for 3.6.6: re-enable Theme of the Month for existing users. */
const THEME_OF_THE_MONTH_RESET_VERSION = "3.6.6";
const scaledValue =
2 + ((maxBase - bksliderinput) / (maxBase - minBase)) ** 4;
const baseSpeed = 3;
async function resetThemeOfTheMonthDisabledFor366Upgrade(
previousVersion: string,
): Promise<void> {
try {
const currRaw = browser.runtime.getManifest().version;
const prev = semver.coerce(previousVersion);
const curr = semver.coerce(currRaw);
if (
prev == null ||
curr == null ||
semver.lt(curr, THEME_OF_THE_MONTH_RESET_VERSION) ||
!semver.lt(prev, THEME_OF_THE_MONTH_RESET_VERSION)
) {
return;
}
const speed = baseSpeed / scaledValue;
return speed;
await browser.storage.local.set({
themeOfTheMonthDisabled: false,
themeOfTheMonthLastSeenId: undefined,
});
console.info(
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RESET_VERSION}: Theme of the Month re-enabled (from ${previousVersion}).`,
);
} catch (e) {
console.warn(
"[BetterSEQTA+] Theme of the Month 3.6.6 reset migration failed:",
e,
);
}
}
async function migrateLegacySettings() {
const storage = (await browser.storage.local.get(
null,
)) as unknown as SettingsState;
/** 3.7.0: Close no longer marks entries seen — clear legacy dismissal keys. */
const THEME_OF_THE_MONTH_RELOAD_VERSION = "3.7.0";
// Animated Background Migration
if ("animatedbk" in storage || "bksliderinput" in storage) {
const animatedSettings = {
enabled: storage.animatedbk ?? true,
speed: storage.bksliderinput
? convertBksliderToSpeed(parseFloat(storage.bksliderinput))
: 1,
};
await browser.storage.local.set({
"plugin.animated-background.settings": animatedSettings,
});
}
async function resetThemeOfTheMonthDismissalFor370Upgrade(
previousVersion: string,
): Promise<void> {
try {
const currRaw = browser.runtime.getManifest().version;
const prev = semver.coerce(previousVersion);
const curr = semver.coerce(currRaw);
if (
prev == null ||
curr == null ||
semver.lt(curr, THEME_OF_THE_MONTH_RELOAD_VERSION) ||
!semver.lt(prev, THEME_OF_THE_MONTH_RELOAD_VERSION)
) {
return;
}
// Assessments Average Migration
if ("assessmentsAverage" in storage || "lettergrade" in storage) {
const assessmentsSettings = {
enabled: storage.assessmentsAverage ?? true,
lettergrade: storage.lettergrade ?? false,
};
await browser.storage.local.set({
"plugin.assessments-average.settings": assessmentsSettings,
themeOfTheMonthLastSeenId: undefined,
themeOfTheMonthDismissedMonth: undefined,
});
}
if ("selectedTheme" in storage) {
const themesSettings = { enabled: true };
await browser.storage.local.set({
"plugin.themes.settings": themesSettings,
});
console.info(
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RELOAD_VERSION}: Theme of the Month shows again until dismissed for the month (from ${previousVersion}).`,
);
} catch (e) {
console.warn(
"[BetterSEQTA+] Theme of the Month 3.7.0 dismissal migration failed:",
e,
);
}
if (storage.notificationCollector !== false) {
await browser.storage.local.set({
"plugin.notificationCollector.settings": { enabled: true },
});
} else {
await browser.storage.local.set({
"plugin.notificationCollector.settings": { enabled: false },
});
}
const keysToRemove = [
"animatedbk",
"bksliderinput",
"assessmentsAverage",
"lettergrade",
];
await browser.storage.local.remove(keysToRemove);
}
browser.runtime.onInstalled.addListener(function (event) {
browser.storage.local.remove(["justupdated"]);
browser.storage.local.remove(["data"]);
void ensureSyncableStorageDefaults();
if (event.reason == "install" || event.reason == "update") {
browser.storage.local.set({ justupdated: true });
migrateLegacySettings();
}
if (event.reason === "update" && event.previousVersion) {
void migrateGlobalSearchDefaultsFor365Upgrade(event.previousVersion);
void resetThemeOfTheMonthDisabledFor366Upgrade(event.previousVersion);
void resetThemeOfTheMonthDismissalFor370Upgrade(event.previousVersion);
reloadSeqtaPages();
}
});
browser.runtime.onStartup.addListener(() => {
void ensureSyncableStorageDefaults();
});
initCloudSettingsAutoSync({ reloadSeqtaPages });
initTimetableClassmatesBackgroundSync();
void ensureSyncableStorageDefaults();
+551
View File
@@ -0,0 +1,551 @@
import {
GOOGLE_AUTH_URL,
GOOGLE_CALENDAR_ACCOUNTS_NOT_READY_HINT,
GOOGLE_CALENDAR_OAUTH_CALLBACK,
GOOGLE_CALENDAR_REFRESH_URL,
GOOGLE_CALENDAR_SCOPE,
GOOGLE_CALENDAR_TOKEN_URL,
GOOGLE_OAUTH_CLIENT_ID,
googleOAuthRedirectUriHint,
isGoogleCalendarConfigured,
} from "@/config/googleCalendar";
import {
OUTLOOK_AUTH_URL,
OUTLOOK_CALENDAR_ACCOUNTS_NOT_READY_HINT,
OUTLOOK_CALENDAR_OAUTH_CALLBACK,
OUTLOOK_CALENDAR_REFRESH_URL,
OUTLOOK_CALENDAR_SCOPE,
OUTLOOK_CALENDAR_TOKEN_URL,
OUTLOOK_OAUTH_CLIENT_ID,
isOutlookCalendarConfigured,
outlookOAuthRedirectUriHint,
} from "@/config/outlookCalendar";
import {
exchangeAccountsCode,
refreshAccountsToken,
type AccountsTokenPayload,
} from "@/seqta/utils/calendarSync/accountsToken";
import {
CALENDAR_WEEKLY_ALARM,
clampSyncWeeks,
getAutoSyncWeekly,
getSyncAssessmentDueDates,
getSyncWeeksAhead,
isAnyCalendarConnected,
markWeeklySyncPending,
readSharedCalendarSyncSettings,
writeSharedCalendarSyncSettings,
} from "@/seqta/utils/calendarSync/settings";
import {
clearGoogleCalendarState,
readGoogleCalendarState,
writeGoogleCalendarState,
} from "@/seqta/utils/calendarSync/providerStorage";
import { ensureGoogleAppCalendar } from "@/seqta/utils/googleCalendar/calendarProvisioning";
import type {
GoogleCalendarStatus,
GoogleCalendarSyncResult,
} from "@/seqta/utils/googleCalendar/types";
import {
clearOutlookCalendarState,
readOutlookCalendarState,
writeOutlookCalendarState,
type OutlookCalendarStatus,
} from "@/seqta/utils/calendarSync/providerStorage";
import browser from "webextension-polyfill";
import { isSeqtaTab } from "@/seqta/utils/seqtaTabMatch";
const WEEKLY_PERIOD_MINUTES = 7 * 24 * 60;
export type CalendarMessageHandler = (
request: unknown,
sendResponse: (response?: unknown) => void,
sender?: browser.Runtime.MessageSender,
) => boolean | void;
export type CalendarMessageHandlerMap = Record<string, CalendarMessageHandler>;
type StoredTokens = {
accessToken?: string;
refreshToken?: string;
expiresAt?: number;
lastSyncAt?: number;
lastSyncOrigin?: string;
};
type OAuthTabFlowOptions = {
callbackPrefix: string;
timeoutMessage: string;
cancelledMessage: string;
tabOpenErrorMessage: string;
timeoutMs?: number;
};
type CalendarProviderBackend = {
label: string;
isConfigured: () => boolean;
redirectHint: () => string;
mismatchRe: RegExp;
authUrl: string;
clientId: string;
scope: string;
callback: string;
tabOpts: Omit<OAuthTabFlowOptions, "callbackPrefix">;
notConfiguredError: string;
notConnectedError: string;
signInFailed: string;
read: () => Promise<StoredTokens>;
write: (patch: Partial<StoredTokens> & { connectedAt?: number }) => Promise<unknown>;
clear: () => Promise<unknown>;
exchange: (code: string, redirectUri: string, verifier: string) => Promise<AccountsTokenPayload>;
refresh: (refreshToken: string) => Promise<AccountsTokenPayload>;
applyAuthParams: (authUrl: URL) => void;
messagePrefix: string;
afterConnect?: (accessToken: string) => Promise<Partial<StoredTokens>>;
};
function createProviderBackend(
config: Omit<CalendarProviderBackend, "exchange" | "refresh"> & {
tokenUrl: string;
refreshUrl: string;
notReadyHint: string;
includeErrorDescription?: boolean;
},
): CalendarProviderBackend {
const { tokenUrl, refreshUrl, notReadyHint, includeErrorDescription, ...backend } = config;
return {
...backend,
exchange: (code, redirectUri, verifier) =>
exchangeAccountsCode(tokenUrl, code, redirectUri, verifier, notReadyHint, includeErrorDescription),
refresh: (refreshToken) =>
refreshAccountsToken(refreshUrl, refreshToken, notReadyHint, includeErrorDescription),
};
}
const GOOGLE_BACKEND = createProviderBackend({
label: "Google",
isConfigured: isGoogleCalendarConfigured,
redirectHint: googleOAuthRedirectUriHint,
mismatchRe: /redirect_uri_mismatch|invalid_request/i,
authUrl: GOOGLE_AUTH_URL,
clientId: GOOGLE_OAUTH_CLIENT_ID,
scope: GOOGLE_CALENDAR_SCOPE,
callback: GOOGLE_CALENDAR_OAUTH_CALLBACK,
tabOpts: {
timeoutMessage: "Google sign-in timed out. Close the tab and try again.",
cancelledMessage: "Google sign-in was cancelled.",
tabOpenErrorMessage: "Could not open Google sign-in tab.",
},
notConfiguredError: "Google Calendar is not configured in this extension build.",
notConnectedError: "Not connected to Google Calendar.",
signInFailed: "Google sign-in failed",
read: readGoogleCalendarState,
write: writeGoogleCalendarState,
clear: clearGoogleCalendarState,
applyAuthParams(authUrl) {
authUrl.searchParams.set("access_type", "offline");
},
messagePrefix: "googleCalendar",
tokenUrl: GOOGLE_CALENDAR_TOKEN_URL,
refreshUrl: GOOGLE_CALENDAR_REFRESH_URL,
notReadyHint: GOOGLE_CALENDAR_ACCOUNTS_NOT_READY_HINT,
async afterConnect(accessToken) {
const state = await readGoogleCalendarState();
const calendarId = await ensureGoogleAppCalendar(accessToken, state.calendarId);
return { calendarId };
},
});
const OUTLOOK_BACKEND = createProviderBackend({
label: "Microsoft",
isConfigured: isOutlookCalendarConfigured,
redirectHint: outlookOAuthRedirectUriHint,
mismatchRe: /redirect_uri|invalid_request|AADSTS50011/i,
authUrl: OUTLOOK_AUTH_URL,
clientId: OUTLOOK_OAUTH_CLIENT_ID,
scope: OUTLOOK_CALENDAR_SCOPE,
callback: OUTLOOK_CALENDAR_OAUTH_CALLBACK,
tabOpts: {
timeoutMessage: "Microsoft sign-in timed out. Close the tab and try again.",
cancelledMessage: "Microsoft sign-in was cancelled.",
tabOpenErrorMessage: "Could not open Microsoft sign-in tab.",
},
notConfiguredError: "Outlook Calendar is not configured in this extension build.",
notConnectedError: "Not connected to Outlook Calendar.",
signInFailed: "Microsoft sign-in failed",
read: readOutlookCalendarState,
write: writeOutlookCalendarState,
clear: clearOutlookCalendarState,
applyAuthParams(authUrl) {
authUrl.searchParams.set("response_mode", "query");
},
messagePrefix: "outlookCalendar",
tokenUrl: OUTLOOK_CALENDAR_TOKEN_URL,
refreshUrl: OUTLOOK_CALENDAR_REFRESH_URL,
notReadyHint: OUTLOOK_CALENDAR_ACCOUNTS_NOT_READY_HINT,
includeErrorDescription: true,
});
function base64UrlEncode(buffer: ArrayBuffer): string {
const bytes = new Uint8Array(buffer);
let binary = "";
for (const b of bytes) binary += String.fromCharCode(b);
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
}
function randomPkceVerifier(): string {
const bytes = new Uint8Array(32);
crypto.getRandomValues(bytes);
return base64UrlEncode(bytes.buffer);
}
async function pkceChallenge(verifier: string): Promise<string> {
const data = new TextEncoder().encode(verifier);
const digest = await crypto.subtle.digest("SHA-256", data);
return base64UrlEncode(digest);
}
function parseOAuthRedirectCode(responseUrl: string, providerLabel: string): string {
const url = new URL(responseUrl);
const err = url.searchParams.get("error");
if (err) throw new Error(url.searchParams.get("error_description") ?? err);
const code = url.searchParams.get("code");
if (!code) throw new Error(`${providerLabel} sign-in did not return an authorization code.`);
return code;
}
function isOAuthCallbackUrl(url: string, callbackPrefix: string): boolean {
if (!url.startsWith(callbackPrefix)) return false;
const parsed = new URL(url);
return parsed.searchParams.has("code") || parsed.searchParams.has("error");
}
function waitForOAuthCallback(authTabId: number, opts: OAuthTabFlowOptions): Promise<string> {
const timeoutMs = opts.timeoutMs ?? 10 * 60 * 1000;
return new Promise((resolve, reject) => {
const timeoutId = setTimeout(() => {
cleanup();
reject(new Error(opts.timeoutMessage));
}, timeoutMs);
const cleanup = () => {
clearTimeout(timeoutId);
browser.tabs.onUpdated.removeListener(onUpdated);
browser.tabs.onRemoved.removeListener(onRemoved);
};
const finishFromUrl = (url: string, tabId: number) => {
if (!isOAuthCallbackUrl(url, opts.callbackPrefix)) return false;
cleanup();
void browser.tabs.remove(tabId).catch(() => {});
resolve(url);
return true;
};
const onRemoved = (tabId: number) => {
if (tabId !== authTabId) return;
cleanup();
reject(new Error(opts.cancelledMessage));
};
const onUpdated = (
tabId: number,
changeInfo: browser.Tabs.OnUpdatedChangeInfoType,
tab: browser.Tabs.Tab,
) => {
if (tabId !== authTabId) return;
const url =
changeInfo.url ?? (changeInfo.status === "complete" ? tab.url : undefined);
if (url) finishFromUrl(url, tabId);
};
browser.tabs.onUpdated.addListener(onUpdated);
browser.tabs.onRemoved.addListener(onRemoved);
void browser.tabs
.get(authTabId)
.then((tab) => {
if (tab.url) finishFromUrl(tab.url, authTabId);
})
.catch(() => {});
});
}
async function openOAuthTab(authUrl: string, opts: OAuthTabFlowOptions): Promise<string> {
const tab = await browser.tabs.create({ url: authUrl, active: true });
if (tab.id === undefined) throw new Error(opts.tabOpenErrorMessage);
return waitForOAuthCallback(tab.id, opts);
}
function tokenExpiresAt(expiresIn?: number): number {
return expiresIn ? Date.now() + expiresIn * 1000 : Date.now() + 3_600_000;
}
async function getValidStoredAccessToken(
provider: CalendarProviderBackend,
): Promise<string> {
const state = await provider.read();
const now = Date.now();
if (state.accessToken && state.expiresAt && state.expiresAt > now + 60_000) {
return state.accessToken;
}
if (!state.refreshToken) throw new Error(provider.notConnectedError);
const refreshed = await provider.refresh(state.refreshToken);
await provider.write({
accessToken: refreshed.access_token,
refreshToken: refreshed.refresh_token ?? state.refreshToken,
expiresAt: tokenExpiresAt(refreshed.expires_in),
});
return refreshed.access_token;
}
export function registerTrustedAsyncHandler(
handlers: CalendarMessageHandlerMap,
isTrustedSender: (sender?: browser.Runtime.MessageSender) => boolean,
key: string,
fn: (request: unknown) => Promise<unknown>,
onError?: (err: unknown) => unknown,
): void {
handlers[key] = (request, sendResponse, sender) => {
if (!isTrustedSender(sender)) {
sendResponse({ success: false, error: "Unauthorized sender" });
return false;
}
void fn(request)
.then(sendResponse)
.catch((err) => {
sendResponse(
onError?.(err) ?? {
success: false,
error: err instanceof Error ? err.message : "Request failed",
},
);
});
return true;
};
}
async function getGoogleCalendarStatus(): Promise<GoogleCalendarStatus> {
const [state, shared, syncWeeksAhead, autoSyncWeekly, syncAssessmentDueDates] =
await Promise.all([
readGoogleCalendarState(),
readSharedCalendarSyncSettings(),
getSyncWeeksAhead(),
getAutoSyncWeekly(),
getSyncAssessmentDueDates(),
]);
return {
configured: isGoogleCalendarConfigured(),
connected: !!(state.refreshToken || state.accessToken),
lastSyncAt: state.lastSyncAt,
lastWeeklySyncAt: shared.lastWeeklySyncAt,
lastSyncOrigin: state.lastSyncOrigin,
syncWeeksAhead,
autoSyncWeekly,
syncAssessmentDueDates,
};
}
async function getOutlookCalendarStatus(): Promise<OutlookCalendarStatus> {
const state = await readOutlookCalendarState();
return {
configured: isOutlookCalendarConfigured(),
connected: !!(state.refreshToken || state.accessToken),
lastSyncAt: state.lastSyncAt,
lastSyncOrigin: state.lastSyncOrigin,
};
}
async function connectCalendar(provider: CalendarProviderBackend): Promise<GoogleCalendarSyncResult> {
if (!provider.isConfigured()) {
return { success: false, configured: false, error: provider.notConfiguredError };
}
const redirectUri = provider.callback;
const verifier = randomPkceVerifier();
const challenge = await pkceChallenge(verifier);
const authUrl = new URL(provider.authUrl);
authUrl.searchParams.set("client_id", provider.clientId);
authUrl.searchParams.set("response_type", "code");
authUrl.searchParams.set("redirect_uri", redirectUri);
authUrl.searchParams.set("scope", provider.scope);
authUrl.searchParams.set("prompt", "consent");
authUrl.searchParams.set("code_challenge", challenge);
authUrl.searchParams.set("code_challenge_method", "S256");
provider.applyAuthParams(authUrl);
let responseUrl: string;
try {
responseUrl = await openOAuthTab(authUrl.toString(), {
callbackPrefix: provider.callback,
...provider.tabOpts,
});
} catch (err) {
const message = err instanceof Error ? err.message : provider.signInFailed;
const mismatch =
provider.mismatchRe.test(message) || provider.mismatchRe.test(String(err));
return {
success: false,
configured: true,
error: mismatch
? `${provider.label} redirect URI mismatch. ${provider.redirectHint()}`
: message.includes("cancel")
? provider.tabOpts.cancelledMessage
: message,
};
}
try {
const code = parseOAuthRedirectCode(responseUrl, provider.label);
const tokens = await provider.exchange(code, redirectUri, verifier);
const existing = await provider.read();
await provider.write({
accessToken: tokens.access_token,
refreshToken: tokens.refresh_token ?? existing.refreshToken,
expiresAt: tokenExpiresAt(tokens.expires_in),
connectedAt: Date.now(),
});
if (provider.afterConnect) {
const patch = await provider.afterConnect(tokens.access_token);
if (patch && Object.keys(patch).length > 0) {
await provider.write(patch);
}
}
await ensureWeeklySyncAlarm();
return { success: true, configured: true, connected: true };
} catch (err) {
return {
success: false,
configured: true,
error: err instanceof Error ? err.message : provider.signInFailed,
};
}
}
function registerProviderHandlers(
handlers: CalendarMessageHandlerMap,
isTrustedSender: (sender?: browser.Runtime.MessageSender) => boolean,
provider: CalendarProviderBackend,
getStatus: () => Promise<unknown>,
): void {
const { messagePrefix, signInFailed } = provider;
const errMsg = (err: unknown, fallback: string) =>
err instanceof Error ? err.message : fallback;
registerTrustedAsyncHandler(
handlers,
isTrustedSender,
`${messagePrefix}Connect`,
() => connectCalendar(provider),
(err) => ({ success: false, error: errMsg(err, signInFailed) }),
);
registerTrustedAsyncHandler(
handlers,
isTrustedSender,
`${messagePrefix}Disconnect`,
async () => {
await provider.clear();
await ensureWeeklySyncAlarm();
return { success: true };
},
(err) => ({ success: false, error: errMsg(err, "Disconnect failed") }),
);
registerTrustedAsyncHandler(
handlers,
isTrustedSender,
`${messagePrefix}Status`,
getStatus,
() => ({ configured: provider.isConfigured(), connected: false }),
);
registerTrustedAsyncHandler(
handlers,
isTrustedSender,
`${messagePrefix}GetAccessToken`,
() => getValidStoredAccessToken(provider).then((accessToken) => ({ success: true, accessToken })),
(err) => ({ success: false, error: errMsg(err, "Token refresh failed") }),
);
}
export function registerGoogleCalendarMessageHandlers(
handlers: CalendarMessageHandlerMap,
isTrustedSender: (sender?: browser.Runtime.MessageSender) => boolean,
): void {
registerProviderHandlers(handlers, isTrustedSender, GOOGLE_BACKEND, getGoogleCalendarStatus);
registerTrustedAsyncHandler(handlers, isTrustedSender, "googleCalendarEnsureWeeklyAlarm", async () => {
await ensureWeeklySyncAlarm();
return { success: true };
}, (err) => ({
success: false,
error: err instanceof Error ? err.message : "Could not schedule weekly sync",
}));
registerTrustedAsyncHandler(handlers, isTrustedSender, "googleCalendarUpdateSyncSettings", async (request) => {
const body = request as {
syncWeeksAhead?: number;
autoSyncWeekly?: boolean;
syncAssessmentDueDates?: boolean;
};
const patch: Record<string, unknown> = {};
if (body.syncWeeksAhead != null) patch.syncWeeksAhead = clampSyncWeeks(body.syncWeeksAhead);
if (body.autoSyncWeekly != null) patch.autoSyncWeekly = !!body.autoSyncWeekly;
if (body.syncAssessmentDueDates != null) {
patch.syncAssessmentDueDates = !!body.syncAssessmentDueDates;
}
if (Object.keys(patch).length > 0) await writeSharedCalendarSyncSettings(patch);
await ensureWeeklySyncAlarm();
return { success: true, ...(await getGoogleCalendarStatus()) };
}, (err) => ({
success: false,
error: err instanceof Error ? err.message : "Could not update sync settings",
}));
}
export function registerOutlookCalendarMessageHandlers(
handlers: CalendarMessageHandlerMap,
isTrustedSender: (sender?: browser.Runtime.MessageSender) => boolean,
): void {
registerProviderHandlers(handlers, isTrustedSender, OUTLOOK_BACKEND, getOutlookCalendarStatus);
}
export async function ensureWeeklySyncAlarm(): Promise<void> {
const [connected, enabled] = await Promise.all([isAnyCalendarConnected(), getAutoSyncWeekly()]);
if (!connected || !enabled) {
await browser.alarms.clear(CALENDAR_WEEKLY_ALARM);
return;
}
const existing = await browser.alarms.get(CALENDAR_WEEKLY_ALARM);
if (!existing) {
await browser.alarms.create(CALENDAR_WEEKLY_ALARM, { periodInMinutes: WEEKLY_PERIOD_MINUTES });
}
}
async function triggerWeeklySyncOnSeqtaTabs(): Promise<boolean> {
const tabs = await browser.tabs.query({});
let delivered = false;
for (const tab of tabs) {
if (tab.id == null || !isSeqtaTab(tab)) continue;
try {
await browser.tabs.sendMessage(tab.id, { type: "calendarRunWeeklySync" });
delivered = true;
} catch {
// Tab may not have content script yet.
}
}
return delivered;
}
async function handleWeeklySyncAlarm(): Promise<void> {
if (!(await isAnyCalendarConnected()) || !(await getAutoSyncWeekly())) return;
if (!(await triggerWeeklySyncOnSeqtaTabs())) await markWeeklySyncPending();
}
export function initCalendarBackground(): void {
browser.alarms.onAlarm.addListener((alarm) => {
if (alarm.name === CALENDAR_WEEKLY_ALARM) void handleWeeklySyncAlarm();
});
void ensureWeeklySyncAlarm();
}
+478
View File
@@ -0,0 +1,478 @@
import browser from "webextension-polyfill";
import {
ensureSyncableStorageDefaults,
getSyncableStorageDefaults,
} from "@/seqta/utils/ensureSyncableStorageDefaults";
import {
applyDownloadedEnvelope,
BSPLUS_CLOUD_KNOWN_REMOTE_UPDATED_AT_KEY,
BSPLUS_PENDING_THEME_ENSURE_AFTER_CLOUD_KEY,
buildUploadPatch,
CLOUD_SETTINGS_SYNC_SCHEMA_VERSION,
isKeyIncludedInCloudUploadPayload,
normalizeStorageForSync,
resolveThemeIdForPostSyncDownload,
saveLastUploadedSnapshot,
getLastUploadedSnapshot,
setKnownRemoteUpdatedAt,
} from "@/seqta/utils/cloudSettingsSync";
const ACCOUNTS_BASE = "https://accounts.betterseqta.org";
export const CLOUD_SUMMARY_URL = `${ACCOUNTS_BASE}/api/user/cloud-summary`;
const CLOUD_SETTINGS_SYNC_URL = `${ACCOUNTS_BASE}/api/bsplus/settings/sync`;
const REFRESH_URL = `${ACCOUNTS_BASE}/api/bsplus/refresh`;
const UPLOAD_DEBOUNCE_MS = 2000;
const POLL_THROTTLE_MS = 24 * 60 * 60 * 1000;
const POLL_THROTTLE_KEY = "bsplus_lastCloudPoll";
const FETCH_TIMEOUT_MS = 30_000;
function fetchWithTimeout(url: string, init?: RequestInit): Promise<Response> {
return fetch(url, { ...init, signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
}
type CloudSummaryResponse = {
desqta?: unknown;
bsplus?: { updated_at: string; schemaVersion: number } | null;
};
let reloadSeqtaPagesFn: (() => void) | null = null;
let suppressAutoUploadDuringRestore = false;
let debounceTimer: ReturnType<typeof setTimeout> | null = null;
let pollInFlight: Promise<void> | null = null;
let autoSyncInitialized = false;
function isAutoCloudSyncEnabled(all: Record<string, unknown>): boolean {
return all.autoCloudSettingsSync !== false;
}
async function parseJsonResponse(r: Response): Promise<any> {
const text = await r.text();
try {
return text ? JSON.parse(text) : {};
} catch {
return {};
}
}
async function getAccessToken(): Promise<string | null> {
const { bsplus_token } = await browser.storage.local.get("bsplus_token");
return typeof bsplus_token === "string" && bsplus_token.length > 0 ? bsplus_token : null;
}
async function tryRefreshTokens(): Promise<boolean> {
const result = await browser.storage.local.get([
"bsplus_refresh_token",
"bsplus_client_id",
"bsplus_user",
]);
const refresh_token = result.bsplus_refresh_token as string | undefined;
const client_id = result.bsplus_client_id as string | undefined;
if (!refresh_token || !client_id) return false;
try {
const r = await fetchWithTimeout(REFRESH_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ refresh_token, client_id }),
});
const data = await parseJsonResponse(r);
if (!r.ok || !data.access_token || !data.refresh_token) return false;
await browser.storage.local.set({
bsplus_token: data.access_token,
bsplus_refresh_token: data.refresh_token,
bsplus_user: data.user ?? result.bsplus_user,
});
return true;
} catch {
return false;
}
}
function isServerTimestampNewer(serverIso: string, localIso: string | undefined): boolean {
const a = Date.parse(serverIso);
if (Number.isNaN(a)) return false;
if (localIso === undefined || localIso === "") return true;
const b = Date.parse(localIso);
if (Number.isNaN(b)) return true;
return a > b;
}
async function fetchCloudSummaryOnce(
token: string,
): Promise<
| { ok: true; data: CloudSummaryResponse }
| { ok: false; unauthorized: boolean; error?: string }
> {
try {
const r = await fetchWithTimeout(CLOUD_SUMMARY_URL, {
headers: { Authorization: `Bearer ${token}` },
cache: "no-store",
});
const data = (await parseJsonResponse(r)) as CloudSummaryResponse;
if (r.status === 401) return { ok: false, unauthorized: true };
if (!r.ok) {
return {
ok: false,
unauthorized: false,
error: (data as { error?: string })?.error ?? `Summary failed (${r.status})`,
};
}
return { ok: true, data };
} catch (e) {
return {
ok: false,
unauthorized: false,
error: e instanceof Error ? e.message : "Network error",
};
}
}
async function fetchCloudSummaryWithAuthRetry(
token: string,
): Promise<CloudSummaryResponse | null> {
let t = token;
for (let attempt = 0; attempt < 2; attempt++) {
const res = await fetchCloudSummaryOnce(t);
if (res.ok) return res.data;
if (res.unauthorized && attempt === 0) {
const refreshed = await tryRefreshTokens();
if (!refreshed) break;
const next = await getAccessToken();
if (!next) break;
t = next;
continue;
}
if (res.error) console.warn("[BS+ cloud sync] cloud-summary:", res.error);
break;
}
return null;
}
type PutResult =
| { ok: true; updated_at?: string; skipped?: boolean }
| { ok: false; unauthorized: boolean; error?: string };
async function resolveUploadBaseline(
normalized: Record<string, unknown>,
watermark: string | undefined,
): Promise<Record<string, unknown>> {
const lastSnapshot = await getLastUploadedSnapshot();
if (lastSnapshot) return lastSnapshot;
if (watermark) {
await saveLastUploadedSnapshot(normalized);
return normalized;
}
return getSyncableStorageDefaults();
}
async function putSettingsOnce(token: string): Promise<PutResult> {
try {
await ensureSyncableStorageDefaults();
const all = (await browser.storage.local.get()) as Record<string, unknown>;
const normalized = normalizeStorageForSync(all);
const watermark = all[BSPLUS_CLOUD_KNOWN_REMOTE_UPDATED_AT_KEY] as string | undefined;
const baseline = await resolveUploadBaseline(normalized, watermark);
const payload = buildUploadPatch(all, baseline);
if (!payload) {
return { ok: true, skipped: true };
}
const r = await fetchWithTimeout(CLOUD_SETTINGS_SYNC_URL, {
method: "PUT",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
const data = await parseJsonResponse(r);
if (r.status === 401) return { ok: false, unauthorized: true };
if (!r.ok) {
return {
ok: false,
unauthorized: false,
error: data?.error ?? `Upload failed (${r.status})`,
};
}
const updated_at = data?.updated_at as string | undefined;
await saveLastUploadedSnapshot(normalized);
await setKnownRemoteUpdatedAt(updated_at);
return { ok: true, updated_at };
} catch (e) {
return {
ok: false,
unauthorized: false,
error: e instanceof Error ? e.message : "Upload failed",
};
}
}
export async function performCloudSettingsUploadWithRetry(
token: string,
): Promise<{ success: boolean; error?: string; updated_at?: string; skipped?: boolean }> {
let t = token;
for (let attempt = 0; attempt < 2; attempt++) {
const res = await putSettingsOnce(t);
if (res.ok) {
return { success: true, updated_at: res.updated_at, skipped: res.skipped };
}
if (res.unauthorized && attempt === 0) {
const refreshed = await tryRefreshTokens();
if (!refreshed) return { success: false, error: "Not authenticated" };
const next = await getAccessToken();
if (!next) return { success: false, error: "Not authenticated" };
t = next;
continue;
}
return { success: false, error: res.error ?? "Upload failed" };
}
return { success: false, error: "Upload failed" };
}
type GetResult =
| { ok: true; updated_at?: string }
| { ok: false; notFound?: boolean; unauthorized: boolean; error?: string };
async function getSettingsAndApplyOnce(token: string): Promise<GetResult> {
try {
const r = await fetchWithTimeout(CLOUD_SETTINGS_SYNC_URL, {
method: "GET",
headers: { Authorization: `Bearer ${token}` },
cache: "no-store",
});
const data = await parseJsonResponse(r);
if (r.status === 401) return { ok: false, unauthorized: true };
if (r.status === 404) {
return {
ok: false,
notFound: true,
unauthorized: false,
error: "No settings backup found in the cloud",
};
}
if (!r.ok) {
return {
ok: false,
unauthorized: false,
error: data?.error ?? `Download failed (${r.status})`,
};
}
const themeIdToEnsure = resolveThemeIdForPostSyncDownload(data);
await applyDownloadedEnvelope(data);
if (themeIdToEnsure) {
await browser.storage.local.set({
[BSPLUS_PENDING_THEME_ENSURE_AFTER_CLOUD_KEY]: themeIdToEnsure,
});
} else {
await browser.storage.local.remove(BSPLUS_PENDING_THEME_ENSURE_AFTER_CLOUD_KEY);
}
reloadSeqtaPagesFn?.();
const updated_at = data?.updated_at as string | undefined;
await setKnownRemoteUpdatedAt(updated_at);
await saveLastUploadedSnapshot(
normalizeStorageForSync((await browser.storage.local.get()) as Record<string, unknown>),
);
return { ok: true, updated_at };
} catch (e) {
return {
ok: false,
unauthorized: false,
error: e instanceof Error ? e.message : "Download failed",
};
}
}
export async function performCloudSettingsDownloadWithRetry(
token: string,
): Promise<{ success: boolean; notFound?: boolean; error?: string; updated_at?: string }> {
suppressAutoUploadDuringRestore = true;
try {
let t = token;
for (let attempt = 0; attempt < 2; attempt++) {
const res = await getSettingsAndApplyOnce(t);
if (res.ok) return { success: true, updated_at: res.updated_at };
if (res.unauthorized && attempt === 0) {
const refreshed = await tryRefreshTokens();
if (!refreshed) return { success: false, error: "Not authenticated" };
const next = await getAccessToken();
if (!next) return { success: false, error: "Not authenticated" };
t = next;
continue;
}
return {
success: false,
notFound: res.notFound,
error: res.error ?? "Download failed",
};
}
return { success: false, error: "Download failed" };
} finally {
suppressAutoUploadDuringRestore = false;
}
}
async function maybeUploadBaseline(token: string): Promise<void> {
const res = await performCloudSettingsUploadWithRetry(token);
if (!res.success) {
console.warn("[BS+ cloud sync] Baseline upload failed:", res.error);
}
}
async function downloadIfNeeded(token: string): Promise<void> {
const res = await performCloudSettingsDownloadWithRetry(token);
if (!res.success && !res.notFound) {
console.warn("[BS+ cloud sync] Auto-download failed:", res.error);
}
}
async function runCloudSettingsPollInner(): Promise<void> {
const all = (await browser.storage.local.get()) as Record<string, unknown>;
if (!isAutoCloudSyncEnabled(all)) return;
let token = await getAccessToken();
if (!token) return;
const summary = await fetchCloudSummaryWithAuthRetry(token);
if (!summary) return;
const bsplus = summary.bsplus;
const watermark = all[BSPLUS_CLOUD_KNOWN_REMOTE_UPDATED_AT_KEY] as string | undefined;
if (
bsplus &&
typeof bsplus.schemaVersion === "number" &&
bsplus.schemaVersion > CLOUD_SETTINGS_SYNC_SCHEMA_VERSION
) {
console.warn(
"[BS+ cloud sync] Server schemaVersion newer than client; skip auto-download",
);
return;
}
token = (await getAccessToken()) ?? token;
if (!watermark) {
if (!bsplus?.updated_at) {
await maybeUploadBaseline(token);
return;
}
await downloadIfNeeded(token);
return;
}
if (!bsplus?.updated_at) return;
if (isServerTimestampNewer(bsplus.updated_at, watermark)) {
await downloadIfNeeded(token);
}
}
export function runCloudSettingsPoll(): Promise<void> {
if (pollInFlight) return pollInFlight;
pollInFlight = (async () => {
try {
const { [POLL_THROTTLE_KEY]: last } = await browser.storage.local.get(POLL_THROTTLE_KEY);
if (Date.now() - (Number(last) || 0) < POLL_THROTTLE_MS) return;
await runCloudSettingsPollInner();
await browser.storage.local.set({ [POLL_THROTTLE_KEY]: Date.now() });
} catch (e) {
console.error("[BS+ cloud sync] Poll error:", e);
} finally {
pollInFlight = null;
}
})();
return pollInFlight;
}
function clearUploadDebounce(): void {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = null;
}
}
function scheduleDebouncedUpload(): void {
if (suppressAutoUploadDuringRestore) return;
clearUploadDebounce();
debounceTimer = setTimeout(() => {
debounceTimer = null;
void runDebouncedUploadJob();
}, UPLOAD_DEBOUNCE_MS);
}
/** Call after store theme install (and similar) so cloud upload runs even if storage events are flaky. */
export function requestCloudSettingsDebouncedUpload(): void {
void (async () => {
const all = (await browser.storage.local.get()) as Record<string, unknown>;
if (!isAutoCloudSyncEnabled(all)) return;
if (suppressAutoUploadDuringRestore) return;
if (!(await getAccessToken())) return;
scheduleDebouncedUpload();
})();
}
async function runDebouncedUploadJob(): Promise<void> {
const all = (await browser.storage.local.get()) as Record<string, unknown>;
if (!isAutoCloudSyncEnabled(all)) return;
const token = await getAccessToken();
if (!token) return;
const res = await performCloudSettingsUploadWithRetry(token);
if (!res.success) {
console.warn("[BS+ cloud sync] Auto-upload failed:", res.error);
}
}
async function syncAutoUploadWithStorage(): Promise<void> {
const all = (await browser.storage.local.get()) as Record<string, unknown>;
if (!isAutoCloudSyncEnabled(all)) {
clearUploadDebounce();
}
}
function onStorageChanged(
changes: Record<string, browser.storage.StorageChange>,
area: string,
): void {
if (area !== "local") return;
if (Object.prototype.hasOwnProperty.call(changes, "autoCloudSettingsSync")) {
void syncAutoUploadWithStorage();
}
const keys = Object.keys(changes);
if (!keys.some((k) => isKeyIncludedInCloudUploadPayload(k))) return;
void (async () => {
const all = (await browser.storage.local.get()) as Record<string, unknown>;
if (!isAutoCloudSyncEnabled(all)) return;
if (suppressAutoUploadDuringRestore) return;
if (!(await getAccessToken())) return;
scheduleDebouncedUpload();
})();
}
export async function withSuppressedCloudAutoUpload<T>(
operation: () => T | Promise<T>,
): Promise<T> {
suppressAutoUploadDuringRestore = true;
try {
return await operation();
} finally {
suppressAutoUploadDuringRestore = false;
}
}
export function initCloudSettingsAutoSync(deps: { reloadSeqtaPages: () => void }): void {
reloadSeqtaPagesFn = deps.reloadSeqtaPages;
if (autoSyncInitialized) return;
autoSyncInitialized = true;
browser.storage.onChanged.addListener(onStorageChanged);
void runCloudSettingsPoll();
}
+298
View File
@@ -0,0 +1,298 @@
import { normalizeCustomThemeApiResponse } from "@/seqta/utils/customThemes/parseApiEnvelope";
type MessageSender = { (response?: unknown): void };
type UploadFilePart = {
fieldName: string;
filename: string;
mimeType: string;
dataBase64: string;
};
type UploadPayload = {
themeZip?: UploadFilePart;
looseFiles?: UploadFilePart[];
submissionNotes?: string;
};
function base64ToBlob(base64: string, mimeType: string): Blob {
const binary = atob(base64);
const bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
return new Blob([bytes], { type: mimeType });
}
function buildFormDataFromPayload(payload: UploadPayload): FormData {
const form = new FormData();
if (payload.themeZip) {
const part = payload.themeZip;
form.append(
part.fieldName,
base64ToBlob(part.dataBase64, part.mimeType),
part.filename,
);
}
for (const part of payload.looseFiles ?? []) {
form.append(
part.fieldName,
base64ToBlob(part.dataBase64, part.mimeType),
part.filename,
);
}
if (payload.submissionNotes?.trim()) {
form.append("submission_notes", payload.submissionNotes.trim());
}
return form;
}
export function createCustomThemesHandlers(deps: {
apiBase: () => string;
getAccessTokenFromStorage: () => Promise<string | null>;
}): Record<string, (request: any, sendResponse: MessageSender) => boolean> {
async function readCustomThemesResponse(r: Response): Promise<Record<string, unknown>> {
const text = await r.text();
let body: unknown = {};
try {
body = text ? JSON.parse(text) : {};
} catch {
body = null;
}
const normalized = normalizeCustomThemeApiResponse(body, r.status, text);
if (!r.ok || normalized.success === false) {
console.error("[BetterSEQTA+ CustomThemes]", r.status, r.url, normalized);
}
return normalized;
}
async function customThemesJsonFetch(
path: string,
init: RequestInit = {},
requireAuth = false,
): Promise<Record<string, unknown>> {
const headers: Record<string, string> = {
Accept: "application/json",
...(init.headers as Record<string, string> | undefined),
};
if (requireAuth) {
const token = await deps.getAccessTokenFromStorage();
if (!token) {
return { success: false, error: "Not authenticated", httpStatus: 401 };
}
headers.Authorization = `Bearer ${token}`;
}
const url = `${deps.apiBase()}${path}`;
const r = await fetch(url, {
...init,
headers,
cache: "no-store",
});
return await readCustomThemesResponse(r);
}
async function customThemesMultipartPost(
path: string,
payload: UploadPayload,
): Promise<Record<string, unknown>> {
const token = await deps.getAccessTokenFromStorage();
if (!token) {
return { success: false, error: "Not authenticated", httpStatus: 401 };
}
const form = buildFormDataFromPayload(payload);
const url = `${deps.apiBase()}${path}`;
const r = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${token}` },
body: form,
cache: "no-store",
});
return await readCustomThemesResponse(r);
}
function handleFetchCustomThemes(request: any, sendResponse: MessageSender): boolean {
void (async () => {
try {
const params = new URLSearchParams();
params.set("type", "betterseqta");
params.set("page", String(request.page ?? 1));
params.set("limit", String(request.limit ?? 20));
if (request.sort) params.set("sort", String(request.sort));
const search = request.search?.trim();
const path = search
? `/api/custom-themes/search?${params}&q=${encodeURIComponent(search)}`
: `/api/custom-themes?${params}`;
sendResponse(await customThemesJsonFetch(path));
} catch (err) {
console.error("[Background] fetchCustomThemes error:", err);
sendResponse({
success: false,
error: err instanceof Error ? err.message : "Fetch failed",
});
}
})();
return true;
}
function handleFetchMyCustomThemes(request: any, sendResponse: MessageSender): boolean {
void (async () => {
try {
const params = new URLSearchParams();
params.set("page", String(request.page ?? 1));
params.set("limit", String(request.limit ?? 20));
params.set("type", "betterseqta");
if (request.status) params.set("status", String(request.status));
sendResponse(
await customThemesJsonFetch(`/api/custom-themes/mine?${params}`, {}, true),
);
} catch (err) {
console.error("[Background] fetchMyCustomThemes error:", err);
sendResponse({
success: false,
error: err instanceof Error ? err.message : "Fetch failed",
});
}
})();
return true;
}
function handleFetchMyCustomThemeDetail(request: any, sendResponse: MessageSender): boolean {
const { themeId } = request;
if (!themeId || typeof themeId !== "string") {
sendResponse({ success: false, error: "Missing themeId" });
return false;
}
void (async () => {
try {
sendResponse(
await customThemesJsonFetch(
`/api/custom-themes/mine/${encodeURIComponent(themeId)}`,
{},
true,
),
);
} catch (err) {
console.error("[Background] fetchMyCustomThemeDetail error:", err);
sendResponse({
success: false,
error: err instanceof Error ? err.message : "Fetch failed",
});
}
})();
return true;
}
function handleSubmitCustomTheme(request: any, sendResponse: MessageSender): boolean {
const payload = request.payload as UploadPayload | undefined;
if (!payload?.themeZip && (!payload?.looseFiles || payload.looseFiles.length === 0)) {
sendResponse({ success: false, error: "Missing upload files" });
return false;
}
void (async () => {
try {
sendResponse(await customThemesMultipartPost("/api/custom-themes/mine", payload!));
} catch (err) {
console.error("[Background] submitCustomTheme error:", err);
sendResponse({
success: false,
error: { message: err instanceof Error ? err.message : "Upload failed" },
httpStatus: 0,
});
}
})();
return true;
}
function handleReplaceCustomThemeFiles(request: any, sendResponse: MessageSender): boolean {
const { themeId, payload } = request;
if (!themeId || typeof themeId !== "string") {
sendResponse({ success: false, error: "Missing themeId" });
return false;
}
if (!payload?.themeZip && (!payload?.looseFiles || payload.looseFiles.length === 0)) {
sendResponse({ success: false, error: "Missing upload files" });
return false;
}
void (async () => {
try {
sendResponse(
await customThemesMultipartPost(
`/api/custom-themes/mine/${encodeURIComponent(themeId)}/files`,
payload,
),
);
} catch (err) {
console.error("[Background] replaceCustomThemeFiles error:", err);
sendResponse({
success: false,
error: err instanceof Error ? err.message : "Upload failed",
});
}
})();
return true;
}
function handleUpdateCustomThemeMetadata(request: any, sendResponse: MessageSender): boolean {
const { themeId, body } = request;
if (!themeId || typeof themeId !== "string") {
sendResponse({ success: false, error: "Missing themeId" });
return false;
}
void (async () => {
try {
sendResponse(
await customThemesJsonFetch(
`/api/custom-themes/mine/${encodeURIComponent(themeId)}`,
{
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body ?? {}),
},
true,
),
);
} catch (err) {
console.error("[Background] updateCustomThemeMetadata error:", err);
sendResponse({
success: false,
error: err instanceof Error ? err.message : "Update failed",
});
}
})();
return true;
}
function handleDeleteCustomTheme(request: any, sendResponse: MessageSender): boolean {
const { themeId } = request;
if (!themeId || typeof themeId !== "string") {
sendResponse({ success: false, error: "Missing themeId" });
return false;
}
void (async () => {
try {
sendResponse(
await customThemesJsonFetch(
`/api/custom-themes/mine/${encodeURIComponent(themeId)}`,
{ method: "DELETE" },
true,
),
);
} catch (err) {
console.error("[Background] deleteCustomTheme error:", err);
sendResponse({
success: false,
error: err instanceof Error ? err.message : "Delete failed",
});
}
})();
return true;
}
return {
fetchCustomThemes: handleFetchCustomThemes,
fetchMyCustomThemes: handleFetchMyCustomThemes,
fetchMyCustomThemeDetail: handleFetchMyCustomThemeDetail,
submitCustomTheme: handleSubmitCustomTheme,
replaceCustomThemeFiles: handleReplaceCustomThemeFiles,
updateCustomThemeMetadata: handleUpdateCustomThemeMetadata,
deleteCustomTheme: handleDeleteCustomTheme,
};
}
+70 -17
View File
@@ -1,17 +1,46 @@
import Parser from "rss-parser";
const fetchAustraliaNews = async (url: string, sendResponse: any) => {
const MAX_RATE_LIMIT_RETRIES = 3;
/**
* Fetches news articles specifically for Australia from the NewsAPI.
*
* This function handles a specific case for fetching Australian news. It includes a
* mechanism to retry the fetch operation by appending "%00" to the URL if a
* rate limit error (`response.code == "rateLimited"`) is encountered. This is
* likely a workaround for cache-busting or bypassing certain rate-limiting measures.
*
* @param {string} url The NewsAPI URL to fetch Australian news from.
* @param {any} sendResponse A callback function (likely from a browser extension message listener)
* to send the fetched news data back to the caller.
* It's called with an object like `{ news: responseData }`.
*/
const fetchAustraliaNews = async (
url: string,
sendResponse: any,
rateLimitRetryCount = 0,
) => {
fetch(url)
.then((result) => result.json())
.then((response) => {
if (response.code == "rateLimited") {
fetchAustraliaNews((url += "%00"), sendResponse);
if (response.code == "rateLimited" && rateLimitRetryCount < MAX_RATE_LIMIT_RETRIES) {
fetchAustraliaNews(`${url}%00`, sendResponse, rateLimitRetryCount + 1);
} else {
sendResponse({ news: response });
}
})
.catch((error) => {
console.error("[BetterSEQTA+] Failed to fetch Australia news", error);
sendResponse({ news: { articles: [] } });
});
};
/**
* A record mapping lowercase country codes (e.g., "usa", "canada") to an array
* of RSS feed URLs for news sources in that country.
*
* @type {Record<string, string[]>}
*/
const rssFeedsByCountry: Record<string, string[]> = {
usa: [
"https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
@@ -54,16 +83,40 @@ const rssFeedsByCountry: Record<string, string[]> = {
netherlands: ["https://www.dutchnews.nl/feed/", "https://www.nrc.nl/rss/"],
};
export async function fetchNews(source: string, sendResponse: any) {
if (source === "australia") {
/**
* Fetches news articles based on a specified source.
*
* The source can be:
* 1. The string "australia": Fetches news from Australian sources via NewsAPI,
* handled by the `fetchAustraliaNews` function.
* 2. A lowercase country code (e.g., "usa", "canada"): Fetches news from a predefined
* list of RSS feeds for that country, as specified in `rssFeedsByCountry`.
* 3. A direct RSS feed URL (starting with "http"): Fetches news directly from this URL.
*
* The fetched articles are then sent back to the caller using the `sendResponse` callback.
*
* @param {string} source The news source identifier. This can be "australia", a
* lowercase country code, or a direct RSS feed URL.
* @param {any} sendResponse A callback function (typically from a browser extension
* message listener, like `chrome.runtime.onMessage`)
* used to send the fetched news data back to the caller.
* It's called with an object like `{ news: { articles: [...] } }`.
*/
export async function fetchNews(source: string | undefined, sendResponse: any) {
const normalizedSource = typeof source === "string" && source.trim()
? source.trim()
: "australia";
if (normalizedSource === "australia") {
const date = new Date();
date.setDate(date.getDate() - 5);
const from =
date.getFullYear() +
"-" +
(date.getMonth() + 1) +
String(date.getMonth() + 1).padStart(2, "0") +
"-" +
(date.getDate() - 5);
String(date.getDate()).padStart(2, "0");
const url = `https://newsapi.org/v2/everything?domains=abc.net.au&from=${from}&apiKey=17c0da766ba347c89d094449504e3080`;
fetchAustraliaNews(url, sendResponse);
@@ -73,23 +126,23 @@ export async function fetchNews(source: string, sendResponse: any) {
const parser = new Parser();
let feeds: string[];
console.log("fetchNews", source);
if (rssFeedsByCountry[source.toLowerCase()]) {
// If the source is a country, fetch from predefined feeds
feeds = rssFeedsByCountry[source.toLowerCase()];
} else if (source.startsWith("http")) {
// If the source is a URL, use it directly
feeds = [source];
if (rssFeedsByCountry[normalizedSource.toLowerCase()]) {
feeds = rssFeedsByCountry[normalizedSource.toLowerCase()];
} else if (normalizedSource.startsWith("http")) {
feeds = [normalizedSource];
} else {
throw new Error(
"Invalid source. Provide a country code or a valid RSS feed URL.",
);
console.warn("[BetterSEQTA+] Invalid news source, falling back to Australia", normalizedSource);
return fetchNews("australia", sendResponse);
}
const articlesPromises = feeds.map(async (feedUrl) => {
try {
const response = await fetch(feedUrl);
if (!response.ok) {
console.error(`Failed to fetch RSS feed: ${feedUrl} (${response.status})`);
return [];
}
const feedString = await response.text();
const feed = await parser.parseString(feedString);
+57
View File
@@ -0,0 +1,57 @@
type MessageSender = { (response?: unknown): void };
type StockPhotoResult = { title: string; thumbUrl: string; imageUrl: string };
export function handleSearchThemeStockPhotos(
request: { query?: string; limit?: number },
sendResponse: MessageSender,
): boolean {
const query = request.query?.trim();
if (!query) {
sendResponse({ success: false, error: "Missing query" });
return false;
}
const limit = Math.min(Math.max(request.limit ?? 8, 1), 12);
void (async () => {
try {
const params = new URLSearchParams({
action: "query",
origin: "*",
format: "json",
generator: "search",
gsrsearch: query,
gsrnamespace: "6",
gsrlimit: String(limit),
prop: "imageinfo",
iiprop: "url",
iiurlwidth: "1400",
});
const res = await fetch(`https://commons.wikimedia.org/w/api.php?${params}`);
const json = (await res.json()) as {
query?: { pages?: Record<string, { title?: string; imageinfo?: { thumburl?: string; url?: string }[] }> };
};
const pages = json.query?.pages ?? {};
const results: StockPhotoResult[] = Object.values(pages)
.map((page) => {
const info = page.imageinfo?.[0];
if (!info?.url) return null;
return {
title: page.title?.replace(/^File:/, "") ?? "Photo",
thumbUrl: info.thumburl ?? info.url,
imageUrl: info.url,
};
})
.filter((row): row is StockPhotoResult => row != null);
sendResponse({ success: true, results });
} catch (err) {
sendResponse({
success: false,
error: err instanceof Error ? err.message : "Search failed",
});
}
})();
return true;
}
+36
View File
@@ -0,0 +1,36 @@
import browser from "webextension-polyfill";
import { hasAnySyncOptInScope } from "@/plugins/built-in/timetableClassmates/syncScopes";
import { isSeqtaTab } from "@/seqta/utils/seqtaTabMatch";
const ALARM_NAME = "timetable-classmates-sync";
const ALARM_PERIOD_MINUTES = 8 * 60;
let initialized = false;
async function pingSeqtaTabs(): Promise<void> {
const tabs = await browser.tabs.query({});
for (const tab of tabs) {
if (!isSeqtaTab(tab) || tab.id == null) continue;
try {
await browser.tabs.sendMessage(tab.id, { type: "timetableClassmatesSync" });
} catch {
/* content script not ready */
}
}
}
async function pingIfOptedIn(): Promise<void> {
if (!(await hasAnySyncOptInScope())) return;
await pingSeqtaTabs();
}
export function initTimetableClassmatesBackgroundSync(): void {
if (initialized) return;
initialized = true;
void browser.alarms.create(ALARM_NAME, { periodInMinutes: ALARM_PERIOD_MINUTES });
browser.alarms.onAlarm.addListener((alarm) => {
if (alarm.name === ALARM_NAME) void pingIfOptedIn();
});
}
+43
View File
@@ -0,0 +1,43 @@
/** Google Calendar OAuth — public client config. Token exchange is on accounts.betterseqta.org. */
const HARDCODED_GOOGLE_OAUTH_CLIENT_ID =
"270834969641-f6t7jtpu6j0cemse8updj3rkos7nl0hf.apps.googleusercontent.com";
const envClientId =
typeof __GOOGLE_OAUTH_CLIENT_ID__ !== "undefined" ? __GOOGLE_OAUTH_CLIENT_ID__ : "";
export const GOOGLE_OAUTH_CLIENT_ID: string =
envClientId.trim() || HARDCODED_GOOGLE_OAUTH_CLIENT_ID.trim();
export const ACCOUNTS_BASE = "https://accounts.betterseqta.org";
export const GOOGLE_CALENDAR_OAUTH_CALLBACK = `${ACCOUNTS_BASE}/auth/google/calendar/callback`;
export const GOOGLE_CALENDAR_TOKEN_URL = `${ACCOUNTS_BASE}/api/bsplus/google/calendar/token`;
export const GOOGLE_CALENDAR_REFRESH_URL = `${ACCOUNTS_BASE}/api/bsplus/google/calendar/refresh`;
/** App-owned secondary calendar only — cannot read or modify the user's other calendars. */
export const GOOGLE_CALENDAR_SCOPE = "https://www.googleapis.com/auth/calendar.app.created";
export const GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
export const GOOGLE_CALENDAR_API = "https://www.googleapis.com/calendar/v3";
export const BSPLUS_GOOGLE_CALENDAR_NAME = "BetterSEQTA+ Timetable";
export const BSPLUS_GOOGLE_CALENDAR_DESCRIPTION =
"School timetable lessons synced by the BetterSEQTA+ extension.";
export const BSPLUS_GOOGLE_CALENDAR_EVENT_PROP = "bsplusSeqtaKey";
export const GOOGLE_CALENDAR_SYNC_WEEKS = 12;
export const GOOGLE_CALENDAR_SYNC_WEEKS_MIN = 1;
export const GOOGLE_CALENDAR_SYNC_WEEKS_MAX = 52;
export function isGoogleCalendarConfigured(): boolean {
return GOOGLE_OAUTH_CLIENT_ID.length > 0;
}
export const GOOGLE_CALENDAR_ACCOUNTS_NOT_READY_HINT =
"Google Calendar connect requires accounts.betterseqta.org — see docs/GOOGLE_CALENDAR_ACCOUNTS_CALLBACK.md";
export function googleOAuthRedirectUriHint(): string {
return `Authorized redirect URI in Google Cloud Console must be: ${GOOGLE_CALENDAR_OAUTH_CALLBACK}`;
}
+35
View File
@@ -0,0 +1,35 @@
/** Outlook Calendar OAuth — public client config. Token exchange is on accounts.betterseqta.org. */
import { ACCOUNTS_BASE } from "@/config/googleCalendar";
const HARDCODED_OUTLOOK_OAUTH_CLIENT_ID = "0b55168c-916c-4323-8f67-b3dd30af3c9e";
const envClientId =
typeof __OUTLOOK_OAUTH_CLIENT_ID__ !== "undefined" ? __OUTLOOK_OAUTH_CLIENT_ID__ : "";
export const OUTLOOK_OAUTH_CLIENT_ID: string =
envClientId.trim() || HARDCODED_OUTLOOK_OAUTH_CLIENT_ID.trim();
export const OUTLOOK_CALENDAR_OAUTH_CALLBACK = `${ACCOUNTS_BASE}/auth/microsoft/calendar/callback`;
export const OUTLOOK_CALENDAR_TOKEN_URL = `${ACCOUNTS_BASE}/api/bsplus/microsoft/calendar/token`;
export const OUTLOOK_CALENDAR_REFRESH_URL = `${ACCOUNTS_BASE}/api/bsplus/microsoft/calendar/refresh`;
export const OUTLOOK_CALENDAR_SCOPE = "offline_access Calendars.ReadWrite User.Read";
export const OUTLOOK_AUTH_URL =
"https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
export const OUTLOOK_GRAPH_API = "https://graph.microsoft.com/v1.0";
export const BSPLUS_OUTLOOK_CALENDAR_EVENT_CATEGORY = "BetterSEQTA+";
export function isOutlookCalendarConfigured(): boolean {
return OUTLOOK_OAUTH_CLIENT_ID.length > 0;
}
export const OUTLOOK_CALENDAR_ACCOUNTS_NOT_READY_HINT =
"Outlook Calendar connect requires accounts.betterseqta.org — see docs/OUTLOOK_CALENDAR_ACCOUNTS_CALLBACK.md";
export function outlookOAuthRedirectUriHint(): string {
return `Authorized redirect URI in Azure must be: ${OUTLOOK_CALENDAR_OAUTH_CALLBACK}`;
}
+88 -1
View File
@@ -17,10 +17,43 @@
@use "injected/popup.scss";
@font-face {
font-family: "Roboto";
src: url("https://fonts.gstatic.com/s/roboto/v50/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBA.woff2")
format("woff2");
font-weight: 700;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "IconFamily";
src: url("@/resources/fonts/IconFamily.woff") format("woff");
font-weight: normal;
font-style: normal;
font-display: block;
}
@layer base, override;
@layer override {
.legacy-root,
.legacy-root *:not(.iconFamily) {
font-family: var(--betterseqta-font-family, Rubik), sans-serif !important;
}
.iconFamily,
.iconFamily *,
[class~="iconFamily"],
[class~="iconFamily"] * {
font-family: "IconFamily" !important;
}
}
html {
background: #161616 !important;
background-color: #161616;
font-family: Rubik, Roboto !important;
font-family: Roboto, system-ui, -apple-system, sans-serif !important;
}
.tooltip svg {
@@ -94,3 +127,57 @@ body:has(.outside-container:not(.hide))
background: var(--text-primary) !important;
color: var(--theme-primary) !important;
}
.fixed-tooltip {
display: inline-block;
z-index: 5 !important;
width: 28px;
background: none;
box-shadow: none;
padding: 2px;
position: absolute;
}
.fixed-tooltip svg {
fill: var(--theme-primary);
}
.tooltiptext-fixed {
width: 120px;
transform: scale(0);
transition: transform 0.2s;
transform-origin: top;
background: var(--background-primary);
color: var(--text-primary);
text-align: center;
border-radius: 6px;
padding: 2px;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
margin-left: -62px;
}
.tooltiptext-fixed::after {
content: "";
position: absolute;
bottom: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent var(--text-primary) transparent;
}
.tooltiptext-fixed.show {
transform: scale(1);
transform-origin: top;
transition: transform 0.2s;
}
.tooltiptext-fixed p:hover {
cursor: pointer;
background: rgba(0, 0, 0, 0.3) !important;
transition: 200ms;
}
.tooltiptext-fixed p {
border-radius: 8px !important;
padding-top: 2px;
padding-bottom: 2px;
margin: 2px;
}
+1 -2
View File
@@ -116,8 +116,7 @@ body {
}
.cke_panel_listItem > a {
&:hover {
background: #3d3d3e !important;
}
}
}
+2796 -401
View File
File diff suppressed because it is too large. Load diff
+51
View File
@@ -0,0 +1,51 @@
html.performanceMode {
--bs-settings-ease: 0.2s cubic-bezier(0.22, 1, 0.36, 1);
--bs-motion-duration: 0.2s;
--bs-motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
backdrop-filter: none !important;
-webkit-backdrop-filter: none !important;
filter: none !important;
/* Inline page loaders only — boot overlay lives in #loading shadow DOM. */
.bkloading-inline .big-circle,
.bkloading-inline .small-circle,
.bkloading-inline .outer-circle {
animation: none !important;
}
/* Custom title: cheaper hit-testing during mouse moves (trace showed many HitTests). */
.bsplus-custom-title,
#title.bsplus-custom-title {
contain: layout style paint;
}
/* Settings backdrop — skip expensive blur in performance mode. */
#ExtensionPopup ~ *,
.outside-container.hide {
backdrop-filter: none !important;
}
}
html.performanceModeSimpleUi {
.bsplus-analytics-charts,
.bsplus-analytics-chart-cell {
display: none !important;
}
}
/* Boot loading spinner uses shadow DOM; custom properties inherit from the host. */
#loading.bkloading {
--bk-stage-duration: 0.85s !important;
--bk-spin-outer: 1s !important;
--bk-spin-inner: 3s !important;
--bk-spin-small: 3s !important;
}
html.performanceMode.transparencyEffects,
html.performanceMode .backdrop-blur-xl,
html.performanceMode .backdrop-blur-sm,
html.performanceMode [class*="backdrop-blur"] {
backdrop-filter: none !important;
-webkit-backdrop-filter: none !important;
}
+25 -13
View File
@@ -14,11 +14,12 @@
.outside-container {
margin: 0;
overflow: hidden;
position: absolute;
right: 10px;
top: 80px;
height: 590px;
z-index: 20;
position: fixed;
inset: 0;
width: 100%;
height: 100%;
/* Above Engage React chrome / MUI layers; below rare fullscreen media overlays */
z-index: 200000;
transition-duration: 100ms;
}
@@ -31,12 +32,23 @@
}
#ExtensionPopup {
border-radius: 1rem;
filter: drop-shadow(0px 0px 20px rgba(0, 0, 0, 0.6));
transform-origin: 70% 0;
will-change: opacity, transform;
transform: translateZ(0); // promotes GPU rendering
transition:
opacity 0.05s,
transform 0.05s;
border-radius: 0;
filter: none;
transform-origin: center center;
opacity: 0;
transition: opacity var(--bs-motion-duration, 0.2s) cubic-bezier(0.22, 1, 0.36, 1);
}
#ExtensionPopup.bsplus-settings-host--open {
opacity: 1;
}
#ExtensionPopup.bsplus-settings-host--closing {
opacity: 0;
pointer-events: none;
}
/* Feedback modal scrollport — host overflow:hidden otherwise clips fixed overlays. */
#ExtensionPopup.bsplus-feedback-open {
overflow: auto !important;
}
+65 -22
View File
@@ -1,22 +1,74 @@
#menu ul:has(li.hasChildren.active) li.hasChildren.active {
#menu
ul:has(li.hasChildren:is(.active, .bsplus-active))
li.hasChildren:is(.active, .bsplus-active) {
box-shadow: inset 0px 0 var(--item-colour, transparent) !important;
background: transparent !important;
}
#menu ul:not(:has(li.hasChildren.active)) {
#menu ul:not(:has(> li.hasChildren:is(.active, .bsplus-active))) {
overflow-y: scroll !important;
}
#menu > ul:has(li.hasChildren.active) > li::before,
#menu > ul ul:has(li.hasChildren.active) > li::before,
#menu > ul:has(li.hasChildren.active) > li > label,
#menu > ul:has(li.hasChildren.active) > li > svg,
#menu > ul ul:has(li.hasChildren.active) > li > label,
#menu > ul ul:has(li.hasChildren.active) > li > svg {
transform: translateX(-320px);
/* Move the complete row, including hover fill, arrow and subject stripe.
A transform on the folder itself would also move its absolute `.sub` panel.
Resting margins are measured before drilling so auto margins interpolate. */
#menu#menu ul.bsplus-drill-rows > :is(li, section) {
margin-left: var(--bsplus-row-margin-left) !important;
transition:
margin-left 0.3s ease,
background-color 0.2s ease,
box-shadow 0.2s ease !important;
animation: none !important;
> label,
> svg,
&::before,
&::after {
transform: none !important;
animation: none !important;
}
}
#menu li.hasChildren:not(.active) li .sub {
#menu#menu
ul.bsplus-drill-rows:has(> .hasChildren:is(.active, .bsplus-active))
> :is(li, section) {
margin-left: calc(
var(--bsplus-row-margin-left) + var(--bsplus-slide-off, -320px)
) !important;
}
/* Incoming rows travel only with their native panel. */
#menu .sub > ul:not(.bsplus-drill-rows) > li {
&,
> label,
> svg,
&::before,
&::after {
animation: none !important;
transform: none !important;
}
}
#menu .sub {
transition:
transform 0.3s ease,
left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
#menu
.sub
ul:has(> li.hasChildren:is(.active, .bsplus-active))
> li:not(:is(.active, .bsplus-active)) {
pointer-events: none !important;
}
#menu
> ul:has(li.hasChildren:is(.active, .bsplus-active))
> li:is(.active, .bsplus-active) {
background: transparent !important;
}
#menu li.hasChildren:not(:is(.active, .bsplus-active)) li .sub {
display: none; // improves performance
}
@@ -25,19 +77,10 @@
padding-top: 2px;
}
.sub:has(ul > li.hasChildren.active) > .nav > .back {
.sub:has(ul > li.hasChildren:is(.active, .bsplus-active)) > .nav > .back {
display: none !important;
}
#menu ul > li > label,
#menu ul > li > svg {
transition: transform 0.3s ease;
}
#menu .sub {
transition: transform 0.3s ease;
}
#menu > ul:has(li.hasChildren.active) > li.active {
background: transparent !important;
#menu {
--bsplus-slide-off: -320px;
}
+191
View File
@@ -0,0 +1,191 @@
/* Sidebar on the right edge — layout, drill direction, and mirrored accents. */
body.bsplus-sidebar-right {
#menu {
left: auto !important;
right: 0 !important;
width: var(--bsplus-sidebar-width, 270px) !important;
overflow: visible !important;
}
#content {
left: 0 !important;
right: var(--bsplus-sidebar-width, 270px) !important;
transition:
right 0.4s cubic-bezier(0.4, 0, 0.2, 1),
left 0.4s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.4s ease !important;
}
/* Sub panels open to the left of the menu — anchor to menu edge, not viewport. */
#menu .sub {
left: auto !important;
right: 100% !important;
width: var(--bsplus-sidebar-width, 270px) !important;
}
/* Title bar spans the full viewport; only page content respects sidebar inset. */
#container #content #title,
#title {
left: 0 !important;
right: 0 !important;
width: 100% !important;
max-width: none !important;
}
&.icon-only-sidebar {
#menu {
width: 70px !important;
}
#content {
right: var(--bsplus-icon-rail-space) !important;
transition: none !important;
}
#menu .sub {
right: 100% !important;
width: var(--bsplus-sidebar-width, 270px) !important;
}
}
&:has(#menu.bsplus-styled-sidebar) #container #content #title,
&.menuShown:has(#menu.bsplus-styled-sidebar) #container #content #title {
box-shadow: -6px 0 8px -4px rgb(0 0 0 / 0.25) !important;
}
#menu.bsplus-styled-sidebar {
&.bsplus-sidebar-indicator-bar:not(.bsplus-sidebar-style-strip) {
> ul > li.item.active:not(.hasChildren)::after,
.sub li.item.active:not(.hasChildren)::after {
left: auto !important;
right: 0 !important;
}
}
&.bsplus-sidebar-style-strip {
> ul > li.item.active:not(.hasChildren)::after,
.sub li.item.active:not(.hasChildren)::after {
left: auto !important;
right: 0 !important;
}
}
}
#menu
li:is(.active, .hasChildren.bsplus-active)
> .sub
> ul
> .item:not(.hasChildren)::before {
left: auto !important;
right: 0 !important;
border-radius: 0 8px 8px 0 !important;
}
}
@media (max-width: 900px) {
body.bsplus-sidebar-right {
#menu {
left: auto !important;
right: 0 !important;
transform: translateX(var(--bsplus-sidebar-width, 270px)) !important;
}
&.menuShown #menu {
transform: translateX(0) !important;
}
#content {
left: 0 !important;
right: 0 !important;
}
&.menuShown #content {
transform: translateX(
calc(-1 * var(--bsplus-sidebar-width, 270px))
) !important;
}
&.icon-only-sidebar {
#menu {
transform: translateX(70px) !important;
}
&.menuShown #content {
right: 0 !important;
transform: translateX(
calc(-1 * var(--bsplus-icon-rail-space))
) !important;
}
}
#menuToggle {
left: auto !important;
right: 8px !important;
}
#container #content #title,
#title {
left: 0 !important;
right: 0 !important;
width: 100% !important;
}
/* Counter `#content` slide so the fixed title stays viewport-wide. */
&.menuShown #container #content #title {
transform: translateX(var(--bsplus-sidebar-width, 270px)) !important;
}
&.icon-only-sidebar.menuShown #container #content #title {
transform: translateX(var(--bsplus-icon-rail-space)) !important;
}
}
}
body.icon-only-sidebar.bsplus-sidebar-right {
#menu#menu > ul > .hasChildren:is(.active, .bsplus-active) {
margin-left: 0 !important;
margin-right: 7.5% !important;
border-radius: 0 var(--bsplus-sidebar-radius, 12px)
var(--bsplus-sidebar-radius, 12px) 0 !important;
> label {
transform: translateX(2.625px) !important;
}
}
#menu#menu > ul > .hasChildren:is(.active, .bsplus-active) > label::after {
right: auto;
left: calc((100% - 70px) / 2 - 1px);
background:
radial-gradient(
circle at 100% 0,
transparent calc(var(--bsplus-sidebar-radius, 12px) - 0.5px),
var(--background-primary) var(--bsplus-sidebar-radius, 12px)
)
top / 100% var(--bsplus-sidebar-radius, 12px) no-repeat,
radial-gradient(
circle at 100% 100%,
transparent calc(var(--bsplus-sidebar-radius, 12px) - 0.5px),
var(--background-primary) var(--bsplus-sidebar-radius, 12px)
)
bottom / 100% var(--bsplus-sidebar-radius, 12px) no-repeat,
linear-gradient(var(--background-primary), var(--background-primary))
center / 100% calc(100% - 2 * var(--bsplus-sidebar-radius, 12px))
no-repeat;
}
#menu > ul > .hasChildren > .sub {
left: auto !important;
right: 70px !important;
border-right: none !important;
border-left: 1px solid var(--border-color, rgba(128, 128, 128, 0.3)) !important;
transform: translateX(100%);
clip-path: inset(0 100% 0 0);
}
#menu > ul > .hasChildren:is(.active, .bsplus-active) > .sub {
transform: none;
clip-path: inset(0);
}
#menu > ul > .hasChildren > .sub .sub {
left: 0 !important;
right: auto !important;
}
}
+263
View File
@@ -0,0 +1,263 @@
/* Native sidebar style presets + Look (density / radius / indicator). */
$sidebar-motion: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
@mixin accent-bar($shadow: 0.55) {
content: "" !important;
position: absolute !important;
left: 0 !important;
top: 10px !important;
bottom: 10px !important;
width: 4px !important;
border-radius: 2px !important;
background: #fff !important;
box-shadow: 0 0 10px rgba(255, 255, 255, $shadow) !important;
pointer-events: none !important;
z-index: 3 !important;
opacity: 1 !important;
display: block !important;
}
#menu.bsplus-styled-sidebar {
$rootItem: "> ul > li.item";
$subItem: ".sub li.item";
$item: "#{$rootItem}, #{$subItem}";
$rootLabel: "> ul > li.item > label:not(.toggle)";
$subLabel: ".sub li.item > label:not(.toggle)";
$label: "#{$rootLabel}, #{$subLabel}";
$active: "> ul > li.item.active:not(.hasChildren), .sub li.item.active:not(.hasChildren)";
/* Look: base radius — layout transitions only on root rows (settings tweaks).
Submenu rows must not animate margin/padding during folder drill slides. */
#{$rootItem} {
border-radius: var(--bsplus-sidebar-radius, 12px) !important;
transition:
padding $sidebar-motion,
margin $sidebar-motion,
border-radius $sidebar-motion,
background-color 0.2s ease,
box-shadow 0.2s ease;
}
#{$subItem} {
border-radius: var(--bsplus-sidebar-radius, 12px) !important;
transition:
background-color 0.2s ease,
box-shadow 0.2s ease;
}
#{$rootLabel} {
min-height: 28px !important;
transition:
font-size $sidebar-motion,
line-height $sidebar-motion,
padding $sidebar-motion,
margin $sidebar-motion;
> svg {
transition:
width $sidebar-motion,
height $sidebar-motion,
margin $sidebar-motion;
}
}
#{$subLabel} {
min-height: 28px !important;
transition: none;
}
/* —— Style presets —— */
&.bsplus-sidebar-style-soft {
#{$item} {
margin: 0 8px 10px !important;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
#{$active} {
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
background: rgba(0, 0, 0, 0.38) !important;
}
}
&.bsplus-sidebar-style-pill {
#{$item} {
margin: 0 10px 8px !important;
border-radius: 999px !important;
}
#{$active} {
background: rgba(0, 0, 0, 0.4) !important;
}
}
&.bsplus-sidebar-style-glass {
/* Never put backdrop-filter on a folder — it becomes a clip
containing-block and hides `.sub` labels on Chromium/Edge. Lean rows
blur; closed folders keep the translated glass surface without blur;
open folders drop the fill entirely so `.sub` stays clip-safe. */
#{$item} {
&:not(:has(> .sub)) {
margin: 4px 8px 4px !important;
background: rgba(255, 255, 255, 0.1) !important;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
&:is(li, section).hasChildren:not(:is(.active, .bsplus-active)) {
margin: 4px 8px 4px !important;
background: rgba(255, 255, 255, 0.1) !important;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
&:has(> .sub):is(.active, .bsplus-active) {
background: transparent !important;
backdrop-filter: none !important;
-webkit-backdrop-filter: none !important;
box-shadow: none !important;
overflow: visible !important;
contain: none !important;
}
}
#{$active} {
background: rgba(255, 255, 255, 0.2) !important;
box-shadow:
inset 0 0 0 1px rgba(255, 255, 255, 0.28),
0 8px 20px rgba(0, 0, 0, 0.2);
}
}
&.bsplus-sidebar-style-sharp {
#{$item},
#{$active} {
border-radius: 4px !important;
}
#{$item} {
margin: 0 4px 4px !important;
}
#{$active} {
background: rgba(0, 0, 0, 0.42) !important;
}
}
&.bsplus-sidebar-style-strip {
#{$item} {
margin: 0 0 2px !important;
border-radius: 0 !important;
background: transparent !important;
box-shadow: none !important;
}
#{$active} {
position: relative !important;
background: rgba(255, 255, 255, 0.12) !important;
box-shadow: none !important;
&::after {
@include accent-bar(0.55);
}
}
}
&.bsplus-sidebar-style-neon {
#{$active} {
background: rgba(255, 255, 255, 0.1) !important;
box-shadow:
0 0 0 1px rgba(255, 255, 255, 0.55),
0 0 14px rgba(255, 255, 255, 0.4),
0 0 28px rgba(255, 255, 255, 0.22) !important;
}
#{$item} {
margin: 0 8px 8px !important;
}
}
/* —— Density (comfortable = no class / no overrides) —— */
&.bsplus-sidebar-density-compact {
#{$item},
#{$active} {
padding: 6px 8px !important;
min-height: 0 !important;
}
#{$item} {
margin: 0 6px 4px !important;
height: auto !important;
}
#{$label} {
padding: 0 !important;
margin: 0 !important;
font-size: 13px !important;
line-height: 1.2 !important;
min-height: 20px !important;
height: auto !important;
white-space: nowrap !important;
> svg {
width: 20px !important;
height: 20px !important;
margin: 0 8px 0 2px !important;
flex-shrink: 0 !important;
}
}
}
&.bsplus-sidebar-density-large {
#{$item} {
margin: 0 8px 10px !important;
padding: 14px 12px !important;
}
#{$label} {
padding: 0 !important;
font-size: 17px !important;
line-height: 1.25 !important;
min-height: 30px !important;
> svg {
width: 30px !important;
height: 30px !important;
margin: 0 10px 0 4px !important;
}
}
}
/* —— Active indicator (fill = default, no class) —— */
&.bsplus-sidebar-indicator-bar:not(.bsplus-sidebar-style-strip) {
#{$active} {
position: relative !important;
background: rgba(255, 255, 255, 0.1) !important;
box-shadow: none !important;
&::after {
@include accent-bar(0.45);
}
}
}
&.bsplus-sidebar-indicator-outline {
#{$active} {
background: transparent !important;
box-shadow:
inset 0 0 0 2px rgba(255, 255, 255, 0.55),
0 0 0 1px rgba(255, 255, 255, 0.12) !important;
}
}
&.bsplus-sidebar-indicator-underline:not(.bsplus-sidebar-style-strip) {
#{$active} {
position: relative !important;
background: transparent !important;
box-shadow: none !important;
&::after {
content: "" !important;
position: absolute !important;
left: 14px !important;
right: 14px !important;
bottom: 6px !important;
top: auto !important;
width: auto !important;
height: 3px !important;
border-radius: 999px !important;
background: #fff !important;
box-shadow: 0 0 8px rgba(255, 255, 255, 0.4) !important;
pointer-events: none !important;
z-index: 3 !important;
opacity: 1 !important;
display: block !important;
}
}
}
}
+10 -12
View File
@@ -21,6 +21,9 @@ html.transparencyEffects {
}
/* Blurs */
.search,
.document,
.bsplus-rounded,
.draggable,
.notice,
[class*="BasicPanel__BasicPanel___"],
@@ -36,35 +39,30 @@ html.transparencyEffects {
[class*="LabelList__selected___"],
.buttonChecklist,
.pane,
.legacy-root button,
.legacy-root a,
[class*="MessageList__MessageList___"] {
backdrop-filter: blur(80px);
}
.filter-select,
.uiShortText.search,
.report {
backdrop-filter: blur(10px) !important;
}
#menu {
backdrop-filter: blur(var(--bsplus-sidebar-blur, 50px));
}
.kanban-column,
.whatsnewContainer,
[class*="Message__Message___"] {
backdrop-filter: blur(50px);
}
#menu {
backdrop-filter: blur(20px);
}
.title > a {
backdrop-filter: blur(0px) !important;
}
.search,
.document,
.border {
backdrop-filter: blur(80px);
}
#main > .dashboard {
section,
.dashlet {
+17
View File
@@ -1,4 +1,5 @@
declare module "*.mp4";
declare module "*.webm";
declare module "*.woff";
declare module "*.scss";
declare module "*.png";
@@ -10,6 +11,22 @@ declare module "*?inlineWorker" {
export default value;
}
/** CRXJS dynamic content / main-world script path (relative to extension root). */
declare module "*?script" {
const path: string;
export default path;
}
declare module "*?script&iife" {
const path: string;
export default path;
}
declare module "*?script&module" {
const path: string;
export default path;
}
declare module "*.png?base64" {
const value: string;
export default value;
+6
View File
@@ -0,0 +1,6 @@
declare const __ENABLE_GH_RELEASE_UPDATE_CHECK__: boolean;
declare const __GH_RELEASE_REPO__: string;
declare const __UPDATE_CHANNEL__: "stable" | "nightly";
declare const __BUILD_LABEL__: string;
declare const __GOOGLE_OAUTH_CLIENT_ID__: string;
declare const __OUTLOOK_OAUTH_CLIENT_ID__: string;
+4
View File
@@ -0,0 +1,4 @@
{
"last_updated": "2024-06-15T12:00:00Z",
"whatsnew_html": "<div class=\"whatsnewTextContainer\" style=\"overflow-y: auto; font-size: 1.3rem; line-height: 1.6;\"><p>It has come to our attention that several schools have expressed concerns about BetterSEQTA+. This is very disheartening, so we have decided to release a statement on the situation.</p><p>To view our privacy policy, please click the <strong>shield icon</strong> in the settings&nbsp;menu, or <a href=\"https://betterseqta.org/privacy\" target=\"_blank\" rel=\"noopener noreferrer\" id=\"privacy-link\" style=\"color: inherit; text-decoration: underline; cursor: pointer; white-space: nowrap;\">click here</a>.</p><p style=\"font-weight: bold; margin-top: 15px;\">We never collect any information from you, and aim to provide the best features possible.</p></div>"
}
+4
View File
@@ -0,0 +1,4 @@
{
"last_updated": "2026-10-29T00:00:00.000Z",
"whatsnew_html": "<div class=\"whatsnewTextContainer\"><h3>1. Agreement</h3><p>By installing or using BetterSEQTA+, you agree to these Terms of Service. If you do not agree, do not use the extension.</p><h3>2. The extension</h3><p>BetterSEQTA+ is a browser extension that enhances SEQTA Learn and SEQTA Engage on your device. Features may change over time.</p><h3>3. Your school account</h3><p>You must comply with your school’s policies when using SEQTA. BetterSEQTA+ does not replace your school’s terms.</p><h3>4. Acceptable use</h3><p>Do not use the extension to harm others, bypass security, or violate applicable law.</p><h3>5. Privacy</h3><p>Our Privacy Policy explains what data we process. See <a href=\"https://betterseqta.org/privacy\" target=\"_blank\" rel=\"noopener noreferrer\">betterseqta.org/privacy</a>.</p><h3>6. Changes</h3><p>We may update these terms. Material changes may require you to accept again in the extension.</p></div>"
}
+29 -3
View File
@@ -1,7 +1,33 @@
<script lang="ts">
let { onClick, text } = $props<{ onClick: () => void, text: string, [key: string]: any }>();
let {
onClick,
text,
disabled = false,
variant = "secondary",
icon,
class: className = "",
} = $props<{
onClick: () => void;
text: string;
disabled?: boolean;
variant?: "primary" | "secondary" | "ghost";
icon?: string;
class?: string;
}>();
const variants = {
primary: "bg-zinc-100 text-zinc-900 border-transparent enabled:hover:bg-white",
secondary: "dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white enabled:hover:brightness-125",
ghost: "bg-transparent border-transparent dark:text-white enabled:hover:bg-zinc-200/60 dark:enabled:hover:bg-zinc-700/50",
};
</script>
<button onclick={onClick} class='px-5 py-1.5 text-[0.75rem] shadow-2xl border dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 dark:text-white rounded-lg'>
<button
type="button"
onclick={onClick}
disabled={disabled}
class="inline-flex items-center justify-center gap-1.5 px-5 py-1.5 text-[0.75rem] shadow-2xl border rounded-lg transition enabled:active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 disabled:cursor-not-allowed disabled:opacity-50 {variants[variant]} {className}"
>
{#if icon}<span class="font-IconFamily text-base" aria-hidden="true">{icon}</span>{/if}
{text}
</button>
</button>
+154
View File
@@ -0,0 +1,154 @@
<script lang="ts">
import { onMount } from "svelte";
import { animate } from "motion";
import { delay } from "@/seqta/utils/delay.ts";
import { cloudAuth } from "@/seqta/utils/CloudAuth";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import CloudPfpAvatar from "@/interface/components/CloudPfpAvatar.svelte";
import Button from "./Button.svelte";
const { hidePanel } = $props<{
hidePanel: () => void;
}>();
let cloudState = $state(cloudAuth.state);
let background = $state<HTMLDivElement | null>(null);
let content = $state<HTMLDivElement | null>(null);
let loginError = $state<string | null>(null);
onMount(() => {
const unsub = cloudAuth.subscribe((s) => {
cloudState = s;
});
if (background && content) {
animate(
background,
{ opacity: [0, 1] },
{ duration: 0.3, ease: [0.4, 0, 0.2, 1] }
);
animate(
content,
{ scale: [0.4, 1], opacity: [0, 1] },
{ type: "spring", stiffness: 400, damping: 30 }
);
}
const handleEscapeKey = (e: KeyboardEvent) => {
if (e.key === "Escape") closePanel();
};
document.addEventListener("keydown", handleEscapeKey);
return () => {
unsub();
document.removeEventListener("keydown", handleEscapeKey);
};
});
async function closePanel() {
if (!background || !content) return;
animate(
content,
{ scale: [1, 0.4], opacity: [1, 0] },
{ type: "spring", stiffness: 400, damping: 30 }
);
animate(
background,
{ opacity: [1, 0] },
{ ease: [0.4, 0, 0.2, 1] }
);
await delay(400);
hidePanel();
}
function handleBackgroundClick(event: MouseEvent) {
if (event.target === background) closePanel();
}
async function handleSignIn() {
loginError = null;
const result = await cloudAuth.startLogin();
if (result.success) {
closePanel();
} else {
loginError = result.error ?? "Failed to open login page";
}
}
async function handleLogout() {
await cloudAuth.logout();
}
function getInitials(): string {
const u = cloudState.user;
if (!u) return "?";
if (u.displayName) return u.displayName.slice(0, 2).toUpperCase();
if (u.username) return u.username.slice(0, 2).toUpperCase();
if (u.email) return u.email.slice(0, 2).toUpperCase();
return "?";
}
</script>
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
bind:this={background}
class="flex absolute top-0 left-0 z-50 justify-center items-center w-full h-full cursor-pointer bg-black/50 {$settingsState.DarkMode ? 'dark' : ''}"
onclick={handleBackgroundClick}
onkeydown={(e) => { if (e.key === "Enter") handleBackgroundClick(e as unknown as MouseEvent) }}
>
<div
bind:this={content}
class="p-5 w-[320px] bg-white rounded-xl border shadow-lg cursor-auto dark:bg-zinc-800 border-zinc-100 dark:border-zinc-700"
>
<h3 class="text-lg font-bold text-zinc-900 dark:text-white">BetterSEQTA Cloud</h3>
<p class="mt-0.5 text-sm text-zinc-500 dark:text-zinc-400">Account & sync</p>
<div class="mt-4">
{#if cloudState.isLoggedIn}
<div class="flex flex-col gap-4">
<div class="flex items-center gap-3">
{#if cloudState.user?.pfpUrl}
<CloudPfpAvatar
user={cloudState.user}
class="w-12 h-12 rounded-full object-cover ring-2 ring-zinc-200 dark:ring-zinc-600"
/>
{/if}
{#if !cloudState.user?.pfpUrl}
<div class="flex items-center justify-center w-12 h-12 rounded-full bg-zinc-300 dark:bg-zinc-600 text-zinc-700 dark:text-zinc-200 font-semibold text-base">
{getInitials()}
</div>
{/if}
<div class="min-w-0 flex-1">
<p class="text-sm font-medium text-zinc-900 dark:text-white truncate">
{cloudState.user?.displayName || cloudState.user?.username || cloudState.user?.email || "User"}
</p>
{#if cloudState.user?.email && cloudState.user?.email !== (cloudState.user?.displayName || cloudState.user?.username)}
<p class="text-xs text-zinc-500 dark:text-zinc-400 truncate">{cloudState.user.email}</p>
{/if}
</div>
</div>
<button
type="button"
onclick={handleLogout}
class="w-full px-4 py-2.5 text-sm font-medium rounded-lg bg-zinc-200 dark:bg-zinc-700 text-zinc-900 dark:text-white hover:bg-zinc-300 dark:hover:bg-zinc-600 transition-colors duration-200"
>
Sign out
</button>
</div>
{:else}
<div class="flex flex-col gap-3">
<p class="text-sm text-zinc-600 dark:text-zinc-400">
Sign in to sync settings across devices, use your cloud profile picture, and more.
</p>
<Button class="w-full" icon={""} text="Sign in with BetterSEQTA Cloud" onClick={handleSignIn} />
{#if loginError}
<p class="text-xs text-red-600 dark:text-red-400">{loginError}</p>
{/if}
<p class="text-xs text-center text-zinc-400 dark:text-zinc-500">
Opens accounts.betterseqta.org in a new tab
</p>
</div>
{/if}
</div>
</div>
</div>
@@ -0,0 +1,46 @@
<script lang="ts">
import { resolveCloudPfp, defaultAccountsPfpUrl } from "@/seqta/utils/cloudPfpCache";
import type { CloudUser } from "@/seqta/utils/CloudAuth";
const { user, class: className = "" } = $props<{
user: CloudUser | null | undefined;
class?: string;
}>();
let avatarSrc = $state<string | undefined>(undefined);
let revokeUrl: string | undefined;
$effect(() => {
const u = user;
if (revokeUrl) {
URL.revokeObjectURL(revokeUrl);
revokeUrl = undefined;
}
avatarSrc = undefined;
if (!u?.id) return;
const pfpUrl = u.pfpUrl ?? defaultAccountsPfpUrl(u.id);
let cancelled = false;
void resolveCloudPfp(u.id, pfpUrl).then((resolved) => {
if (cancelled || !resolved) return;
if (resolved.fromCache) {
revokeUrl = resolved.src;
}
avatarSrc = resolved.src;
});
return () => {
cancelled = true;
if (revokeUrl) {
URL.revokeObjectURL(revokeUrl);
revokeUrl = undefined;
}
};
});
</script>
{#if avatarSrc}
<img src={avatarSrc} alt="" class={className} />
{/if}
@@ -0,0 +1,116 @@
<script lang="ts">
import browser from "webextension-polyfill";
import { cloudAuth } from "@/seqta/utils/CloudAuth";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import Button from "./Button.svelte";
import Switch from "./Switch.svelte";
let { showDisclaimer } = $props<{
showDisclaimer: (onConfirm: () => void, onCancel: () => void) => void;
}>();
let cloudState = $state(cloudAuth.state);
let busy = $state(false);
let statusMessage = $state<string | null>(null);
let statusError = $state<string | null>(null);
$effect(() => {
const unsub = cloudAuth.subscribe((s) => {
cloudState = s;
});
return unsub;
});
async function upload() {
if (!cloudState.isLoggedIn) return;
busy = true;
statusError = null;
statusMessage = null;
try {
const res = (await browser.runtime.sendMessage({
type: "cloudSettingsUpload",
})) as { success?: boolean; error?: string };
if (res?.success) {
statusMessage = "Settings uploaded.";
} else {
statusError = res?.error ?? "Upload failed";
}
} catch (e) {
statusError = e instanceof Error ? e.message : "Upload failed";
} finally {
busy = false;
}
}
function promptDownload() {
showDisclaimer(confirmDownload, () => {});
}
async function confirmDownload() {
if (!cloudState.isLoggedIn) return;
busy = true;
statusError = null;
statusMessage = null;
try {
const res = (await browser.runtime.sendMessage({
type: "cloudSettingsDownload",
})) as { success?: boolean; error?: string; notFound?: boolean };
if (res?.success) {
statusMessage = "Settings restored.";
} else {
statusError = res?.error ?? "Download failed";
}
} catch (e) {
statusError = e instanceof Error ? e.message : "Download failed";
} finally {
busy = false;
}
}
</script>
{#if cloudState.isLoggedIn}
<div class="flex flex-col gap-2.5">
<div class="flex items-center justify-between gap-3">
<div>
<p class="text-[11px] font-semibold text-zinc-800 dark:text-zinc-100">Automatic sync</p>
<p class="text-[10px] text-zinc-500 dark:text-zinc-400">Syncs settings when SEQTA loads and when you make changes</p>
</div>
<div class="shrink-0">
<Switch
state={$settingsState.autoCloudSettingsSync !== false}
onChange={(isOn: boolean) => (settingsState.autoCloudSettingsSync = isOn)}
/>
</div>
</div>
<div class="flex flex-wrap gap-2">
<Button
text={busy ? "Please wait\u2026" : "Upload"}
onClick={upload}
disabled={busy}
/>
<Button
text={busy ? "Please wait\u2026" : "Download"}
onClick={promptDownload}
disabled={busy}
/>
</div>
{#if statusMessage}
<p class="text-[11px] text-emerald-600 dark:text-emerald-400">{statusMessage}</p>
{/if}
{#if statusError}
<p class="text-[11px] text-red-600 dark:text-red-400">{statusError}</p>
{/if}
<p class="text-[10px] text-zinc-400 dark:text-zinc-500">
Passwords and tokens are never synced.
<a
href="https://betterseqta.org/privacy"
target="_blank"
rel="noopener noreferrer"
class="font-medium text-emerald-600 underline decoration-emerald-600/50 underline-offset-2 hover:text-emerald-700 dark:text-emerald-400 dark:hover:text-emerald-300 rounded-sm"
>Privacy policy</a>
</p>
</div>
{/if}
+3 -1
View File
@@ -19,6 +19,7 @@
let editor = $state<HTMLDivElement | null>(null)
let view: EditorView | null = null;
let unsubSettings: (() => void) | undefined;
let editorTheme = new Compartment();
let { value, onChange, className } = $props<{value: string, onChange: (value: string) => void, className?: string}>()
@@ -73,7 +74,7 @@
view = createEditorView(state, editor as HTMLElement);
}
settingsState.subscribe((settings) => {
unsubSettings = settingsState.subscribe((settings) => {
if (view) {
view.dispatch({
effects: editorTheme.reconfigure(
@@ -85,6 +86,7 @@
});
onDestroy(() => {
unsubSettings?.();
if (view) {
view.destroy();
}
+10
View File
@@ -2,6 +2,16 @@ div:has(> #rbgcp-wrapper) {
background: transparent !important;
}
#rbgcp-inputs-wrap {
padding-top: 4px !important;
margin-bottom: -8px;
#rbgcp-hex-input,
#rbgcp-input {
height: 28px !important;
}
}
.dark {
#rbgcp-wrapper {
div[style="padding-top: 11px; position: relative;"] div {
+43 -24
View File
@@ -1,9 +1,9 @@
<script lang="ts">
import { onMount } from 'svelte'
import ColourPicker from './ColourPicker.tsx';
import ReactAdapter from './utils/ReactAdapter.svelte';
import type { Component } from 'svelte'
import { animate } from 'motion';
import { delay } from '@/seqta/utils/delay.ts'
import { settingsState } from '@/seqta/utils/listeners/SettingsState.ts'
const { hidePicker, standalone = false, savePresets = true, customOnChange = null, customState = null } = $props<{
hidePicker?: () => void,
@@ -15,6 +15,19 @@
let background = $state<HTMLDivElement | null>(null);
let content = $state<HTMLDivElement | null>(null);
let ReactAdapter = $state<Component | null>(null);
let ColourPickerEl = $state<unknown>(null);
let pickerReady = $state(false);
const loadPicker = async () => {
const [adapterMod, pickerMod] = await Promise.all([
import('./utils/ReactAdapter.svelte'),
import('./ColourPicker.tsx'),
]);
ReactAdapter = adapterMod.default;
ColourPickerEl = pickerMod.default;
pickerReady = true;
};
const closePicker = async () => {
if (standalone) return;
@@ -37,28 +50,30 @@
);
await delay(400);
hidePicker();
hidePicker?.();
}
onMount(() => {
if (standalone) return;
if (!background || !content) return;
void loadPicker().then(() => {
if (standalone) return;
if (!background || !content) return;
animate(
background,
{ opacity: [0, 1] },
{ duration: 0.3, ease: [0.4, 0, 0.2, 1] }
);
animate(
background,
{ opacity: [0, 1] },
{ duration: 0.3, ease: [0.4, 0, 0.2, 1] }
);
animate(
content,
{ scale: [0.4, 1], opacity: [0, 1] },
{
type: 'spring',
stiffness: 400,
damping: 30
}
);
animate(
content,
{ scale: [0.4, 1], opacity: [0, 1] },
{
type: 'spring',
stiffness: 400,
damping: 30
}
);
});
const handleEscapeKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
@@ -81,22 +96,26 @@
</script>
{#if standalone}
<div class="h-auto overflow-clip rounded-xl">
<ReactAdapter customOnChange={customOnChange} customState={customState} savePresets={savePresets} el={ColourPicker} />
<div class="h-auto overflow-clip rounded-xl {$settingsState.DarkMode ? 'dark' : ''}">
{#if pickerReady && ReactAdapter && ColourPickerEl}
<ReactAdapter customOnChange={customOnChange} customState={customState} savePresets={savePresets} el={ColourPickerEl} />
{/if}
</div>
{:else}
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
bind:this={background}
class="flex absolute top-0 left-0 z-50 justify-center items-center w-full h-full shadow-2xl cursor-pointer bg-black/20 border border-[#DDDDDD]/30 dark:border-[#38373D]/30"
class="flex absolute top-0 left-0 z-50 justify-center items-center w-full h-full shadow-2xl cursor-pointer bg-black/20 border border-[#DDDDDD]/30 dark:border-[#38373D]/30 {$settingsState.DarkMode ? 'dark' : ''}"
onclick={handleBackgroundClick}
onkeydown={(e) => { e.key === 'Enter' && handleBackgroundClick }}
onkeydown={(e) => { if (e.key === 'Enter') handleBackgroundClick(e as unknown as MouseEvent) }}
>
<div
bind:this={content}
class="p-4 h-auto bg-white rounded-xl border shadow-lg cursor-auto dark:bg-zinc-800 border-zinc-100 dark:border-zinc-700"
>
<ReactAdapter customOnChange={customOnChange} customState={customState} savePresets={savePresets} el={ColourPicker} />
{#if pickerReady && ReactAdapter && ColourPickerEl}
<ReactAdapter customOnChange={customOnChange} customState={customState} savePresets={savePresets} el={ColourPickerEl} />
{/if}
</div>
</div>
{/if}
@@ -108,7 +108,6 @@ export default function Picker({
<ColorPicker
disableDarkMode={true}
presets={presets}
hideInputs={customOnChange ? false : true}
value={customThemeColor ?? ""}
onChange={(color: string) => {
if (customOnChange) {
@@ -0,0 +1,168 @@
<script lang="ts">
import { fade } from "svelte/transition";
import browser from "webextension-polyfill";
import QRCode from "qrcode";
import Button from "./Button.svelte";
import { portal } from "../utils/portal";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
let showQrModal = $state(false);
let qrDataUrl = $state<string | null>(null);
let appLink = $state<string | null>(null);
let errorMessage = $state<string | null>(null);
let isLoading = $state(false);
let isStandalone = $state(false);
function isExtensionPage(): boolean {
return (
window.location.protocol === "chrome-extension:" ||
window.location.protocol === "moz-extension:"
);
}
function isSeqtaUrl(url: string): boolean {
try {
const u = new URL(url);
return u.hostname.includes("seqta") || u.hostname.endsWith(".edu.au");
} catch {
return false;
}
}
function normalizeBaseUrl(url: string): string {
try {
const u = new URL(url);
return u.origin;
} catch {
return url;
}
}
async function getAppLink(): Promise<string | null> {
let baseUrl: string | undefined;
if (isExtensionPage()) {
baseUrl = undefined;
} else {
baseUrl = normalizeBaseUrl(window.location.href);
if (!isSeqtaUrl(baseUrl)) return null;
}
const { appLink: link } = (await browser.runtime.sendMessage({
type: "getSeqtaSession",
baseUrl,
})) as { appLink: string | null };
return link ?? null;
}
async function generateQrCode() {
errorMessage = null;
qrDataUrl = null;
isLoading = true;
try {
isStandalone = isExtensionPage();
const link = await getAppLink();
if (!link) {
if (isStandalone) {
errorMessage =
"Open SEQTA Learn in a tab and log in, then open settings from that tab to generate a QR code.";
} else {
errorMessage = "Please log in to SEQTA Learn first.";
}
return;
}
const dataUrl = await QRCode.toDataURL(link, { width: 256, margin: 2 });
appLink = link;
qrDataUrl = dataUrl;
showQrModal = true;
} catch (err) {
console.error("[ConnectMobileApp] Failed to generate QR:", err);
errorMessage = "Failed to generate QR code. Please try again.";
} finally {
isLoading = false;
}
}
function closeModal() {
showQrModal = false;
qrDataUrl = null;
appLink = null;
errorMessage = null;
}
function openAppLink() {
if (appLink) window.location.href = appLink;
}
function downloadQrImage() {
if (!qrDataUrl) return;
const link = document.createElement("a");
link.href = qrDataUrl;
link.download = "desqta-login-qr.png";
link.click();
}
</script>
<div class="flex flex-col gap-1 items-end">
<Button onClick={generateQrCode} disabled={isLoading} text={isLoading ? "Generating..." : "Generate QR"} />
{#if errorMessage}
<p class="text-xs text-right text-amber-600 dark:text-amber-400">{errorMessage}</p>
{/if}
</div>
{#if showQrModal && qrDataUrl}
<div
use:portal
class="fixed cursor-auto inset-0 z-[10000] flex justify-center items-center bg-black/50 {isStandalone ? 'backdrop-blur-sm' : ''} {$settingsState.DarkMode ? 'dark' : ''}"
role="button"
tabindex="-1"
onclick={(e) => {
if (e.target === e.currentTarget) closeModal();
}}
onkeydown={(e) => {
if (e.key === "Escape") closeModal();
}}
transition:fade={{ duration: 150 }}>
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="p-6 mx-4 w-full max-w-sm bg-white rounded-2xl shadow-2xl dark:bg-zinc-800"
onclick={(e) => e.stopPropagation()}
onkeydown={(e) => e.stopPropagation()}>
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-bold text-zinc-900 dark:text-white">Scan with DesQTA</h2>
<button
type="button"
onclick={closeModal}
class="p-2 rounded-lg transition-colors text-zinc-500 hover:text-zinc-700 hover:bg-zinc-100 dark:hover:text-zinc-400 dark:hover:bg-zinc-700"
aria-label="Close">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div class="flex justify-center p-4 bg-white rounded-xl dark:bg-zinc-900">
<img src={qrDataUrl} alt="SEQTA Learn app link QR code" class="w-64 h-64" />
</div>
<div class="flex flex-col gap-2 mt-4">
<button
type="button"
onclick={openAppLink}
class="px-4 py-2.5 w-full text-sm font-medium text-white bg-indigo-600 rounded-lg transition-colors dark:bg-indigo-500 hover:bg-indigo-700 dark:hover:bg-indigo-600">
Sign into DesQTA Desktop
</button>
<button
type="button"
onclick={downloadQrImage}
class="px-4 py-2 w-full text-xs font-medium rounded-lg border transition-colors text-zinc-500 dark:text-zinc-400 border-zinc-200 dark:border-zinc-600 hover:bg-zinc-50 dark:hover:bg-zinc-800/50">
Download QR as image
</button>
</div>
<p class="mt-2 text-sm text-center text-zinc-600 dark:text-zinc-400">
Or scan this QR code with DesQTA on your phone.
</p>
</div>
</div>
{/if}
@@ -0,0 +1,74 @@
<script lang="ts">
import { fade } from 'svelte/transition';
import { animate } from 'motion';
import { settingsState } from '@/seqta/utils/listeners/SettingsState';
let { onConfirm, onCancel, title, message } = $props<{
onConfirm: () => void;
onCancel: () => void;
title: string;
message: string;
}>();
let modalElement: HTMLElement;
$effect(() => {
if (modalElement) {
animate(
modalElement,
{ scale: [0.9, 1], opacity: [0, 1] },
{
type: 'spring',
stiffness: 300,
damping: 25
}
);
}
});
</script>
<div
class="flex fixed inset-0 z-[10000] justify-center items-center bg-black/50 {$settingsState.DarkMode ? 'dark' : ''}"
style="position: fixed; top: 0; left: 0; right: 0; bottom: 0;"
onclick={(e) => {
if (e.target === e.currentTarget) onCancel();
}}
onkeydown={(e) => {
if (e.key === 'Escape') onCancel();
}}
role="button"
tabindex="-1"
transition:fade={{ duration: 150 }}
>
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
bind:this={modalElement}
class="p-4 mx-4 w-full max-w-md bg-white rounded-2xl shadow-2xl dark:bg-zinc-800"
onclick={(e) => e.stopPropagation()}
onkeydown={(e) => e.stopPropagation()}
>
<h2 class="mb-3 text-xl font-bold text-gray-900 dark:text-white">
{title}
</h2>
<div class="mb-6 text-lg text-gray-700 whitespace-pre-line dark:text-gray-300">
{message}
</div>
<div class="flex gap-3 justify-end">
<button
onclick={onCancel}
class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg transition-colors hover:bg-gray-200 dark:bg-zinc-700 dark:text-gray-200 dark:hover:bg-zinc-600"
>
Cancel
</button>
<button
onclick={onConfirm}
class="px-4 py-2 text-sm font-medium text-white bg-green-600 rounded-lg shadow-inner transition-colors hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600"
>
Enable
</button>
</div>
</div>
</div>
@@ -0,0 +1,574 @@
<script lang="ts">
import { fade, scale } from "svelte/transition";
import { onMount } from "svelte";
import Switch from "./Switch.svelte";
import {
FEEDBACK_CATEGORIES,
FEEDBACK_MESSAGE_MAX,
FEEDBACK_MESSAGE_MIN,
type FeedbackCategory,
} from "@/seqta/utils/feedback/constants";
import {
FeedbackApiError,
addPendingFeedbackId,
categoryLabel,
fetchFeedbackStatusItem,
fetchFeedbackStatusList,
formatStatus,
getInstanceHostname,
hasReply,
removePendingFeedbackIds,
submitFeedback,
validateFeedbackForm,
type FeedbackStatusItem,
} from "@/seqta/utils/feedback/client";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import Spinner from "./Spinner.svelte";
let { onClose, initialFeedbackId = null } = $props<{
onClose: () => void;
initialFeedbackId?: string | null;
}>();
let tab = $state<"send" | "status">(
typeof initialFeedbackId === "string" && initialFeedbackId ? "status" : "send",
);
let category = $state<FeedbackCategory>("bug");
let subject = $state("");
let message = $state("");
let includeContact = $state(false);
let contactName = $state("");
let contactEmail = $state("");
let includeInstance = $state(false);
let submitting = $state(false);
let errorMessage = $state<string | null>(null);
let successId = $state<string | null>(null);
let statusLoading = $state(false);
let statusError = $state<string | null>(null);
let statusItems = $state<FeedbackStatusItem[]>([]);
let selectedItem = $state<FeedbackStatusItem | null>(null);
const instanceHostname = getInstanceHostname();
const isDark = $derived(!!$settingsState.DarkMode);
const busy = $derived(submitting || statusLoading);
const fieldStyle = $derived(
isDark
? "background-color:#18181b;color:#fafafa;border-color:#52525b;color-scheme:dark"
: "background-color:#fff;color:#18181b;border-color:#e4e4e7;color-scheme:light",
);
const field =
"feedback-field w-full px-3 py-2.5 text-[18px] rounded-lg border focus:outline-none focus:ring-2 focus:ring-zinc-400";
const btn =
"px-4 py-2 text-[18px] font-medium rounded-lg transition-all duration-200 hover:scale-105 active:scale-95 focus:outline-none focus:ring-2 focus:ring-zinc-400 disabled:opacity-50";
const btnMuted = $derived(
`${btn} ${isDark ? "bg-zinc-700 text-zinc-200" : "bg-zinc-200 text-zinc-700"}`,
);
const btnPrimary = $derived(
`${btn} ${isDark ? "bg-zinc-200 text-zinc-900" : "bg-zinc-800 text-white"}`,
);
function isStatusDetailKey(key: string): boolean {
return key.startsWith("status-") && key !== "status-list";
}
const panelKey = $derived(
tab === "send"
? successId
? "send-success"
: "send-form"
: selectedItem
? `status-${selectedItem.id}`
: "status-list",
);
function errText(e: unknown): string {
if (e instanceof FeedbackApiError) return e.message;
return e instanceof Error ? e.message : "Something went wrong.";
}
async function loadStatusList() {
statusLoading = true;
statusError = null;
selectedItem = null;
try {
statusItems = await fetchFeedbackStatusList(10);
} catch (e) {
statusItems = [];
statusError = errText(e);
} finally {
statusLoading = false;
}
}
async function openStatusItem(id: string) {
statusLoading = true;
statusError = null;
try {
selectedItem = await fetchFeedbackStatusItem(id);
tab = "status";
successId = null;
if (selectedItem && hasReply(selectedItem)) {
void removePendingFeedbackIds([selectedItem.id]);
}
} catch (e) {
statusError = errText(e);
} finally {
statusLoading = false;
}
}
function selectTab(next: "send" | "status") {
tab = next;
errorMessage = null;
statusError = null;
successId = null;
selectedItem = null;
if (next === "status") void loadStatusList();
}
onMount(() => {
const host = document.getElementById("ExtensionPopup");
host?.classList.add("bsplus-feedback-open");
// Remove leaked global styles from earlier builds that portaled to body.
document.getElementById("betterseqta-feedback-modal-styles")?.remove();
const handleEscapeKey = (e: KeyboardEvent) => {
if (e.key === "Escape" && !busy) onClose();
};
document.addEventListener("keydown", handleEscapeKey);
if (typeof initialFeedbackId === "string" && initialFeedbackId) {
void openStatusItem(initialFeedbackId);
}
return () => {
host?.classList.remove("bsplus-feedback-open");
document.removeEventListener("keydown", handleEscapeKey);
};
});
async function handleSubmit() {
const form = {
category,
subject,
message,
includeContact,
contactName,
contactEmail,
includeInstance,
};
errorMessage = validateFeedbackForm(form);
if (errorMessage) return;
submitting = true;
try {
const result = await submitFeedback(form);
successId = result.id;
void addPendingFeedbackId(result.id);
} catch (e) {
errorMessage = errText(e);
} finally {
submitting = false;
}
}
</script>
<!-- Backdrop click target — separate from dialog so inner clicks never bubble to a "close" handler. -->
<div
class="feedback-overlay fixed inset-0 z-[99999] overflow-y-auto overscroll-contain {isDark
? 'dark'
: ''}"
transition:fade={{ duration: $settingsState.animations ? 200 : 0 }}
>
<button
type="button"
class="feedback-overlay__backdrop fixed inset-0 bg-black/50 backdrop-blur-sm border-0 p-0 cursor-default"
aria-label="Close feedback"
disabled={busy}
onclick={() => {
if (!busy) onClose();
}}
></button>
<div
class="feedback-overlay__center relative z-[1] flex min-h-full items-center justify-center p-4 sm:p-6 pointer-events-none"
>
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="feedback-dialog pointer-events-auto w-full max-w-lg max-h-[min(90dvh,100%)] rounded-2xl shadow-2xl border text-[18px] {isDark
? 'bg-zinc-800 text-white border-zinc-700'
: 'bg-white text-zinc-900 border-zinc-200'}"
onclick={(e) => e.stopPropagation()}
onkeydown={(e) => e.stopPropagation()}
role="dialog"
aria-modal="true"
aria-labelledby="feedback-modal-title"
tabindex="-1"
in:scale={{
duration: $settingsState.animations ? 280 : 0,
start: 0.92,
opacity: 0,
easing: (t) => 1 - Math.pow(1 - t, 3),
}}
>
<div
class="feedback-tabs shrink-0 flex gap-1 p-1 m-5 mb-0 rounded-full {isDark
? 'bg-zinc-900'
: 'bg-zinc-100'}"
role="tablist"
aria-label="Feedback views"
>
<button
type="button"
role="tab"
aria-selected={tab === "send"}
onclick={() => selectTab("send")}
class="feedback-tab flex-1 px-3 py-2.5 rounded-full text-[18px] font-medium transition-all duration-200 {tab ===
'send'
? isDark
? 'bg-zinc-700 text-white font-semibold shadow-sm'
: 'bg-white text-zinc-900 font-semibold shadow-sm'
: isDark
? 'bg-transparent text-zinc-400 hover:text-zinc-200'
: 'bg-transparent text-zinc-500 hover:text-zinc-800'}"
>
Send
</button>
<button
type="button"
role="tab"
aria-selected={tab === "status"}
onclick={() => selectTab("status")}
class="feedback-tab flex-1 px-3 py-2.5 rounded-full text-[18px] font-medium transition-all duration-200 {tab ===
'status'
? isDark
? 'bg-zinc-700 text-white font-semibold shadow-sm'
: 'bg-white text-zinc-900 font-semibold shadow-sm'
: isDark
? 'bg-transparent text-zinc-400 hover:text-zinc-200'
: 'bg-transparent text-zinc-500 hover:text-zinc-800'}"
>
My feedback
</button>
</div>
<div class="feedback-panel__body overflow-y-auto overscroll-contain px-5 pb-5 pt-4">
{#if panelKey === "send-success" && successId}
<h2 id="feedback-modal-title" class="mb-3 text-xl font-bold">Thanks for the feedback</h2>
<p class="mb-2 text-zinc-600 dark:text-zinc-300">Reference ID:</p>
<p
class="mb-4 px-3 py-2 font-mono text-base rounded-lg {isDark
? 'bg-zinc-900'
: 'bg-zinc-100'} break-all"
>
{successId}
</p>
<div class="flex gap-3 justify-end">
<button
type="button"
class={btnMuted}
onclick={() => successId && openStatusItem(successId)}>Check status</button
>
<button type="button" class={btnPrimary} onclick={onClose}>Done</button>
</div>
{:else if panelKey === "send-form"}
<h2 id="feedback-modal-title" class="mb-1 text-xl font-bold">Send feedback</h2>
<p class="mb-4 text-zinc-600 dark:text-zinc-400">
Anonymous by default. Contact and school details are optional.
</p>
<div class="flex flex-col gap-4">
<label class="flex flex-col gap-1.5 font-medium">
Category
<select id="feedback-category" bind:value={category} class={field} style={fieldStyle}>
{#each FEEDBACK_CATEGORIES as value (value)}
<option {value} style={fieldStyle}>{categoryLabel(value)}</option>
{/each}
</select>
</label>
<label class="flex flex-col gap-1.5 font-medium">
Subject <span class="font-normal text-zinc-500">(optional)</span>
<input
type="text"
maxlength={120}
bind:value={subject}
placeholder="Short summary"
class={field}
style={fieldStyle}
/>
</label>
<label class="flex flex-col gap-1.5 font-medium">
Message
<textarea
rows={5}
maxlength={FEEDBACK_MESSAGE_MAX}
bind:value={message}
placeholder="What happened, or what would you like to see?"
class="{field} resize-y min-h-[120px]"
style={fieldStyle}
></textarea>
<span class="text-base font-normal text-zinc-500"
>{message.trim().length}/{FEEDBACK_MESSAGE_MAX} (min {FEEDBACK_MESSAGE_MIN})</span
>
</label>
<div class="flex justify-between items-center gap-3">
<div>
<p class="font-medium">Include contact details</p>
<p class="text-base text-zinc-500">Name and email so we can reply</p>
</div>
<Switch state={includeContact} onChange={(v) => (includeContact = v)} />
</div>
{#if includeContact}
<input
type="text"
maxlength={80}
bind:value={contactName}
placeholder="Name"
class={field}
style={fieldStyle}
/>
<input
type="email"
maxlength={254}
bind:value={contactEmail}
placeholder="Email"
class={field}
style={fieldStyle}
/>
{/if}
<div class="flex justify-between items-center gap-3">
<div>
<p class="font-medium">Include SEQTA instance</p>
<p class="text-base text-zinc-500">
{#if instanceHostname}
Hostname only: <span class="font-mono">{instanceHostname}</span>
{:else}
Open SEQTA first to detect hostname
{/if}
</p>
</div>
<Switch
state={includeInstance && !!instanceHostname}
onChange={(v) => {
if (instanceHostname) includeInstance = v;
}}
/>
</div>
{#if errorMessage}
<p class="text-red-600 dark:text-red-400" role="alert">{errorMessage}</p>
{/if}
<p class="text-base text-zinc-500">
Sent to betterseqta.org.
<a
href="https://betterseqta.org/privacy"
target="_blank"
rel="noopener noreferrer"
class="underline">Privacy</a
>
</p>
<div class="flex gap-3 justify-end">
<button type="button" class={btnMuted} onclick={onClose} disabled={submitting}
>Cancel</button
>
<button type="button" class={btnPrimary} onclick={handleSubmit} disabled={submitting}>
{submitting ? "Sending…" : "Send feedback"}
</button>
</div>
</div>
{:else if isStatusDetailKey(panelKey) && selectedItem}
<div class="flex items-start justify-between gap-3 mb-3">
<h2 id="feedback-modal-title" class="text-xl font-bold">Feedback status</h2>
<button
type="button"
class="{btnMuted} !text-base !px-3 !py-1.5"
onclick={() => {
selectedItem = null;
void loadStatusList();
}}>Back</button
>
</div>
<p class="mb-1 font-medium">
{selectedItem.subject || "Untitled"} · {formatStatus(selectedItem.status)}
</p>
<p class="mb-4 font-mono text-base text-zinc-500 break-all">{selectedItem.id}</p>
{#if hasReply(selectedItem)}
<div
class="p-3 mb-4 rounded-lg border {isDark
? 'border-zinc-700 bg-zinc-900/50'
: 'border-zinc-200 bg-zinc-50'}"
>
<p class="mb-1 text-base font-semibold uppercase tracking-wide text-zinc-500">
Response
</p>
<p class="whitespace-pre-wrap">{selectedItem.response}</p>
</div>
{:else}
<p class="mb-4 text-zinc-500">No response yet.</p>
{/if}
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">{statusError}</p
>{/if}
<div class="flex gap-3 justify-end">
<button
type="button"
class={btnMuted}
onclick={() => openStatusItem(selectedItem!.id)}
disabled={statusLoading}
>
{statusLoading ? "Refreshing…" : "Refresh"}
</button>
<button type="button" class={btnPrimary} onclick={onClose}>Close</button>
</div>
{:else}
<div class="flex items-start justify-between gap-3 mb-3">
<h2 id="feedback-modal-title" class="text-xl font-bold">My feedback</h2>
<button
type="button"
class="{btnMuted} !text-base !px-3 !py-1.5"
onclick={() => void loadStatusList()}
disabled={statusLoading}
>
{statusLoading ? "…" : "Refresh"}
</button>
</div>
{#if statusError}<p class="mb-3 text-red-600 dark:text-red-400" role="alert">{statusError}</p
>{/if}
{#if statusLoading && !statusItems.length}
<div class="feedback-loading" aria-busy="true" aria-live="polite">
<Spinner size="md" />
<p class="text-zinc-500">Checking your feedback…</p>
<div class="feedback-loading__skeleton" aria-hidden="true">
<span></span>
<span></span>
<span></span>
</div>
</div>
{:else if !statusItems.length}
<p class="mb-4 text-zinc-500">No feedback yet.</p>
<button type="button" class={btnPrimary} onclick={() => selectTab("send")}
>Send feedback</button
>
{:else}
<ul class="flex flex-col gap-2 mb-4">
{#each statusItems as item (item.id)}
<li>
<button
type="button"
onclick={() => openStatusItem(item.id)}
class="w-full p-3 text-left rounded-lg border transition-all duration-200 hover:scale-[1.01] focus:outline-none focus:ring-2 focus:ring-zinc-400 {isDark
? 'border-zinc-700 bg-zinc-900/40'
: 'border-zinc-200 bg-white'}"
>
<p class="text-base text-zinc-500 mb-0.5">
{formatStatus(item.status)}{#if hasReply(item)} · Reply{/if} · {categoryLabel(
item.category,
)}
</p>
<p class="font-medium truncate">{item.subject || "Untitled"}</p>
</button>
</li>
{/each}
</ul>
{/if}
<div class="flex justify-end">
<button type="button" class={btnMuted} onclick={onClose}>Close</button>
</div>
{/if}
</div>
</div>
</div>
</div>
<style>
.feedback-overlay {
-webkit-overflow-scrolling: touch;
}
.feedback-overlay__backdrop:disabled {
cursor: default;
}
.feedback-dialog {
display: flex;
flex-direction: column;
min-height: 0;
overflow: hidden;
}
.feedback-panel__body {
flex: 1 1 auto;
min-height: 0;
-webkit-overflow-scrolling: touch;
}
.feedback-tabs {
flex-shrink: 0;
}
.feedback-tab {
border: none;
cursor: pointer;
line-height: 1.2;
}
.feedback-loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.75rem;
min-height: 14rem;
padding: 1rem 0 1.5rem;
}
.feedback-loading__skeleton {
display: flex;
flex-direction: column;
gap: 0.5rem;
width: 100%;
margin-top: 0.5rem;
}
.feedback-loading__skeleton span {
display: block;
height: 3.5rem;
border-radius: 0.5rem;
background: color-mix(in srgb, currentColor 8%, transparent);
animation: feedback-skeleton-pulse 1.2s ease-in-out infinite;
}
.feedback-loading__skeleton span:nth-child(2) {
animation-delay: 0.15s;
}
.feedback-loading__skeleton span:nth-child(3) {
animation-delay: 0.3s;
}
@keyframes feedback-skeleton-pulse {
0%,
100% {
opacity: 0.45;
}
50% {
opacity: 0.9;
}
}
:global(.feedback-field),
:global(.feedback-field option) {
-webkit-text-fill-color: currentColor !important;
caret-color: currentColor !important;
}
:global(.feedback-field::placeholder) {
-webkit-text-fill-color: #a1a1aa !important;
color: #a1a1aa !important;
opacity: 1;
}
</style>
@@ -0,0 +1,146 @@
<script lang="ts">
import { fade } from "svelte/transition";
import { onMount } from "svelte";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import { FONT_PRESETS, DEFAULT_FONT_ID, getFontPreset } from "@/seqta/ui/fonts/presets";
import {
applySelectedFont,
buildFontPreviewCss,
ensureFontPickerFontsLoaded,
} from "@/seqta/ui/fonts/Manager";
import { portal } from "@/interface/utils/portal";
import { syncPageThemeToElement } from "@/interface/utils/syncPageTheme";
import fontPickerStyles from "./fontPickerModal.css?inline";
let { hidePicker } = $props<{ hidePicker: () => void }>();
let rootEl = $state<HTMLElement | null>(null);
let selectedId = $state(getFontPreset($settingsState.selectedFont).id);
let styleEl: HTMLStyleElement | null = null;
function selectFont(id: string) {
selectedId = id;
settingsState.selectedFont = id;
applySelectedFont(id);
}
function resetToDefault() {
selectFont(DEFAULT_FONT_ID);
}
function handleBackdropClick(event: MouseEvent) {
if (event.target === event.currentTarget) hidePicker();
}
function syncTheme() {
if (rootEl) syncPageThemeToElement(rootEl);
}
onMount(() => {
void ensureFontPickerFontsLoaded();
styleEl = document.getElementById(
"betterseqta-font-picker-styles",
) as HTMLStyleElement | null;
if (!styleEl) {
styleEl = document.createElement("style");
styleEl.id = "betterseqta-font-picker-styles";
document.head.appendChild(styleEl);
}
styleEl.textContent = `${fontPickerStyles}\n${buildFontPreviewCss()}`;
syncTheme();
const themeObserver = new MutationObserver(() => syncTheme());
themeObserver.observe(document.documentElement, {
attributes: true,
attributeFilter: ["style", "class"],
});
const handleEscapeKey = (event: KeyboardEvent) => {
if (event.key === "Escape") hidePicker();
};
document.addEventListener("keydown", handleEscapeKey);
return () => {
themeObserver.disconnect();
document.removeEventListener("keydown", handleEscapeKey);
};
});
</script>
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
bind:this={rootEl}
use:portal={document.body}
class="bsplus-font-picker-overlay bsplus-font-picker-root"
onclick={handleBackdropClick}
onkeydown={(event) => {
if (event.key === "Enter" || event.key === " ") handleBackdropClick(event as unknown as MouseEvent);
}}
role="presentation"
transition:fade={{ duration: 200 }}
>
<div
class="bsplus-font-picker-dialog"
onclick={(event) => event.stopPropagation()}
onkeydown={(event) => event.stopPropagation()}
role="dialog"
aria-modal="true"
aria-labelledby="font-picker-title"
>
<header class="bsplus-font-picker-header">
<div class="bsplus-font-picker-header-actions">
<button
type="button"
onclick={resetToDefault}
disabled={selectedId === DEFAULT_FONT_ID}
class="bsplus-font-picker-reset"
aria-label="Reset font to default"
>
Reset to default
</button>
<button
type="button"
onclick={hidePicker}
class="bsplus-font-picker-done"
aria-label="Close font picker"
>
Done
</button>
</div>
<div class="bsplus-font-picker-header-text">
<h2 id="font-picker-title" class="bsplus-font-picker-title">
Choose a font
</h2>
<p class="bsplus-font-picker-desc">
Choose a typeface for SEQTA Learn.
</p>
</div>
</header>
<div class="bsplus-font-picker-list">
{#each FONT_PRESETS as preset (preset.id)}
<button
type="button"
onclick={() => selectFont(preset.id)}
class="bsplus-font-picker-option {selectedId === preset.id ? 'is-selected' : ''}"
data-font-id={preset.id}
>
<div class="bsplus-font-picker-option-head">
<span
class="bsplus-font-picker-option-name"
style="font-family: {preset.stack} !important;"
>
{preset.name}
</span>
{#if selectedId === preset.id}
<span class="bsplus-font-picker-badge">Selected</span>
{/if}
</div>
</button>
{/each}
</div>
</div>
</div>
+14 -8
View File
@@ -78,7 +78,7 @@
const startRecording = () => {
isRecording = true;
recordedKeys.clear();
recordedKeys = new Set();
inputElement?.focus();
};
@@ -87,7 +87,7 @@
if (recordedKeys.has('esc')) {
onChange('');
isRecording = false;
recordedKeys.clear();
recordedKeys = new Set();
inputElement?.blur();
return;
}
@@ -113,10 +113,16 @@
}
isRecording = false;
recordedKeys.clear();
recordedKeys = new Set();
inputElement?.blur();
};
const addRecordedKey = (key: string) => {
const next = new Set(recordedKeys);
next.add(key);
recordedKeys = next;
};
const handleKeyDown = (e: KeyboardEvent) => {
if (!isRecording) return;
@@ -126,14 +132,14 @@
const key = formatKeyForHotkey(e.key);
// Add modifiers
if (e.ctrlKey) recordedKeys.add('ctrl');
if (e.metaKey) recordedKeys.add('cmd');
if (e.altKey) recordedKeys.add('alt');
if (e.shiftKey) recordedKeys.add('shift');
if (e.ctrlKey) addRecordedKey('ctrl');
if (e.metaKey) addRecordedKey('cmd');
if (e.altKey) addRecordedKey('alt');
if (e.shiftKey) addRecordedKey('shift');
// Add the main key (ignore modifier keys themselves)
if (!['ctrl', 'cmd', 'alt', 'shift'].includes(key)) {
recordedKeys.add(key);
addRecordedKey(key);
}
// Auto-stop recording if we have a main key
+34
View File
@@ -0,0 +1,34 @@
<script lang="ts">
import type { Component } from "svelte";
let {
loader,
props = {},
remountKey = "default",
}: {
loader: () => Promise<{ default: Component }>;
props?: Record<string, unknown>;
/** Change to force a fresh import (e.g. different panel). Props-only updates reuse the component. */
remountKey?: string;
} = $props();
let Comp = $state<Component | null>(null);
let loadedKey = $state("");
$effect(() => {
const key = remountKey;
if (key === loadedKey && Comp) return;
loadedKey = key;
Comp = null;
void loader().then((mod) => {
if (loadedKey === key) Comp = mod.default;
});
});
</script>
{#if Comp}
<Comp {...props} />
{:else}
<div class="px-2 py-8 text-sm text-zinc-400 animate-pulse">Loading…</div>
{/if}
+21 -1
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import { onMount, onDestroy } from 'svelte';
import { animate as motionAnimate } from 'motion';
import { fullMotionEffectsEnabled } from '@/seqta/utils/performanceMode';
let { initial, animate, exit, transition, children, class: className } = $props<{
initial?: any,
@@ -13,8 +14,27 @@
let divElement: HTMLElement;
const applyCssKeyframe = (keyframe: Record<string, unknown>) => {
if (!divElement || !keyframe) return;
if (keyframe.x != null) {
divElement.style.transition =
'transform var(--bs-motion-duration, 0.2s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1))';
const x = keyframe.x;
divElement.style.transform =
typeof x === 'number' ? `translateX(${x}px)` : `translateX(${String(x)})`;
}
if (typeof keyframe.opacity === 'number') {
divElement.style.opacity = String(keyframe.opacity);
}
};
const playAnimation = (keyframe: any) => {
if (divElement && keyframe) {
if (!fullMotionEffectsEnabled()) {
applyCssKeyframe(keyframe);
return Promise.resolve();
}
let finalKeyframe = { ...keyframe };
if (finalKeyframe.height === 'auto') {
@@ -72,7 +92,7 @@
});
</script>
<div class={className} bind:this={divElement} style="will-change: transform, opacity;">
<div class={className} bind:this={divElement} style={fullMotionEffectsEnabled() ? 'will-change: transform, opacity;' : undefined}>
{#if children}
{@render children()}
{/if}
@@ -0,0 +1,25 @@
<script lang="ts">
let { onclick, label = "Close" } = $props<{
onclick: () => void;
label?: string;
}>();
</script>
<button
type="button"
{onclick}
class="flex h-10 w-10 shrink-0 items-center justify-center text-zinc-500 transition-[color,transform] duration-150 hover:text-zinc-950 active:scale-[0.96] focus:outline-none dark:text-zinc-400 dark:hover:text-white"
aria-label={label}
>
<svg
class="h-6 w-6"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
aria-hidden="true"
>
<path d="M6 6l12 12M18 6 6 18" />
</svg>
</button>
+195 -16
View File
@@ -1,24 +1,203 @@
<script lang="ts">
let { state, onChange, options } = $props<{
state: string,
onChange: (newState: string) => void,
let { value, onChange, options } = $props<{
value: string,
onChange: (newValue: string) => void,
options: Array<{ value: string, label: string }>
}>();
let select: HTMLSelectElement;
const listboxId = `select-listbox-${Math.random().toString(36).slice(2, 9)}`;
let isOpen = $state(false);
let activeIndex = $state(0);
let trigger = $state<HTMLButtonElement>();
function openMenu(preferredIndex?: number) {
isOpen = true;
const selectedIndex = options.findIndex((option) => option.value === value);
activeIndex = preferredIndex ?? (selectedIndex >= 0 ? selectedIndex : 0);
}
function closeMenu(returnFocus = true) {
isOpen = false;
if (returnFocus) trigger?.focus();
}
function selectValue(nextValue: string) {
onChange(nextValue);
closeMenu();
}
function onKeydown(event: KeyboardEvent, inListbox = false) {
const { key } = event;
if (key === "ArrowDown" || key === "ArrowUp") {
event.preventDefault();
const count = options.length;
if (!count) return;
if (isOpen || inListbox) {
activeIndex = (activeIndex + (key === "ArrowDown" ? 1 : -1) + count) % count;
} else {
openMenu();
}
return;
}
if (key === "Enter" || key === " ") {
event.preventDefault();
if (isOpen) {
const option = options[activeIndex];
if (option) selectValue(option.value);
} else {
openMenu();
}
return;
}
if (key === "Escape" && isOpen) {
event.preventDefault();
closeMenu();
return;
}
if (!inListbox) return;
if (key === "Home") {
event.preventDefault();
activeIndex = 0;
} else if (key === "End") {
event.preventDefault();
activeIndex = Math.max(0, options.length - 1);
} else if (key === "Tab") {
closeMenu(false);
}
}
$effect(() => {
if (!isOpen) return;
queueMicrotask(() => document.getElementById(listboxId)?.focus());
const wrapper = trigger?.parentElement;
const onPointerDown = (event: PointerEvent) => {
if (wrapper && event.composedPath().includes(wrapper)) return;
closeMenu(false);
};
document.addEventListener("pointerdown", onPointerDown, true);
return () => document.removeEventListener("pointerdown", onPointerDown, true);
});
</script>
<div class="border dark:bg-[#38373D]/50 bg-[#DDDDDD]/50 border-[#DDDDDD]/30 dark:border-[#38373D]/30 shadow-2xl rounded-lg w-full overflow-clip">
<select
bind:this={select}
value={state}
onchange={() => onChange(select.value)}
class="px-4 py-1 text-[0.75rem] dark:text-white w-full border-none bg-transparent focus:ring-0 focus:bg-white/20 dark:focus:bg-black/10"
<div class="select relative w-full">
<button
bind:this={trigger}
type="button"
class="select-trigger flex w-full items-center justify-between gap-3 rounded-[18px] border px-4 py-2.5 text-sm font-medium leading-tight shadow-2xl transition-[background-color,border-color,box-shadow] duration-200 cursor-pointer"
aria-haspopup="listbox"
aria-expanded={isOpen}
aria-controls={listboxId}
onclick={() => (isOpen ? closeMenu() : openMenu())}
onkeydown={onKeydown}
>
{#each options as option}
<option value={option.value}>
{option.label}
</option>
{/each}
</select>
<span class="truncate">
{options.find((option) => option.value === value)?.label ?? value}
</span>
<span class="select-icon shrink-0" aria-hidden="true">
<svg viewBox="0 0 20 20" fill="currentColor" class="h-4 w-4">
<path
fill-rule="evenodd"
d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06Z"
clip-rule="evenodd"
/>
</svg>
</span>
</button>
{#if isOpen}
<div
id={listboxId}
class="select-menu absolute inset-x-0 top-[calc(100%+0.35rem)] z-50 flex max-h-72 flex-col gap-0.5 p-2"
role="listbox"
tabindex="-1"
aria-activedescendant={options[activeIndex] ? `${listboxId}-opt-${activeIndex}` : undefined}
onkeydown={(event) => onKeydown(event, true)}
>
{#each options as option, index (option.value)}
<button
type="button"
id={`${listboxId}-opt-${index}`}
role="option"
aria-selected={option.value === value}
class="select-option block w-full rounded-[10px] border-none px-3.5 py-2.5 text-left text-sm font-medium leading-snug transition-colors duration-150 cursor-pointer"
class:is-selected={option.value === value}
class:is-active={index === activeIndex}
tabindex="-1"
onclick={() => selectValue(option.value)}
onmouseenter={() => (activeIndex = index)}
>
{option.label}
</button>
{/each}
</div>
{/if}
</div>
<style>
.select {
--sel-border: var(--theme-offset-bg, var(--theme-secondary, #e5e7eb));
--sel-bg: var(--theme-primary, #ffffff);
--sel-surface: var(--theme-secondary, #e5e7eb);
--sel-focus-border: color-mix(in srgb, var(--text-primary) 22%, var(--theme-secondary, #e5e7eb) 78%);
--sel-ring: 0 0 0 1px color-mix(in srgb, var(--text-primary) 12%, transparent);
--sel-menu-shadow:
0 10px 25px -5px rgb(0 0 0 / 0.25),
0 8px 10px -6px rgb(0 0 0 / 0.2);
}
.select-trigger {
border-color: var(--sel-border);
background: var(--sel-bg);
color: var(--text-primary);
}
.select-trigger:hover,
.select-trigger:focus-visible {
outline: none;
background: var(--sel-surface);
border-color: var(--sel-border);
}
.select-trigger:focus-visible {
border-color: var(--sel-focus-border);
box-shadow: var(--sel-ring);
}
.select-icon {
color: color-mix(in srgb, var(--text-primary) 60%, transparent);
}
.select-menu {
border: 1px solid var(--sel-border);
border-radius: 14px;
background: var(--sel-bg);
box-shadow: var(--sel-menu-shadow);
}
.select-menu:focus-visible {
outline: none;
box-shadow: var(--sel-menu-shadow), var(--sel-ring);
}
.select-option {
background: transparent;
color: var(--text-primary);
}
.select-option:hover,
.select-option:focus-visible,
.select-option.is-active,
.select-option.is-selected {
outline: none;
background: var(--sel-surface);
}
</style>
@@ -0,0 +1,690 @@
<script lang="ts">
import Select from "@/interface/components/Select.svelte";
import Slider from "@/interface/components/Slider.svelte";
import Switch from "@/interface/components/Switch.svelte";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import {
DEFAULT_SIDEBAR_BLUR,
DEFAULT_SIDEBAR_RADIUS,
getSidebarStyle,
normalizeSidebarBlur,
normalizeSidebarDensity,
normalizeSidebarIndicator,
normalizeSidebarRadius,
normalizeSidebarStyleId,
normalizeSidebarWidth,
normalizeSidebarPosition,
SIDEBAR_STYLES,
type SidebarStyleId,
} from "@/seqta/ui/sidebar/sidebarStyles";
const PREVIEW_ITEMS = [
{ label: "Home", active: true },
{ label: "Timetable", active: false },
{ label: "Assessments", active: false },
{ label: "Messages", active: false },
{ label: "Documents", active: false },
] as const;
const selectedId = $derived(
normalizeSidebarStyleId($settingsState.sidebarStyle),
);
const selected = $derived(getSidebarStyle(selectedId));
const density = $derived(
normalizeSidebarDensity($settingsState.sidebarDensity),
);
const indicator = $derived(
normalizeSidebarIndicator($settingsState.sidebarActiveIndicator),
);
const width = $derived(normalizeSidebarWidth($settingsState.sidebarWidth));
const position = $derived(
normalizeSidebarPosition($settingsState.sidebarPosition),
);
const radius = $derived(
normalizeSidebarRadius(
$settingsState.sidebarCornerRadius ?? DEFAULT_SIDEBAR_RADIUS,
),
);
const blur = $derived(
normalizeSidebarBlur($settingsState.sidebarBlur ?? DEFAULT_SIDEBAR_BLUR),
);
const transparencyOn = $derived($settingsState.transparencyEffects === true);
function selectStyle(id: SidebarStyleId) {
if (selectedId !== id) settingsState.sidebarStyle = id;
}
</script>
<div class="sidebar-appearance">
<div class="card">
<header class="card-header split">
<div>
<h2 class="title">Sidebar Style</h2>
<p class="subtitle">Choose how the navigation menu looks</p>
</div>
<div class="selected-meta" aria-live="polite">
<span class="selected-label">{selected.label}</span>
<span class="selected-desc">{selected.description}</span>
</div>
</header>
<div class="picker-body">
<div class="preview-pane" aria-hidden="true">
<div class={`preview style-${selectedId}`}>
<div class="preview-chrome">
<div class="preview-logo"></div>
{#each PREVIEW_ITEMS as item (item.label)}
<div class="preview-item" class:active={item.active}>
<span class="preview-dot"></span>
<span class="preview-label">{item.label}</span>
</div>
{/each}
</div>
</div>
</div>
<div
class="options"
role="listbox"
tabindex="0"
aria-label="Sidebar styles"
aria-activedescendant={`sidebar-style-${selectedId}`}
>
{#each SIDEBAR_STYLES as style (style.id)}
{@const active = style.id === selectedId}
<button
type="button"
id={`sidebar-style-${style.id}`}
class={`option style-${style.id}`}
class:active
role="option"
aria-selected={active}
onclick={() => selectStyle(style.id)}
>
<div class={`thumb style-${style.id}`}>
<div class="thumb-chrome">
{#each PREVIEW_ITEMS.slice(0, 3) as item (item.label)}
<div class="thumb-item" class:active={item.active}></div>
{/each}
</div>
</div>
<span class="option-label">{style.label}</span>
</button>
{/each}
</div>
</div>
</div>
<div class="card">
<header class="card-header">
<h2 class="title">Sidebar Look</h2>
<p class="subtitle">Density, size, and active-state details</p>
</header>
<div class="rows">
<div class="row">
<div class="copy">
<h3 class="row-title">Item Size</h3>
<p class="row-desc">Spacing and type size for menu rows</p>
</div>
<div class="control">
<Select
value={density}
onChange={(value) => (settingsState.sidebarDensity = value)}
options={[
{ value: "compact", label: "Compact" },
{ value: "comfortable", label: "Comfortable" },
{ value: "large", label: "Large" },
]}
/>
</div>
</div>
<div class="row">
<div class="copy">
<h3 class="row-title">Corner Radius</h3>
<p class="row-desc">Roundness of menu items ({radius}px)</p>
</div>
<div class="control slider">
<Slider
state={radius}
min={0}
max={24}
step={1}
onChange={(value) => (settingsState.sidebarCornerRadius = value)}
/>
</div>
</div>
<div class="row">
<div class="copy">
<h3 class="row-title">Active Indicator</h3>
<p class="row-desc">How the current page is highlighted</p>
</div>
<div class="control">
<Select
value={indicator}
onChange={(value) => (settingsState.sidebarActiveIndicator = value)}
options={[
{ value: "fill", label: "Fill" },
{ value: "bar", label: "Left bar" },
{ value: "outline", label: "Outline" },
{ value: "underline", label: "Underline" },
]}
/>
</div>
</div>
<div class="row">
<div class="copy">
<h3 class="row-title">Sidebar Position</h3>
<p class="row-desc">Which edge of the screen the navigation sits on</p>
</div>
<div class="control">
<Select
value={position}
onChange={(value) => (settingsState.sidebarPosition = value)}
options={[
{ value: "left", label: "Left" },
{ value: "right", label: "Right" },
]}
/>
</div>
</div>
<div class="row">
<div class="copy">
<h3 class="row-title">Sidebar Width</h3>
<p class="row-desc">Overall navigation column width</p>
</div>
<div class="control">
<Select
value={width}
onChange={(value) => (settingsState.sidebarWidth = value)}
options={[
{ value: "narrow", label: "Narrow" },
{ value: "default", label: "Default" },
{ value: "wide", label: "Wide" },
]}
/>
</div>
</div>
<div class="row">
<div class="copy">
<h3 class="row-title">Transparency Effects</h3>
<p class="row-desc">Use glass effects on supported surfaces (may impact battery life)</p>
</div>
<div class="control toggle">
<Switch
state={transparencyOn}
onChange={(value) => (settingsState.transparencyEffects = value)}
/>
</div>
</div>
{#if transparencyOn}
<div class="row">
<div class="copy">
<h3 class="row-title">Blur Strength</h3>
<p class="row-desc">Glass blur on the sidebar ({blur}px)</p>
</div>
<div class="control slider">
<Slider
state={blur}
min={0}
max={80}
step={1}
onChange={(value) => (settingsState.sidebarBlur = value)}
/>
</div>
</div>
{/if}
</div>
</div>
</div>
<style>
.sidebar-appearance {
container: sidebar-appearance / inline-size;
}
.card {
margin: 4px 0;
padding: 4px;
border-radius: 0.75rem;
border: 1px solid rgb(228 228 231 / 0.5);
background: linear-gradient(to bottom right, white, rgb(244 244 245));
box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
:global(.dark) .card {
border-color: rgb(63 63 70 / 0.4);
background: linear-gradient(
to bottom right,
rgb(24 24 27 / 0.4),
rgb(24 24 27 / 0.5)
);
}
.card-header {
padding: 1rem 1.25rem 0.5rem;
}
.card-header.split {
display: flex;
justify-content: space-between;
gap: 1rem;
align-items: flex-start;
}
.title {
font-size: 0.875rem;
font-weight: 700;
line-height: 1.3;
}
.subtitle {
margin-top: 0.15rem;
font-size: 0.75rem;
color: rgb(82 82 91);
}
:global(.dark) .subtitle {
color: rgb(212 212 216);
}
.selected-meta {
display: flex;
flex-direction: column;
align-items: flex-end;
text-align: right;
max-width: 14rem;
gap: 0.15rem;
}
.selected-label {
font-size: 0.875rem;
font-weight: 700;
}
.selected-desc {
font-size: 0.75rem;
line-height: 1.35;
color: rgb(113 113 122);
}
:global(.dark) .selected-desc {
color: rgb(161 161 170);
}
.picker-body {
display: grid;
grid-template-columns: minmax(160px, 210px) 1fr;
gap: 1rem;
padding: 0.5rem 1rem 1rem;
}
@media (max-width: 720px) {
.picker-body {
grid-template-columns: 1fr;
}
}
.preview-pane {
display: flex;
align-items: center;
}
.preview {
width: 100%;
max-width: 196px;
height: 280px;
border-radius: 18px;
overflow: hidden;
box-shadow: 0 14px 32px rgb(0 0 0 / 0.22);
background: linear-gradient(160deg, #aa053a, #141414 70%);
}
.preview-chrome {
display: flex;
flex-direction: column;
height: 100%;
padding: 14px 0 10px;
color: #fff;
}
.preview-logo {
width: 42%;
height: 10px;
margin: 0 16px 14px;
border-radius: 999px;
background: rgb(255 255 255 / 0.35);
}
.preview-item {
display: flex;
align-items: center;
gap: 8px;
margin: 0 8px 6px;
padding: 8px 10px;
border-radius: 12px;
}
.preview-item.active {
background: rgba(0, 0, 0, 0.35);
}
.preview.style-soft .preview-item {
margin: 0 10px 8px;
border-radius: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.preview.style-pill .preview-item {
margin: 0 12px 7px;
border-radius: 999px;
}
.preview.style-glass .preview-item {
margin: 0 10px 7px;
background: rgba(255, 255, 255, 0.12);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.preview.style-glass .preview-item.active {
background: rgba(255, 255, 255, 0.22);
}
.preview.style-sharp .preview-item {
margin: 0 6px 4px;
border-radius: 4px;
}
.preview.style-strip .preview-item {
margin: 0;
border-radius: 0;
background: transparent;
}
.preview.style-strip .preview-item.active {
position: relative;
background: rgba(255, 255, 255, 0.12);
}
.preview.style-strip .preview-item.active::after {
content: "";
position: absolute;
left: 0;
top: 6px;
bottom: 6px;
width: 3px;
border-radius: 2px;
background: #fff;
box-shadow: 0 0 8px rgba(255, 255, 255, 0.55);
}
.preview.style-neon .preview-item.active {
background: rgba(255, 255, 255, 0.1);
box-shadow:
0 0 0 1px rgba(255, 255, 255, 0.55),
0 0 12px rgba(255, 255, 255, 0.4),
0 0 22px rgba(255, 255, 255, 0.22);
}
.preview-dot {
width: 10px;
height: 10px;
border-radius: 999px;
background: rgb(255 255 255 / 0.75);
flex: 0 0 auto;
}
.preview-label {
font-size: 11px;
font-weight: 600;
white-space: nowrap;
}
.options {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
gap: 0.65rem;
align-content: start;
}
.option {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.4rem;
padding: 0.45rem;
border: 1px solid transparent;
border-radius: 0.75rem;
background: rgb(255 255 255 / 0.55);
color: inherit;
cursor: pointer;
transition:
transform 0.2s ease,
border-color 0.2s ease,
box-shadow 0.2s ease;
}
:global(.dark) .option {
background: rgb(39 39 42 / 0.55);
}
.option:hover {
transform: scale(1.02);
}
.option:active {
transform: scale(0.98);
}
.option.active {
border-color: var(--theme-primary, #f43f5e);
box-shadow: 0 0 0 1px var(--theme-primary, #f43f5e);
}
.option:focus-visible {
outline: none;
box-shadow: 0 0 0 2px var(--theme-primary, #f43f5e);
}
.thumb {
width: 100%;
aspect-ratio: 3 / 4;
border-radius: 10px;
overflow: hidden;
background: linear-gradient(160deg, #aa053a, #141414 70%);
}
.thumb-chrome {
display: flex;
flex-direction: column;
justify-content: center;
gap: 4px;
height: 100%;
padding: 8px 6px;
}
.thumb-item {
height: 10px;
border-radius: 6px;
background: rgba(255, 255, 255, 0.18);
}
.thumb-item.active {
background: rgba(0, 0, 0, 0.4);
}
.thumb.style-pill .thumb-item {
border-radius: 999px;
}
.thumb.style-sharp .thumb-item {
border-radius: 2px;
}
.thumb.style-strip .thumb-item {
border-radius: 0;
}
.thumb.style-strip .thumb-item.active {
background: rgba(255, 255, 255, 0.22);
box-shadow: inset 3px 0 0 #fff;
}
.thumb.style-glass .thumb-item {
background: rgba(255, 255, 255, 0.22);
}
.thumb.style-neon .thumb-item.active {
background: rgba(255, 255, 255, 0.2);
box-shadow:
0 0 0 1px rgba(255, 255, 255, 0.5),
0 0 8px rgba(255, 255, 255, 0.55);
}
.option-label {
font-size: 0.8rem;
font-weight: 700;
}
.rows {
display: flex;
flex-direction: column;
padding: 0.25rem 0.5rem 0.75rem;
}
.row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 0.85rem 0.75rem;
border-top: 1px solid rgb(244 244 245);
}
:global(.dark) .row {
border-top-color: rgb(63 63 70 / 0.5);
}
.row:first-child {
border-top: none;
}
.copy {
min-width: 0;
flex: 1 1 auto;
padding-right: 0.5rem;
}
.row-title {
font-size: 0.875rem;
font-weight: 700;
line-height: 1.3;
}
.row-desc {
margin-top: 0.1rem;
font-size: 0.75rem;
color: rgb(82 82 91);
}
:global(.dark) .row-desc {
color: rgb(212 212 216);
}
.control {
flex: 0 0 auto;
min-width: 9.5rem;
max-width: 12rem;
}
.control.slider {
min-width: 10rem;
width: 11rem;
}
.control.toggle {
display: flex;
justify-content: flex-end;
}
@container sidebar-appearance (max-width: 500px) {
.preview-pane,
.thumb {
display: none;
}
.picker-body {
grid-template-columns: minmax(0, 1fr);
gap: 0;
}
.options {
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0.5rem;
}
.option {
min-height: 2.5rem;
justify-content: center;
padding: 0.5rem;
}
.option.style-soft {
border-radius: 1rem;
box-shadow: 0 3px 8px rgb(0 0 0 / 0.2);
}
.option.style-pill {
border-radius: 999px;
}
.option.style-glass {
background: linear-gradient(135deg, rgb(148 163 184 / 0.24), rgb(148 163 184 / 0.08));
box-shadow: inset 0 0 0 1px rgb(148 163 184 / 0.35);
}
.option.style-sharp {
border-radius: 0.25rem;
}
.option.style-strip {
border-radius: 0;
border-left: 3px solid currentColor;
}
.option.style-neon {
box-shadow: 0 0 0 1px rgb(148 163 184 / 0.6), 0 0 12px rgb(148 163 184 / 0.4);
}
.option.active {
outline: 1px solid currentColor;
outline-offset: 2px;
}
.option-label {
font-size: 0.775rem;
}
.card-header.split {
gap: 0.5rem;
}
.card-header.split .title {
font-size: 0.875rem;
}
.card-header.split .subtitle {
font-size: 0.65rem;
}
.selected-meta {
display: none;
}
}
</style>
@@ -0,0 +1,90 @@
<script lang="ts">
import { animationsEnabled } from "@/seqta/utils/performanceMode";
import { rafThrottle } from "@/seqta/utils/rafThrottle";
import SidebarNavItem from "./SidebarNavItem.svelte";
type NavGroup = {
label?: string;
items: {
id: string;
label: string;
divided?: boolean;
nested?: boolean;
expanded?: boolean;
}[];
};
let { groups, selectedId, onselect } = $props<{
groups: NavGroup[];
selectedId: string;
onselect: (id: string) => void;
}>();
let trackEl = $state<HTMLElement | null>(null);
let indicatorX = $state(0);
let indicatorY = $state(0);
let indicatorW = $state(0);
let indicatorH = $state(40);
let indicatorReady = $state(false);
const updateIndicator = () => {
if (!trackEl) return;
const item = trackEl.querySelector<HTMLElement>(`[data-nav-section="${selectedId}"]`);
if (!item) return;
const trackRect = trackEl.getBoundingClientRect();
const itemRect = item.getBoundingClientRect();
indicatorX = itemRect.left - trackRect.left;
indicatorY = itemRect.top - trackRect.top + trackEl.scrollTop;
indicatorW = itemRect.width;
indicatorH = itemRect.height;
indicatorReady = true;
};
const scheduleIndicator = rafThrottle(updateIndicator);
$effect(() => {
selectedId;
groups;
trackEl;
scheduleIndicator();
});
</script>
<div
class="relative flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto no-scrollbar"
bind:this={trackEl}
>
{#if indicatorReady}
<div
class="pointer-events-none absolute left-0 top-0 z-0 rounded-lg bg-zinc-200/90 dark:bg-zinc-700/90"
style="transform: translate({indicatorX}px, {indicatorY}px); width: {indicatorW}px; height: {indicatorH}px; transition: {animationsEnabled()
? 'transform var(--bs-motion-duration, 0.28s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)), width var(--bs-motion-duration, 0.28s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)), height var(--bs-motion-duration, 0.28s) var(--bs-motion-ease, cubic-bezier(0.22, 1, 0.36, 1))'
: 'none'};"
></div>
{/if}
{#each groups as group}
<div class="relative flex flex-col gap-1">
{#if group.label}
<p
class="relative z-10 mb-1.5 px-3 text-sm font-semibold uppercase tracking-wider text-zinc-400 dark:text-zinc-500"
>
{group.label}
</p>
{/if}
{#each group.items as item (item.id)}
{#if item.divided}
<div class="my-2 border-t border-zinc-200 dark:border-zinc-700 {item.nested ? 'ml-4' : ''}"></div>
{/if}
<SidebarNavItem
label={item.label}
active={selectedId === item.id}
nested={item.nested}
emphasized={item.expanded}
trackId={item.id}
onclick={() => onselect(item.id)}
/>
{/each}
</div>
{/each}
</div>
@@ -0,0 +1,33 @@
<script lang="ts">
let {
label,
active = false,
nested = false,
emphasized = false,
trackId,
onclick,
} = $props<{
label: string;
active?: boolean;
nested?: boolean;
emphasized?: boolean;
trackId?: string;
onclick: () => void;
}>();
</script>
<button
type="button"
data-nav-section={trackId}
{onclick}
class="relative z-10 rounded-lg text-left transition-[color,background-color] duration-200
{nested
? 'ml-4 w-[calc(100%-1rem)] px-3 py-2 text-base'
: 'w-full px-3 py-2.5 text-lg'}
{active || emphasized
? 'font-medium text-zinc-900 dark:text-white'
: 'text-zinc-600 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-white'}"
aria-current={active ? "page" : undefined}
>
{label}
</button>
Loaded 100 of 571 files, more files were not shown because too many files have changed in this diff. Show more