Commit graph

149 commits

Author SHA1 Message Date
Claude
46d152dfc5
fix: guard StremioServer::start() with a running flag
start() unconditionally spawned a fresh stremio-runtime every time it
was called. Today only the GUI thread calls it, but the crash-restart
path can re-fire start() while the previous teardown is still in
progress, racing two runtimes for port 11470.

Track a `running: Arc<AtomicBool>` on the struct: swap(true) on entry
and bail with a log if the previous server thread has not yet flipped
it back to false. Reset to false right before sender.notice() so that
the GUI's crash handler can legitimately spawn the next instance.

Closes #57
2026-05-10 14:44:18 +00:00
Claude
51d75cfe6e
fix: search accumulated log buffer for server readiness line
The stdout reader matched 'EngineFS server started at' against
string_data (the bytes from the most recent read only). If server.js
flushed in such a way that the readiness line straddled two reads,
neither chunk's .lines() yielded a full match, the endpoint channel
never received, recv() timed out, and the WebUI loaded against the
fallback URL.

Search the accumulated *lines buffer instead so a line split across
reads matches once the second chunk lands. Track endpoint_sent so we
do not resend on every subsequent chunk after a match.

Also preserve trailing newlines when trimming the retained buffer to
SRV_LOG_SIZE lines so a later chunk cannot be concatenated onto the
last unterminated line and corrupt a parser. Same trim treatment for
the stderr reader for consistency.

Closes #53
2026-05-10 14:43:48 +00:00
Claude
1464d46172
fix: kill and wait stremio-runtime child after readers finish
After both stdout and stderr readers exited, the Child handle was just
dropped at the end of the match arm. On Windows std::process::Child's
Drop neither kills nor waits, so the OS process kept its kernel object
(and its bound ports) alive until either the JobObject KILL_ON_JOB_CLOSE
fired on shell exit or init adopted it.

In the crash-restart path this is worse: a fresh start() is launched
while the previous runtime is still being reaped, and both processes
race for port 11470.

Explicitly kill().ok() + wait().ok() once the readers see EOF so the
previous runtime is gone before we report 'Server terminated.' and fire
the crash notice. Errors from killing an already-exited child are
intentionally swallowed.

Closes #50
2026-05-10 14:43:28 +00:00
Claude
2294f52407
fix: guard JobObject setup with Once and check return values
CreateJobObjectA / SetInformationJobObject / AssignProcessToJobObject
were called inside the per-start thread and their return values were
ignored. Two consequences:

1. Each server crash-restart created a fresh kernel JobObject HANDLE
   that was never CloseHandle'd. The HANDLE went out of scope when the
   spawned thread exited, leaking a kernel object every crash.
2. On Win 7/8 (single-job systems) and inside parent jobs that disallow
   breakaway, AssignProcessToJobObject silently failed, so
   stremio-runtime could survive the shell's death and hold port 11470.

Hoist the setup into ensure_parent_job_object() guarded by sync::Once
so it runs exactly once per shell process, and check each return value
explicitly with a clear log message when the OS-level safety net is
degraded. The HANDLE is intentionally not closed: closing it while
KILL_ON_JOB_CLOSE is set would terminate the shell itself.

Closes #47
Closes #48
2026-05-10 14:43:06 +00:00
Claude
a9d9673f2a
fix: break server reader threads on read error
stdout.read(...).unwrap_or(!0) substituted usize::MAX on Err, then
`if on > buffer.len() { continue; }` swallowed it and looped back into
read(). On a sticky IO error (broken pipe, EBADF) the thread spun a
CPU core forever and the accumulated logs were never flushed.

Match Ok(0)/Ok(n)/Err(e) explicitly: break on EOF, break on error after
logging, and treat any other Ok(n) as bytes read. Same change for
stderr.

Closes #51
2026-05-10 12:32:20 +00:00
Владимир Борисов
7f2bbb2c12
Merge pull request #38 from Stremio/feat/player-add-video-scale-property
Some checks failed
Continuous integration / test (push) Has been cancelled
Feat/Player add video scale property
2026-04-23 11:18:41 +03:00
Владимир Борисов
d8ec1c4cc1
Merge pull request #39 from Stremio/feat/media-keys-support
Feat/Player add media keys support
2026-04-23 11:17:49 +03:00
Claude
e25dc1fd02
fix(Player): stop fabricating end-file on transient mpv event errors
Commit 0b882f3 synthesized an Event::EndFile(Error) whenever
event_context.wait_event returned libmpv2::Error::Raw and forwarded it
to the web layer. MPV is fully able to continue playback after such
transient errors (its demuxer cache is intact), so fabricating an
end-of-file caused long-running HTTP streams (e.g. RealDebrid) to flip
to a blocking "Loading failed" overlay mid-playback. Revert that branch
to the prior log-and-continue behavior.

Also downgrade PlayerEnded errors from critical:true to critical:false
so genuine mpv_end_file_reason::Error surfaces as a 3s toast in
stremio-web (Player.js), letting the user retry, instead of an
unrecoverable full-screen overlay.
2026-04-22 22:07:54 +00:00
Timothy Z.
285415be55 chore: lint 2026-04-22 18:23:29 +03:00
Timothy Z.
fe13fb0fa4 feat: add media keys support to player 2026-04-22 18:18:07 +03:00
Timothy Z.
342a005dc0 feat: player add video scale property 2026-04-22 15:34:21 +03:00
Botzy
d43c462adf fix(Player): added demuxer cache time to get buffered value 2026-04-14 12:07:31 +03:00
Vladimir Borisov
0b882f3f9b
Handle Player critical errors 2026-03-12 17:28:44 +02:00
Vladimir Borisov
15069204be
Server IPC key
Some checks failed
Continuous integration / test (push) Has been cancelled
2026-02-02 17:21:47 +02:00
Vladimir Borisov
07d821012d
server IPC key 2026-02-02 14:54:41 +02:00
Vladimir Borisov
be55565ee4
Check for architecture specific updates
Some checks failed
Continuous integration / test (push) Has been cancelled
2025-11-27 16:35:40 +02:00
Владимир Борисов
53cfa3dc21
Windows no ARM build 2025-11-12 18:02:41 +02:00
Vladimir Borisov
e04cf5f0c4
Allow UI to set video output but keep gpu-next in the list 2025-08-01 12:04:25 +03:00
Vladimir Borisov
b37fbbd4c8
64 bit build 2025-06-30 12:39:12 +03:00
Tim
7ca2e78dac Merge branch 'main' of https://github.com/Stremio/stremio-shell-ng into refactor/preload-ipc-init
Some checks failed
Continuous integration / test (push) Has been cancelled
2025-06-25 13:05:10 +02:00
Tim
1c40762cf5 chore: clippy
Some checks failed
Continuous integration / test (push) Has been cancelled
2025-06-25 13:04:37 +02:00
unknown
d51211d071 refactor(webiew): remove init ipc logic 2025-06-21 01:23:07 +02:00
Tim
65b7978abd refactor: use OnWindowFocus derive instead of raw event handler 2025-04-02 18:58:23 +02:00
Tim
20dbac018a refactor(app): use WM_SETFOCUS event instead to send ipc win-state-change
Some checks failed
Continuous integration / test (push) Has been cancelled
2025-04-02 13:15:25 +02:00
Tim
972a6fe0a0 fix(app): send ipc win-state-changed on paint 2025-04-01 16:27:14 +02:00
Владимир Борисов
222e59442b
Merge pull request #22 from Stremio/fix/fullscreen-win-visibility-change
Some checks are pending
Continuous integration / test (push) Waiting to run
fix(app): send ipc event when fullscreen state change
2025-04-01 16:22:54 +03:00
Tim
ff820cea6b fix(app): send ipc event when fullscreen state change 2025-04-01 12:28:23 +02:00
Tim
98edc086ea feat(webview): redirect to warning page for non-whitelisted host 2025-03-31 14:25:23 +02:00
Tim
c665c2fb75 fix(webview): handle window request 2025-03-31 14:05:41 +02:00
Владимир Борисов
38d52a3c6a
Merge pull request #15 from Stremio/feat/webview-handle-window-open
feat(webview): handle window.open
2025-03-24 17:03:03 +02:00
Tim
5afca64bda fix(player): handle SubDelay mpv prop 2025-02-27 23:08:21 +01:00
Tim
3848b5a59f fix(app): send visibility events when window is shown or hidden 2025-02-24 14:25:02 +01:00
Tim
8ef0f079b6 fix(webiew): incorrect condition for window.open js script
Some checks failed
Continuous integration / test (push) Has been cancelled
2025-02-24 00:28:56 +01:00
Tim
ae5e8eb0e4 feat(webview): handle window.open 2025-01-31 17:40:05 +01:00
Tim
9364538e41 refactor(app): make updater thread blocking 2025-01-31 10:18:12 +01:00
Tim
520971b841 refactor(app): wait for app-ready before checking for updates 2025-01-30 17:25:55 +01:00
Vladimir Borisov
21fb872a51
Disable player loggin in release 2025-01-28 11:12:07 +02:00
Vladimir Borisov
82a0b15b35
Do not set audio track id. Set audio name 2025-01-28 09:50:50 +02:00
Vladimir Borisov
9e1c06c7d2
Enable context menus for text boxes 2025-01-24 12:27:17 +02:00
Vladimir Borisov
d9fbabbf62
Use layout for the splash image 2025-01-23 17:36:22 +02:00
Vladimir Borisov
9902c37aa2
Fix HDR 2025-01-23 15:12:30 +02:00
Vladimir Borisov
70d67a2aa2
Rename _handle to handle in webview events 2025-01-21 15:56:24 +02:00
Vladimir Borisov
0d6b8f23b5
Better event handling in the webview 2025-01-21 15:55:27 +02:00
Vladimir Borisov
03921ffce9
Clippy 2025-01-21 11:53:38 +02:00
Vladimir Borisov
8e1b72d513
Server crash logs and boot availability 2025-01-21 11:45:14 +02:00
Владимир Борисов
bb5387bd98
Merge pull request #12 from Stremio/fix-focus-on-launch
fix: focus main window on launching second instance
2025-01-16 09:23:54 +02:00
Vladimir Borisov
8ecdb1264b
fix: focus main window on launching second instance 2025-01-13 16:29:51 +02:00
Vladimir Borisov
494be0adc0
fix: Retrieve active monitor before going full screen 2025-01-13 11:04:34 +02:00
Vladimir Borisov
2b5f1f727b Inject JS before content loaded 2024-12-23 15:20:55 +02:00
Vladimir Borisov
693d545923 Inject shell js on reload 2024-12-23 15:06:46 +02:00