feat(stremio): instant mount, X-Api-Key auth, NZB by URL, cached flag#693
Open
javi11 wants to merge 1 commit into
Open
feat(stremio): instant mount, X-Api-Key auth, NZB by URL, cached flag#693javi11 wants to merge 1 commit into
javi11 wants to merge 1 commit into
Conversation
- Broadcast "streamable" event from ProgressBroadcaster as soon as storage path is written (before post-processing), allowing Stremio waiters to return playable stream URLs without waiting for status=Completed - Accept X-Api-Key header (raw API key) on POST /api/nzb/streams so AIOStreams can authenticate without computing the SHA256 download_key - Accept nzb_url form field to let callers pass an NZB download URL instead of uploading file bytes — removes an extra round-trip for AIOStreams and other integrations - Add _cached bool field to StremioStreamsResponse so AIOStreams can show an instant/lightning tag when the NZB was already processed - waitAndRespond and waitAndRedirectToStream now handle "streamable" events and also perform an upfront check for items already in processing state with a storage path set (covers the subscribe-after-event race)
Open
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes AltMount a first-class backend for AIOStreams (and any Stremio integration) by closing the latency gap between NZB submission and first playable frame.
Changes
Instant mount (A1 —
internal/importer/service.go,internal/progress/progress_broadcaster.go)ProgressBroadcasternow has aNotifyStreamable(queueID, storagePath)method that broadcasts a"streamable"event the momentStoragePathis written to the DB — before post-processing (symlinks, STRM files, health scheduling) and beforestatus=Completed.handleProcessingSuccessin the importer service calls this immediately afterAddStoragePath.Early stream return (A1 —
nzb_stremio_handlers.go,stremio_addon_handlers.go)waitAndRespond(native/api/nzb/streams) andwaitAndRedirectToStream(addon play path) both listen for"streamable"events and return/redirect immediately — no longer blocked onstatus=Completed.X-Api-Key header auth (A5 —
nzb_stremio_handlers.go)POST /api/nzb/streamsnow accepts the raw API key viaX-Api-Keyheader in addition to thedownload_keyform field (SHA256 hash). AIOStreams sendsaltmountApiKeyinX-Api-Key— this makes it work without any extra config on the AIOStreams side.NZB by URL (A5 —
nzb_stremio_handlers.go)nzb_urlform field: callers pass an NZB download URL instead of uploading file bytes, removing an extra HTTP round-trip._cachedflag (A5 —nzb_stremio_handlers.go)StremioStreamsResponsegains_cached: bool. Set totruewhen streams are served from an already-completed queue item. AIOStreams can use this to show a lightning/instant badge without probing WebDAV.Test plan
POST /api/nzb/streamswithX-Api-Keyheader → confirm response arrives beforestatus=Completed(streamable stage) and_cached=false_cached=true, response is instantnzb_urlfield: pass an NZB download URL instead of file upload → same resultGET /stremio/:key/play): confirm 302 redirect fires at streamable stage, not at completedgo test ./internal/api/... ./internal/importer/... ./internal/progress/...passes