@bnhf/prismcast 1.3.4-2026.2.19

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 (234) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +347 -0
  3. package/bin/prismcast +6 -0
  4. package/dist/app.d.ts +6 -0
  5. package/dist/app.js +315 -0
  6. package/dist/app.js.map +1 -0
  7. package/dist/browser/cdp.d.ts +38 -0
  8. package/dist/browser/cdp.js +155 -0
  9. package/dist/browser/cdp.js.map +1 -0
  10. package/dist/browser/channelSelection.d.ts +65 -0
  11. package/dist/browser/channelSelection.js +202 -0
  12. package/dist/browser/channelSelection.js.map +1 -0
  13. package/dist/browser/display.d.ts +34 -0
  14. package/dist/browser/display.js +54 -0
  15. package/dist/browser/display.js.map +1 -0
  16. package/dist/browser/index.d.ts +205 -0
  17. package/dist/browser/index.js +1205 -0
  18. package/dist/browser/index.js.map +1 -0
  19. package/dist/browser/tuning/fox.d.ts +2 -0
  20. package/dist/browser/tuning/fox.js +83 -0
  21. package/dist/browser/tuning/fox.js.map +1 -0
  22. package/dist/browser/tuning/hbo.d.ts +2 -0
  23. package/dist/browser/tuning/hbo.js +237 -0
  24. package/dist/browser/tuning/hbo.js.map +1 -0
  25. package/dist/browser/tuning/hulu.d.ts +2 -0
  26. package/dist/browser/tuning/hulu.js +550 -0
  27. package/dist/browser/tuning/hulu.js.map +1 -0
  28. package/dist/browser/tuning/sling.d.ts +2 -0
  29. package/dist/browser/tuning/sling.js +518 -0
  30. package/dist/browser/tuning/sling.js.map +1 -0
  31. package/dist/browser/tuning/thumbnailRow.d.ts +2 -0
  32. package/dist/browser/tuning/thumbnailRow.js +108 -0
  33. package/dist/browser/tuning/thumbnailRow.js.map +1 -0
  34. package/dist/browser/tuning/tileClick.d.ts +2 -0
  35. package/dist/browser/tuning/tileClick.js +103 -0
  36. package/dist/browser/tuning/tileClick.js.map +1 -0
  37. package/dist/browser/tuning/youtubeTv.d.ts +2 -0
  38. package/dist/browser/tuning/youtubeTv.js +182 -0
  39. package/dist/browser/tuning/youtubeTv.js.map +1 -0
  40. package/dist/browser/video.d.ts +289 -0
  41. package/dist/browser/video.js +996 -0
  42. package/dist/browser/video.js.map +1 -0
  43. package/dist/channels/index.d.ts +3 -0
  44. package/dist/channels/index.js +392 -0
  45. package/dist/channels/index.js.map +1 -0
  46. package/dist/config/index.d.ts +53 -0
  47. package/dist/config/index.js +233 -0
  48. package/dist/config/index.js.map +1 -0
  49. package/dist/config/presets.d.ts +98 -0
  50. package/dist/config/presets.js +241 -0
  51. package/dist/config/presets.js.map +1 -0
  52. package/dist/config/profiles.d.ts +79 -0
  53. package/dist/config/profiles.js +245 -0
  54. package/dist/config/profiles.js.map +1 -0
  55. package/dist/config/providers.d.ts +120 -0
  56. package/dist/config/providers.js +450 -0
  57. package/dist/config/providers.js.map +1 -0
  58. package/dist/config/sites.d.ts +22 -0
  59. package/dist/config/sites.js +377 -0
  60. package/dist/config/sites.js.map +1 -0
  61. package/dist/config/userChannels.d.ts +178 -0
  62. package/dist/config/userChannels.js +543 -0
  63. package/dist/config/userChannels.js.map +1 -0
  64. package/dist/config/userConfig.d.ts +235 -0
  65. package/dist/config/userConfig.js +913 -0
  66. package/dist/config/userConfig.js.map +1 -0
  67. package/dist/hdhr/channelMap.d.ts +21 -0
  68. package/dist/hdhr/channelMap.js +82 -0
  69. package/dist/hdhr/channelMap.js.map +1 -0
  70. package/dist/hdhr/deviceId.d.ts +11 -0
  71. package/dist/hdhr/deviceId.js +84 -0
  72. package/dist/hdhr/deviceId.js.map +1 -0
  73. package/dist/hdhr/discover.d.ts +6 -0
  74. package/dist/hdhr/discover.js +155 -0
  75. package/dist/hdhr/discover.js.map +1 -0
  76. package/dist/hdhr/index.d.ts +9 -0
  77. package/dist/hdhr/index.js +87 -0
  78. package/dist/hdhr/index.js.map +1 -0
  79. package/dist/index.d.ts +1 -0
  80. package/dist/index.js +144 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/routes/assets.d.ts +6 -0
  83. package/dist/routes/assets.js +79 -0
  84. package/dist/routes/assets.js.map +1 -0
  85. package/dist/routes/auth.d.ts +6 -0
  86. package/dist/routes/auth.js +77 -0
  87. package/dist/routes/auth.js.map +1 -0
  88. package/dist/routes/channels.d.ts +6 -0
  89. package/dist/routes/channels.js +40 -0
  90. package/dist/routes/channels.js.map +1 -0
  91. package/dist/routes/components.d.ts +138 -0
  92. package/dist/routes/components.js +210 -0
  93. package/dist/routes/components.js.map +1 -0
  94. package/dist/routes/config.d.ts +72 -0
  95. package/dist/routes/config.js +1977 -0
  96. package/dist/routes/config.js.map +1 -0
  97. package/dist/routes/debug.d.ts +6 -0
  98. package/dist/routes/debug.js +274 -0
  99. package/dist/routes/debug.js.map +1 -0
  100. package/dist/routes/health.d.ts +6 -0
  101. package/dist/routes/health.js +85 -0
  102. package/dist/routes/health.js.map +1 -0
  103. package/dist/routes/hls.d.ts +6 -0
  104. package/dist/routes/hls.js +25 -0
  105. package/dist/routes/hls.js.map +1 -0
  106. package/dist/routes/index.d.ts +19 -0
  107. package/dist/routes/index.js +49 -0
  108. package/dist/routes/index.js.map +1 -0
  109. package/dist/routes/logs.d.ts +6 -0
  110. package/dist/routes/logs.js +164 -0
  111. package/dist/routes/logs.js.map +1 -0
  112. package/dist/routes/mpegts.d.ts +6 -0
  113. package/dist/routes/mpegts.js +19 -0
  114. package/dist/routes/mpegts.js.map +1 -0
  115. package/dist/routes/play.d.ts +6 -0
  116. package/dist/routes/play.js +18 -0
  117. package/dist/routes/play.js.map +1 -0
  118. package/dist/routes/playlist.d.ts +36 -0
  119. package/dist/routes/playlist.js +134 -0
  120. package/dist/routes/playlist.js.map +1 -0
  121. package/dist/routes/root.d.ts +6 -0
  122. package/dist/routes/root.js +2920 -0
  123. package/dist/routes/root.js.map +1 -0
  124. package/dist/routes/streams.d.ts +6 -0
  125. package/dist/routes/streams.js +88 -0
  126. package/dist/routes/streams.js.map +1 -0
  127. package/dist/routes/theme.d.ts +15 -0
  128. package/dist/routes/theme.js +275 -0
  129. package/dist/routes/theme.js.map +1 -0
  130. package/dist/routes/ui.d.ts +56 -0
  131. package/dist/routes/ui.js +354 -0
  132. package/dist/routes/ui.js.map +1 -0
  133. package/dist/service/commands.d.ts +41 -0
  134. package/dist/service/commands.js +391 -0
  135. package/dist/service/commands.js.map +1 -0
  136. package/dist/service/generators.d.ts +33 -0
  137. package/dist/service/generators.js +432 -0
  138. package/dist/service/generators.js.map +1 -0
  139. package/dist/service/index.d.ts +2 -0
  140. package/dist/service/index.js +7 -0
  141. package/dist/service/index.js.map +1 -0
  142. package/dist/streaming/clients.d.ts +48 -0
  143. package/dist/streaming/clients.js +114 -0
  144. package/dist/streaming/clients.js.map +1 -0
  145. package/dist/streaming/fmp4Segmenter.d.ts +61 -0
  146. package/dist/streaming/fmp4Segmenter.js +461 -0
  147. package/dist/streaming/fmp4Segmenter.js.map +1 -0
  148. package/dist/streaming/hls.d.ts +120 -0
  149. package/dist/streaming/hls.js +722 -0
  150. package/dist/streaming/hls.js.map +1 -0
  151. package/dist/streaming/hlsSegments.d.ts +54 -0
  152. package/dist/streaming/hlsSegments.js +162 -0
  153. package/dist/streaming/hlsSegments.js.map +1 -0
  154. package/dist/streaming/lifecycle.d.ts +33 -0
  155. package/dist/streaming/lifecycle.js +185 -0
  156. package/dist/streaming/lifecycle.js.map +1 -0
  157. package/dist/streaming/monitor.d.ts +74 -0
  158. package/dist/streaming/monitor.js +1310 -0
  159. package/dist/streaming/monitor.js.map +1 -0
  160. package/dist/streaming/mp4Parser.d.ts +74 -0
  161. package/dist/streaming/mp4Parser.js +566 -0
  162. package/dist/streaming/mp4Parser.js.map +1 -0
  163. package/dist/streaming/mpegts.d.ts +14 -0
  164. package/dist/streaming/mpegts.js +248 -0
  165. package/dist/streaming/mpegts.js.map +1 -0
  166. package/dist/streaming/registry.d.ts +119 -0
  167. package/dist/streaming/registry.js +127 -0
  168. package/dist/streaming/registry.js.map +1 -0
  169. package/dist/streaming/setup.d.ts +135 -0
  170. package/dist/streaming/setup.js +670 -0
  171. package/dist/streaming/setup.js.map +1 -0
  172. package/dist/streaming/showInfo.d.ts +30 -0
  173. package/dist/streaming/showInfo.js +362 -0
  174. package/dist/streaming/showInfo.js.map +1 -0
  175. package/dist/streaming/statusEmitter.d.ts +125 -0
  176. package/dist/streaming/statusEmitter.js +139 -0
  177. package/dist/streaming/statusEmitter.js.map +1 -0
  178. package/dist/types/index.d.ts +403 -0
  179. package/dist/types/index.js +6 -0
  180. package/dist/types/index.js.map +1 -0
  181. package/dist/utils/debugFilter.d.ts +38 -0
  182. package/dist/utils/debugFilter.js +157 -0
  183. package/dist/utils/debugFilter.js.map +1 -0
  184. package/dist/utils/delay.d.ts +6 -0
  185. package/dist/utils/delay.js +15 -0
  186. package/dist/utils/delay.js.map +1 -0
  187. package/dist/utils/errors.d.ts +15 -0
  188. package/dist/utils/errors.js +40 -0
  189. package/dist/utils/errors.js.map +1 -0
  190. package/dist/utils/evaluate.d.ts +51 -0
  191. package/dist/utils/evaluate.js +124 -0
  192. package/dist/utils/evaluate.js.map +1 -0
  193. package/dist/utils/ffmpeg.d.ts +65 -0
  194. package/dist/utils/ffmpeg.js +317 -0
  195. package/dist/utils/ffmpeg.js.map +1 -0
  196. package/dist/utils/fileLogger.d.ts +25 -0
  197. package/dist/utils/fileLogger.js +248 -0
  198. package/dist/utils/fileLogger.js.map +1 -0
  199. package/dist/utils/format.d.ts +16 -0
  200. package/dist/utils/format.js +46 -0
  201. package/dist/utils/format.js.map +1 -0
  202. package/dist/utils/html.d.ts +6 -0
  203. package/dist/utils/html.js +24 -0
  204. package/dist/utils/html.js.map +1 -0
  205. package/dist/utils/index.d.ts +15 -0
  206. package/dist/utils/index.js +20 -0
  207. package/dist/utils/index.js.map +1 -0
  208. package/dist/utils/logEmitter.d.ts +17 -0
  209. package/dist/utils/logEmitter.js +30 -0
  210. package/dist/utils/logEmitter.js.map +1 -0
  211. package/dist/utils/logger.d.ts +82 -0
  212. package/dist/utils/logger.js +219 -0
  213. package/dist/utils/logger.js.map +1 -0
  214. package/dist/utils/m3u.d.ts +32 -0
  215. package/dist/utils/m3u.js +148 -0
  216. package/dist/utils/m3u.js.map +1 -0
  217. package/dist/utils/morganStream.d.ts +7 -0
  218. package/dist/utils/morganStream.js +33 -0
  219. package/dist/utils/morganStream.js.map +1 -0
  220. package/dist/utils/platform.d.ts +64 -0
  221. package/dist/utils/platform.js +157 -0
  222. package/dist/utils/platform.js.map +1 -0
  223. package/dist/utils/retry.d.ts +15 -0
  224. package/dist/utils/retry.js +82 -0
  225. package/dist/utils/retry.js.map +1 -0
  226. package/dist/utils/streamContext.d.ts +28 -0
  227. package/dist/utils/streamContext.js +33 -0
  228. package/dist/utils/streamContext.js.map +1 -0
  229. package/dist/utils/version.d.ts +37 -0
  230. package/dist/utils/version.js +228 -0
  231. package/dist/utils/version.js.map +1 -0
  232. package/package.json +92 -0
  233. package/prismcast.png +0 -0
  234. package/prismcast.svg +74 -0
@@ -0,0 +1,235 @@
1
+ import type { Config, Nullable } from "../types/index.js";
2
+ /**
3
+ * Metadata describing a single configuration setting. Note: Default values are not stored here to avoid duplication. Use getNestedValue(DEFAULTS, setting.path) to get
4
+ * the default value for a setting.
5
+ */
6
+ export interface SettingMetadata {
7
+ description: string;
8
+ dependsOn?: string;
9
+ disabledReason?: string;
10
+ displayDivisor?: number;
11
+ displayPrecision?: number;
12
+ displayUnit?: string;
13
+ envVar: Nullable<string>;
14
+ label: string;
15
+ max?: number;
16
+ min?: number;
17
+ path: string;
18
+ type: "boolean" | "float" | "host" | "integer" | "path" | "port" | "string";
19
+ validValues?: string[];
20
+ unit?: string;
21
+ }
22
+ /**
23
+ * Metadata for all configurable settings, organized by category.
24
+ */
25
+ export declare const CONFIG_METADATA: Record<string, SettingMetadata[]>;
26
+ /**
27
+ * Partial browser configuration for user config file.
28
+ */
29
+ export interface UserBrowserConfig {
30
+ executablePath?: Nullable<string>;
31
+ initTimeout?: number;
32
+ }
33
+ /**
34
+ * Partial HLS configuration for user config file.
35
+ */
36
+ export interface UserHLSConfig {
37
+ idleTimeout?: number;
38
+ maxSegments?: number;
39
+ segmentDuration?: number;
40
+ }
41
+ /**
42
+ * Partial logging configuration for user config file.
43
+ */
44
+ export interface UserLoggingConfig {
45
+ maxSize?: number;
46
+ }
47
+ /**
48
+ * Partial playback configuration for user config file.
49
+ */
50
+ export interface UserPlaybackConfig {
51
+ bufferingGracePeriod?: number;
52
+ channelSelectorDelay?: number;
53
+ channelSwitchDelay?: number;
54
+ clickToPlayDelay?: number;
55
+ iframeInitDelay?: number;
56
+ maxPageReloads?: number;
57
+ monitorInterval?: number;
58
+ pageReloadWindow?: number;
59
+ sourceReloadDelay?: number;
60
+ stallCountThreshold?: number;
61
+ stallThreshold?: number;
62
+ sustainedPlaybackRequired?: number;
63
+ }
64
+ /**
65
+ * Partial recovery configuration for user config file.
66
+ */
67
+ export interface UserRecoveryConfig {
68
+ backoffJitter?: number;
69
+ circuitBreakerThreshold?: number;
70
+ circuitBreakerWindow?: number;
71
+ maxBackoffDelay?: number;
72
+ stalePageCleanupInterval?: number;
73
+ stalePageGracePeriod?: number;
74
+ }
75
+ /**
76
+ * Partial server configuration for user config file.
77
+ */
78
+ export interface UserServerConfig {
79
+ host?: string;
80
+ port?: number;
81
+ }
82
+ /**
83
+ * Partial streaming configuration for user config file.
84
+ */
85
+ export interface UserStreamingConfig {
86
+ audioBitsPerSecond?: number;
87
+ captureMode?: string;
88
+ frameRate?: number;
89
+ maxConcurrentStreams?: number;
90
+ maxNavigationRetries?: number;
91
+ navigationTimeout?: number;
92
+ qualityPreset?: string;
93
+ videoBitsPerSecond?: number;
94
+ videoTimeout?: number;
95
+ }
96
+ /**
97
+ * Partial channels configuration for user config file.
98
+ */
99
+ export interface UserChannelsConfig {
100
+ disabledPredefined?: string[];
101
+ enabledProviders?: string[];
102
+ }
103
+ /**
104
+ * Partial HDHomeRun configuration for user config file.
105
+ */
106
+ export interface UserHdhrConfig {
107
+ deviceId?: string;
108
+ enabled?: boolean;
109
+ friendlyName?: string;
110
+ port?: number;
111
+ }
112
+ /**
113
+ * User configuration with all fields optional. This is the structure of the config.json file.
114
+ */
115
+ export interface UserConfig {
116
+ browser?: UserBrowserConfig;
117
+ channels?: UserChannelsConfig;
118
+ hdhr?: UserHdhrConfig;
119
+ hls?: UserHLSConfig;
120
+ logging?: UserLoggingConfig;
121
+ playback?: UserPlaybackConfig;
122
+ recovery?: UserRecoveryConfig;
123
+ server?: UserServerConfig;
124
+ streaming?: UserStreamingConfig;
125
+ }
126
+ /**
127
+ * Result of loading user config, includes parse error flag for UI display.
128
+ */
129
+ export interface UserConfigLoadResult {
130
+ config: UserConfig;
131
+ parseError: boolean;
132
+ parseErrorMessage?: string;
133
+ }
134
+ /**
135
+ * Returns the path to the user configuration file.
136
+ * @returns The absolute path to ~/.prismcast/config.json.
137
+ */
138
+ export declare function getConfigFilePath(): string;
139
+ /**
140
+ * Loads user configuration from the config file. Returns an empty config if the file doesn't exist, and sets parseError if the file exists but contains invalid
141
+ * JSON.
142
+ * @returns The loaded configuration with parse status.
143
+ */
144
+ export declare function loadUserConfig(): Promise<UserConfigLoadResult>;
145
+ /**
146
+ * Saves user configuration to the config file. Creates the data directory if it doesn't exist.
147
+ * @param config - The configuration to save.
148
+ * @throws If the file cannot be written.
149
+ */
150
+ export declare function saveUserConfig(config: UserConfig): Promise<void>;
151
+ /**
152
+ * Returns a map of setting paths to their environment variable values for settings that are overridden by environment variables.
153
+ * @returns Map of path -> env var value for overridden settings.
154
+ */
155
+ export declare function getEnvOverrides(): Map<string, string>;
156
+ /**
157
+ * Hard-coded default configuration values. These are the baseline values used when neither user config nor environment variables provide a value.
158
+ */
159
+ export declare const DEFAULTS: Config;
160
+ /**
161
+ * Gets a value from a nested object using a dot-separated path.
162
+ * @param obj - The object to read from.
163
+ * @param settingPath - Dot-separated path (e.g., "browser.viewport.width").
164
+ * @returns The value at the path, or undefined if not found.
165
+ */
166
+ export declare function getNestedValue(obj: unknown, settingPath: string): unknown;
167
+ /**
168
+ * Sets a value in a nested object using a dot-separated path, creating intermediate objects as needed.
169
+ * @param obj - The object to modify.
170
+ * @param settingPath - Dot-separated path (e.g., "browser.viewport.width").
171
+ * @param value - The value to set.
172
+ */
173
+ export declare function setNestedValue(obj: Record<string, unknown>, settingPath: string, value: unknown): void;
174
+ /**
175
+ * Merges user configuration with defaults and environment overrides to produce the final configuration. Priority: env vars > user config > defaults.
176
+ * @param userConfig - User configuration from the config file.
177
+ * @returns The merged configuration.
178
+ */
179
+ export declare function mergeConfiguration(userConfig: UserConfig): Config;
180
+ /**
181
+ * Metadata for a UI tab in the configuration interface.
182
+ */
183
+ export interface UITab {
184
+ description: string;
185
+ displayName: string;
186
+ id: string;
187
+ settings: SettingMetadata[];
188
+ }
189
+ /**
190
+ * Metadata for a collapsible section within the Advanced tab.
191
+ */
192
+ export interface AdvancedSection {
193
+ displayName: string;
194
+ id: string;
195
+ settings: SettingMetadata[];
196
+ }
197
+ /**
198
+ * Metadata for a non-collapsible section within the Settings tab. Uses the same structure as AdvancedSection for consistency.
199
+ */
200
+ export type SettingsSection = AdvancedSection;
201
+ /**
202
+ * Looks up a setting by its path.
203
+ * @param settingPath - The dot-separated path (e.g., "streaming.videoBitsPerSecond").
204
+ * @returns The setting metadata, or undefined if not found.
205
+ */
206
+ export declare function getSettingByPath(settingPath: string): SettingMetadata | undefined;
207
+ /**
208
+ * Returns the sections for the Settings tab with resolved setting metadata.
209
+ * @returns Array of section definitions.
210
+ */
211
+ export declare function getSettingsTabSections(): SettingsSection[];
212
+ /**
213
+ * Returns the UI tabs for the configuration interface. The Settings tab contains commonly-used options; the Advanced tab contains everything else.
214
+ * @returns Array of UI tab definitions.
215
+ */
216
+ export declare function getUITabs(): UITab[];
217
+ /**
218
+ * Returns the collapsible sections for the Advanced tab. Each section groups settings by their storage category.
219
+ * @returns Array of section definitions.
220
+ */
221
+ export declare function getAdvancedSections(): AdvancedSection[];
222
+ /**
223
+ * Checks if two values are equal for the purpose of default comparison. Handles null, undefined, and type coercion consistently.
224
+ * @param value - The value to check.
225
+ * @param defaultValue - The default value to compare against.
226
+ * @returns True if the values are considered equal.
227
+ */
228
+ export declare function isEqualToDefault(value: unknown, defaultValue: unknown): boolean;
229
+ /**
230
+ * Filters a user configuration object to remove values that match the defaults. This produces a minimal config file containing only the settings the user has actually
231
+ * customized. Empty nested objects are also removed.
232
+ * @param config - The user configuration to filter.
233
+ * @returns A new configuration object containing only non-default values.
234
+ */
235
+ export declare function filterDefaults(config: UserConfig): UserConfig;