// THE /cookies CONTROLS' SHAPES — client-safe (the board imports // `sectionFailed`); the server read is cookieControls.ts. import type { XSessionStatus } from "yt-dlp-transcript-common/social/xSessionBroker"; import type { XCookieSourceView, XPostsVisibility } from "yt-dlp-transcript-common/social/xCookieSource"; import type { ArchiveSessionStatus } from "yt-dlp-transcript-common/lib/archives/archiveTodaySession"; import type { ArchivesSettings } from "yt-dlp-transcript-common/lib/archives/settings"; import type { ForumSessionStatus } from "yt-dlp-transcript-common/social/forumSession"; // A section whose read failed carries its error instead of its data: the // page draws that one section's sentence, never a failed page. export type SectionRead = T | { error: string }; export function sectionFailed(v: SectionRead): v is { error: string } { return "error" in v && typeof (v as { error?: unknown }).error === "string"; } export type XControls = { initial: XSessionStatus; initialSource: XCookieSourceView; initialVisibility: XPostsVisibility; initialMaxCookieAge: number; // X in sittings (lib/xSitting.ts): jobs per refresh, the gap's range (min). initialPacing?: { sittingJobs: number; gapMinMinutes: number; gapMaxMinutes: number }; }; export type ArchiveControls = { initial: ArchivesSettings; session: ArchiveSessionStatus }; export type YtdlpControls = { cookiesFromBrowser: string; cookieMode: string }; // Per forum host (its service key): the session, and its thread channels. export type ForumControls = Record; export type CookieControls = { x: SectionRead; archive: SectionRead; ytdlp: SectionRead; forums: SectionRead; };