Skip to content

Syncthing#558

Open
IrosTheBeggar wants to merge 3 commits intomasterfrom
syncthing
Open

Syncthing#558
IrosTheBeggar wants to merge 3 commits intomasterfrom
syncthing

Conversation

@IrosTheBeggar
Copy link
Copy Markdown
Owner

No description provided.

IrosTheBeggar added a commit that referenced this pull request Apr 25, 2026
Three small modernizations from PR #558 (the syncthing/electron PR), pulled
out so they can land independent of the Electron Desktop Player work.

* src/api/scrobbler.js — POST /api/v1/lastfm/test-login was the last
  caller of axios. Switched to native fetch (Node ≥22), drop the dep.
* src/logger.js — was using winston-daily-rotate-file for log rotation.
  Replaced with a small in-process rotator that opens a fresh file every
  hour and prunes anything older than 14 days.
* src/api/file-explorer.js — `makeDirectorySync` from `make-dir` was the
  only caller; native `fs.mkdirSync(p, { recursive: true })` covers the
  same use. Also tightened the playlist-resolver loop and added a
  `skipped` count to the response so clients can see when entries were
  filtered for traversal.
IrosTheBeggar added a commit that referenced this pull request Apr 25, 2026
Lifts the scan-progress refactor out of PR #558 (syncthing/electron) so
the player UI can show live scan progress on a default-UI install today,
without waiting for the Desktop Player feature to ship.

Three problems with the old flow:

  1. The scan_progress table was readable only via /api/v1/admin/db/scan/
     progress, mounted in velvet-stubs.js and gated under /admin/. On a
     default-UI install the endpoint didn't exist (velvet-stubs only loaded
     when ui='velvet'), and even on velvet, non-admin users couldn't reach it.
  2. The default UI's player polled /api/v1/db/status (coarse boolean lock +
     total file count) and only set up its 2s interval AFTER seeing
     locked=true once. A scan triggered after page-load went invisible until
     the next refresh.
  3. The renderer only knew how to write 'Scan In Progress' + a count to a
     pair of divs. No per-vpath progress, no current-file display.

Changes:

* src/api/scan.js (NEW) — GET /api/v1/scan/progress. Authenticated but
  not admin-only. Filters rows to vpaths the caller can see; admins also
  see pre-vpath 'counting' rows where the scanner hasn't assigned a
  library yet. currentFile is stripped to basename so absolute server
  paths don't leak.
* src/api/velvet-stubs.js — drop the old /api/v1/admin/db/scan/progress;
  one comment in its place pointing at the new endpoint.
* src/server.js — mount scanApi alongside the other core APIs (always
  loaded, regardless of ui setting).
* webapp/alpha/scan-progress.js (NEW) — polls every 3s unconditionally.
  Empty response → empty wrap → no visible UI when idle. Renders a
  per-vpath card with vpath name, progress bar, percent, scanned/expected
  counts, and current-file as the title attribute.
* webapp/alpha/spa.css — .spc-* rules for the cards (palette adapted to
  the main UI's colors; the velvet variables aren't defined here).
* webapp/index.html — replaces the legacy <div id='scan-status'> +
  <div id='scan-status-files'> with <div id='scan-progress-wrap'>; loads
  the new scan-progress.js script.
* webapp/alpha/m.js — removes the old async dbStatus() + its caller +
  the unused startInterval. The function wrote to the now-removed
  scan-status DOM ids and would have thrown on every page load.

MSTREAMAPI.dbStatus and the GET /api/v1/db/status endpoint are left in
place — both are public surface and may have external callers.
IrosTheBeggar added a commit that referenced this pull request Apr 25, 2026
scan progress: core API + UI poller (extracted from #558)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant