mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
refactor(runtime): gate settings external players by capability
This commit is contained in:
1 parent
b4fd93354e
commit
09e2e08fc1
9 files changed
+104
-27
No files matched your search
@@ -27,6 +27,7 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
expect(service.supportsPortalActivityStorage).toBe(false);
|
||||
expect(service.supportsPlaylistRefresh).toBe(false);
|
||||
expect(service.supportsManagedExternalPlayers).toBe(false);
|
||||
expect(service.supportsExternalPlayerPathSettings).toBe(false);
|
||||
expect(service.supportsEmbeddedMpv).toBe(false);
|
||||
expect(service.supportsDesktopFileSave).toBe(false);
|
||||
expect(service.supportsRemoteControl).toBe(false);
|
||||
@@ -97,6 +98,8 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
onPlaylistRefreshEvent: jest.fn(),
|
||||
openInMpv: jest.fn(),
|
||||
openInVlc: jest.fn(),
|
||||
setMpvPlayerPath: jest.fn(),
|
||||
setVlcPlayerPath: jest.fn(),
|
||||
prepareEmbeddedMpv: jest.fn(),
|
||||
saveFileDialog: jest.fn(),
|
||||
writeFile: jest.fn(),
|
||||
@@ -120,6 +123,7 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
expect(service.supportsPortalActivityStorage).toBe(true);
|
||||
expect(service.supportsPlaylistRefresh).toBe(true);
|
||||
expect(service.supportsManagedExternalPlayers).toBe(true);
|
||||
expect(service.supportsExternalPlayerPathSettings).toBe(true);
|
||||
expect(service.supportsEmbeddedMpv).toBe(true);
|
||||
expect(service.supportsDesktopFileSave).toBe(true);
|
||||
expect(service.supportsRemoteControl).toBe(true);
|
||||
@@ -143,6 +147,7 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
expect(service.supportsPortalActivityStorage).toBe(false);
|
||||
expect(service.supportsPlaylistRefresh).toBe(false);
|
||||
expect(service.supportsManagedExternalPlayers).toBe(false);
|
||||
expect(service.supportsExternalPlayerPathSettings).toBe(false);
|
||||
expect(service.supportsEmbeddedMpv).toBe(false);
|
||||
expect(service.supportsDesktopFileSave).toBe(false);
|
||||
expect(service.supportsRemoteControl).toBe(false);
|
||||
@@ -170,22 +175,27 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
expect(service.supportsXtreamSqliteDataSource).toBe(false);
|
||||
});
|
||||
|
||||
it('requires both managed external player launch methods', () => {
|
||||
testWindow.electron = {
|
||||
openInMpv: jest.fn(),
|
||||
};
|
||||
|
||||
const service = new RuntimeCapabilitiesService();
|
||||
|
||||
expect(service.isElectron).toBe(true);
|
||||
expect(service.supportsManagedExternalPlayers).toBe(false);
|
||||
|
||||
it('decouples external player launch support from path-setting support', () => {
|
||||
testWindow.electron = {
|
||||
openInMpv: jest.fn(),
|
||||
openInVlc: jest.fn(),
|
||||
};
|
||||
|
||||
const service = new RuntimeCapabilitiesService();
|
||||
|
||||
expect(service.isElectron).toBe(true);
|
||||
expect(service.supportsManagedExternalPlayers).toBe(true);
|
||||
expect(service.supportsExternalPlayerPathSettings).toBe(false);
|
||||
|
||||
testWindow.electron = {
|
||||
openInMpv: jest.fn(),
|
||||
openInVlc: jest.fn(),
|
||||
setMpvPlayerPath: jest.fn(),
|
||||
setVlcPlayerPath: jest.fn(),
|
||||
};
|
||||
|
||||
expect(service.supportsManagedExternalPlayers).toBe(true);
|
||||
expect(service.supportsExternalPlayerPathSettings).toBe(true);
|
||||
});
|
||||
|
||||
it('requires the complete downloads preload surface', () => {
|
||||
|
||||
@@ -136,6 +136,12 @@ export class RuntimeCapabilitiesService {
|
||||
);
|
||||
}
|
||||
|
||||
get supportsExternalPlayerPathSettings(): boolean {
|
||||
return ['setMpvPlayerPath', 'setVlcPlayerPath'].every((methodName) =>
|
||||
this.hasElectronMethod(methodName)
|
||||
);
|
||||
}
|
||||
|
||||
get supportsEmbeddedMpv(): boolean {
|
||||
return this.hasElectronMethod('prepareEmbeddedMpv');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user