prismcast 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.d.ts +41 -1
- package/dist/app.js +164 -76
- package/dist/app.js.map +1 -1
- package/dist/browser/blockedPage.d.ts +0 -1
- package/dist/browser/browserSupervisor.d.ts +34 -5
- package/dist/browser/browserSupervisor.js +39 -12
- package/dist/browser/browserSupervisor.js.map +1 -1
- package/dist/browser/cdp.d.ts +58 -6
- package/dist/browser/cdp.js +147 -9
- package/dist/browser/cdp.js.map +1 -1
- package/dist/browser/channelSelection.d.ts +18 -6
- package/dist/browser/channelSelection.js +47 -36
- package/dist/browser/channelSelection.js.map +1 -1
- package/dist/browser/consent.d.ts +33 -4
- package/dist/browser/consent.js +87 -50
- package/dist/browser/consent.js.map +1 -1
- package/dist/browser/display.d.ts +0 -1
- package/dist/browser/hlsPlaylistObserver.d.ts +3 -2
- package/dist/browser/hlsPlaylistObserver.js +11 -6
- package/dist/browser/hlsPlaylistObserver.js.map +1 -1
- package/dist/browser/index.d.ts +273 -59
- package/dist/browser/index.js +768 -255
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/launchGovernor.d.ts +0 -1
- package/dist/browser/login.d.ts +11 -10
- package/dist/browser/login.js +42 -33
- package/dist/browser/login.js.map +1 -1
- package/dist/browser/manifestInterceptor.d.ts +14 -5
- package/dist/browser/manifestInterceptor.js +26 -13
- package/dist/browser/manifestInterceptor.js.map +1 -1
- package/dist/browser/navigation.d.ts +28 -0
- package/dist/browser/navigation.js +57 -0
- package/dist/browser/navigation.js.map +1 -0
- package/dist/browser/pageStaleness.d.ts +1 -2
- package/dist/browser/pageStaleness.js +9 -9
- package/dist/browser/pageStaleness.js.map +1 -1
- package/dist/browser/precaching.d.ts +27 -13
- package/dist/browser/precaching.js +219 -73
- package/dist/browser/precaching.js.map +1 -1
- package/dist/browser/tabCapture.d.ts +97 -0
- package/dist/browser/tabCapture.js +314 -0
- package/dist/browser/tabCapture.js.map +1 -0
- package/dist/browser/tabNetworkObserver.d.ts +0 -1
- package/dist/browser/tabSelection.d.ts +117 -0
- package/dist/browser/tabSelection.js +547 -0
- package/dist/browser/tabSelection.js.map +1 -0
- package/dist/browser/tuning/cache.d.ts +0 -1
- package/dist/browser/tuning/comcastPolymer.d.ts +0 -1
- package/dist/browser/tuning/comcastPolymer.js +18 -19
- package/dist/browser/tuning/comcastPolymer.js.map +1 -1
- package/dist/browser/tuning/cox.d.ts +0 -1
- package/dist/browser/tuning/directv.d.ts +0 -1
- package/dist/browser/tuning/directv.js +12 -13
- package/dist/browser/tuning/directv.js.map +1 -1
- package/dist/browser/tuning/fox.d.ts +0 -1
- package/dist/browser/tuning/fox.js +2 -2
- package/dist/browser/tuning/fox.js.map +1 -1
- package/dist/browser/tuning/gridSearch.d.ts +0 -1
- package/dist/browser/tuning/hbo.d.ts +0 -1
- package/dist/browser/tuning/hbo.js +2 -2
- package/dist/browser/tuning/hbo.js.map +1 -1
- package/dist/browser/tuning/hulu.d.ts +14 -2
- package/dist/browser/tuning/hulu.js +150 -24
- package/dist/browser/tuning/hulu.js.map +1 -1
- package/dist/browser/tuning/shared.d.ts +1 -2
- package/dist/browser/tuning/shared.js +1 -1
- package/dist/browser/tuning/sling.d.ts +0 -1
- package/dist/browser/tuning/sling.js +17 -22
- package/dist/browser/tuning/sling.js.map +1 -1
- package/dist/browser/tuning/spectrum.d.ts +0 -1
- package/dist/browser/tuning/thumbnailRow.d.ts +0 -1
- package/dist/browser/tuning/tileClick.d.ts +0 -1
- package/dist/browser/tuning/xfinity.d.ts +0 -1
- package/dist/browser/tuning/youtubeTv.d.ts +0 -1
- package/dist/browser/tuning/youtubeTv.js +1 -2
- package/dist/browser/tuning/youtubeTv.js.map +1 -1
- package/dist/browser/video.d.ts +55 -33
- package/dist/browser/video.js +213 -169
- package/dist/browser/video.js.map +1 -1
- package/dist/browser/windowSync.d.ts +45 -0
- package/dist/browser/windowSync.js +153 -0
- package/dist/browser/windowSync.js.map +1 -0
- package/dist/channels/index.d.ts +7 -1
- package/dist/channels/index.js +24 -8
- package/dist/channels/index.js.map +1 -1
- package/dist/config/channelForm.d.ts +0 -1
- package/dist/config/channelIdentity.d.ts +27 -0
- package/dist/config/channelIdentity.js +72 -0
- package/dist/config/channelIdentity.js.map +1 -0
- package/dist/config/channelSort.d.ts +25 -0
- package/dist/config/channelSort.js +101 -0
- package/dist/config/channelSort.js.map +1 -0
- package/dist/config/consistencyProbe.d.ts +0 -1
- package/dist/config/consistencyProbe.js +1 -1
- package/dist/config/consistencyProbe.js.map +1 -1
- package/dist/config/health.d.ts +3 -2
- package/dist/config/health.js +41 -31
- package/dist/config/health.js.map +1 -1
- package/dist/config/index.d.ts +12 -1
- package/dist/config/index.js +77 -31
- package/dist/config/index.js.map +1 -1
- package/dist/config/paths.d.ts +17 -2
- package/dist/config/paths.js +21 -1
- package/dist/config/paths.js.map +1 -1
- package/dist/config/persistence.context.d.ts +0 -1
- package/dist/config/persistence.d.ts +8 -4
- package/dist/config/persistence.js +143 -82
- package/dist/config/persistence.js.map +1 -1
- package/dist/config/presets.d.ts +0 -1
- package/dist/config/profiles.d.ts +9 -4
- package/dist/config/profiles.js +39 -6
- package/dist/config/profiles.js.map +1 -1
- package/dist/config/providerLineups.d.ts +0 -1
- package/dist/config/providerLineups.js +0 -3
- package/dist/config/providerLineups.js.map +1 -1
- package/dist/config/reactivity.d.ts +0 -1
- package/dist/config/servicePacks.d.ts +0 -1
- package/dist/config/services.d.ts +1 -47
- package/dist/config/services.js +4 -135
- package/dist/config/services.js.map +1 -1
- package/dist/config/sites.d.ts +0 -9
- package/dist/config/sites.js +82 -98
- package/dist/config/sites.js.map +1 -1
- package/dist/config/userChannels.d.ts +22 -29
- package/dist/config/userChannels.js +47 -65
- package/dist/config/userChannels.js.map +1 -1
- package/dist/config/userConfig.d.ts +19 -4
- package/dist/config/userConfig.js +123 -25
- package/dist/config/userConfig.js.map +1 -1
- package/dist/config/userProfiles.d.ts +2 -3
- package/dist/config/userProfiles.js +16 -13
- package/dist/config/userProfiles.js.map +1 -1
- package/dist/hdhr/channelMap.d.ts +0 -1
- package/dist/hdhr/deviceId.d.ts +0 -1
- package/dist/hdhr/discover.d.ts +0 -1
- package/dist/hdhr/getHandlers.d.ts +0 -1
- package/dist/hdhr/identity.d.ts +0 -1
- package/dist/hdhr/index.d.ts +0 -1
- package/dist/hdhr/protocol.d.ts +1 -2
- package/dist/hdhr/protocol.js +1 -1
- package/dist/hdhr/tunerState.d.ts +0 -1
- package/dist/hdhr/udp.d.ts +0 -1
- package/dist/hdhr/udp.js +16 -4
- package/dist/hdhr/udp.js.map +1 -1
- package/dist/identity.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/native/codecInference.d.ts +5 -4
- package/dist/native/codecInference.js +12 -7
- package/dist/native/codecInference.js.map +1 -1
- package/dist/native/decrypt.d.ts +10 -3
- package/dist/native/decrypt.js +9 -5
- package/dist/native/decrypt.js.map +1 -1
- package/dist/native/index.d.ts +26 -24
- package/dist/native/index.js +26 -20
- package/dist/native/index.js.map +1 -1
- package/dist/native/probe.d.ts +7 -10
- package/dist/native/probe.js +41 -37
- package/dist/native/probe.js.map +1 -1
- package/dist/native/proxy.d.ts +3 -4
- package/dist/native/proxy.js +91 -69
- package/dist/native/proxy.js.map +1 -1
- package/dist/native/tokenExpiry.d.ts +0 -1
- package/dist/routes/assets.d.ts +0 -1
- package/dist/routes/auth.d.ts +0 -1
- package/dist/routes/auth.js +1 -1
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/cdp.d.ts +11 -5
- package/dist/routes/cdp.js +91 -63
- package/dist/routes/cdp.js.map +1 -1
- package/dist/routes/channels.d.ts +0 -1
- package/dist/routes/clientActions.d.ts +0 -1
- package/dist/routes/components.d.ts +0 -1
- package/dist/routes/config/channels/endpoints/browse.d.ts +0 -1
- package/dist/routes/config/channels/endpoints/bulk.d.ts +0 -1
- package/dist/routes/config/channels/endpoints/bulk.js +3 -3
- package/dist/routes/config/channels/endpoints/bulk.js.map +1 -1
- package/dist/routes/config/channels/endpoints/crud.d.ts +0 -1
- package/dist/routes/config/channels/endpoints/crud.js +4 -3
- package/dist/routes/config/channels/endpoints/crud.js.map +1 -1
- package/dist/routes/config/channels/endpoints/importExport.d.ts +0 -1
- package/dist/routes/config/channels/endpoints/importExport.js +7 -3
- package/dist/routes/config/channels/endpoints/importExport.js.map +1 -1
- package/dist/routes/config/channels/endpoints/predefined.d.ts +0 -1
- package/dist/routes/config/channels/endpoints/prefs.d.ts +0 -1
- package/dist/routes/config/channels/endpoints/prefs.js +1 -1
- package/dist/routes/config/channels/endpoints/prefs.js.map +1 -1
- package/dist/routes/config/channels/endpoints/service.d.ts +0 -1
- package/dist/routes/config/channels/endpoints/service.js +8 -5
- package/dist/routes/config/channels/endpoints/service.js.map +1 -1
- package/dist/routes/config/channels/endpoints/tags.d.ts +0 -1
- package/dist/routes/config/channels/endpoints/tags.js +3 -3
- package/dist/routes/config/channels/endpoints/tags.js.map +1 -1
- package/dist/routes/config/channels/healthBridge.d.ts +4 -1
- package/dist/routes/config/channels/healthBridge.js +9 -5
- package/dist/routes/config/channels/healthBridge.js.map +1 -1
- package/dist/routes/config/channels/http/handler.d.ts +0 -1
- package/dist/routes/config/channels/http/playlistHint.d.ts +0 -1
- package/dist/routes/config/channels/http/serviceWarning.d.ts +0 -1
- package/dist/routes/config/channels/http/serviceWarning.js +1 -1
- package/dist/routes/config/channels/http/serviceWarning.js.map +1 -1
- package/dist/routes/config/channels/index.d.ts +0 -1
- package/dist/routes/config/channels/setup.d.ts +0 -1
- package/dist/routes/config/channels/table.d.ts +0 -1
- package/dist/routes/config/channels/table.js +66 -134
- package/dist/routes/config/channels/table.js.map +1 -1
- package/dist/routes/config/http/envelope.d.ts +1 -2
- package/dist/routes/config/index.d.ts +5 -5
- package/dist/routes/config/index.js +7 -5
- package/dist/routes/config/index.js.map +1 -1
- package/dist/routes/config/services.d.ts +0 -1
- package/dist/routes/config/services.js +17 -19
- package/dist/routes/config/services.js.map +1 -1
- package/dist/routes/config/settings.d.ts +6 -15
- package/dist/routes/config/settings.js +16 -35
- package/dist/routes/config/settings.js.map +1 -1
- package/dist/routes/debug.d.ts +0 -1
- package/dist/routes/debug.js +1 -1
- package/dist/routes/debug.js.map +1 -1
- package/dist/routes/health.d.ts +16 -8
- package/dist/routes/health.js +27 -12
- package/dist/routes/health.js.map +1 -1
- package/dist/routes/hls.d.ts +0 -1
- package/dist/routes/icons.d.ts +0 -1
- package/dist/routes/index.d.ts +0 -1
- package/dist/routes/logs.d.ts +3 -2
- package/dist/routes/logs.js +54 -14
- package/dist/routes/logs.js.map +1 -1
- package/dist/routes/mpegts.d.ts +0 -1
- package/dist/routes/play.d.ts +0 -1
- package/dist/routes/playlist.d.ts +0 -1
- package/dist/routes/playlist.js +2 -1
- package/dist/routes/playlist.js.map +1 -1
- package/dist/routes/root/content.d.ts +0 -1
- package/dist/routes/root/content.js +32 -11
- package/dist/routes/root/content.js.map +1 -1
- package/dist/routes/root/index.d.ts +10 -1
- package/dist/routes/root/index.js +17 -7
- package/dist/routes/root/index.js.map +1 -1
- package/dist/routes/root/scripts/channels.d.ts +0 -1
- package/dist/routes/root/scripts/channels.js +10 -20
- package/dist/routes/root/scripts/channels.js.map +1 -1
- package/dist/routes/root/scripts/clientEscape.d.ts +0 -1
- package/dist/routes/root/scripts/clientEscape.js +1 -1
- package/dist/routes/root/scripts/clientUrl.d.ts +0 -1
- package/dist/routes/root/scripts/config.d.ts +0 -1
- package/dist/routes/root/scripts/config.js +8 -29
- package/dist/routes/root/scripts/config.js.map +1 -1
- package/dist/routes/root/scripts/index.d.ts +0 -1
- package/dist/routes/root/scripts/shared.d.ts +0 -1
- package/dist/routes/root/scripts/shared.js +16 -13
- package/dist/routes/root/scripts/shared.js.map +1 -1
- package/dist/routes/root/scripts/status.d.ts +0 -1
- package/dist/routes/root/scripts/status.handlers.d.ts +3 -1
- package/dist/routes/root/scripts/status.handlers.js +52 -26
- package/dist/routes/root/scripts/status.handlers.js.map +1 -1
- package/dist/routes/root/styles.d.ts +0 -1
- package/dist/routes/root/styles.js +10 -18
- package/dist/routes/root/styles.js.map +1 -1
- package/dist/routes/services.d.ts +0 -1
- package/dist/routes/services.js +1 -1
- package/dist/routes/services.js.map +1 -1
- package/dist/routes/sse.d.ts +3 -2
- package/dist/routes/sse.js +7 -3
- package/dist/routes/sse.js.map +1 -1
- package/dist/routes/streams.d.ts +4 -2
- package/dist/routes/streams.js +8 -5
- package/dist/routes/streams.js.map +1 -1
- package/dist/routes/theme.d.ts +0 -1
- package/dist/routes/theme.js +3 -3
- package/dist/routes/theme.js.map +1 -1
- package/dist/routes/ui.d.ts +0 -1
- package/dist/routes/ui.js +5 -5
- package/dist/routes/ui.js.map +1 -1
- package/dist/routes/upgrade.d.ts +0 -1
- package/dist/routes/upgrade.js +2 -1
- package/dist/routes/upgrade.js.map +1 -1
- package/dist/service/commands.context.d.ts +0 -1
- package/dist/service/commands.context.js +7 -1
- package/dist/service/commands.context.js.map +1 -1
- package/dist/service/commands.d.ts +0 -1
- package/dist/service/generators.context.d.ts +0 -1
- package/dist/service/generators.d.ts +0 -1
- package/dist/service/index.d.ts +0 -1
- package/dist/streaming/captureLock.d.ts +1 -2
- package/dist/streaming/captureLock.js +8 -7
- package/dist/streaming/captureLock.js.map +1 -1
- package/dist/streaming/captureSession.d.ts +0 -1
- package/dist/streaming/clients.d.ts +4 -3
- package/dist/streaming/clients.js +5 -4
- package/dist/streaming/clients.js.map +1 -1
- package/dist/streaming/codec.d.ts +0 -1
- package/dist/streaming/fmp4Segmenter.d.ts +11 -6
- package/dist/streaming/fmp4Segmenter.js +39 -17
- package/dist/streaming/fmp4Segmenter.js.map +1 -1
- package/dist/streaming/hls.d.ts +96 -3
- package/dist/streaming/hls.js +282 -171
- package/dist/streaming/hls.js.map +1 -1
- package/dist/streaming/hlsResume.d.ts +8 -5
- package/dist/streaming/hlsResume.js +10 -8
- package/dist/streaming/hlsResume.js.map +1 -1
- package/dist/streaming/hlsSegments.d.ts +11 -8
- package/dist/streaming/hlsSegments.js +38 -18
- package/dist/streaming/hlsSegments.js.map +1 -1
- package/dist/streaming/lifecycle.d.ts +5 -4
- package/dist/streaming/lifecycle.js +43 -13
- package/dist/streaming/lifecycle.js.map +1 -1
- package/dist/streaming/monitor.d.ts +14 -3
- package/dist/streaming/monitor.js +447 -234
- package/dist/streaming/monitor.js.map +1 -1
- package/dist/streaming/mp4Parser.d.ts +0 -1
- package/dist/streaming/mpegts.d.ts +11 -1
- package/dist/streaming/mpegts.js +92 -28
- package/dist/streaming/mpegts.js.map +1 -1
- package/dist/streaming/playlistBuilder.d.ts +0 -1
- package/dist/streaming/preroll.d.ts +34 -15
- package/dist/streaming/preroll.js +32 -30
- package/dist/streaming/preroll.js.map +1 -1
- package/dist/streaming/pretune.d.ts +2 -3
- package/dist/streaming/pretune.js +45 -45
- package/dist/streaming/pretune.js.map +1 -1
- package/dist/streaming/pretuneTimers.d.ts +16 -12
- package/dist/streaming/pretuneTimers.js +27 -37
- package/dist/streaming/pretuneTimers.js.map +1 -1
- package/dist/streaming/recovery.d.ts +97 -9
- package/dist/streaming/recovery.js +96 -18
- package/dist/streaming/recovery.js.map +1 -1
- package/dist/streaming/registry.d.ts +102 -15
- package/dist/streaming/registry.js +90 -5
- package/dist/streaming/registry.js.map +1 -1
- package/dist/streaming/setup.d.ts +90 -32
- package/dist/streaming/setup.js +379 -248
- package/dist/streaming/setup.js.map +1 -1
- package/dist/streaming/showInfo.d.ts +8 -4
- package/dist/streaming/showInfo.js +54 -45
- package/dist/streaming/showInfo.js.map +1 -1
- package/dist/streaming/statusEmitter.d.ts +5 -3
- package/dist/streaming/statusEmitter.js +20 -8
- package/dist/streaming/statusEmitter.js.map +1 -1
- package/dist/types/channels.d.ts +0 -1
- package/dist/types/channels.js +0 -4
- package/dist/types/channels.js.map +1 -1
- package/dist/types/config.d.ts +0 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +2 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/profiles.d.ts +51 -9
- package/dist/types/profiles.js +35 -1
- package/dist/types/profiles.js.map +1 -1
- package/dist/types/selection.d.ts +10 -1
- package/dist/types/shared.d.ts +0 -1
- package/dist/types/streaming.d.ts +8 -1
- package/dist/types/streaming.js +7 -0
- package/dist/types/streaming.js.map +1 -1
- package/dist/upgrade/commands.context.d.ts +0 -1
- package/dist/upgrade/commands.d.ts +0 -1
- package/dist/upgrade/commands.js +1 -1
- package/dist/upgrade/commands.js.map +1 -1
- package/dist/upgrade/detection.context.d.ts +0 -1
- package/dist/upgrade/detection.d.ts +1 -2
- package/dist/upgrade/index.d.ts +0 -1
- package/dist/upgrade/lifecycle.context.d.ts +2 -1
- package/dist/upgrade/lifecycle.context.js +9 -4
- package/dist/upgrade/lifecycle.context.js.map +1 -1
- package/dist/upgrade/lifecycle.d.ts +0 -1
- package/dist/upgrade/pathHandle.d.ts +0 -1
- package/dist/utils/bootSession.context.d.ts +0 -1
- package/dist/utils/bootSession.context.js +3 -2
- package/dist/utils/bootSession.context.js.map +1 -1
- package/dist/utils/bootSession.d.ts +0 -1
- package/dist/utils/chromeFetch.d.ts +0 -1
- package/dist/utils/cliOutput.d.ts +0 -1
- package/dist/utils/debugFilter.d.ts +0 -1
- package/dist/utils/debugFilter.js +5 -3
- package/dist/utils/debugFilter.js.map +1 -1
- package/dist/utils/delay.d.ts +65 -13
- package/dist/utils/delay.js +96 -23
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/errors.d.ts +0 -11
- package/dist/utils/errors.js +3 -14
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/evaluate.d.ts +11 -3
- package/dist/utils/evaluate.js +4 -3
- package/dist/utils/evaluate.js.map +1 -1
- package/dist/utils/ffmpeg.context.d.ts +0 -1
- package/dist/utils/ffmpeg.d.ts +1 -1
- package/dist/utils/ffmpeg.js +2 -1
- package/dist/utils/ffmpeg.js.map +1 -1
- package/dist/utils/fileLogger.d.ts +26 -7
- package/dist/utils/fileLogger.js +241 -102
- package/dist/utils/fileLogger.js.map +1 -1
- package/dist/utils/format.d.ts +36 -4
- package/dist/utils/format.js +66 -12
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logEmitter.d.ts +0 -1
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/m3u.d.ts +0 -1
- package/dist/utils/markup.d.ts +0 -1
- package/dist/utils/memo.d.ts +0 -1
- package/dist/utils/morganStream.d.ts +2 -3
- package/dist/utils/morganStream.js +6 -8
- package/dist/utils/morganStream.js.map +1 -1
- package/dist/utils/network.d.ts +0 -1
- package/dist/utils/never.d.ts +8 -0
- package/dist/utils/never.js +20 -0
- package/dist/utils/never.js.map +1 -0
- package/dist/utils/pid.d.ts +0 -1
- package/dist/utils/platform.d.ts +0 -1
- package/dist/utils/processInspector.context.d.ts +32 -2
- package/dist/utils/processInspector.context.js +117 -1
- package/dist/utils/processInspector.context.js.map +1 -1
- package/dist/utils/processInspector.d.ts +0 -32
- package/dist/utils/processInspector.js +10 -117
- package/dist/utils/processInspector.js.map +1 -1
- package/dist/utils/retry.d.ts +5 -4
- package/dist/utils/retry.js +43 -33
- package/dist/utils/retry.js.map +1 -1
- package/dist/utils/runtimeIdentity.context.d.ts +0 -1
- package/dist/utils/runtimeIdentity.context.js +3 -1
- package/dist/utils/runtimeIdentity.context.js.map +1 -1
- package/dist/utils/runtimeIdentity.d.ts +1 -1
- package/dist/utils/runtimeIdentity.js +1 -1
- package/dist/utils/runtimeIdentity.js.map +1 -1
- package/dist/utils/sanitize.d.ts +8 -1
- package/dist/utils/sanitize.js +19 -0
- package/dist/utils/sanitize.js.map +1 -1
- package/dist/utils/streamContext.d.ts +0 -1
- package/dist/utils/timing.d.ts +3 -4
- package/dist/utils/timing.js +4 -4
- package/dist/utils/timing.js.map +1 -1
- package/dist/utils/version.d.ts +14 -8
- package/dist/utils/version.js +35 -24
- package/dist/utils/version.js.map +1 -1
- package/package.json +7 -7
- package/dist/app.d.ts.map +0 -1
- package/dist/browser/blockedPage.d.ts.map +0 -1
- package/dist/browser/browserSupervisor.d.ts.map +0 -1
- package/dist/browser/cdp.d.ts.map +0 -1
- package/dist/browser/channelSelection.d.ts.map +0 -1
- package/dist/browser/consent.d.ts.map +0 -1
- package/dist/browser/display.d.ts.map +0 -1
- package/dist/browser/hlsPlaylistObserver.d.ts.map +0 -1
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/launchGovernor.d.ts.map +0 -1
- package/dist/browser/login.d.ts.map +0 -1
- package/dist/browser/manifestInterceptor.d.ts.map +0 -1
- package/dist/browser/pageStaleness.d.ts.map +0 -1
- package/dist/browser/precaching.d.ts.map +0 -1
- package/dist/browser/tabNetworkObserver.d.ts.map +0 -1
- package/dist/browser/tuning/cache.d.ts.map +0 -1
- package/dist/browser/tuning/comcastPolymer.d.ts.map +0 -1
- package/dist/browser/tuning/cox.d.ts.map +0 -1
- package/dist/browser/tuning/directv.d.ts.map +0 -1
- package/dist/browser/tuning/fox.d.ts.map +0 -1
- package/dist/browser/tuning/gridSearch.d.ts.map +0 -1
- package/dist/browser/tuning/hbo.d.ts.map +0 -1
- package/dist/browser/tuning/hulu.d.ts.map +0 -1
- package/dist/browser/tuning/shared.d.ts.map +0 -1
- package/dist/browser/tuning/sling.d.ts.map +0 -1
- package/dist/browser/tuning/spectrum.d.ts.map +0 -1
- package/dist/browser/tuning/thumbnailRow.d.ts.map +0 -1
- package/dist/browser/tuning/tileClick.d.ts.map +0 -1
- package/dist/browser/tuning/xfinity.d.ts.map +0 -1
- package/dist/browser/tuning/youtubeTv.d.ts.map +0 -1
- package/dist/browser/video.d.ts.map +0 -1
- package/dist/channels/index.d.ts.map +0 -1
- package/dist/config/channelForm.d.ts.map +0 -1
- package/dist/config/consistencyProbe.d.ts.map +0 -1
- package/dist/config/health.d.ts.map +0 -1
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/paths.d.ts.map +0 -1
- package/dist/config/persistence.context.d.ts.map +0 -1
- package/dist/config/persistence.d.ts.map +0 -1
- package/dist/config/presets.d.ts.map +0 -1
- package/dist/config/profiles.d.ts.map +0 -1
- package/dist/config/providerLineups.d.ts.map +0 -1
- package/dist/config/reactivity.d.ts.map +0 -1
- package/dist/config/servicePacks.d.ts.map +0 -1
- package/dist/config/services.d.ts.map +0 -1
- package/dist/config/sites.d.ts.map +0 -1
- package/dist/config/userChannels.d.ts.map +0 -1
- package/dist/config/userConfig.d.ts.map +0 -1
- package/dist/config/userProfiles.d.ts.map +0 -1
- package/dist/hdhr/channelMap.d.ts.map +0 -1
- package/dist/hdhr/deviceId.d.ts.map +0 -1
- package/dist/hdhr/discover.d.ts.map +0 -1
- package/dist/hdhr/getHandlers.d.ts.map +0 -1
- package/dist/hdhr/identity.d.ts.map +0 -1
- package/dist/hdhr/index.d.ts.map +0 -1
- package/dist/hdhr/protocol.d.ts.map +0 -1
- package/dist/hdhr/tunerState.d.ts.map +0 -1
- package/dist/hdhr/udp.d.ts.map +0 -1
- package/dist/identity.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/native/codecInference.d.ts.map +0 -1
- package/dist/native/decrypt.d.ts.map +0 -1
- package/dist/native/index.d.ts.map +0 -1
- package/dist/native/probe.d.ts.map +0 -1
- package/dist/native/proxy.d.ts.map +0 -1
- package/dist/native/tokenExpiry.d.ts.map +0 -1
- package/dist/routes/assets.d.ts.map +0 -1
- package/dist/routes/auth.d.ts.map +0 -1
- package/dist/routes/cdp.d.ts.map +0 -1
- package/dist/routes/channels.d.ts.map +0 -1
- package/dist/routes/clientActions.d.ts.map +0 -1
- package/dist/routes/components.d.ts.map +0 -1
- package/dist/routes/config/channels/endpoints/browse.d.ts.map +0 -1
- package/dist/routes/config/channels/endpoints/bulk.d.ts.map +0 -1
- package/dist/routes/config/channels/endpoints/crud.d.ts.map +0 -1
- package/dist/routes/config/channels/endpoints/importExport.d.ts.map +0 -1
- package/dist/routes/config/channels/endpoints/predefined.d.ts.map +0 -1
- package/dist/routes/config/channels/endpoints/prefs.d.ts.map +0 -1
- package/dist/routes/config/channels/endpoints/service.d.ts.map +0 -1
- package/dist/routes/config/channels/endpoints/tags.d.ts.map +0 -1
- package/dist/routes/config/channels/healthBridge.d.ts.map +0 -1
- package/dist/routes/config/channels/http/handler.d.ts.map +0 -1
- package/dist/routes/config/channels/http/playlistHint.d.ts.map +0 -1
- package/dist/routes/config/channels/http/serviceWarning.d.ts.map +0 -1
- package/dist/routes/config/channels/index.d.ts.map +0 -1
- package/dist/routes/config/channels/setup.d.ts.map +0 -1
- package/dist/routes/config/channels/table.d.ts.map +0 -1
- package/dist/routes/config/http/envelope.d.ts.map +0 -1
- package/dist/routes/config/index.d.ts.map +0 -1
- package/dist/routes/config/services.d.ts.map +0 -1
- package/dist/routes/config/settings.d.ts.map +0 -1
- package/dist/routes/debug.d.ts.map +0 -1
- package/dist/routes/health.d.ts.map +0 -1
- package/dist/routes/hls.d.ts.map +0 -1
- package/dist/routes/icons.d.ts.map +0 -1
- package/dist/routes/index.d.ts.map +0 -1
- package/dist/routes/logs.d.ts.map +0 -1
- package/dist/routes/mpegts.d.ts.map +0 -1
- package/dist/routes/play.d.ts.map +0 -1
- package/dist/routes/playlist.d.ts.map +0 -1
- package/dist/routes/root/content.d.ts.map +0 -1
- package/dist/routes/root/index.d.ts.map +0 -1
- package/dist/routes/root/scripts/channels.d.ts.map +0 -1
- package/dist/routes/root/scripts/clientEscape.d.ts.map +0 -1
- package/dist/routes/root/scripts/clientUrl.d.ts.map +0 -1
- package/dist/routes/root/scripts/config.d.ts.map +0 -1
- package/dist/routes/root/scripts/index.d.ts.map +0 -1
- package/dist/routes/root/scripts/shared.d.ts.map +0 -1
- package/dist/routes/root/scripts/status.d.ts.map +0 -1
- package/dist/routes/root/scripts/status.handlers.d.ts.map +0 -1
- package/dist/routes/root/styles.d.ts.map +0 -1
- package/dist/routes/services.d.ts.map +0 -1
- package/dist/routes/sse.d.ts.map +0 -1
- package/dist/routes/streams.d.ts.map +0 -1
- package/dist/routes/theme.d.ts.map +0 -1
- package/dist/routes/ui.d.ts.map +0 -1
- package/dist/routes/upgrade.d.ts.map +0 -1
- package/dist/service/commands.context.d.ts.map +0 -1
- package/dist/service/commands.d.ts.map +0 -1
- package/dist/service/generators.context.d.ts.map +0 -1
- package/dist/service/generators.d.ts.map +0 -1
- package/dist/service/index.d.ts.map +0 -1
- package/dist/streaming/captureLock.d.ts.map +0 -1
- package/dist/streaming/captureSession.d.ts.map +0 -1
- package/dist/streaming/clients.d.ts.map +0 -1
- package/dist/streaming/codec.d.ts.map +0 -1
- package/dist/streaming/fmp4Segmenter.d.ts.map +0 -1
- package/dist/streaming/hls.d.ts.map +0 -1
- package/dist/streaming/hlsResume.d.ts.map +0 -1
- package/dist/streaming/hlsSegments.d.ts.map +0 -1
- package/dist/streaming/lifecycle.d.ts.map +0 -1
- package/dist/streaming/monitor.d.ts.map +0 -1
- package/dist/streaming/mp4Parser.d.ts.map +0 -1
- package/dist/streaming/mpegts.d.ts.map +0 -1
- package/dist/streaming/playlistBuilder.d.ts.map +0 -1
- package/dist/streaming/preroll.d.ts.map +0 -1
- package/dist/streaming/pretune.d.ts.map +0 -1
- package/dist/streaming/pretuneTimers.d.ts.map +0 -1
- package/dist/streaming/recovery.d.ts.map +0 -1
- package/dist/streaming/registry.d.ts.map +0 -1
- package/dist/streaming/setup.d.ts.map +0 -1
- package/dist/streaming/showInfo.d.ts.map +0 -1
- package/dist/streaming/statusEmitter.d.ts.map +0 -1
- package/dist/types/channels.d.ts.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/profiles.d.ts.map +0 -1
- package/dist/types/selection.d.ts.map +0 -1
- package/dist/types/shared.d.ts.map +0 -1
- package/dist/types/streaming.d.ts.map +0 -1
- package/dist/upgrade/commands.context.d.ts.map +0 -1
- package/dist/upgrade/commands.d.ts.map +0 -1
- package/dist/upgrade/detection.context.d.ts.map +0 -1
- package/dist/upgrade/detection.d.ts.map +0 -1
- package/dist/upgrade/index.d.ts.map +0 -1
- package/dist/upgrade/lifecycle.context.d.ts.map +0 -1
- package/dist/upgrade/lifecycle.d.ts.map +0 -1
- package/dist/upgrade/pathHandle.d.ts.map +0 -1
- package/dist/utils/bootSession.context.d.ts.map +0 -1
- package/dist/utils/bootSession.d.ts.map +0 -1
- package/dist/utils/chromeFetch.d.ts.map +0 -1
- package/dist/utils/cliOutput.d.ts.map +0 -1
- package/dist/utils/clock.d.ts +0 -15
- package/dist/utils/clock.d.ts.map +0 -1
- package/dist/utils/clock.js +0 -31
- package/dist/utils/clock.js.map +0 -1
- package/dist/utils/debugFilter.d.ts.map +0 -1
- package/dist/utils/delay.d.ts.map +0 -1
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/evaluate.d.ts.map +0 -1
- package/dist/utils/ffmpeg.context.d.ts.map +0 -1
- package/dist/utils/ffmpeg.d.ts.map +0 -1
- package/dist/utils/fileLogger.d.ts.map +0 -1
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/logEmitter.d.ts.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/m3u.d.ts.map +0 -1
- package/dist/utils/markup.d.ts.map +0 -1
- package/dist/utils/memo.d.ts.map +0 -1
- package/dist/utils/morganStream.d.ts.map +0 -1
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/pid.d.ts.map +0 -1
- package/dist/utils/platform.d.ts.map +0 -1
- package/dist/utils/processInspector.context.d.ts.map +0 -1
- package/dist/utils/processInspector.d.ts.map +0 -1
- package/dist/utils/retry.d.ts.map +0 -1
- package/dist/utils/runtimeIdentity.context.d.ts.map +0 -1
- package/dist/utils/runtimeIdentity.d.ts.map +0 -1
- package/dist/utils/sanitize.d.ts.map +0 -1
- package/dist/utils/streamContext.d.ts.map +0 -1
- package/dist/utils/timing.d.ts.map +0 -1
- package/dist/utils/version.d.ts.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { canAttemptLaunch, createLaunchGovernorState, noteLaunchFailure, noteLaunchSuccess, noteReadinessLost, noteSustainedHealth } from "./launchGovernor.js";
|
|
2
|
+
import { assertNever } from "../utils/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* Error thrown by acquire() while the governor is cooling (degraded). Carries the timestamp until which launches are blocked so the adapter can surface a
|
|
4
5
|
* Retry-After and a 503-class back-off rather than spawning Chrome. Distinct from a launch failure (which rejects with the underlying launch error).
|
|
@@ -22,6 +23,18 @@ export class BrowserSupersededError extends Error {
|
|
|
22
23
|
this.name = "BrowserSupersededError";
|
|
23
24
|
}
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Thrown by acquire() for a capture purpose on a browser that can no longer start captures. The caller maps it to the same 503 back-off class as
|
|
28
|
+
* BrowserUnavailableError, and it carries no retry horizon because the relaunch that cures it waits on the browser's own streams draining rather than on a clock.
|
|
29
|
+
*/
|
|
30
|
+
export class BrowserCaptureImpairedError extends Error {
|
|
31
|
+
impairment;
|
|
32
|
+
constructor(impairment) {
|
|
33
|
+
super("The browser can no longer start captures and is waiting to relaunch.");
|
|
34
|
+
this.impairment = impairment;
|
|
35
|
+
this.name = "BrowserCaptureImpairedError";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
25
38
|
/**
|
|
26
39
|
* Creates a browser supervisor over the injected ports. The returned object owns the lifecycle and governor state for the process lifetime; the adapter holds one
|
|
27
40
|
* instance and routes all browser access through it.
|
|
@@ -78,7 +91,7 @@ export function createBrowserSupervisor(ports) {
|
|
|
78
91
|
throw new BrowserSupersededError();
|
|
79
92
|
}
|
|
80
93
|
noteLaunchSuccess(governor, ports.now());
|
|
81
|
-
transition({ browser, kind: "ready", launchTime: ports.now() });
|
|
94
|
+
transition({ browser, impairment: null, kind: "ready", launchTime: ports.now() });
|
|
82
95
|
return browser;
|
|
83
96
|
}
|
|
84
97
|
/* Begins a launch in the given phase (launching for a normal acquire, trialing for a post-cooldown trial) and publishes the in-flight promise into the state so
|
|
@@ -92,9 +105,14 @@ export function createBrowserSupervisor(ports) {
|
|
|
92
105
|
transition({ kind, promise });
|
|
93
106
|
return promise;
|
|
94
107
|
}
|
|
95
|
-
async function acquire() {
|
|
108
|
+
async function acquire(purpose) {
|
|
96
109
|
switch (state.kind) {
|
|
97
110
|
case "ready": {
|
|
111
|
+
// A marked browser still opens pages, so only a capture purpose is refused. Refusing here rather than launching is what keeps a second Chrome away from the
|
|
112
|
+
// profile lock this instance still holds while it serves the captures it started; the relaunch is the adapter's to schedule once nothing depends on it.
|
|
113
|
+
if ((purpose === "capture") && state.impairment) {
|
|
114
|
+
throw new BrowserCaptureImpairedError(state.impairment);
|
|
115
|
+
}
|
|
98
116
|
return state.browser;
|
|
99
117
|
}
|
|
100
118
|
// Join the launch already in flight rather than starting a second one - the single-flight guarantee.
|
|
@@ -127,6 +145,23 @@ export function createBrowserSupervisor(ports) {
|
|
|
127
145
|
}
|
|
128
146
|
}
|
|
129
147
|
}
|
|
148
|
+
function captureImpairment() {
|
|
149
|
+
return (state.kind === "ready") ? state.impairment : null;
|
|
150
|
+
}
|
|
151
|
+
/* Records the capture impairment against the published ready browser, and reports whether this call is the one that recorded it.
|
|
152
|
+
*
|
|
153
|
+
* The identity guard is what makes a verdict safe to act on late: the caller confirmed a specific instance, and a disconnect plus relaunch during that
|
|
154
|
+
* confirmation can have replaced it, so a mark aimed at a superseded instance is dropped rather than applied to the healthy browser that took its place. The
|
|
155
|
+
* first mark wins for a reason of its own - the adapter's alarm and its status emit both belong to this transition, so a second verdict against the same
|
|
156
|
+
* instance must not fire either of them again.
|
|
157
|
+
*/
|
|
158
|
+
function handleCaptureImpaired(browser, reason) {
|
|
159
|
+
if ((state.kind !== "ready") || (state.browser !== browser) || (state.impairment !== null)) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
transition({ ...state, impairment: { reason, since: ports.now() } });
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
130
165
|
function current() {
|
|
131
166
|
return (state.kind === "ready") ? state.browser : null;
|
|
132
167
|
}
|
|
@@ -172,15 +207,7 @@ export function createBrowserSupervisor(ports) {
|
|
|
172
207
|
}
|
|
173
208
|
return noteSustainedHealth(governor, ports.now(), ports.policy());
|
|
174
209
|
}
|
|
175
|
-
return { acquire, current, currentLaunchTime, inspect: () => state,
|
|
176
|
-
noteTeardownBegun: handleTeardownBegun };
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Exhaustiveness guard for the lifecycle switch: referencing a `never` makes the compiler flag any unhandled variant if the union grows.
|
|
180
|
-
* @param value - The unreachable value.
|
|
181
|
-
* @returns Never returns.
|
|
182
|
-
*/
|
|
183
|
-
function assertNever(value) {
|
|
184
|
-
throw new Error("Unhandled browser lifecycle state: " + JSON.stringify(value));
|
|
210
|
+
return { acquire, captureImpairment, current, currentLaunchTime, inspect: () => state, noteCaptureImpaired: handleCaptureImpaired,
|
|
211
|
+
noteReadinessLost: handleReadinessLost, noteSustainedHealth: noteSustainedHealthTick, noteTeardownBegun: handleTeardownBegun };
|
|
185
212
|
}
|
|
186
213
|
//# sourceMappingURL=browserSupervisor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserSupervisor.js","sourceRoot":"","sources":["../../src/browser/browserSupervisor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"browserSupervisor.js","sourceRoot":"","sources":["../../src/browser/browserSupervisor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,i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AO,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,qBAAqB;QAC/H,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAC;AACnI,CAAC"}
|
package/dist/browser/cdp.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { CDPSession, Page } from "puppeteer-core";
|
|
2
|
+
import type { Clock } from "homebridge-plugin-utils";
|
|
3
|
+
import type { Nullable } from "../types/index.ts";
|
|
4
|
+
export declare const WINDOW_STATE_POLL_MS = 25;
|
|
5
|
+
export declare const WINDOW_RESTORE_CEILING_MS = 2000;
|
|
2
6
|
/**
|
|
3
7
|
* Executes a CDP (Chrome DevTools Protocol) operation with proper session lifecycle management. This helper handles the common pattern of:
|
|
4
8
|
* 1. Creating a CDP session attached to the page's target
|
|
@@ -13,16 +17,64 @@ import type { CDPSession, Page } from "puppeteer-core";
|
|
|
13
17
|
* @returns The result of the operation, or undefined if the page was closed or an error occurred.
|
|
14
18
|
*/
|
|
15
19
|
export declare function withCDPSession<T>(page: Page, operation: (session: CDPSession, windowId: number) => Promise<T>): Promise<T | undefined>;
|
|
20
|
+
export interface WindowPlacement {
|
|
21
|
+
readonly height: number;
|
|
22
|
+
readonly left: number;
|
|
23
|
+
readonly top: number;
|
|
24
|
+
readonly width: number;
|
|
25
|
+
readonly windowState: string;
|
|
26
|
+
}
|
|
16
27
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
28
|
+
* Reads the window state Chrome reports for the window a page belongs to. Resolves null whenever the state cannot be read at all - a closed page, a target that
|
|
29
|
+
* yields no window ID, or a CDP failure withCDPSession absorbs - so a caller logging this as a diagnostic never has to tell a missing session apart from a
|
|
30
|
+
* missing report.
|
|
31
|
+
* @param page - The Puppeteer page whose window is read.
|
|
32
|
+
* @returns The window state Chrome reports, or null when it cannot be read.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readWindowState(page: Page): Promise<Nullable<string>>;
|
|
35
|
+
/**
|
|
36
|
+
* Reads the full placement - frame and state - of the window a page belongs to, for a caller that means to put a second window in the same spot. Resolves null
|
|
37
|
+
* whenever the placement cannot be read completely: a closed page, a target that yields no window ID, a CDP failure withCDPSession absorbs, or a response
|
|
38
|
+
* missing any one of the four numbers or the state. That strictness lives here rather than in the shared read, because a partial frame is useless to the one
|
|
39
|
+
* consumer this exists for while a partial response is still a perfectly good state report.
|
|
40
|
+
*
|
|
41
|
+
* Mirroring the shared window's own placement is what keeps a second window from disturbing the profile: Chrome persists the window placement it will relaunch
|
|
42
|
+
* at from the last window whose bounds changed, within seconds and regardless of which window the user is working in, and any exit that does not flush that
|
|
43
|
+
* preference - a crash, a forced kill, and the relaunch that follows a crash - carries those bounds into the next launch. A window opened anywhere else writes
|
|
44
|
+
* its own frame there and the shared window comes back at it (measured 2026-08-31).
|
|
45
|
+
* @param page - The Puppeteer page whose window is read.
|
|
46
|
+
* @returns The window's placement, or null when it cannot be read completely.
|
|
47
|
+
*/
|
|
48
|
+
export declare function readWindowPlacement(page: Page): Promise<Nullable<WindowPlacement>>;
|
|
49
|
+
/**
|
|
50
|
+
* Minimizes the browser window, which keeps the desktop clear and the GPU idle while nothing is capturing. Only the window-visibility executor should call this:
|
|
51
|
+
* the window has to stay on screen for as long as any capture stream is reading the compositor, and that decision belongs to decideWindowVisibility in
|
|
52
|
+
* windowSync.ts.
|
|
19
53
|
* @param page - The Puppeteer page object.
|
|
20
54
|
*/
|
|
21
55
|
export declare function minimizeWindow(page: Page): Promise<void>;
|
|
22
56
|
/**
|
|
23
|
-
* Un-minimizes the browser window, restoring it to normal state.
|
|
24
|
-
*
|
|
57
|
+
* Un-minimizes the browser window, restoring it to normal state. The window belongs on screen while a capture stream is reading the compositor's output for it, and
|
|
58
|
+
* while a user is completing TV provider authentication in it. The capability probe calls this directly to make its environment representative of the one capture
|
|
59
|
+
* runs in; every other caller goes through the window-visibility executor, which owns the policy.
|
|
60
|
+
*
|
|
61
|
+
* The contract is a confirmed state, not a fired command: this resolves once Chrome reports the window restored, or once the ceiling lapses with a warning and the
|
|
62
|
+
* window left in whatever state it does report. On macOS a restore runs asynchronously against the acknowledgement of the command that asked for it, and a capture
|
|
63
|
+
* requested against a window still mid-restore is the shape of the 2026-08-26 through 08-28 capture-start failures. A window already on screen confirms on its
|
|
64
|
+
* first read, so the confirmation costs one round trip on the common path.
|
|
25
65
|
* @param page - The Puppeteer page object.
|
|
66
|
+
* @param clock - Clock driving the confirmation cadence and its elapsed measurement. Defaults to the system clock; tests inject a virtual clock.
|
|
67
|
+
*/
|
|
68
|
+
export declare function unminimizeWindow(page: Page, clock?: Clock): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Re-issues a capture page's own declared device metrics. Chrome composes the capture of a selected tab from the window's fitted presentation rather than from the
|
|
71
|
+
* emulated surface, and the override event is what re-selects the composition target: a capture composing the window's view of the page returns to the full
|
|
72
|
+
* emulated surface, and a capture already composing that surface is left exactly as it was. Callable at any time, from anywhere, at any frequency, because the
|
|
73
|
+
* values sent are the ones Puppeteer has already declared on this page - nothing about the page's emulation changes.
|
|
74
|
+
*
|
|
75
|
+
* The command is issued raw rather than through page.setViewport, which drops an override whose values match the standing one. It is the event, not a change of
|
|
76
|
+
* values, that does the work here.
|
|
77
|
+
* @param page - The page to re-affirm. A page carrying no explicitly declared density is left alone.
|
|
78
|
+
* @throws Whatever the CDP send rejects with. Each trigger site decides whether that matters to it.
|
|
26
79
|
*/
|
|
27
|
-
export declare function
|
|
28
|
-
//# sourceMappingURL=cdp.d.ts.map
|
|
80
|
+
export declare function reaffirmCaptureSurface(page: Page): Promise<void>;
|
package/dist/browser/cdp.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { LOG, delay, formatError } from "../utils/index.js";
|
|
1
|
+
import { LOG, delay, formatError, pollUntil } from "../utils/index.js";
|
|
2
|
+
import { systemClock } from "homebridge-plugin-utils";
|
|
2
3
|
/* The Chrome DevTools Protocol (CDP) provides low-level access to Chrome's internal state and capabilities. While Puppeteer abstracts most common operations, some
|
|
3
4
|
* features require direct CDP access:
|
|
4
5
|
*
|
|
5
|
-
* - Window presentation: moving the shared browser window between its normal and minimized states
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* - Window presentation: moving the shared browser window between its normal and minimized states, and reading the state Chrome reports for it. That state is the
|
|
7
|
+
* only window property this application drives, and it is not cosmetic: Chrome's tab capture consumes the compositor's output for the shared window, and a
|
|
8
|
+
* minimized window's output is not composed for capture to read. Which state the window should be in is decided in one place, by decideWindowVisibility in
|
|
9
|
+
* windowSync.ts; these primitives only carry it out and report back what Chrome says came of it.
|
|
10
|
+
*
|
|
11
|
+
* - Capture surface re-affirmation: re-issuing a capture page's own declared device metrics, which is what moves that capture's composition target back to the
|
|
12
|
+
* emulated surface.
|
|
8
13
|
*
|
|
9
14
|
* - Browser-level operations: Operations that affect the browser rather than a specific page, like getting the window ID for a page's target.
|
|
10
15
|
*
|
|
@@ -15,6 +20,13 @@ import { LOG, delay, formatError } from "../utils/index.js";
|
|
|
15
20
|
*
|
|
16
21
|
* The withCDPSession helper encapsulates the common pattern of creating a session, getting the window ID, performing an operation, and handling errors.
|
|
17
22
|
*/
|
|
23
|
+
// The wait between one read of the window's state and the next while a restore is in flight. This is a cadence rather than a settle - nothing is being given time
|
|
24
|
+
// to happen, Chrome is simply being asked again - and the measured macOS restore completes in roughly a quarter second, so a genuine restore costs about ten reads
|
|
25
|
+
// and a window already on screen costs exactly one.
|
|
26
|
+
export const WINDOW_STATE_POLL_MS = 25;
|
|
27
|
+
// The bound on how long a restore may take to report itself complete. Eight times the measured restore, so a lapse is a genuine fault worth a warning rather than
|
|
28
|
+
// a slow-but-healthy transition. Lapsing never blocks the caller: capture proceeds against whatever state Chrome reports.
|
|
29
|
+
export const WINDOW_RESTORE_CEILING_MS = 2000;
|
|
18
30
|
/**
|
|
19
31
|
* Executes a CDP (Chrome DevTools Protocol) operation with proper session lifecycle management. This helper handles the common pattern of:
|
|
20
32
|
* 1. Creating a CDP session attached to the page's target
|
|
@@ -59,8 +71,72 @@ export async function withCDPSession(page, operation) {
|
|
|
59
71
|
}
|
|
60
72
|
}
|
|
61
73
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
74
|
+
* Reads the bounds Chrome reports for a window, through a session that is already open. Private to this module and the one place the frame is read: the state
|
|
75
|
+
* derivation below, the restore confirmation, and the page-level placement read all take their answer from this single call, so no other site composes the
|
|
76
|
+
* request. A response carrying no bounds reads as null rather than throwing, because an absent report is an answer every derivation already branches on. The
|
|
77
|
+
* frame comes back for a minimized window too - Chrome reports the frame it is resting at, which is exactly what a window created beside it needs.
|
|
78
|
+
* @param session - An open CDP session attached to the page's target.
|
|
79
|
+
* @param windowId - The browser window ID that session resolved.
|
|
80
|
+
* @returns The bounds Chrome reports, with every field as optional as Chrome leaves it, or null when the response carries none.
|
|
81
|
+
*/
|
|
82
|
+
async function readWindowBoundsWith(session, windowId) {
|
|
83
|
+
const response = await session.send("Browser.getWindowBounds", { windowId });
|
|
84
|
+
return response?.bounds ?? null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Reads the window state Chrome reports for a window, through a session that is already open. Private to this module: the restore confirmation below and the
|
|
88
|
+
* page-level readWindowState both ask Chrome through the shared read above, so no other site composes the request. A response carrying no bounds, or bounds
|
|
89
|
+
* carrying no state, reads as null rather than throwing, because an absent report is an answer its callers already branch on.
|
|
90
|
+
* @param session - An open CDP session attached to the page's target.
|
|
91
|
+
* @param windowId - The browser window ID that session resolved.
|
|
92
|
+
* @returns The window state Chrome reports, or null when the response carries none.
|
|
93
|
+
*/
|
|
94
|
+
async function readWindowStateWith(session, windowId) {
|
|
95
|
+
return (await readWindowBoundsWith(session, windowId))?.windowState ?? null;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Reads the window state Chrome reports for the window a page belongs to. Resolves null whenever the state cannot be read at all - a closed page, a target that
|
|
99
|
+
* yields no window ID, or a CDP failure withCDPSession absorbs - so a caller logging this as a diagnostic never has to tell a missing session apart from a
|
|
100
|
+
* missing report.
|
|
101
|
+
* @param page - The Puppeteer page whose window is read.
|
|
102
|
+
* @returns The window state Chrome reports, or null when it cannot be read.
|
|
103
|
+
*/
|
|
104
|
+
export async function readWindowState(page) {
|
|
105
|
+
return (await withCDPSession(page, readWindowStateWith)) ?? null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Reads the full placement - frame and state - of the window a page belongs to, for a caller that means to put a second window in the same spot. Resolves null
|
|
109
|
+
* whenever the placement cannot be read completely: a closed page, a target that yields no window ID, a CDP failure withCDPSession absorbs, or a response
|
|
110
|
+
* missing any one of the four numbers or the state. That strictness lives here rather than in the shared read, because a partial frame is useless to the one
|
|
111
|
+
* consumer this exists for while a partial response is still a perfectly good state report.
|
|
112
|
+
*
|
|
113
|
+
* Mirroring the shared window's own placement is what keeps a second window from disturbing the profile: Chrome persists the window placement it will relaunch
|
|
114
|
+
* at from the last window whose bounds changed, within seconds and regardless of which window the user is working in, and any exit that does not flush that
|
|
115
|
+
* preference - a crash, a forced kill, and the relaunch that follows a crash - carries those bounds into the next launch. A window opened anywhere else writes
|
|
116
|
+
* its own frame there and the shared window comes back at it (measured 2026-08-31).
|
|
117
|
+
* @param page - The Puppeteer page whose window is read.
|
|
118
|
+
* @returns The window's placement, or null when it cannot be read completely.
|
|
119
|
+
*/
|
|
120
|
+
export async function readWindowPlacement(page) {
|
|
121
|
+
return (await withCDPSession(page, async (session, windowId) => {
|
|
122
|
+
const bounds = await readWindowBoundsWith(session, windowId);
|
|
123
|
+
if (!bounds) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
const { height, left, top, width, windowState } = bounds;
|
|
127
|
+
// Each field's presence is a type test rather than a truthiness test: a window flush against the top or the left edge of the screen reports that
|
|
128
|
+
// coordinate as 0, which a truthiness test would discard as a missing placement.
|
|
129
|
+
if ((typeof height !== "number") || (typeof left !== "number") || (typeof top !== "number") || (typeof width !== "number") ||
|
|
130
|
+
(typeof windowState !== "string")) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
return { height, left, top, width, windowState };
|
|
134
|
+
})) ?? null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Minimizes the browser window, which keeps the desktop clear and the GPU idle while nothing is capturing. Only the window-visibility executor should call this:
|
|
138
|
+
* the window has to stay on screen for as long as any capture stream is reading the compositor, and that decision belongs to decideWindowVisibility in
|
|
139
|
+
* windowSync.ts.
|
|
64
140
|
* @param page - The Puppeteer page object.
|
|
65
141
|
*/
|
|
66
142
|
export async function minimizeWindow(page) {
|
|
@@ -81,11 +157,18 @@ export async function minimizeWindow(page) {
|
|
|
81
157
|
});
|
|
82
158
|
}
|
|
83
159
|
/**
|
|
84
|
-
* Un-minimizes the browser window, restoring it to normal state.
|
|
85
|
-
*
|
|
160
|
+
* Un-minimizes the browser window, restoring it to normal state. The window belongs on screen while a capture stream is reading the compositor's output for it, and
|
|
161
|
+
* while a user is completing TV provider authentication in it. The capability probe calls this directly to make its environment representative of the one capture
|
|
162
|
+
* runs in; every other caller goes through the window-visibility executor, which owns the policy.
|
|
163
|
+
*
|
|
164
|
+
* The contract is a confirmed state, not a fired command: this resolves once Chrome reports the window restored, or once the ceiling lapses with a warning and the
|
|
165
|
+
* window left in whatever state it does report. On macOS a restore runs asynchronously against the acknowledgement of the command that asked for it, and a capture
|
|
166
|
+
* requested against a window still mid-restore is the shape of the 2026-08-26 through 08-28 capture-start failures. A window already on screen confirms on its
|
|
167
|
+
* first read, so the confirmation costs one round trip on the common path.
|
|
86
168
|
* @param page - The Puppeteer page object.
|
|
169
|
+
* @param clock - Clock driving the confirmation cadence and its elapsed measurement. Defaults to the system clock; tests inject a virtual clock.
|
|
87
170
|
*/
|
|
88
|
-
export async function unminimizeWindow(page) {
|
|
171
|
+
export async function unminimizeWindow(page, clock = systemClock) {
|
|
89
172
|
// Early exit if the page is already closed.
|
|
90
173
|
if (page.isClosed()) {
|
|
91
174
|
return;
|
|
@@ -96,6 +179,61 @@ export async function unminimizeWindow(page) {
|
|
|
96
179
|
bounds: { windowState: "normal" },
|
|
97
180
|
windowId
|
|
98
181
|
});
|
|
182
|
+
// Confirm the restore against Chrome's own report rather than against the acknowledgement above, which arrives while the window manager is still working.
|
|
183
|
+
const startedAt = clock.now();
|
|
184
|
+
const outcome = await pollUntil({ cadenceMs: WINDOW_STATE_POLL_MS, ceilingMs: WINDOW_RESTORE_CEILING_MS, clock,
|
|
185
|
+
read: () => readWindowStateWith(session, windowId), until: (state) => state === "normal" });
|
|
186
|
+
if (outcome.status === "lapsed") {
|
|
187
|
+
/* A lapse is reported and then stepped past. The window's presentation is the caller's precondition, not its permission: blocking capture on a window that
|
|
188
|
+
* will not report itself restored would convert a presentation fault into a stream failure, which is strictly worse than capturing against a window whose
|
|
189
|
+
* state we have named in the log.
|
|
190
|
+
*/
|
|
191
|
+
LOG.warn("The browser window did not report a completed restore within %dms; continuing with the window in its reported state.", WINDOW_RESTORE_CEILING_MS, { windowState: outcome.value });
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
LOG.debug("browser:lifecycle", "The window reported its restore complete after %dms (%d reads).", clock.now() - startedAt, outcome.reads);
|
|
195
|
+
}
|
|
99
196
|
});
|
|
100
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Re-issues a capture page's own declared device metrics. Chrome composes the capture of a selected tab from the window's fitted presentation rather than from the
|
|
200
|
+
* emulated surface, and the override event is what re-selects the composition target: a capture composing the window's view of the page returns to the full
|
|
201
|
+
* emulated surface, and a capture already composing that surface is left exactly as it was. Callable at any time, from anywhere, at any frequency, because the
|
|
202
|
+
* values sent are the ones Puppeteer has already declared on this page - nothing about the page's emulation changes.
|
|
203
|
+
*
|
|
204
|
+
* The command is issued raw rather than through page.setViewport, which drops an override whose values match the standing one. It is the event, not a change of
|
|
205
|
+
* values, that does the work here.
|
|
206
|
+
* @param page - The page to re-affirm. A page carrying no explicitly declared density is left alone.
|
|
207
|
+
* @throws Whatever the CDP send rejects with. Each trigger site decides whether that matters to it.
|
|
208
|
+
*/
|
|
209
|
+
export async function reaffirmCaptureSurface(page) {
|
|
210
|
+
/* An explicitly declared, positive density is precisely the mark of a capture page, which is what makes this function safe to fire at any page from any trigger.
|
|
211
|
+
* A page PrismCast has not emulated carries no viewport at all and falls out on the first test; a page emulated for layout declares the display's own density
|
|
212
|
+
* through Chrome's disable value of 0, which the positive test excludes. The narrowing runs in two steps because the send forwards the page's own dimensions as
|
|
213
|
+
* well: the record is nullable, and its density is optional where CDP's field is required.
|
|
214
|
+
*/
|
|
215
|
+
const viewport = page.viewport();
|
|
216
|
+
if (!viewport) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const deviceScaleFactor = viewport.deviceScaleFactor;
|
|
220
|
+
if ((typeof deviceScaleFactor !== "number") || !(deviceScaleFactor > 0)) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const session = await page.createCDPSession();
|
|
224
|
+
try {
|
|
225
|
+
await session.send("Emulation.setDeviceMetricsOverride", { deviceScaleFactor, height: viewport.height, mobile: false, width: viewport.width });
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
/* The detach carries a catch of its own. A page that dies mid-send takes its session with it, and a throw raised out of this finally would replace the send's
|
|
229
|
+
* rejection with a detach failure the caller can do nothing about - the send's own reason has to reach the caller unaltered.
|
|
230
|
+
*/
|
|
231
|
+
try {
|
|
232
|
+
await session.detach();
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// The session is already gone, which is the state the detach was asking for.
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
101
239
|
//# sourceMappingURL=cdp.js.map
|
package/dist/browser/cdp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdp.js","sourceRoot":"","sources":["../../src/brow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,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAE9C,IAAI,CAAC;QAEH,MAAM,OAAO,CAAC,IAAI,CAAC,oCAAoC,EAAE,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IACjJ,CAAC;YAAS,CAAC;QAET;;WAEG;QACH,IAAI,CAAC;YAEH,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YAEP,6EAA6E;QAC/E,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ChannelSelectorResult, Nullable, ProviderModule, ResolvedSiteProfile } from "../types/index.ts";
|
|
1
|
+
import type { ChannelSelectorResult, Nullable, ProviderModule, ResolvedSiteProfile, StrategyNavigator } from "../types/index.ts";
|
|
2
|
+
import type { Clock } from "homebridge-plugin-utils";
|
|
2
3
|
import type { Page } from "puppeteer-core";
|
|
3
4
|
/**
|
|
4
5
|
* Returns a direct watch URL for the channel specified in the profile, if one can be resolved. Looks up the strategy entry's resolveDirectUrl hook and calls it
|
|
@@ -32,8 +33,8 @@ export declare function resolveDirectUrl(profile: ResolvedSiteProfile, page: Pag
|
|
|
32
33
|
*/
|
|
33
34
|
export declare function invalidateDirectUrl(profile: ResolvedSiteProfile, cause: unknown): boolean;
|
|
34
35
|
/**
|
|
35
|
-
* Clears all channel selection caches. Called by
|
|
36
|
-
*
|
|
36
|
+
* Clears all channel selection caches. Called by browser/index.ts wherever a browser session ends - the disconnect handler's readiness relinquish and the restart
|
|
37
|
+
* routine's relaunch - since cached state (guide row positions, discovered page URLs, watch URLs) may be stale in a new browser session.
|
|
37
38
|
*/
|
|
38
39
|
export declare function clearChannelSelectionCaches(): void;
|
|
39
40
|
/**
|
|
@@ -50,6 +51,13 @@ export declare function getProviderBySlug(slug: string): ProviderModule | undefi
|
|
|
50
51
|
* @returns The matching provider module or undefined.
|
|
51
52
|
*/
|
|
52
53
|
export declare function getProviderByStrategy(strategyName: string): ProviderModule | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the strategy's own navigator for the given profile, when its provider declares one. The navigation and reload functions in video.ts read this ahead of
|
|
56
|
+
* every document load, so a provider that owns its route into its site is honored on every path without the callers knowing which provider it is.
|
|
57
|
+
* @param profile - The resolved site profile.
|
|
58
|
+
* @returns The navigator, or undefined when the strategy loads its pages by URL.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getStrategyNavigator(profile: ResolvedSiteProfile): StrategyNavigator | undefined;
|
|
53
61
|
/**
|
|
54
62
|
* Returns all registered provider module slugs. Used for validation in the checkboxList setting for precache providers.
|
|
55
63
|
* @returns Array of provider slugs.
|
|
@@ -110,6 +118,11 @@ export { logAvailableChannels, normalizeChannelName, resolveMatchSelector, scrol
|
|
|
110
118
|
* Options that callers may supply to selectChannel(). All fields are optional; selectChannel() may be called with no options.
|
|
111
119
|
*/
|
|
112
120
|
export interface SelectChannelOptions {
|
|
121
|
+
/**
|
|
122
|
+
* The clock the pre-selection scroll poll's cadence and ceiling read. Defaults to the system clock, so a caller that holds no clock passes nothing. The tune
|
|
123
|
+
* orchestrator threads its own clock here, while the provider strategies behind the shared strategy types keep running on the poll policy's default.
|
|
124
|
+
*/
|
|
125
|
+
readonly clock?: Clock;
|
|
113
126
|
/**
|
|
114
127
|
* Callback invoked when the resolution layer converts a category selector to a concrete per-user channel identifier. The framework calls this with the resolved
|
|
115
128
|
* call sign so the caller can persist the value to the user's channel store. After persistence, subsequent tunes start with the concrete selector and skip the
|
|
@@ -122,7 +135,7 @@ export interface SelectChannelOptions {
|
|
|
122
135
|
* Null/undefined means "do not persist." The resolution still happens and the resolved selector is used for this tune; it just isn't saved. Useful for ad-hoc
|
|
123
136
|
* tunes (no associated channel record) and for testing.
|
|
124
137
|
*/
|
|
125
|
-
persistResolution?: (resolvedSelector: string) => Promise<void>;
|
|
138
|
+
readonly persistResolution?: (resolvedSelector: string) => Promise<void>;
|
|
126
139
|
}
|
|
127
140
|
/**
|
|
128
141
|
* Selects a channel from a multi-channel player UI using the strategy specified in the profile. This is the main entry point for channel selection, called by
|
|
@@ -140,8 +153,7 @@ export interface SelectChannelOptions {
|
|
|
140
153
|
* - Strategy dispatch based on profile.channelSelection.strategy.
|
|
141
154
|
* @param page - The Puppeteer page object.
|
|
142
155
|
* @param profile - The resolved site profile containing channelSelection config and channelSelector slug.
|
|
143
|
-
* @param options -
|
|
156
|
+
* @param options - The clock the scroll poll runs on and the resolution layer's persistence callback. See SelectChannelOptions.
|
|
144
157
|
* @returns Result object with success status and optional failure reason.
|
|
145
158
|
*/
|
|
146
159
|
export declare function selectChannel(page: Page, profile: ResolvedSiteProfile, options?: SelectChannelOptions): Promise<ChannelSelectorResult>;
|
|
147
|
-
//# sourceMappingURL=channelSelection.d.ts.map
|