prismcast 1.5.2 → 1.7.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.
Files changed (239) hide show
  1. package/README.md +44 -28
  2. package/dist/app.d.ts +5 -0
  3. package/dist/app.js +63 -5
  4. package/dist/app.js.map +1 -1
  5. package/dist/browser/cdp.js +1 -1
  6. package/dist/browser/cdp.js.map +1 -1
  7. package/dist/browser/channelSelection.d.ts +10 -34
  8. package/dist/browser/channelSelection.js +31 -96
  9. package/dist/browser/channelSelection.js.map +1 -1
  10. package/dist/browser/display.d.ts +19 -0
  11. package/dist/browser/display.js +16 -11
  12. package/dist/browser/display.js.map +1 -1
  13. package/dist/browser/index.d.ts +31 -54
  14. package/dist/browser/index.js +334 -272
  15. package/dist/browser/index.js.map +1 -1
  16. package/dist/browser/login.d.ts +65 -0
  17. package/dist/browser/login.js +193 -0
  18. package/dist/browser/login.js.map +1 -0
  19. package/dist/browser/precaching.js +15 -3
  20. package/dist/browser/precaching.js.map +1 -1
  21. package/dist/browser/tuning/comcastPolymer.d.ts +23 -0
  22. package/dist/browser/tuning/comcastPolymer.js +655 -0
  23. package/dist/browser/tuning/comcastPolymer.js.map +1 -0
  24. package/dist/browser/tuning/cox.d.ts +2 -0
  25. package/dist/browser/tuning/cox.js +14 -0
  26. package/dist/browser/tuning/cox.js.map +1 -0
  27. package/dist/browser/tuning/directv.js +14 -1
  28. package/dist/browser/tuning/directv.js.map +1 -1
  29. package/dist/browser/tuning/fox.js +14 -2
  30. package/dist/browser/tuning/fox.js.map +1 -1
  31. package/dist/browser/tuning/hbo.js +12 -1
  32. package/dist/browser/tuning/hbo.js.map +1 -1
  33. package/dist/browser/tuning/hulu.js +24 -1
  34. package/dist/browser/tuning/hulu.js.map +1 -1
  35. package/dist/browser/tuning/shared.d.ts +46 -0
  36. package/dist/browser/tuning/shared.js +100 -0
  37. package/dist/browser/tuning/shared.js.map +1 -0
  38. package/dist/browser/tuning/sling.js +35 -5
  39. package/dist/browser/tuning/sling.js.map +1 -1
  40. package/dist/browser/tuning/spectrum.js +13 -1
  41. package/dist/browser/tuning/spectrum.js.map +1 -1
  42. package/dist/browser/tuning/thumbnailRow.js +1 -1
  43. package/dist/browser/tuning/thumbnailRow.js.map +1 -1
  44. package/dist/browser/tuning/tileClick.js +1 -1
  45. package/dist/browser/tuning/tileClick.js.map +1 -1
  46. package/dist/browser/tuning/xfinity.d.ts +2 -0
  47. package/dist/browser/tuning/xfinity.js +14 -0
  48. package/dist/browser/tuning/xfinity.js.map +1 -0
  49. package/dist/browser/tuning/youtubeTv.js +15 -1
  50. package/dist/browser/tuning/youtubeTv.js.map +1 -1
  51. package/dist/browser/video.d.ts +20 -0
  52. package/dist/browser/video.js +168 -124
  53. package/dist/browser/video.js.map +1 -1
  54. package/dist/channels/index.d.ts +2 -2
  55. package/dist/channels/index.js +2075 -683
  56. package/dist/channels/index.js.map +1 -1
  57. package/dist/config/health.d.ts +28 -28
  58. package/dist/config/health.js +72 -54
  59. package/dist/config/health.js.map +1 -1
  60. package/dist/config/index.js +29 -64
  61. package/dist/config/index.js.map +1 -1
  62. package/dist/config/paths.d.ts +12 -0
  63. package/dist/config/paths.js +16 -0
  64. package/dist/config/paths.js.map +1 -1
  65. package/dist/config/profiles.d.ts +3 -2
  66. package/dist/config/profiles.js +45 -34
  67. package/dist/config/profiles.js.map +1 -1
  68. package/dist/config/providerPacks.js +4 -1
  69. package/dist/config/providerPacks.js.map +1 -1
  70. package/dist/config/providers.d.ts +19 -5
  71. package/dist/config/providers.js +123 -93
  72. package/dist/config/providers.js.map +1 -1
  73. package/dist/config/sites.d.ts +28 -0
  74. package/dist/config/sites.js +104 -127
  75. package/dist/config/sites.js.map +1 -1
  76. package/dist/config/userChannels.d.ts +53 -2
  77. package/dist/config/userChannels.js +222 -13
  78. package/dist/config/userChannels.js.map +1 -1
  79. package/dist/config/userConfig.d.ts +2 -1
  80. package/dist/config/userConfig.js +6 -15
  81. package/dist/config/userConfig.js.map +1 -1
  82. package/dist/config/userProfiles.d.ts +0 -1
  83. package/dist/config/userProfiles.js +18 -10
  84. package/dist/config/userProfiles.js.map +1 -1
  85. package/dist/hdhr/channelMap.d.ts +1 -1
  86. package/dist/hdhr/channelMap.js +4 -4
  87. package/dist/hdhr/channelMap.js.map +1 -1
  88. package/dist/index.js +25 -22
  89. package/dist/index.js.map +1 -1
  90. package/dist/native/decrypt.d.ts +32 -0
  91. package/dist/native/decrypt.js +85 -0
  92. package/dist/native/decrypt.js.map +1 -0
  93. package/dist/native/index.d.ts +61 -0
  94. package/dist/native/index.js +342 -0
  95. package/dist/native/index.js.map +1 -0
  96. package/dist/native/intercept.d.ts +35 -0
  97. package/dist/native/intercept.js +184 -0
  98. package/dist/native/intercept.js.map +1 -0
  99. package/dist/native/probe.d.ts +49 -0
  100. package/dist/native/probe.js +294 -0
  101. package/dist/native/probe.js.map +1 -0
  102. package/dist/native/proxy.d.ts +54 -0
  103. package/dist/native/proxy.js +947 -0
  104. package/dist/native/proxy.js.map +1 -0
  105. package/dist/routes/components.d.ts +43 -0
  106. package/dist/routes/components.js +122 -0
  107. package/dist/routes/components.js.map +1 -1
  108. package/dist/routes/config/channels/index.d.ts +2 -2
  109. package/dist/routes/config/channels/index.js +1 -1
  110. package/dist/routes/config/channels/index.js.map +1 -1
  111. package/dist/routes/config/channels/routes.js +443 -65
  112. package/dist/routes/config/channels/routes.js.map +1 -1
  113. package/dist/routes/config/channels/table.d.ts +76 -0
  114. package/dist/routes/config/channels/table.js +369 -89
  115. package/dist/routes/config/channels/table.js.map +1 -1
  116. package/dist/routes/config/index.d.ts +1 -1
  117. package/dist/routes/config/index.js +1 -1
  118. package/dist/routes/config/index.js.map +1 -1
  119. package/dist/routes/config/providers.d.ts +6 -6
  120. package/dist/routes/config/providers.js +73 -99
  121. package/dist/routes/config/providers.js.map +1 -1
  122. package/dist/routes/debug.js +5 -5
  123. package/dist/routes/debug.js.map +1 -1
  124. package/dist/routes/hls.js +12 -2
  125. package/dist/routes/hls.js.map +1 -1
  126. package/dist/routes/index.d.ts +0 -15
  127. package/dist/routes/index.js +2 -16
  128. package/dist/routes/index.js.map +1 -1
  129. package/dist/routes/providers.js +106 -3
  130. package/dist/routes/providers.js.map +1 -1
  131. package/dist/routes/root/content.js +124 -47
  132. package/dist/routes/root/content.js.map +1 -1
  133. package/dist/routes/root/index.js +2 -1
  134. package/dist/routes/root/index.js.map +1 -1
  135. package/dist/routes/root/scripts/channels.js +772 -312
  136. package/dist/routes/root/scripts/channels.js.map +1 -1
  137. package/dist/routes/root/scripts/config.js +596 -544
  138. package/dist/routes/root/scripts/config.js.map +1 -1
  139. package/dist/routes/root/scripts/index.d.ts +1 -0
  140. package/dist/routes/root/scripts/index.js +1 -0
  141. package/dist/routes/root/scripts/index.js.map +1 -1
  142. package/dist/routes/root/scripts/shared.d.ts +6 -0
  143. package/dist/routes/root/scripts/shared.js +391 -0
  144. package/dist/routes/root/scripts/shared.js.map +1 -0
  145. package/dist/routes/root/scripts/status.js +49 -33
  146. package/dist/routes/root/scripts/status.js.map +1 -1
  147. package/dist/routes/root/styles.js +117 -10
  148. package/dist/routes/root/styles.js.map +1 -1
  149. package/dist/service/commands.js +2 -1
  150. package/dist/service/commands.js.map +1 -1
  151. package/dist/streaming/fmp4Segmenter.d.ts +5 -0
  152. package/dist/streaming/fmp4Segmenter.js +146 -42
  153. package/dist/streaming/fmp4Segmenter.js.map +1 -1
  154. package/dist/streaming/hls.d.ts +24 -19
  155. package/dist/streaming/hls.js +603 -297
  156. package/dist/streaming/hls.js.map +1 -1
  157. package/dist/streaming/hlsResume.d.ts +16 -3
  158. package/dist/streaming/hlsResume.js +35 -8
  159. package/dist/streaming/hlsResume.js.map +1 -1
  160. package/dist/streaming/hlsSegments.d.ts +41 -2
  161. package/dist/streaming/hlsSegments.js +131 -28
  162. package/dist/streaming/hlsSegments.js.map +1 -1
  163. package/dist/streaming/lifecycle.js +27 -13
  164. package/dist/streaming/lifecycle.js.map +1 -1
  165. package/dist/streaming/monitor.d.ts +1 -0
  166. package/dist/streaming/monitor.js +862 -474
  167. package/dist/streaming/monitor.js.map +1 -1
  168. package/dist/streaming/mp4Parser.d.ts +52 -6
  169. package/dist/streaming/mp4Parser.js +156 -30
  170. package/dist/streaming/mp4Parser.js.map +1 -1
  171. package/dist/streaming/mpegts.d.ts +2 -2
  172. package/dist/streaming/mpegts.js +156 -109
  173. package/dist/streaming/mpegts.js.map +1 -1
  174. package/dist/streaming/playlistBuilder.d.ts +38 -0
  175. package/dist/streaming/playlistBuilder.js +66 -0
  176. package/dist/streaming/playlistBuilder.js.map +1 -0
  177. package/dist/streaming/preroll.d.ts +126 -0
  178. package/dist/streaming/preroll.js +434 -0
  179. package/dist/streaming/preroll.js.map +1 -0
  180. package/dist/streaming/pretune.d.ts +8 -0
  181. package/dist/streaming/pretune.js +226 -0
  182. package/dist/streaming/pretune.js.map +1 -0
  183. package/dist/streaming/recovery.d.ts +0 -6
  184. package/dist/streaming/recovery.js +0 -8
  185. package/dist/streaming/recovery.js.map +1 -1
  186. package/dist/streaming/registry.d.ts +57 -9
  187. package/dist/streaming/registry.js +26 -7
  188. package/dist/streaming/registry.js.map +1 -1
  189. package/dist/streaming/setup.d.ts +8 -1
  190. package/dist/streaming/setup.js +71 -27
  191. package/dist/streaming/setup.js.map +1 -1
  192. package/dist/streaming/showInfo.d.ts +29 -4
  193. package/dist/streaming/showInfo.js +210 -38
  194. package/dist/streaming/showInfo.js.map +1 -1
  195. package/dist/streaming/statusEmitter.d.ts +20 -6
  196. package/dist/streaming/statusEmitter.js +31 -7
  197. package/dist/streaming/statusEmitter.js.map +1 -1
  198. package/dist/types/channels.d.ts +32 -0
  199. package/dist/types/config.d.ts +2 -2
  200. package/dist/types/index.d.ts +2 -2
  201. package/dist/types/index.js.map +1 -1
  202. package/dist/types/profiles.d.ts +13 -1
  203. package/dist/types/selection.d.ts +5 -1
  204. package/dist/types/shared.d.ts +1 -1
  205. package/dist/types/streaming.d.ts +7 -0
  206. package/dist/utils/chromeFetch.d.ts +20 -0
  207. package/dist/utils/chromeFetch.js +43 -0
  208. package/dist/utils/chromeFetch.js.map +1 -0
  209. package/dist/utils/debugFilter.d.ts +0 -5
  210. package/dist/utils/debugFilter.js +20 -11
  211. package/dist/utils/debugFilter.js.map +1 -1
  212. package/dist/utils/delay.d.ts +28 -0
  213. package/dist/utils/delay.js +35 -1
  214. package/dist/utils/delay.js.map +1 -1
  215. package/dist/utils/evaluate.js +6 -11
  216. package/dist/utils/evaluate.js.map +1 -1
  217. package/dist/utils/ffmpeg.d.ts +14 -12
  218. package/dist/utils/ffmpeg.js +114 -134
  219. package/dist/utils/ffmpeg.js.map +1 -1
  220. package/dist/utils/format.d.ts +6 -0
  221. package/dist/utils/format.js +8 -0
  222. package/dist/utils/format.js.map +1 -1
  223. package/dist/utils/index.d.ts +3 -0
  224. package/dist/utils/index.js +3 -0
  225. package/dist/utils/index.js.map +1 -1
  226. package/dist/utils/logEmitter.js +1 -1
  227. package/dist/utils/logEmitter.js.map +1 -1
  228. package/dist/utils/pid.d.ts +40 -0
  229. package/dist/utils/pid.js +83 -0
  230. package/dist/utils/pid.js.map +1 -0
  231. package/dist/utils/retry.d.ts +15 -9
  232. package/dist/utils/retry.js +7 -23
  233. package/dist/utils/retry.js.map +1 -1
  234. package/dist/utils/timing.d.ts +5 -0
  235. package/dist/utils/timing.js +13 -0
  236. package/dist/utils/timing.js.map +1 -0
  237. package/dist/utils/version.js +2 -2
  238. package/dist/utils/version.js.map +1 -1
  239. package/package.json +7 -7
@@ -1,15 +1,18 @@
1
1
  import { LOG, delay, evaluateWithAbort } from "../utils/index.js";
2
- import { CHANNELS } from "../channels/index.js";
2
+ import { getDomainConfig, registerProviderModuleProfile } from "../config/sites.js";
3
3
  import { CONFIG } from "../config/index.js";
4
+ import { coxProvider } from "./tuning/cox.js";
4
5
  import { directvProvider } from "./tuning/directv.js";
5
6
  import { foxProvider } from "./tuning/fox.js";
6
7
  import { hboProvider } from "./tuning/hbo.js";
7
8
  import { huluProvider } from "./tuning/hulu.js";
8
9
  import { isChannelSelectionProfile } from "../types/index.js";
10
+ import { resolveMatchSelector } from "./tuning/shared.js";
9
11
  import { slingProvider } from "./tuning/sling.js";
10
12
  import { spectrumProvider } from "./tuning/spectrum.js";
11
13
  import { thumbnailRowStrategy } from "./tuning/thumbnailRow.js";
12
14
  import { tileClickStrategy } from "./tuning/tileClick.js";
15
+ import { xfinityProvider } from "./tuning/xfinity.js";
13
16
  import { yttvProvider } from "./tuning/youtubeTv.js";
14
17
  /* Multi-channel streaming sites (like USA Network) present multiple channels on a single page, with a program guide for each channel. Users must select which
15
18
  * channel they want to watch by clicking on a show in the guide. This module coordinates the dispatch to per-provider strategy functions in the tuning/ directory.
@@ -18,8 +21,8 @@ import { yttvProvider } from "./tuning/youtubeTv.js";
18
21
  * discoverChannels implementation. The coordinator builds its strategy dispatch lookup from provider modules at evaluation time. Generic strategies
19
22
  * (thumbnailRow, tileClick) remain bare ChannelStrategyEntry objects — they are site-specific interaction patterns, not provider-level registrations.
20
23
  *
21
- * Strategy files may import scrollAndClick(), normalizeChannelName(), and resolveMatchSelector() from this coordinator the circular import is safe because
22
- * all cross-module calls happen inside async functions long after module evaluation completes.
24
+ * Shared utilities (scrollAndClick, normalizeChannelName, resolveMatchSelector, logAvailableChannels) live in tuning/shared.ts so that tuning strategy files can
25
+ * import them without creating a circular dependency with this coordinator. This module re-exports them for backward compatibility.
23
26
  */
24
27
  /* Adding a new channel selection provider:
25
28
  *
@@ -27,11 +30,12 @@ import { yttvProvider } from "./tuning/youtubeTv.js";
27
30
  * 2. Export a single ProviderModule object from the file. Set the required fields:
28
31
  * - slug, label, guideUrl: Identity metadata for API endpoints and logging.
29
32
  * - strategyName: The ChannelSelectionStrategy union value that site profiles reference.
33
+ * - profile, profileName: The SiteProfile definition and its name (e.g., "huluLive"). Registered automatically by the coordinator at import time.
30
34
  * - strategy: A ChannelStrategyEntry with at minimum an execute hook. Also set clearCache, resolveDirectUrl, and invalidateDirectUrl as needed.
31
35
  * - discoverChannels: Reads the provider's guide for all available channels, returning DiscoveredChannel[].
32
36
  * 3. Import the provider here and add it to the providerModules array.
33
37
  * 4. Add the strategy name to the ChannelSelectionStrategy union type in types/index.ts.
34
- * 5. Add a site profile entry in config/sites.ts that references the new strategy name.
38
+ * 5. Add a DOMAIN_CONFIG entry in config/sites.ts mapping the provider's domain to the profileName.
35
39
  *
36
40
  * The coordinator handles all cross-cutting concerns (dispatch, cache clearing, direct URL resolution, matchSelector polling) through the ChannelStrategyEntry
37
41
  * interface. Strategy files may import scrollAndClick(), normalizeChannelName(), resolveMatchSelector(), and logAvailableChannels() from this module for shared
@@ -39,13 +43,22 @@ import { yttvProvider } from "./tuning/youtubeTv.js";
39
43
  */
40
44
  // Provider module registry. The primary registry for all provider-level operations. Each entry bundles identity metadata, tuning strategy, and channel discovery.
41
45
  // Future capabilities become additional methods on ProviderModule — no new registries needed.
42
- const providerModules = [directvProvider, foxProvider, hboProvider, huluProvider, slingProvider, spectrumProvider, yttvProvider];
46
+ const providerModules = [
47
+ coxProvider, directvProvider, foxProvider, hboProvider, huluProvider, slingProvider, spectrumProvider, xfinityProvider, yttvProvider
48
+ ];
43
49
  // Strategy dispatch registry. Derived from provider modules (keyed by strategyName) plus generic strategies that are not provider-level registrations.
44
50
  const strategies = Object.fromEntries([
45
51
  ...providerModules.map((p) => [p.strategyName, p.strategy]),
46
52
  ["thumbnailRow", thumbnailRowStrategy],
47
53
  ["tileClick", tileClickStrategy]
48
54
  ]);
55
+ // Register provider module profiles with the profile resolution system. This happens at module evaluation time so profiles are available before any startup
56
+ // code runs. Providers that define a profile and profileName have their profile registered via the setter in sites.ts, avoiding circular dependencies.
57
+ for (const provider of providerModules) {
58
+ if (provider.profile && provider.profileName) {
59
+ registerProviderModuleProfile(provider.profileName, provider.profile);
60
+ }
61
+ }
49
62
  /**
50
63
  * 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
51
64
  * with the channelSelector and page. Returns null if the strategy has no resolver, the profile has no channelSelector, or the resolver returns null.
@@ -99,11 +112,17 @@ export function getProviderSlugs() {
99
112
  return providerModules.map((p) => p.slug);
100
113
  }
101
114
  /**
102
- * Returns slug and label pairs for all registered provider modules. Used by the checkboxList setting to render precache provider checkbox labels.
103
- * @returns Array of objects with label and slug properties.
115
+ * Returns slug, label, domain, and optional icon URL for all registered provider modules. Used by the checkboxList setting for precache labels and by the
116
+ * browse modal for provider picker cards with icons. The domain is extracted from the guide URL. The icon URL is derived from the provider's DOMAIN_CONFIG
117
+ * entry — the single source of truth for provider icon URLs.
118
+ * @returns Array of objects with domain, iconUrl, label, noDirectTuneOptimization, and slug properties.
104
119
  */
105
120
  export function getProviderModuleInfo() {
106
- return providerModules.map((p) => ({ label: p.label, slug: p.slug }));
121
+ return providerModules.map((p) => {
122
+ const domain = new URL(p.guideUrl).hostname;
123
+ const domainConfig = getDomainConfig(p.guideUrl);
124
+ return { domain, iconUrl: domainConfig?.iconUrl, label: p.label, noDirectTuneOptimization: p.noDirectTuneOptimization, slug: p.slug };
125
+ });
107
126
  }
108
127
  /**
109
128
  * Returns a mapping of provider guide URL hostnames to provider slugs for all registered provider modules. Used by the channels panel to embed a client-side
@@ -142,98 +161,14 @@ export function getCachedProviderChannels() {
142
161
  continue;
143
162
  }
144
163
  const hostname = new URL(provider.guideUrl).hostname;
145
- const entries = cached.map((ch) => ({ label: ch.name, value: ch.channelSelector }));
164
+ const entries = cached.map((ch) => ({ label: ch.name, stationId: ch.stationId, value: ch.channelSelector }));
146
165
  results.push({ entries, hostname });
147
166
  }
148
167
  return results;
149
168
  }
150
- /**
151
- * Clicks at the specified coordinates after a brief settle delay. The delay allows scroll animations and lazy-loaded content to finish before the click fires.
152
- * Callers are responsible for scrolling the target element into view (typically via scrollIntoView inside a page.evaluate call) before invoking this function.
153
- * Exported for use by tuning strategy files (thumbnailRow, tileClick, hulu).
154
- * @param page - The Puppeteer page object.
155
- * @param target - The x/y coordinates to click.
156
- * @returns True if the click was executed.
157
- */
158
- export async function scrollAndClick(page, target) {
159
- // Brief delay after scrolling for any animations or lazy-loaded content to settle.
160
- await delay(200);
161
- // Click the target coordinates to switch to the channel.
162
- await page.mouse.click(target.x, target.y);
163
- return true;
164
- }
165
- // Normalizes a channel name for case-insensitive, whitespace-tolerant comparison. Trims leading and trailing whitespace, collapses internal whitespace sequences
166
- // (including non-breaking spaces, tabs, and other Unicode whitespace matched by \s) into a single regular space, and lowercases. This handles data-testid values
167
- // with trailing spaces, double spaces, or non-breaking space characters that would otherwise cause exact match failures.
168
- // Exported for use by tuning strategy files (hulu, sling).
169
- export function normalizeChannelName(name) {
170
- return name.trim().replace(/\s+/g, " ").toLowerCase();
171
- }
172
- // Resolves the CSS selector for finding a channel element. Interpolates the {channel} placeholder in the profile's matchSelector template with the channelSelector
173
- // value. When matchSelector is not configured, falls back to image URL matching for backward compatibility.
174
- // Exported for use by tuning strategy files (tileClick, thumbnailRow).
175
- export function resolveMatchSelector(profile) {
176
- const template = profile.channelSelection.matchSelector;
177
- if (template) {
178
- return template.replaceAll("{channel}", profile.channelSelector);
179
- }
180
- // Default to image URL slug matching for backward compatibility with profiles that don't specify matchSelector.
181
- return "img[src*=\"" + profile.channelSelector + "\" i]";
182
- }
183
- /**
184
- * Logs available channel names from a provider's guide grid when channel selection fails. Produces an actionable log message listing channel names that users can
185
- * use as `channelSelector` values in user-defined channels. When `presetSuffix` is provided, channels already covered by built-in preset definitions are filtered
186
- * out so users see only channels that require manual configuration. When omitted (small channel sets like Fox or HBO), all channels are logged unfiltered.
187
- * @param options - Diagnostic dump configuration.
188
- * @param options.additionalKnownNames - Extra names to exclude from the filtered list (e.g., CHANNEL_ALTERNATES values for YTTV).
189
- * @param options.availableChannels - Sorted list of channel names discovered in the guide grid.
190
- * @param options.channelName - The channelSelector value that failed to match, for the log message.
191
- * @param options.guideUrl - The URL of the provider's guide page, included in the log message so users know what to set as the channel URL.
192
- * @param options.presetSuffix - Key suffix to filter preset channels (e.g., "-yttv", "-hulu"). Omit for small unfiltered channel sets.
193
- * @param options.providerName - Human-readable provider name for the log message (e.g., "YouTube TV", "Hulu").
194
- */
195
- export function logAvailableChannels(options) {
196
- const { additionalKnownNames, availableChannels, channelName, guideUrl, presetSuffix, providerName } = options;
197
- if (availableChannels.length === 0) {
198
- return;
199
- }
200
- let filteredChannels;
201
- let countLabel;
202
- if (presetSuffix) {
203
- // Collect all channelSelector values from preset channels with this suffix, lowercased for case-insensitive comparison.
204
- const knownSelectors = Object.entries(CHANNELS)
205
- .filter(([key]) => key.endsWith(presetSuffix))
206
- .map(([, ch]) => (ch.channelSelector ?? "").toLowerCase())
207
- .filter((s) => s.length > 0);
208
- // Include additional known names (e.g., CHANNEL_ALTERNATES values for YTTV) so those are also filtered out.
209
- if (additionalKnownNames) {
210
- for (const name of additionalKnownNames) {
211
- knownSelectors.push(name.toLowerCase());
212
- }
213
- }
214
- // Filter to channels not matched by any known selector. A channel is "covered" if a preset would find it via exact match (with parenthetical suffix stripped)
215
- // or prefix+digit match. This mirrors the strategy's own matching tiers so users see only channels that genuinely need manual configuration.
216
- filteredChannels = availableChannels.filter((name) => {
217
- const lower = name.toLowerCase();
218
- const stripped = lower.replace(/ \(.*\)$/, "");
219
- return !knownSelectors.some((sel) => {
220
- return (stripped === sel) ||
221
- (lower.startsWith(sel + " ") && (lower.length > sel.length + 1) && (lower.charCodeAt(sel.length + 1) >= 48) && (lower.charCodeAt(sel.length + 1) <= 57));
222
- });
223
- });
224
- countLabel = "uncovered (" + String(filteredChannels.length) + " of " + String(availableChannels.length) + ")";
225
- }
226
- else {
227
- // No preset suffix — log all available channels unfiltered. Used for small channel sets (Fox, HBO) where the full list is actionable without filtering.
228
- filteredChannels = availableChannels;
229
- countLabel = String(filteredChannels.length);
230
- }
231
- if (filteredChannels.length === 0) {
232
- return;
233
- }
234
- LOG.warn("Channel \"%s\" not found in %s guide. Create a user-defined channel with one of the names below as the Channel Selector and %s as the URL. " +
235
- "Available channels (%s): %s.", channelName, providerName, guideUrl, countLabel, filteredChannels.join(", "));
236
- }
169
+ // Re-export shared tuning utilities so external callers that import from channelSelection.ts continue to work. The implementations live in tuning/shared.ts to
170
+ // break the circular import between the coordinator (which imports tuning modules) and tuning modules (which need these utilities).
171
+ export { logAvailableChannels, normalizeChannelName, resolveMatchSelector, scrollAndClick } from "./tuning/shared.js";
237
172
  /**
238
173
  * 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
239
174
  * tuneToChannel() after page navigation.
@@ -1 +1 @@
1
- {"version":3,"file":"channelSelection.js","sourceRoot":"","sources":["../../src/browser/channelSelection.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,kKAAkK;AAClK,8FAA8F;AAC9F,MAAM,e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CAAC;YAEF,GAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE,0DAA0D,CAAC,CAAC;QAC5F,CAAC;QAAC,MAAM,CAAC;YAEP,oIAAoI;YACpI,GAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE,4EAA4E,EAAE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;QACpJ,CAAC;IACH,CAAC;IAED,yDAAyD;IACzD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAElD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,4 +1,13 @@
1
1
  import type { Nullable } from "../types/index.js";
2
+ /**
3
+ * GPU capabilities detected from the browser at startup via CDP SystemInfo, WebGL renderer identification, and MediaRecorder probing.
4
+ */
5
+ export interface GpuCapabilities {
6
+ av1HardwareEncoding: boolean;
7
+ h264HardwareEncoding: boolean;
8
+ hevcHardwareEncoding: boolean;
9
+ renderer: string;
10
+ }
2
11
  /**
3
12
  * Sets the maximum supported viewport dimensions. Called by browser initialization after detecting the display size and accounting for browser chrome.
4
13
  * @param width - Maximum viewport width in pixels.
@@ -28,3 +37,13 @@ export declare function getBrowserChrome(): Nullable<{
28
37
  height: number;
29
38
  width: number;
30
39
  }>;
40
+ /**
41
+ * Sets the GPU capabilities detected from the browser. Called by browser initialization after probing CDP SystemInfo, WebGL, and MediaRecorder.
42
+ * @param capabilities - The detected GPU capabilities.
43
+ */
44
+ export declare function setGpuCapabilities(capabilities: GpuCapabilities): void;
45
+ /**
46
+ * Returns the cached GPU capabilities, or null if GPU detection has not yet completed.
47
+ * @returns The GPU capabilities, or null before detection.
48
+ */
49
+ export declare function getGpuCapabilities(): Nullable<GpuCapabilities>;
@@ -1,18 +1,9 @@
1
- /* This module provides a simple cache for display-related dimensions detected during browser initialization. Two sets of values are cached:
2
- *
3
- * 1. Maximum supported viewport: The largest viewport that fits on the display after accounting for browser chrome. Used by the preset system to determine if the
4
- * configured preset needs to be degraded.
5
- *
6
- * 2. Browser chrome dimensions: The height and width of browser UI elements (title bar, toolbar, borders). Used when resizing the browser window to calculate the
7
- * total window size needed for a given viewport size.
8
- *
9
- * This module is intentionally minimal with no imports from other project modules to avoid circular dependencies. The browser module detects dimensions and calls
10
- * the setters. Other modules call the getters to access cached values.
11
- */
12
1
  // Cached maximum supported viewport dimensions. Null before browser initialization completes display detection.
13
2
  let maxSupportedViewport = null;
14
3
  // Cached browser chrome dimensions (title bar, toolbar, borders). Null before browser initialization completes display detection.
15
4
  let browserChrome = null;
5
+ // Cached GPU capabilities. Null before browser initialization completes GPU detection.
6
+ let gpuCapabilities = null;
16
7
  /**
17
8
  * Sets the maximum supported viewport dimensions. Called by browser initialization after detecting the display size and accounting for browser chrome.
18
9
  * @param width - Maximum viewport width in pixels.
@@ -44,4 +35,18 @@ export function setBrowserChrome(width, height) {
44
35
  export function getBrowserChrome() {
45
36
  return browserChrome;
46
37
  }
38
+ /**
39
+ * Sets the GPU capabilities detected from the browser. Called by browser initialization after probing CDP SystemInfo, WebGL, and MediaRecorder.
40
+ * @param capabilities - The detected GPU capabilities.
41
+ */
42
+ export function setGpuCapabilities(capabilities) {
43
+ gpuCapabilities = capabilities;
44
+ }
45
+ /**
46
+ * Returns the cached GPU capabilities, or null if GPU detection has not yet completed.
47
+ * @returns The GPU capabilities, or null before detection.
48
+ */
49
+ export function getGpuCapabilities() {
50
+ return gpuCapabilities;
51
+ }
47
52
  //# sourceMappingURL=display.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/browser/display.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AAEH,gHAAgH;AAChH,IAAI,oBAAoB,GAAgD,IAAI,CAAC;AAE7E,kIAAkI;AAClI,IAAI,aAAa,GAAgD,IAAI,CAAC;AAEtE;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAa,EAAE,MAAc;IAEnE,oBAAoB,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB;IAErC,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,MAAc;IAE5D,aAAa,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAE9B,OAAO,aAAa,CAAC;AACvB,CAAC"}
1
+ {"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/browser/display.ts"],"names":[],"mappings":"AAuCA,gHAAgH;AAChH,IAAI,oBAAoB,GAAgD,IAAI,CAAC;AAE7E,kIAAkI;AAClI,IAAI,aAAa,GAAgD,IAAI,CAAC;AAEtE,uFAAuF;AACvF,IAAI,eAAe,GAA8B,IAAI,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAa,EAAE,MAAc;IAEnE,oBAAoB,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB;IAErC,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,MAAc;IAE5D,aAAa,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAE9B,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,YAA6B;IAE9D,eAAe,GAAG,YAAY,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAEhC,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Browser, LaunchOptions, Page } from "puppeteer-core";
2
+ import { clearLoginState, isLoginModeActive } from "./login.js";
2
3
  import { getStream } from "puppeteer-stream";
3
4
  import type { Nullable } from "../types/index.js";
4
5
  /**
@@ -9,14 +10,8 @@ export declare function isGracefulShutdown(): boolean;
9
10
  * Sets the graceful shutdown flag. Call this at the start of shutdown, before terminating streams, so that page close errors are suppressed.
10
11
  */
11
12
  export declare function setGracefulShutdown(value: boolean): void;
12
- /**
13
- * Login status information returned by getLoginStatus().
14
- */
15
- export interface LoginStatus {
16
- active: boolean;
17
- startTime: Nullable<number>;
18
- url: Nullable<string>;
19
- }
13
+ export { clearLoginState, isLoginModeActive };
14
+ export { type LoginStatus, endLoginMode, getLoginPage, getLoginStatus, startLoginMode } from "./login.js";
20
15
  /**
21
16
  * Computes the current system status and emits it to SSE subscribers. Called when browser state changes significantly or when streams are added/removed.
22
17
  */
@@ -47,21 +42,29 @@ export declare function unregisterManagedPage(page: Page): void;
47
42
  export declare function ensureDataDirectory(): Promise<void>;
48
43
  /**
49
44
  * Ensures a clean slate for browser launch by terminating any stale Chrome processes and removing orphaned profile lock files. Chrome locks its profile directory
50
- * while running, and if a previous instance crashed without releasing the lock, we cannot launch a new browser with the same profile. This function uses pkill to
51
- * find and terminate any Chrome processes whose command line contains our profile directory path, then polls pgrep to verify the processes have actually exited.
52
- * After process cleanup, it removes stale lock files (SingletonLock, SingletonCookie, SingletonSocket) and DevToolsActivePort from the profile directory.
45
+ * while running, and if a previous instance crashed without releasing the lock, we cannot launch a new browser with the same profile. This function uses the
46
+ * saved Chrome PID to find and terminate the process via process.kill(), then polls for exit using signal 0. This approach is fully cross-platform it does not
47
+ * rely on Unix-only tools like pkill or pgrep.
53
48
  *
54
49
  * The termination strategy escalates from SIGTERM to SIGKILL. SIGTERM is sent first, giving Chrome up to 5 seconds to flush its profile databases (LevelDB,
55
50
  * extension state, session storage) and exit cleanly. If Chrome does not exit, SIGKILL is sent as a fallback. This escalation is critical when called from the
56
51
  * process exit handler — Chrome may be running normally (e.g., after a capture probe timeout), and an immediate SIGKILL would corrupt its profile databases,
57
52
  * poisoning the Docker volume for subsequent container restarts.
58
53
  *
59
- * The file cleanup is essential for Docker deployments. Container restarts destroy Chrome processes without giving them a chance to release profile locks, but the
60
- * lock files persist in the mounted volume. Without removing them, Chrome cannot start in the new container, causing a crash loop.
54
+ * If no PID is available (first run or clean shutdown where the PID file was already removed), process killing is skipped entirely and only lock file cleanup
55
+ * runs. When a PID file does exist but the process is gone (Docker restart with a mounted volume the PID belongs to the previous container's PID namespace),
56
+ * process.kill() throws ESRCH, which is caught gracefully.
61
57
  *
62
- * This is called at startup before launching the browser and after closeBrowser() during shutdown. It's safe to call even when no stale processes or files exist.
58
+ * This is called at startup before launching the browser and from the process exit handler as a crash recovery fallback. It's safe to call even when no stale
59
+ * processes or files exist.
63
60
  */
64
61
  export declare function killStaleChrome(): void;
62
+ /**
63
+ * Returns whether this process has taken ownership of Chrome cleanup by running killStaleChrome() during startup. Used by the exit handler to avoid killing
64
+ * Chrome that belongs to another running PrismCast instance.
65
+ * @returns True if killStaleChrome() has run in this process.
66
+ */
67
+ export declare function canCleanupChrome(): boolean;
65
68
  /**
66
69
  * Locates the Google Chrome executable on the system. The CHROME_BIN environment variable takes precedence, allowing operators to specify a non-standard
67
70
  * installation. Otherwise, we search common installation paths across macOS, Linux, and Windows.
@@ -97,6 +100,12 @@ export declare function getCurrentBrowser(): Promise<Browser>;
97
100
  * @returns The Chrome version string (e.g., "Chrome/144.0.7559.110") or null.
98
101
  */
99
102
  export declare function getChromeVersion(): Nullable<string>;
103
+ /**
104
+ * Returns the current browser instance, or null if not launched. Unlike getCurrentBrowser(), this does not lazily launch. Used by modules that need to check
105
+ * browser state without triggering a launch (e.g., login mode checking connectivity before opening a tab).
106
+ * @returns The browser instance, or null if not running.
107
+ */
108
+ export declare function getBrowserInstance(): Nullable<Browser>;
100
109
  /**
101
110
  * Checks if the browser is currently connected and usable. This is a synchronous check that can be used before attempting browser operations.
102
111
  * @returns True if the browser is connected and ready for use, false otherwise.
@@ -120,49 +129,17 @@ export declare function getBrowserPages(): Promise<Page[]>;
120
129
  * Closes the browser and cleans up resources. This is called during graceful shutdown to ensure Chrome exits cleanly. After this call, the browser reference is
121
130
  * cleared and any subsequent stream requests will launch a fresh browser.
122
131
  *
123
- * The function uses a two-stage approach to ensure Chrome actually exits:
124
- * 1. Try browser.close() with a 5-second timeout (DevTools Protocol graceful close)
125
- * 2. Run killStaleChrome() to catch anything Stage 1 missed, using SIGTERM→SIGKILL escalation to give Chrome a chance to flush its profile databases
126
- */
127
- export declare function closeBrowser(): Promise<void>;
128
- /**
129
- * Starts login mode by opening a new browser tab with the specified URL and un-minimizing the browser window. The user can then authenticate with their TV
130
- * provider in the visible browser.
132
+ * Chrome termination uses Puppeteer's ChildProcess handle and its `exit` event for detection:
131
133
  *
132
- * Login mode blocks new stream requests until it ends (via endLoginMode, tab close detection, or timeout).
133
- * @param url - The URL to navigate to for authentication.
134
- * @returns Object indicating success or failure with optional error message.
135
- */
136
- export declare function startLoginMode(url: string): Promise<{
137
- error?: string;
138
- success: boolean;
139
- }>;
140
- /**
141
- * Ends login mode by closing the login tab (if still open) and re-minimizing the browser window. This function is idempotent - it's safe to call multiple times
142
- * or when login mode is not active.
134
+ * - browserRef.close() sends CDP Browser.close and waits for WebSocket teardown, which hangs 3-5 seconds even after Chrome exits.
135
+ * - browserRef.disconnect() drops the WebSocket instantly but orphans Chrome as a Node child process, creating a zombie that process.kill(pid, 0) cannot detect.
136
+ * - Synchronous polling (Atomics.wait) blocks the event loop, preventing Node from processing SIGCHLD to reap the child — Chrome becomes a zombie regardless
137
+ * of how SIGTERM was sent.
143
138
  *
144
- * Called by:
145
- * - User clicking "Done" in the web UI (POST /auth/done)
146
- * - Tab close detection (user closes the tab manually)
147
- * - 15-minute timeout
148
- * - Browser disconnect handler (cleanup)
139
+ * Instead, we send SIGTERM through the ChildProcess handle and listen for the `exit` event. This keeps the event loop running so Node can process SIGCHLD and
140
+ * reap Chrome properly. The exit event fires only after the process is fully reaped — no zombies, no polling, no event loop blocking.
149
141
  */
150
- export declare function endLoginMode(): Promise<void>;
151
- /**
152
- * Returns whether login mode is currently active. Used by the stream handler to block new stream requests during login.
153
- * @returns True if login mode is active, false otherwise.
154
- */
155
- export declare function isLoginModeActive(): boolean;
156
- /**
157
- * Returns the current login status including whether active, the URL being used, and when login started. Used by the /auth/status API endpoint.
158
- * @returns Login status object.
159
- */
160
- export declare function getLoginStatus(): LoginStatus;
161
- /**
162
- * Returns the active login page if login mode is currently active. Used by the profile test flow to evaluate CSS selectors against the live page DOM.
163
- * @returns The login page, or null if login mode is not active.
164
- */
165
- export declare function getLoginPage(): Nullable<Page>;
142
+ export declare function closeBrowser(): Promise<void>;
166
143
  /**
167
144
  * Cleans up browser pages that are not associated with active streams. This function runs periodically to catch any pages that were not properly closed during
168
145
  * stream termination.