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.
This commit is contained in:
SethBurkart123
2026-06-28 10:45:45 +10:00
parent f4230e02b9
commit 7779edb063
52 changed files with 1965 additions and 3258 deletions
+1 -9
View File
@@ -1,8 +1,4 @@
/**
* Google Calendar OAuth — public client config (extension).
* Client secret and token exchange live on accounts.betterseqta.org.
* See docs/GOOGLE_CALENDAR_ACCOUNTS_CALLBACK.md
*/
/** Google Calendar OAuth — public client config. Token exchange is on accounts.betterseqta.org. */
const HARDCODED_GOOGLE_OAUTH_CLIENT_ID =
"270834969641-f6t7jtpu6j0cemse8updj3rkos7nl0hf.apps.googleusercontent.com";
@@ -15,9 +11,7 @@ export const GOOGLE_OAUTH_CLIENT_ID: string =
export const ACCOUNTS_BASE = "https://accounts.betterseqta.org";
/** Must match Google Console + accounts callback route exactly. */
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`;
@@ -28,9 +22,7 @@ export const GOOGLE_CALENDAR_API = "https://www.googleapis.com/calendar/v3";
export const BSPLUS_GOOGLE_CALENDAR_EVENT_PROP = "bsplusSeqtaKey";
/** Default weeks of timetable to sync forward (from start of current week). */
export const GOOGLE_CALENDAR_SYNC_WEEKS = 12;
export const GOOGLE_CALENDAR_SYNC_WEEKS_DEFAULT = GOOGLE_CALENDAR_SYNC_WEEKS;
export const GOOGLE_CALENDAR_SYNC_WEEKS_MIN = 1;
export const GOOGLE_CALENDAR_SYNC_WEEKS_MAX = 52;
+2 -10
View File
@@ -1,13 +1,8 @@
/**
* Outlook Calendar OAuth — public client config (extension).
* Client secret and token exchange live on accounts.betterseqta.org.
* See docs/OUTLOOK_CALENDAR_ACCOUNTS_CALLBACK.md
*/
/** 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 HARDCODED_OUTLOOK_OAUTH_CLIENT_ID = "0b55168c-916c-4323-8f67-b3dd30af3c9e";
const envClientId =
typeof __OUTLOOK_OAUTH_CLIENT_ID__ !== "undefined" ? __OUTLOOK_OAUTH_CLIENT_ID__ : "";
@@ -15,13 +10,10 @@ const envClientId =
export const OUTLOOK_OAUTH_CLIENT_ID: string =
envClientId.trim() || HARDCODED_OUTLOOK_OAUTH_CLIENT_ID.trim();
/** Must match Azure app registration + accounts callback route exactly. */
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`;
/** Delegated Graph scopes for create/update/delete calendar events. */
export const OUTLOOK_CALENDAR_SCOPE = "offline_access Calendars.ReadWrite User.Read";
export const OUTLOOK_AUTH_URL =