feat(audit): L51 + L64 — daily-sync time picker + aria2c connection tuning
Two small self-contained features from the audit's deferred list: - L51: the Task Scheduler daily sync is no longer pinned to 09:00. New Settings.syncTime (24h HH:MM) with a native time input beside the Library "Daily sync" switch — persists on change, re-registers the task on blur (schtasks /Create /F overwrite is the time-change mechanism). The value reaches the schtasks /ST argv, so a shared isValidSyncTime guards it at both the settings write and in schedule.ts (unit-tested incl. injection-shaped input). Live-verified against the machine's real task. - L64: aria2c connection count (-x/-s) is user-tunable. New Settings.aria2cConnections (1-16, aria2c's own ceiling) exposed as a SpinButton in Settings -> Network while the aria2c toggle is on. ARIA2C_ARGS became the pure aria2cArgs(n?) with a defensive clamp; threaded through AccessOptions. The -k 1M split floor stays fixed — a free-text field would bypass the custom-command consent gate. typecheck + 309 tests + eslint + production build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -319,6 +319,15 @@ export function isYtdlpUpdateChannel(v: unknown): v is YtdlpUpdateChannel {
|
||||
return typeof v === 'string' && (YTDLP_UPDATE_CHANNELS as readonly string[]).includes(v)
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime guard for a 24h 'HH:MM' sync time crossing the IPC boundary (L51) —
|
||||
* the value reaches `schtasks /ST`, so anything malformed must never be forwarded.
|
||||
* Shared so main's settings validation and schedule.ts use one definition.
|
||||
*/
|
||||
export function isValidSyncTime(v: unknown): v is string {
|
||||
return typeof v === 'string' && /^([01]\d|2[0-3]):[0-5]\d$/.test(v)
|
||||
}
|
||||
|
||||
export interface YtdlpUpdateResult {
|
||||
ok: boolean
|
||||
/** yt-dlp's own update output, e.g. "Updated to ... " or "yt-dlp is up to date" */
|
||||
@@ -570,6 +579,8 @@ export interface Settings {
|
||||
rateLimit: string
|
||||
/** use bundled aria2c (resources/bin/aria2c.exe) as the external downloader */
|
||||
useAria2c: boolean
|
||||
/** aria2c parallel connections per download (-x/-s), 1–16; only used when useAria2c is on (L64) */
|
||||
aria2cConnections: number
|
||||
/** where auth cookies come from: none, a browser's store, or the sign-in window */
|
||||
cookieSource: CookieSource
|
||||
/** which browser to read cookies from when cookieSource is 'browser' */
|
||||
@@ -603,6 +614,8 @@ export interface Settings {
|
||||
notifyOnComplete: boolean
|
||||
/** auto-enqueue newly-found videos from watched sources during a sync (Phase J) */
|
||||
autoDownloadNew: boolean
|
||||
/** daily watched-source sync start time, 24h 'HH:MM' (Task Scheduler /ST) (L51) */
|
||||
syncTime: string
|
||||
/** false until the first-run welcome screen has been dismissed */
|
||||
hasCompletedOnboarding: boolean
|
||||
/** keep AeroFetch running in the system tray when its window is closed (Phase O) */
|
||||
@@ -650,6 +663,7 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||
proxy: '',
|
||||
rateLimit: '',
|
||||
useAria2c: false,
|
||||
aria2cConnections: 16,
|
||||
cookieSource: 'none',
|
||||
cookiesBrowser: 'chrome',
|
||||
youtubePlayerClient: '',
|
||||
@@ -670,6 +684,7 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||
// Default off so adding a watched channel doesn't silently fill the user's
|
||||
// disk on first use (SR3). Enable explicitly once they know what it does.
|
||||
autoDownloadNew: false,
|
||||
syncTime: '09:00',
|
||||
hasCompletedOnboarding: false,
|
||||
minimizeToTray: false,
|
||||
launchAtStartup: false,
|
||||
|
||||
Reference in New Issue
Block a user