Background running for downloads/auto-download, library clipboard detect, updater auth #7

Merged
debont80 merged 2 commits from feat/tray-background-clipboard into main 2026-06-29 10:17:50 -04:00
Collaborator

Three things, branched from current main:

1. Closing the window no longer kills downloads

  • The close handler now hides to the tray (instead of quitting) whenever a download is in flight -- even with "Keep running in the tray" off -- so the spawned yt-dlp processes survive. A one-time notification explains it is still running. (download.ts exposes hasActiveDownloads().)
  • Fix: tray.ts falls back to an embedded icon when no build/icon.ico ships. Previously an empty icon meant the tray was skipped entirely, so a minimized window could be stranded with no way back.
  • New "Start with Windows" setting (launchAtStartup -> app.setLoginItemSettings), synced at startup and on toggle -- useful with auto-download so watched channels stay current in the background.

2. Library copied-link detection

  • Extracted the downloads tab clipboard watcher into a shared useClipboardLink hook and used it in the library add-source field, so a copied channel/playlist link is offered there too.

3. Updater works on a sign-in-required / private instance

  • Added an optional updateToken setting. When set, it is sent as a Gitea Authorization header on the release check, checksum fetch, and installer download -- fixing the "could not reach the update server" case where anonymous access is blocked. Blank = anonymous (unchanged). The token is only ever sent to the host-pinned update host, never shipped. Settings gains a masked "Update access token" field.

Typecheck clean; 187 tests pass; electron-vite build clean. UI verified in the browser preview.

Three things, branched from current main: ### 1. Closing the window no longer kills downloads - The close handler now hides to the tray (instead of quitting) whenever a download is in flight -- even with "Keep running in the tray" off -- so the spawned yt-dlp processes survive. A one-time notification explains it is still running. (download.ts exposes hasActiveDownloads().) - Fix: tray.ts falls back to an embedded icon when no build/icon.ico ships. Previously an empty icon meant the tray was skipped entirely, so a minimized window could be stranded with no way back. - New "Start with Windows" setting (launchAtStartup -> app.setLoginItemSettings), synced at startup and on toggle -- useful with auto-download so watched channels stay current in the background. ### 2. Library copied-link detection - Extracted the downloads tab clipboard watcher into a shared useClipboardLink hook and used it in the library add-source field, so a copied channel/playlist link is offered there too. ### 3. Updater works on a sign-in-required / private instance - Added an optional updateToken setting. When set, it is sent as a Gitea Authorization header on the release check, checksum fetch, and installer download -- fixing the "could not reach the update server" case where anonymous access is blocked. Blank = anonymous (unchanged). The token is only ever sent to the host-pinned update host, never shipped. Settings gains a masked "Update access token" field. Typecheck clean; 187 tests pass; electron-vite build clean. UI verified in the browser preview.
wayne added 1 commit 2026-06-28 12:24:09 -04:00
Closing the window no longer kills in-progress downloads, the library gains the
same copied-link suggestion the downloads tab has, and the in-app updater can now
authenticate to a sign-in-required Gitea.

Background / tray:
- The window's close handler now hides to the tray (instead of quitting) whenever
  a download is in flight, even if "Keep running in the tray" is off — quitting
  was killing the spawned yt-dlp processes. A one-time notification explains the
  app is still running. (download.ts exposes hasActiveDownloads().)
- tray.ts now falls back to an embedded icon when no build/icon.ico ships, so the
  tray actually appears — previously an empty icon meant the tray was skipped and
  a minimized window could be stranded with no way back.
- New "Start with Windows" setting (launchAtStartup) wired to
  app.setLoginItemSettings, synced at startup and on toggle. Useful with
  auto-download so watched channels stay current in the background.
- The "Keep running in the tray" hint now explains it also enables background
  auto-download of new uploads.

Library clipboard detection:
- Extracted the downloads tab's clipboard watcher into a shared useClipboardLink
  hook and used it in the library's add-source field, so a copied channel/playlist
  link is offered there too.

Updater fix (works on a private / sign-in-required instance):
- Added an optional updateToken setting. When set, the updater sends it as a Gitea
  Authorization header on the release check, the checksum fetch, and the installer
  download — so "Check for updates" works where anonymous access is blocked (the
  previous "could not reach the update server" case). Blank = anonymous, unchanged.
  No token is ever shipped; it's only ever sent to the host-pinned update host.
  Settings gains a masked "Update access token" field.

Typecheck clean; 187 tests pass; electron-vite build clean. New UI verified in the
browser preview (tray/startup toggles, token field, library copied-link banner).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
debont80 added 1 commit 2026-06-29 10:16:26 -04:00
Encrypt proxy / youtubePoToken / updateToken on disk via safeStorage (DPAPI on Windows), with a one-time launch migration for legacy plaintext. Decrypted before reaching callers/renderer; backup export still writes clear, as documented. Harden updater token handling to refuse cross-origin redirects on the authenticated REST check.

Extract the clipboard-link logic from DownloadBar into the shared useClipboardLink hook: add an optional filter (library skips single-video links), an offer() for external aerofetch:// / .url links, and a source field driving banner wording. Add looksLikeSingleVideo plus its unit tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
debont80 merged commit d112bc4878 into main 2026-06-29 10:17:50 -04:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: debont80/AeroFetch#7