feat: Update API versioning and parser handling for improved schedule updates and error management

This commit is contained in:
2026-10-19 23:29:35 +03:00
parent 85c5baa3e5
commit 68f9b95090
10 changed files with 32 additions and 18 deletions

View File

@@ -61,8 +61,6 @@ import {
subgroupsOf,
} from "../shared/lessons";
import qrcode from "qrcode-generator";
/** Matches PARSER_VERSION on the server: older saved schedules are re-read once. */
const SCHEMA_VERSION = 7;
const SOURCE =
"https://nextcloud.psu.by/index.php/s/no5zKbMrns6j5jQ?dir=/2026-2027";
const DAYS = [
@@ -710,10 +708,8 @@ export default function App() {
lastCheck.current = Date.now();
const c = known === undefined ? await loadCatalog() : known;
if (!c || !schedule) return;
const found = scheduleUpdate(schedule, c, group, {
dismissed: readDismissed(),
schemaVersion: SCHEMA_VERSION,
});
// A schedule read by an older parser than the server's (c.parserVersion) is re-read once.
const found = scheduleUpdate(schedule, c, group, { dismissed: readDismissed() });
if (!found) return setUpdate(null);
// activate() reports what changed for the group.
if (found.changed) await loadFile(found.changed, false, group);

View File

@@ -61,4 +61,6 @@ export interface Catalog {
year: string;
currentYear?: boolean;
expectedYear?: string;
/** The server's parser: saved schedules read by an older one are re-read (API 10+). */
parserVersion?: number;
}