Commit graph

48 commits

Author SHA1 Message Date
KhooLy
4257de53b7 Test telemetry session state machine
Some checks failed
CI / test (push) Has been cancelled
CI / clippy (push) Has been cancelled
CI / bench-check (push) Has been cancelled
CI / wasm-check (push) Has been cancelled
CI / feature-check (desktop) (push) Has been cancelled
CI / feature-check (streaming-shared) (push) Has been cancelled
CI / feature-check (uniffi-bindings) (push) Has been cancelled
CI / android-check (push) Has been cancelled
CI / dependency-audit (push) Has been cancelled
CI / fuzz-smoke (push) Has been cancelled
CI / fmt (push) Has been cancelled
2026-08-01 21:22:41 +03:00
KhooLy
ba39d577d2 Harden telemetry and plugin URL validation 2026-08-01 21:09:47 +03:00
KhooLy
46ad60811e harden core boundaries and scheduling 2026-08-01 19:56:23 +03:00
KhooLy
ce8822aded style: apply safe clippy suggestions 2026-08-01 19:32:50 +03:00
KhooLy
712003f12b fix: order torrent telemetry by generation 2026-08-01 19:26:09 +03:00
KhooLy
15e37b67e7 fix: isolate torrent telemetry sessions 2026-08-01 19:13:26 +03:00
KhooLy
d33fd06fc9 chore: consolidate production hardening updates 2026-08-01 18:53:26 +03:00
KhooLy
6b885bd078 Fix torrent playback cancellation races 2026-08-01 17:49:41 +03:00
KhooLy
499f1556ca Test torrent probe scheduling
Some checks are pending
CI / test (push) Waiting to run
CI / clippy (push) Waiting to run
CI / bench-check (push) Waiting to run
CI / wasm-check (push) Waiting to run
CI / fmt (push) Waiting to run
2026-08-01 16:26:32 +03:00
KhooLy
5d6f8c9f1a Ignore distant torrent probe ranges 2026-08-01 16:25:57 +03:00
KhooLy
b3bd25fc42 Wake cancelled torrent streams promptly 2026-08-01 16:24:57 +03:00
KhooLy
882acbcf1b Fix adaptive streaming lifecycle and buffer metrics 2026-08-01 16:23:52 +03:00
KhooLy
0194e28786 Run local proxy accept loops on Tokio 2026-08-01 16:07:34 +03:00
KhooLy
d63a3e3628 Add adaptive torrent streaming scheduler 2026-08-01 16:03:48 +03:00
KhooLy
f5d20bebe7 Serialize failed torrent retries 2026-08-01 15:29:26 +03:00
KhooLy
79b982e543 Fix torrent subtitle focus 2026-08-01 15:24:14 +03:00
KhooLy
c9901cbbe4 Harden torrent engine lifecycle 2026-08-01 15:08:42 +03:00
KhooLy
b754d619c6 fix(core): fix edition-2024 unsafe-attribute compile errors and rquickjs bindgen gap on Apple-only code paths 2026-07-28 15:59:35 +03:00
KhooLy
13d5d623be style: reformat for Rust 2024 edition rustfmt defaults
Some checks are pending
CI / test (push) Waiting to run
CI / clippy (push) Waiting to run
CI / bench-check (push) Waiting to run
CI / wasm-check (push) Waiting to run
CI / fmt (push) Waiting to run
2026-07-28 15:39:27 +03:00
KhooLy
ec8c2335a4 chore: bump to Rust edition 2024, update GitHub Actions to latest majors 2026-07-28 15:21:41 +03:00
KhooLy
8d78c5448c fix(streaming-engine): don't evict the active video file when prioritizing a sibling file
Some checks are pending
CI / test (push) Waiting to run
CI / clippy (push) Waiting to run
CI / bench-check (push) Waiting to run
CI / wasm-check (push) Waiting to run
CI / fmt (push) Waiting to run
prioritize_stream_file() replaced the torrent's only_files set instead
of adding to it, so fetching any other file (e.g. a subtitle sibling
served through the same /stream/fname endpoint) deprioritized the
video that was already streaming. Track prioritized files as a set per
torrent and union new requests into it instead of overwriting.
2026-07-27 16:18:24 +03:00
KhooLy
669f36f259 Refine library history and recommendation requests
Some checks are pending
CI / test (push) Waiting to run
CI / clippy (push) Waiting to run
CI / bench-check (push) Waiting to run
CI / wasm-check (push) Waiting to run
CI / fmt (push) Waiting to run
2026-07-26 03:14:04 +03:00
KhooLy
1fab5d27c2 chore: format core sources
Some checks failed
CI / test (push) Has been cancelled
CI / clippy (push) Has been cancelled
CI / bench-check (push) Has been cancelled
CI / wasm-check (push) Has been cancelled
CI / fmt (push) Has been cancelled
2026-07-22 20:36:55 +03:00
KhooLy
4e787268b8 refactor: split core and streaming engine modules 2026-07-22 18:46:54 +03:00
KhooLy
6c4744333d Follow SeekHead to locate MKV Chapters past the first Cluster
The chapter reader assumed Chapters always sits before the first
Cluster within a small prefix, but releases with sizeable embedded
attachments (fonts, etc.) can push Chapters well past that — one
observed case had it at ~10MB in, past the first Cluster entirely, so
the existing scan (which stops at the first Cluster) found nothing.

MKV's SeekHead element is always compact and near the file start and
routinely carries an entry pointing straight at Chapters. Have
scan_segment also record that offset when Chapters isn't found
directly, expose it via parse_mkv_chapters_json's new seekOffset field,
and add parse_mkv_chapters_at_offset_json to parse a buffer fetched
starting exactly at that offset. This also means the initial scan no
longer needs a multi-megabyte prefix to work reliably.
2026-07-19 03:02:05 +03:00
KhooLy
f0d77c8b61 Apply cargo fmt across accumulated unformatted files
Some checks failed
CI / test (push) Has been cancelled
CI / clippy (push) Has been cancelled
CI / bench-check (push) Has been cancelled
CI / wasm-check (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI's fmt check was failing on formatting debt that had built up across
several commits merged from agent/apple-streaming-engine.
2026-07-15 20:08:18 +03:00
KhooLy
5fb1c08afd Add Apple streaming engine bridge 2026-07-14 18:13:54 +03:00
KhooLy
31556a62cb Refine sync and streaming boundaries 2026-07-12 02:47:09 +03:00
KhooLy
b9b690f135 Improve torrent streaming and playback matching 2026-07-12 01:24:11 +03:00
KhooLy
5834189d90 Fix inverted released_only filter in next-episode resolution
resolve_next_episode_json's released_only flag was backwards
(released_only || is_episode_released instead of !released_only ||
...), so the "raw next episode" and "released-only next episode"
call sites got each other's behavior. Also add debug timing around
torrent server teardown/bootstrap to help diagnose slow episode
transitions.
2026-07-11 04:19:30 +03:00
KhooLy
05b60e1da4 Avoid repeated torrent file prioritization 2026-07-10 19:41:35 +03:00
KhooLy
c1ef70c9e2 Scope readiness-poll torrent adds to the requested file
The stat-polling "get" action registered a magnet without narrowing
rqbit's only_files to the target index, so progress/readiness could be
driven by unrelated files in the torrent. That let isPlayableEnough
report true before the actual file had any data, handing mpv a stream
URL that wasn't ready yet (Sentry RUST-4). Also re-scope on repeat
lookups of an already-known link so switching files on a shared magnet
(season packs) doesn't keep the first file's scope.
2026-07-10 17:25:20 +03:00
KhooLy
e6d7ad75f6 Serve higher-resolution YouTube trailers via HLS variants and adaptive audio pairing
YouTube's muxed mp4 formats cap out around 720p. Prefer, in order:
the highest-resolution muxed-audio HLS variant from the master
playlist, then the best adaptive video paired with the best adaptive
audio track (returned as a separate audioUrl), then falling back to
muxed mp4 as before. try_all_clients now keeps the best adaptive/muxed
fallback seen across client contexts instead of returning on first
success, since an earlier client can return a worse stream than a
later one.

Pairs with the audio-track sync already added to the desktop hero
trailer player, which was waiting on a resolvedTrailer.audioUrl this
enables.
2026-07-09 21:29:15 +03:00
KhooLy
58266b32e7 chore: format Rust sources 2026-07-08 15:04:56 +03:00
KhooLy
9391b49c99 Expose prewarm_youtube_watch_config for early visitor_data scraping
Companion to the desktop-side prewarm call: lets the frontend trigger
the one-time YouTube watch-page scrape in the background as soon as
Home mounts, instead of paying that cost inline on the first real
trailer resolution.
2026-07-08 14:59:09 +03:00
KhooLy
f7aa810ed8 Scrape YouTube visitor_data and add ANDROID_VR client for higher-res trailers
Without a visitor_data header, YouTube strips the url/cipher from every
adaptive format and only serves the lowest-quality progressive stream
(itag 18, ~360p). Fetch a real watch page once (cached, 3h TTL) to grab
INNERTUBE_API_KEY/VISITOR_DATA and send it as X-Goog-Visitor-Id, and add
the ANDROID_VR client ahead of ANDROID/IOS, matching the approach used by
other Stremio-ecosystem clients (Nuvio) to unlock full adaptive quality.
2026-07-08 13:58:09 +03:00
KhooLy
5d57fde599 chore: format Rust sources 2026-07-07 22:46:39 +03:00
KhooLy
7964ec45ef feat(streaming): add subtitle tracks and a JNI export to the trailer resolver
Extends resolve_youtube_trailer_json to also extract caption tracks and
distinguish geo-blocked vs. failed outcomes, then exposes it over JNI
(Java_..._FluxaStreamingNative_resolveYoutubeTrailerJsonNative) so the
Android app's TrailerResolver can delegate to this instead of keeping
its own separate innertube client in sync.
2026-07-07 20:34:52 +03:00
KhooLy
3b955c0de4 feat(streaming): resolve YouTube trailer stream URLs via innertube
Adds a minimal innertube client (ANDROID primary, IOS fallback) that
POSTs to /youtubei/v1/player and extracts a direct progressive mp4 URL
from streamingData.formats, with a disk cache (6h TTL) keyed by video
id. Lets the desktop shell play a muted/looping trailer through a
plain <video> element instead of embedding YouTube's own web player.
2026-07-07 20:16:21 +03:00
KhooLy
e05afb2761 chore(ci): add GitHub Actions workflow and clippy lint policy
Add warn-level unsafe_op_in_unsafe_fn / unwrap_used / expect_used /
indexing_slicing / panic clippy lints (test code exempted via cfg_attr),
per the robustness plan's ratchet-to-deny strategy. Add a CI workflow
covering workspace test/clippy/fmt plus a wasm-only cargo check. Run
`cargo fmt` to clear pre-existing formatting drift so the fmt gate starts
clean, and drop a now-unnecessary `mut` flagged by clippy.
2026-07-07 14:22:15 +03:00
KhooLy
ca749a8d00 fix(torrent): prevent stale stop from killing a replayed session
start_torrent_server is a process-wide singleton that fully tears
down and recreates the engine on every play. A stop invoked for an
old session could race a fast replay's start and land after the new
session was already up, silently killing the just-started server and
leaving mpv with a dead socket (MPV_ERROR_LOADING_FAILED / "Loading
failed" on the same torrent). Each server generation is now tagged;
stop is a no-op unless it targets the currently active generation.
2026-07-07 13:14:31 +03:00
KhooLy
d614de3341 fix(torrent): fix startup ordering, add metadata timeouts, track real streamed bytes
Bind the listener only after the torrent session is up (with an 18s init
timeout) instead of before, wrap add_lock/api_add_torrent in a 45s timeout
so a stuck peer/tracker can't hang requests forever, and stop stat-only
polls from triggering ensure_torrent so they can't contend with the real
stream request. Also track bytes actually streamed to the client
(CountingReader) so the preload/stat readiness check reflects playback
progress past a seek, not just bytes written to disk.
2026-07-06 21:56:26 +03:00
KhooLy
6ebd09a101 style: rustfmt fluxa-streaming-engine
No behavioral changes, pure formatting.
2026-07-06 21:51:32 +03:00
KhooLy
b0bb52a6a3 feat: update desktop core API support 2026-07-03 16:05:52 +03:00
KhooLy
5fb580f782 feat: update core casting and streaming support 2026-06-27 21:04:20 +03:00
KhooLy
894ca2c81f feat: companion server, FFI cleanup, and pre-release hardening
- Add fluxa-streaming-engine companion server (torrent start/stop,
  ffmpeg transcode/probe, OAuth token exchange) for the web build
- Add SSRF guard restricting transcode/probe url param to http(s)
  loopback hosts, blocking file:// and remote-host abuse via ffmpeg
- Add src/ffi.rs string-routed RPC dispatcher and wasm bindings
- Add headless engine profile module and several FFI surface
  additions (scrobble plans, episode navigation, collections import/export)
- Remove dead runtime::msg/update scaffolding and addon_transport trait
- Remove fluxa_play.rs dev scratch binary (hardcoded scraper, not
  part of the product)
- Reorder dv_rewrite.rs so implementation precedes its test module;
  strip decorative section dividers
- Add docs/, fuzz/ targets, and a rewritten README
- Fix .gitignore to cover fluxa-streaming-engine/target
2026-06-17 20:01:42 +03:00
KhooLy
2f510a6a4b feat: complete core engine, FFI layer, and streaming engine
- Add headless engine with full action/effect dispatch (detail, player,
  home, library, search, discover, calendar, offline, auth, sync)
- Add ffi.rs RPC dispatch table used by UniFFI (iOS) and WASM bindings
- Add wasm.rs binding surface (core_invoke + fluxa_core_version)
- Extend FluxaCore public API with tmdb, intro_segments, external_sync,
  library_state, player_policy, watchlist, and search plan methods
- Fix torrent server race: replace AtomicBool + Mutex dual-state with
  mutex-only source of truth for running status
- Document result_json drain contract in headless engine
- Remove decorative section dividers from core_api.rs (style)
- Remove unused normalize_skip_time function (dead code warning)
- Remove generated doc block from FluxaCore struct (style)
- Clarify app_state comment in ffi.rs (not legacy, used by Android JNI)
2026-06-16 01:44:59 +03:00
KhooLy
b0c0b93b8e feat: add fluxa-streaming-engine as subdirectory 2026-06-09 17:00:14 +03:00