diff --git a/CODE-AUDIT.md b/CODE-AUDIT.md index 7a74d70..2cc9f2a 100644 --- a/CODE-AUDIT.md +++ b/CODE-AUDIT.md @@ -483,7 +483,7 @@ token system + shared primitives (UI/SIMP — high value, larger effort) · i18n - [ ] **L52 — Installer handoff is a fixed `setTimeout(app.quit, 1500)`** (updater.ts) — a race on slow machines. - [x] **L53 — `dialog.show*Dialog(win!, …)` non-null assertions** on a possibly-null window (chooseFolder, backup export/import) — can throw if the sender window is gone. -- [ ] **L54 — DownloadBar preview `` has no `onError` fallback** (inconsistent with `MediaThumb`'s retry). +- [x] **L54 — DownloadBar preview `` has no `onError` fallback** (inconsistent with `MediaThumb`'s retry). - [x] **L55 — QueueItem meta line can show size twice** — a probed-format `quality` label already contains the size, then `sizeLabel` is appended again. - [ ] **L56 — SponsorBlock ON with zero categories silently no-ops** (`buildArgs` guards on @@ -494,10 +494,10 @@ token system + shared primitives (UI/SIMP — high value, larger effort) · i18n - [x] **L59 — `THEME_BACKGROUND` (index.ts) duplicates `pageBackground` (theme.ts)** — two hand-synced color constants (a "keep in sync" comment guards them). - [x] **L60 — `'external-url'` channel name lacks the `category:` prefix** every other IPC channel uses. -- [ ] **L61 — `taskbarProgress` is the lone `ipcMain.on`** (fire-and-forget) amid all-`invoke` channels. +- [x] **L61 — `taskbarProgress` is the lone `ipcMain.on`** (fire-and-forget) amid all-`invoke` channels. - [ ] **L62 — "Best available" synthetic format hardcodes `ext:'mp4'`/`hasAudio:true`** (probe.ts) — mislabels when the chosen container is mkv/webm. -- [ ] **L63 — `audioQuality()` unknown label → silent `'0'` (best)** — the audio analog of H5. +- [x] **L63 — `audioQuality()` unknown label → silent `'0'` (best)** — the audio analog of H5. - [ ] **L64 — `ARIA2C_ARGS` connection params hardcoded** (`-x16 -s16 -k1M`), no user control. - [ ] **L65 — Pause uses `taskkill /F`** like cancel — a forced kill risks an unflushed `.part` tail vs a graceful stop. - [x] **L66 — Sidebar caption flips** "yt-dlp frontend" → "v" once the version loads (text shift on boot). diff --git a/src/main/buildArgs.ts b/src/main/buildArgs.ts index 653e76d..76ee4db 100644 --- a/src/main/buildArgs.ts +++ b/src/main/buildArgs.ts @@ -55,8 +55,11 @@ function audioQuality(quality: string): string { return '192K' case '128 kbps': return '128K' + case 'Best': + return '0' default: - return '0' // Best + // Unrecognised label — fall back to best (0) so the download still works. + return '0' } } diff --git a/src/main/index.ts b/src/main/index.ts index b26ed97..73e2708 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -427,8 +427,8 @@ function registerIpcHandlers(): void { ipcMain.handle(IpcChannels.scheduledSyncGet, () => getScheduledSync()) ipcMain.handle(IpcChannels.scheduledSyncSet, (_e, enabled: boolean) => setScheduledSync(enabled)) - // Reflect overall queue progress on the Windows taskbar (fire-and-forget). - ipcMain.on(IpcChannels.taskbarProgress, (_e, p: TaskbarProgress) => { + // Reflect overall queue progress on the Windows taskbar. + ipcMain.handle(IpcChannels.taskbarProgress, (_e, p: TaskbarProgress) => { if (!mainWindow || mainWindow.isDestroyed()) return if (p.mode === 'none') { mainWindow.setProgressBar(-1) diff --git a/src/preload/index.ts b/src/preload/index.ts index 2108c02..7655631 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -223,9 +223,9 @@ const api = { return () => ipcRenderer.removeListener(IpcChannels.terminalOutput, listener) }, - /** Reflect overall queue progress on the Windows taskbar (fire-and-forget). */ - setTaskbarProgress: (p: TaskbarProgress): void => - ipcRenderer.send(IpcChannels.taskbarProgress, p), + /** Reflect overall queue progress on the Windows taskbar. */ + setTaskbarProgress: (p: TaskbarProgress): Promise => + ipcRenderer.invoke(IpcChannels.taskbarProgress, p), /** Open a YouTube WebView to automatically extract a PO token (Phase P). */ mintPoToken: (): Promise => diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 5b79507..26a32d3 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -69,7 +69,11 @@ function App(): React.JSX.Element { lastFraction = s.progress lastMode = mode lastBadge = s.downloading - window.api?.setTaskbarProgress?.({ fraction: s.progress, mode, badgeCount: s.downloading }) + void window.api?.setTaskbarProgress?.({ + fraction: s.progress, + mode, + badgeCount: s.downloading + }) } push(useDownloads.getState().items) return useDownloads.subscribe((st) => push(st.items)) diff --git a/src/renderer/src/components/DownloadBar.tsx b/src/renderer/src/components/DownloadBar.tsx index 19b53e3..edb0a64 100644 --- a/src/renderer/src/components/DownloadBar.tsx +++ b/src/renderer/src/components/DownloadBar.tsx @@ -327,6 +327,7 @@ export function DownloadBar(): React.JSX.Element { // Probe state for the single-video format picker. const [info, setInfo] = useState(null) + const [thumbFailed, setThumbFailed] = useState(null) const [probing, setProbing] = useState(false) const [probeError, setProbeError] = useState(null) const [formatId, setFormatId] = useState('') @@ -627,8 +628,13 @@ export function DownloadBar(): React.JSX.Element { {info && (
- {info.thumbnail ? ( - + {info.thumbnail && thumbFailed !== info.thumbnail ? ( + setThumbFailed(info.thumbnail ?? null)} + /> ) : (
{kind === 'audio' ? ( diff --git a/src/renderer/src/main.tsx b/src/renderer/src/main.tsx index d90be6e..9322c61 100644 --- a/src/renderer/src/main.tsx +++ b/src/renderer/src/main.tsx @@ -269,7 +269,7 @@ if (import.meta.env.DEV && !window.api) { runTerminal: async () => ({ ok: true }), cancelTerminal: async () => {}, onTerminalOutput: () => () => {}, - setTaskbarProgress: () => {}, + setTaskbarProgress: async () => {}, mintPoToken: async () => null } }