Skip to content

feat(strm): one-click STRM generation (progress-tracked task + admin endpoint) - #9556

Open
okatu-loli wants to merge 7 commits into
AlistGo:mainfrom
okatu-loli:feat/strm-generate-button
Open

feat(strm): one-click STRM generation (progress-tracked task + admin endpoint)#9556
okatu-loli wants to merge 7 commits into
AlistGo:mainfrom
okatu-loli:feat/strm-generate-button

Conversation

@okatu-loli

Copy link
Copy Markdown
Collaborator

What

Adds one-click STRM generation to the Strm driver: an explicit, progress-tracked, repeatable action that walks a mount (or any subdirectory) and writes .strm/local files to disk — instead of relying only on lazy generation during directory browsing.

Changes

  • GenerateLocal (two-phase, progress) — refactors the tree walk into a reusable, cancellable, two-phase implementation: phase 1 scans via fs.List to count units, phase 2 writes files and reports progress. Exposed through a new internal/driver.StrmGenerator interface to avoid an import cycle (internal/fs → driver package).
  • StrmGenerateTask + manager — a non-persisted tache task (3 workers) registered in bootstrap; resolves the Strm driver by mount path via type assertion and calls GenerateLocal with SetProgress.
  • Admin endpoint POST /api/admin/strm/generate { path } — validates the target is a Strm storage with SaveStrmLocalPath configured, enqueues the task, returns the task id for progress polling.
  • rotateAllLocal unified with the same walk (drops the duplicate walkAndSync); cancellation supported via context.

Notes

  • Admin-only (writes to server local disk). Works even if SaveStrmToLocal is off, since it's an explicit action.
  • Override mode uses the storage's configured SaveLocalMode (insert/update/sync).
  • Sign handling is unchanged — .strm lines go through the same buildStrmLine/generateSign path; ?sign= is appended iff the storage's WithSign is enabled.
  • Frontend (button + inline progress + task center) is in a companion alist-web PR.

…nterface

Introduces driver.StrmGenerator interface in internal/driver/strm.go so
internal/fs can call GenerateLocal without importing the driver package.
Adds resolveStarts/collectUnits/generateUnits helpers and the GenerateLocal
method on *Strm; moves the SaveStrmToLocal toggle guard out of
syncLocalDirWithMode (into syncLocalDir only) so manual generation works
when the toggle is off as long as SaveStrmLocalPath is set.
skysliences
skysliences previously approved these changes Jun 19, 2026
JoaHuang
JoaHuang previously approved these changes Jul 10, 2026
The conflict is in rotateAllLocal: this branch replaced it with the
two-phase generate walk and dropped walkAndSync, while main added
NoUpdateIndex to every strm listing in AlistGo#9563 — including the copy inside
walkAndSync that this branch deletes.

Keep the refactored walk and carry the fix over to collectUnits, so
generating and rotating STRM files still avoids auto-indexing the
underlying storage.
@okatu-loli
okatu-loli dismissed stale reviews from JoaHuang and skysliences via 9da6bba August 5, 2026 01:30
skysliences
skysliences previously approved these changes Aug 5, 2026
JoaHuang
JoaHuang previously approved these changes Aug 5, 2026
@okatu-loli
okatu-loli dismissed stale reviews from JoaHuang and skysliences via d061a5a August 5, 2026 02:05
@okatu-loli
okatu-loli force-pushed the feat/strm-generate-button branch from d061a5a to fd71e6e Compare August 5, 2026 02:10
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.

3 participants