mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 09:01:03 -08:00
refactor(runtime): require downloads bridge surface
This commit is contained in:
1 parent
109aea0794
commit
9a5620bf95
3 files changed
+58
-4
No files matched your search
@@ -70,9 +70,11 @@ direct `window.electron` or `DataService.getAppEnvironment()` checks. Keep
|
||||
feature decisions expressed as capabilities such as `supportsEpg`,
|
||||
`supportsSqlite`, `supportsXtreamSqliteDataSource`, `supportsDownloads`, or
|
||||
`supportsManagedExternalPlayers` so PWA and Electron behavior stays auditable
|
||||
from one shared boundary. `supportsManagedExternalPlayers` requires the MPV and
|
||||
VLC preload launch methods (`openInMpv` and `openInVlc`); a partial Electron
|
||||
bridge must not expose managed external-player actions in the PWA/shared UI.
|
||||
from one shared boundary. `supportsDownloads` requires the complete downloads
|
||||
preload API surface used by `DownloadsService`, and
|
||||
`supportsManagedExternalPlayers` requires the MPV and VLC preload launch methods
|
||||
(`openInMpv` and `openInVlc`); a partial Electron bridge must not expose
|
||||
desktop-only actions in the PWA/shared UI.
|
||||
|
||||
## Runtime Limitations
|
||||
|
||||
|
||||
@@ -76,7 +76,18 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
dbClearPlaybackPosition: jest.fn(),
|
||||
dbDeleteXtreamContent: jest.fn(),
|
||||
dbRestoreXtreamUserData: jest.fn(),
|
||||
downloadsStart: jest.fn(),
|
||||
downloadsCancel: jest.fn(),
|
||||
downloadsRetry: jest.fn(),
|
||||
downloadsRemove: jest.fn(),
|
||||
downloadsGetList: jest.fn(),
|
||||
downloadsGet: jest.fn(),
|
||||
downloadsGetDefaultFolder: jest.fn(),
|
||||
downloadsSelectFolder: jest.fn(),
|
||||
downloadsRevealFile: jest.fn(),
|
||||
downloadsPlayFile: jest.fn(),
|
||||
downloadsClearCompleted: jest.fn(),
|
||||
onDownloadsUpdate: jest.fn(),
|
||||
openInMpv: jest.fn(),
|
||||
openInVlc: jest.fn(),
|
||||
prepareEmbeddedMpv: jest.fn(),
|
||||
@@ -171,4 +182,32 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
|
||||
expect(service.supportsManagedExternalPlayers).toBe(true);
|
||||
});
|
||||
|
||||
it('requires the complete downloads preload surface', () => {
|
||||
testWindow.electron = {
|
||||
downloadsGetList: jest.fn(),
|
||||
};
|
||||
|
||||
const service = new RuntimeCapabilitiesService();
|
||||
|
||||
expect(service.isElectron).toBe(true);
|
||||
expect(service.supportsDownloads).toBe(false);
|
||||
|
||||
testWindow.electron = {
|
||||
downloadsStart: jest.fn(),
|
||||
downloadsCancel: jest.fn(),
|
||||
downloadsRetry: jest.fn(),
|
||||
downloadsRemove: jest.fn(),
|
||||
downloadsGetList: jest.fn(),
|
||||
downloadsGet: jest.fn(),
|
||||
downloadsGetDefaultFolder: jest.fn(),
|
||||
downloadsSelectFolder: jest.fn(),
|
||||
downloadsRevealFile: jest.fn(),
|
||||
downloadsPlayFile: jest.fn(),
|
||||
downloadsClearCompleted: jest.fn(),
|
||||
onDownloadsUpdate: jest.fn(),
|
||||
};
|
||||
|
||||
expect(service.supportsDownloads).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -83,7 +83,20 @@ export class RuntimeCapabilitiesService {
|
||||
}
|
||||
|
||||
get supportsDownloads(): boolean {
|
||||
return this.hasElectronMethod('downloadsGetList');
|
||||
return [
|
||||
'downloadsStart',
|
||||
'downloadsCancel',
|
||||
'downloadsRetry',
|
||||
'downloadsRemove',
|
||||
'downloadsGetList',
|
||||
'downloadsGet',
|
||||
'downloadsGetDefaultFolder',
|
||||
'downloadsSelectFolder',
|
||||
'downloadsRevealFile',
|
||||
'downloadsPlayFile',
|
||||
'downloadsClearCompleted',
|
||||
'onDownloadsUpdate',
|
||||
].every((methodName) => this.hasElectronMethod(methodName));
|
||||
}
|
||||
|
||||
get supportsPortalActivityStorage(): boolean {
|
||||
|
||||
Reference in new issue
Block a user