Files
iptvnator/libs/shared/interfaces/src/lib/settings.interface.ts
T
4gray beb62db314 feat(settings): add shared web player controls toggle (#1198)
* docs(playback): design shared controls setting

* docs(playback): plan shared controls setting

* feat(settings): persist shared web controls preference

* test(settings): harden shared controls normalization coverage

* feat(settings): expose shared web controls toggle

* fix(settings): label shared controls toggle

* feat(playback): resolve shared controls from settings

* test(playback): cover shared controls setting

* docs(playback): document shared controls preference

* fix(playback): await settings before host creation

* fix(settings): normalize shared controls updates
2026-07-17 13:38:06 +02:00

154 lines
5.0 KiB
TypeScript

import { Language } from './language.enum';
import { StreamFormat } from './stream-format.enum';
import { Theme } from './theme.enum';
import { TmdbSettings } from './tmdb.interface';
/**
* Contains all types of supported video players
*/
export enum VideoPlayer {
VideoJs = 'videojs',
Html5Player = 'html5',
EmbeddedMpv = 'embedded-mpv',
MPV = 'mpv',
VLC = 'vlc',
ArtPlayer = 'artplayer',
}
export enum StartupBehavior {
FirstView = 'first-view',
RestoreLastView = 'restore-last-view',
}
export type CoverSize = 'small' | 'medium' | 'large';
/** Rendering of the live EPG panel under the player. */
export type EpgViewMode = 'timeline' | 'list';
export interface DashboardRailsSettings {
hero: boolean;
continueWatching: boolean;
liveFavorites: boolean;
recentlyWatchedLive: boolean;
favoriteMoviesAndSeries: boolean;
recentSources: boolean;
xtreamRecentlyAdded: boolean;
/** TMDB "Trending this week" rail (needs the TMDB opt-in; Electron) */
tmdbTrending: boolean;
}
export const DEFAULT_DASHBOARD_RAILS_SETTINGS: DashboardRailsSettings = {
hero: true,
continueWatching: true,
liveFavorites: true,
recentlyWatchedLive: true,
favoriteMoviesAndSeries: true,
recentSources: true,
xtreamRecentlyAdded: true,
tmdbTrending: true,
};
export type DashboardRailsSettingsInput = Partial<
Record<keyof DashboardRailsSettings, boolean | null | undefined>
>;
export function normalizeDashboardRailsSettings(
settings?: DashboardRailsSettingsInput | null
): DashboardRailsSettings {
const normalized = { ...DEFAULT_DASHBOARD_RAILS_SETTINGS };
if (!settings) {
return normalized;
}
const keys = Object.keys(
DEFAULT_DASHBOARD_RAILS_SETTINGS
) as (keyof DashboardRailsSettings)[];
for (const key of keys) {
if (typeof settings[key] === 'boolean') {
normalized[key] = settings[key];
}
}
return normalized;
}
/**
* Describes all available settings options of the application
*/
export interface Settings {
player: VideoPlayer;
/**
* Use IPTVnator's shared controls in HTML5, Video.js, and ArtPlayer.
* Missing values remain off for compatibility with older saved settings.
*/
webPlayerSharedControls?: boolean;
epgUrl: string[];
streamFormat: StreamFormat;
openStreamOnDoubleClick: boolean;
language: Language;
showCaptions: boolean;
showDashboard: boolean;
startupBehavior: StartupBehavior;
/** Show the desktop footer bar for external playback status */
showExternalPlaybackBar?: boolean;
theme: Theme;
mpvPlayerPath: string;
/**
* Extra MPV CLI arguments entered one argument per line. Applied only when
* starting a new external MPV process.
*/
mpvPlayerArguments: string;
mpvReuseInstance: boolean;
vlcPlayerPath: string;
/**
* Extra VLC CLI arguments entered one argument per line. Applied only when
* starting a new external VLC process.
*/
vlcPlayerArguments: string;
vlcReuseInstance: boolean;
remoteControl: boolean;
remoteControlPort: number;
/** Custom download folder path (uses system Downloads folder if not set) */
downloadFolder?: string;
/** Custom live recording folder path (uses system Downloads folder if not set) */
recordingFolder?: string;
/**
* Embedded MPV frame-copy engine (experimental, macOS Apple Silicon and Linux).
* Applied on the next app start — the engine relaxes the window sandbox
* for its preload frame pump, which is fixed at window creation.
*/
embeddedMpvFrameCopy?: boolean;
/** Cover/poster sizing preset applied across grids and rails */
coverSize?: CoverSize;
/** Live EPG panel layout: horizontal timeline (default) or vertical list */
epgViewMode?: EpgViewMode;
/** Per-rail dashboard visibility preferences. Missing keys default on. */
dashboardRails?: DashboardRailsSettings;
/**
* When true, the locally-parsed XMLTV programs (loaded from `epgUrl`)
* take precedence over the Xtream provider's EPG for live TV channels.
* When false (default), the Xtream provider's EPG is preferred and
* XMLTV is consulted only when the provider returns no programs.
* Only meaningful for Xtream playlists in Electron.
*/
preferUploadedEpgOverXtream?: boolean;
/**
* Exact EPG source URLs the user has allowed to resolve to private/LAN
* network addresses. Kept source-scoped instead of disabling SSRF
* protection globally.
*/
trustedPrivateNetworkEpgUrls?: string[];
/**
* Lowercase hostnames whose invalid TLS certificates the user has chosen
* to trust. This is host-scoped and does not disable TLS validation for
* unrelated playlist or EPG hosts.
*/
trustedInsecureTlsHosts?: string[];
/**
* Opt-in TMDB metadata enrichment for VOD/series detail views.
* Disabled by default because enrichment sends content titles to TMDB.
*/
tmdb?: TmdbSettings;
}