chore: lint whole repo and remove dead files

This commit is contained in:
Jones Jankovic committed 2026-11-02 17:40:03 +10:30
1 parent 64923cabbf
commit e3648330df
17 files changed
+13 -1384

No files matched your search

-1
View File
@@ -640,7 +640,6 @@ browser.runtime.onMessage.addListener(
const result = handler(request, sendResponse, sender);
return result === true;
}
console.log("Unknown request type");
return false;
},
);
-191
View File
@@ -1,191 +0,0 @@
/* 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;
}
}
@@ -1,111 +0,0 @@
<script lang="ts">
import { cloudAuth } from "@/seqta/utils/CloudAuth";
let {
introText,
onSuccess,
compact = false,
} = $props<{
introText?: string;
onSuccess?: () => void;
/** Smaller padding/text for overlays (e.g. SignInToFavoriteModal) */
compact?: boolean;
}>();
let username = $state("");
let password = $state("");
let loading = $state(false);
let error = $state<string | null>(null);
const inputClass = $derived(
compact
? "w-full px-4 py-2 text-sm rounded-lg bg-zinc-100 dark:bg-zinc-800 dark:text-white border border-zinc-200 dark:border-zinc-600 focus:outline-hidden focus:ring-2 focus:ring-accent-ring focus:border-transparent transition-colors duration-200"
: "w-full px-4 py-3 text-base rounded-lg bg-zinc-100 dark:bg-zinc-800 dark:text-white border border-zinc-200 dark:border-zinc-600 focus:outline-hidden focus:ring-2 focus:ring-accent-ring focus:border-transparent transition-colors duration-200",
);
const btnClass = $derived(
compact
? "w-full px-4 py-2 text-sm font-medium rounded-lg bg-zinc-800 dark:bg-zinc-200 text-white dark:text-zinc-900 hover:bg-zinc-700 dark:hover:bg-zinc-300 disabled:opacity-50 transition-colors duration-200"
: "w-full px-4 py-3 text-base font-medium rounded-lg bg-zinc-800 dark:bg-zinc-200 text-white dark:text-zinc-900 hover:bg-zinc-700 dark:hover:bg-zinc-300 disabled:opacity-50 transition-colors duration-200",
);
const linkClass = $derived(
compact
? "inline-flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border border-zinc-200 dark:border-zinc-600 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-all duration-200"
: "inline-flex items-center justify-center gap-2 px-4 py-3 text-base font-medium rounded-lg border border-zinc-200 dark:border-zinc-600 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-all duration-200",
);
async function handleLogin() {
if (loading) return;
error = null;
if (!username.trim() || !password) {
error = "Please enter username and password";
return;
}
loading = true;
try {
const result = await cloudAuth.login(username.trim(), password);
if (result.success) {
password = "";
onSuccess?.();
} else {
error = result.error ?? "Login failed";
}
} finally {
loading = false;
}
}
</script>
{#if introText}
<p
class="mb-4 text-zinc-600 dark:text-zinc-400 {compact ? 'text-sm' : 'text-base'}"
>
{introText}
</p>
{/if}
<form
class="flex flex-col gap-3"
autocomplete="off"
onsubmit={(e) => {
e.preventDefault();
handleLogin();
}}
>
<input
type="text"
name="betterseqta-cloud-username"
autocomplete="off"
placeholder="Email or username"
bind:value={username}
disabled={loading}
readonly
onfocus={(e) => e.currentTarget.removeAttribute("readonly")}
class={inputClass}
/>
<input
type="password"
name="betterseqta-cloud-password"
autocomplete="new-password"
placeholder="Password"
bind:value={password}
disabled={loading}
readonly
onfocus={(e) => e.currentTarget.removeAttribute("readonly")}
class={inputClass}
/>
{#if error}
<p class="text-red-600 dark:text-red-400 {compact ? 'text-sm' : 'text-base'}">{error}</p>
{/if}
<button type="submit" disabled={loading} class={btnClass}>
{loading ? "Signing in..." : "Sign in"}
</button>
<a
href="https://accounts.betterseqta.org/register"
target="_blank"
rel="noopener noreferrer"
class={linkClass}
>
Create account
</a>
</form>
-1
View File
@@ -1 +0,0 @@
export { settingsPopup } from "@/seqta/utils/settingsPopup";
@@ -1,8 +1,5 @@
import { getEngageAssessmentStudentId } from "@/seqta/utils/engageAssessmentStudent";
function randomEngagePdfFileName(): string {
const token = Math.random().toString(36).slice(2, 10);
return `${token}.pdf`;
export function randomPdfFileName(): string {
return `${Math.random().toString(36).slice(2, 10)}.pdf`;
}
export async function requestEngageAssessmentPdf(params: {
@@ -10,11 +7,10 @@ export async function requestEngageAssessmentPdf(params: {
metaclassID: string | number;
studentID: string | number;
}): Promise<string> {
const fileName = randomEngagePdfFileName();
const cacheBuster = Math.random().toString(36).slice(2, 10);
const fileName = randomPdfFileName();
const response = await fetch(
`${location.origin}/seqta/parent/print/assessment?${cacheBuster}`,
`${location.origin}/seqta/parent/print/assessment?${Date.now()}`,
{
method: "POST",
headers: { "Content-Type": "application/json; charset=utf-8" },
@@ -4,6 +4,7 @@ import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
import { getEngageAssessmentStudentId } from "@/seqta/utils/engageAssessmentStudent";
import {
getEngageAssessmentReportUrl,
randomPdfFileName,
requestEngageAssessmentPdf,
} from "./engage.ts";
import {
@@ -679,17 +680,13 @@ export async function extractPDFText(url: string): Promise<string> {
}
}
function randomStudentPdfFileName(): string {
// Matches SEQTA Learn coversheet tokens, e.g. "mrr158ct.pdf".
return `${Math.random().toString(36).slice(2, 10)}.pdf`;
}
async function requestStudentAssessmentPdf(params: {
assessmentID: string | number;
metaclassID: string | number;
studentID: string | number;
}): Promise<string> {
const fileName = randomStudentPdfFileName();
const fileName = randomPdfFileName();
const printResponse = await fetch(
`${location.origin}/seqta/student/print/assessment`,
@@ -216,7 +216,7 @@
try {
confetti({ disableForReducedMotion: true, ...options });
} catch (e) {
console.log("Confetti celebration failed:", e);
console.warn("Confetti celebration failed:", e);
}
}
@@ -1,6 +0,0 @@
import type { SearchResult } from "embeddia";
import type { IndexItem } from "../../indexing/types";
export interface VectorSearchResult extends SearchResult {
object: IndexItem & { embedding: number[] };
}
Whitespace-only changes.
@@ -1,230 +0,0 @@
import { delay } from "@/seqta/utils/delay";
export interface RateLimiterConfig {
minDelay: number; // Minimum delay between requests (ms)
maxDelay: number; // Maximum delay between requests (ms)
baseDelay: number; // Base delay between requests (ms)
backoffMultiplier: number; // Exponential backoff multiplier
maxRetries: number; // Maximum retries for failed requests
adaptiveBatchSize?: boolean; // Enable adaptive batch sizing
minBatchSize?: number; // Minimum batch size
maxBatchSize?: number; // Maximum batch size
baseBatchSize?: number; // Starting batch size
}
export interface RateLimiterState {
currentDelay: number;
failedRequests: number;
lastSuccessTime: number;
currentBatchSize?: number;
}
export class RateLimiter {
private config: RateLimiterConfig;
private state: RateLimiterState;
constructor(config: RateLimiterConfig, initialState?: Partial<RateLimiterState>) {
this.config = config;
this.state = {
currentDelay: config.baseDelay,
failedRequests: 0,
lastSuccessTime: Date.now(),
currentBatchSize: config.baseBatchSize || 50,
...initialState,
};
}
/**
* Wait for the appropriate delay before making the next request
*/
async waitForNext(): Promise<void> {
await delay(this.state.currentDelay);
}
/**
* Record a successful request and adjust delays accordingly
*/
recordSuccess(responseTime?: number): void {
this.state.lastSuccessTime = Date.now();
this.state.failedRequests = Math.max(0, this.state.failedRequests - 1);
if (responseTime !== undefined) {
this.state.currentDelay = this.calculateAdaptiveDelay(responseTime);
if (this.config.adaptiveBatchSize && this.state.currentBatchSize !== undefined) {
this.state.currentBatchSize = this.calculateAdaptiveBatchSize(responseTime);
}
}
}
/**
* Record a failed request and increase delays
*/
recordFailure(): void {
this.state.failedRequests++;
this.state.currentDelay = Math.min(
this.state.currentDelay * this.config.backoffMultiplier,
this.config.maxDelay
);
if (this.config.adaptiveBatchSize && this.state.currentBatchSize !== undefined) {
this.state.currentBatchSize = Math.max(
Math.floor(this.state.currentBatchSize * 0.7),
this.config.minBatchSize || 10
);
}
}
/**
* Execute a request with automatic retry logic
*/
async executeWithRetry<T>(
requestFn: () => Promise<T>,
retryCount = 0
): Promise<T | null> {
try {
const startTime = Date.now();
const result = await requestFn();
const responseTime = Date.now() - startTime;
this.recordSuccess(responseTime);
return result;
} catch (error) {
console.warn(`Request failed (attempt ${retryCount + 1}):`, error);
if (retryCount < this.config.maxRetries) {
this.recordFailure();
await this.waitForNext();
return this.executeWithRetry(requestFn, retryCount + 1);
}
this.recordFailure();
return null;
}
}
/**
* Get current state for persistence
*/
getState(): RateLimiterState {
return { ...this.state };
}
/**
* Update state from persisted data
*/
setState(state: Partial<RateLimiterState>): void {
this.state = { ...this.state, ...state };
}
/**
* Get current batch size (if adaptive batching is enabled)
*/
getCurrentBatchSize(): number {
return this.state.currentBatchSize || this.config.baseBatchSize || 50;
}
/**
* Get current delay
*/
getCurrentDelay(): number {
return this.state.currentDelay;
}
/**
* Get failure count
*/
getFailureCount(): number {
return this.state.failedRequests;
}
private calculateAdaptiveDelay(responseTime: number): number {
const { currentDelay, failedRequests, lastSuccessTime } = this.state;
const timeSinceLastSuccess = Date.now() - lastSuccessTime;
// Increase delay if we're seeing failures or slow responses
if (failedRequests > 0 || responseTime > 2000) {
return Math.min(currentDelay * this.config.backoffMultiplier, this.config.maxDelay);
}
// Decrease delay if we're doing well and it's been a while since last success
if (responseTime < 500 && timeSinceLastSuccess > 10000) {
return Math.max(currentDelay * 0.8, this.config.minDelay);
}
return currentDelay;
}
private calculateAdaptiveBatchSize(responseTime: number): number {
if (!this.config.adaptiveBatchSize || this.state.currentBatchSize === undefined) {
return this.state.currentBatchSize || this.config.baseBatchSize || 50;
}
const { currentBatchSize, failedRequests } = this.state;
// Reduce batch size if we're seeing failures or slow responses
if (failedRequests > 2 || responseTime > 3000) {
return Math.max(
Math.floor(currentBatchSize * 0.7),
this.config.minBatchSize || 10
);
}
// Increase batch size if we're doing well
if (failedRequests === 0 && responseTime < 1000) {
return Math.min(
Math.floor(currentBatchSize * 1.2),
this.config.maxBatchSize || 100
);
}
return currentBatchSize;
}
}
/**
* Predefined rate limiter configurations for different job types
*/
export const RATE_LIMITER_PRESETS = {
MESSAGES: {
minDelay: 50,
maxDelay: 5000,
baseDelay: 200,
backoffMultiplier: 1.5,
maxRetries: 3,
adaptiveBatchSize: true,
minBatchSize: 10,
maxBatchSize: 100,
baseBatchSize: 50,
} as RateLimiterConfig,
NOTIFICATIONS: {
minDelay: 100,
maxDelay: 3000,
baseDelay: 150,
backoffMultiplier: 1.4,
maxRetries: 2,
adaptiveBatchSize: false,
} as RateLimiterConfig,
FORUMS: {
minDelay: 75,
maxDelay: 2000,
baseDelay: 100,
backoffMultiplier: 1.3,
maxRetries: 2,
adaptiveBatchSize: true,
minBatchSize: 5,
maxBatchSize: 50,
baseBatchSize: 25,
} as RateLimiterConfig,
SUBJECTS: {
minDelay: 50,
maxDelay: 1000,
baseDelay: 75,
backoffMultiplier: 1.2,
maxRetries: 1,
adaptiveBatchSize: false,
} as RateLimiterConfig,
};
-20
View File
@@ -1,20 +0,0 @@
import { getEngageRoutePage } from "@/seqta/utils/engageRoute";
import {
loadEngageHomePage,
updateEngageHomeMenuActive,
} from "@/seqta/utils/loaders/LoadEngageHomePage";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
let engageHashListenerAttached = false;
export function attachEngageHashListenerIfNeeded(): void {
if (!isSeqtaEngageExperience() || engageHashListenerAttached) return;
engageHashListenerAttached = true;
window.addEventListener("hashchange", () => {
if (getEngageRoutePage() === "home") {
void loadEngageHomePage();
} else {
updateEngageHomeMenuActive(false);
}
});
}
@@ -1,74 +0,0 @@
import stringToHTML from "../stringToHTML";
import { settingsState } from "../listeners/SettingsState";
import { openPopup } from "./PopupManager";
import { attachPopupMediaFullscreenIfPresent } from "./attachPopupMediaFullscreen";
const PRIVACY_STATEMENT_VERSION = "2025-12-19";
export function shouldShowPrivacyNotification(): boolean {
if (settingsState.privacyStatementShown) return false;
if (
settingsState.privacyStatementLastUpdated &&
new Date(settingsState.privacyStatementLastUpdated) >
new Date(PRIVACY_STATEMENT_VERSION)
) {
return false;
}
return true;
}
export function showPrivacyNotification(onDismissed?: () => void) {
if (document.getElementById("whatsnewbk")) {
onDismissed?.();
return;
}
if (!shouldShowPrivacyNotification()) {
onDismissed?.();
return;
}
const header = stringToHTML(
/* html */
`<div class="whatsnewHeader">
<h1>Privacy Statement</h1>
<p>Important Information</p>
</div>`,
).firstChild as HTMLElement;
const text = stringToHTML(/* html */ `
<div class="whatsnewTextContainer privacyStatement" style="overflow-y: auto; font-size: 1.2rem; line-height: 1.6;">
<img style="aspect-ratio: 16/5.8;" src="${settingsState.DarkMode ? "https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Plus/main/src/resources/branding/dark.jpg" : "https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Plus/main/src/resources/branding/light.jpg"}" class="aboutImg" />
<p>
<strong>Addressing Recent Concerns About BetterSEQTA+</strong><br>
We appreciate the feedback we've received from several schools regarding BetterSEQTA+. Transparency and trust are core to our mission, and we want to address these concerns directly.
</p>
<p>
<strong>Our Commitment to Privacy:</strong><br>
<span style="display: block; margin-left: 1em;">
• We do not collect, store, or share any personal information<br>
• All data processing happens locally on your device<br>
• Our code is open source and available for review
</span>
</p>
<p>
<strong>What We're Doing:</strong><br>
We're willing to actively work with school administrators to ensure BetterSEQTA+ meets both student needs and institutional requirements. If your school has specific concerns, we encourage them to contact us at <a href="mailto:betterseqta.plus@gmail.com" style="color: inherit; text-decoration: underline;">betterseqta.plus@gmail.com</a> or via github at <a href="https://github.com/BetterSEQTA/BetterSEQTA-Plus" target="_blank" rel="noopener noreferrer" style="color: inherit; text-decoration: underline;">github.com/BetterSEQTA/BetterSEQTA-Plus</a>.
</p>
<p>
For complete details about our privacy practices, visit our <a href="https://betterseqta.org/privacy" target="_blank" rel="noopener noreferrer" style="color: inherit; text-decoration: underline;">privacy policy</a> or click the shield icon in settings.
</p>
</div>
`).firstChild as HTMLElement;
attachPopupMediaFullscreenIfPresent(text, "img.aboutImg");
openPopup({
header,
content: [text],
afterClose: () => {
settingsState.privacyStatementLastUpdated = "2025-12-20";
settingsState.privacyStatementShown = true;
onDismissed?.();
},
});
}