Commit b412a58
committed
feat(media-server): implement runtime runtime management system (#204)
* feat(media-server): implement runtime runtime management system
- add UV bootstrapper with cross-platform install, caching, progress, validation
- manage Python venv lifecycle, dependency installs, cleanup, and phased progress
- introduce MediaServerService with lifecycle control, health checks, and port management
- extend FFmpeg service to handle FFprobe with unified downloads and version updates
- build settings UI sections for media server and plugins with real-time status
- wire up 38 IPC channels covering UV, venv, FFmpeg/FFprobe, and server control
- update build configs, add ffprobe download script, auto-start server, and bump backend ref
* test: Update tests
* test(main): mock electron app for ipc handlers
* Update src/renderer/src/pages/settings/FFprobeSection.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Apply suggestion from @coderabbitai[bot]
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* refactor(types): extract common Platform and Arch types to shared package
- Create packages/shared/types/system.ts with Platform and Arch type definitions
- Remove duplicate type definitions from FFmpegDownloadService
- Remove duplicate type definitions from UvBootstrapperService
- Import shared types from @shared/types/system in both services
This change improves code maintainability by centralizing common system type definitions.
* fix(media-server): clear port and notify frontend on process exit
Ensure media server port is properly cleared and frontend is notified
when the process stops or crashes to prevent stale port usage.
Changes:
- Update notifyPortChanged signature to accept number | null
- Clear this.port to null in both normal stop and crash exit handlers
- Notify frontend with null port when server stops
- Update SessionService listener to handle null port notifications
- Add appropriate logging for port clearing events
This prevents the frontend from continuing to use expired ports after
the media server has stopped, requiring manual app restart.
* fix(settings): prevent setTimeout memory leak in MediaServerSection
Fix potential memory leak and unmounted component state update in
MediaServerSection by properly managing setTimeout lifecycle:
- Add successTimeoutRef to store timeout handle
- Clear timeout in effect cleanup on component unmount
- Clear timeout before creating new one in handleInstall
- Clear timeout in error handler to prevent orphaned timers
- Set ref to null after clearing to maintain clean state
This prevents "Can't perform a React state update on an unmounted
component" warnings and ensures proper cleanup of async operations.
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(media-server): improve status display during installation and startup
- Add 'starting' status immediately after installation completes
- Move fetchServerInfo() to finally block to ensure status refresh
- Prevent confusing 'stopped' status display during startup process
* fix(python-venv): preserve final install progress state for callers
Remove finally block that immediately clears installProgress, preventing callers from reading final "completed" or "error" state. Instead:
- Clear installProgress at start of new installation
- Preserve final state after completion/error for caller consumption
- Remove unnecessary finally block cleanup
This ensures MediaServerSection and other callers can reliably read the final installation state.
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(types): centralize media server types to shared package
- Create shared types module for Media Server and Python Venv
- Add media-server.ts with MediaServerInfo, MediaServerStatus, PythonVenvInfo, and InstallProgress types
- Remove duplicate type definitions from MediaServerService, PythonVenvService, and MediaServerSection
- Update imports to use @shared/types across main and renderer processes
- Maintain backward compatibility by re-exporting types from service files
- All type checks passing1 parent 51c7b89 commit b412a58
28 files changed
Lines changed: 6459 additions & 172 deletions
File tree
- scripts
- src
- main
- __tests__
- services
- __tests__
- preload
- renderer/src
- i18n/locales
- pages
- player
- settings
- services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
46 | 27 | | |
47 | 28 | | |
48 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
91 | 86 | | |
| 87 | + | |
| 88 | + | |
92 | 89 | | |
93 | 90 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | | - | |
101 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| |||
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
116 | | - | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
93 | 131 | | |
94 | 132 | | |
95 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
0 commit comments