Introducing a new way to review your PRs.

Read the announcement

4gray / iptvnator

:tv: Cross-platform IPTV player application with multiple features, such as support of m3u and m3u8 playlists, favorites, TV guide, TV archive/catchup and more.

View on GitHub

26 documents · Updated Nov 23, 2026

docs / settings-and-parental-controls

Settings and parental controls

Settings give the user one place to shape the viewing experience and connect those choices to the runtime. The page loads saved values, exposes only useful controls, supports search, and sends accepted changes to the desktop side when a capability needs it. Parental controls add a PIN-protected policy for portal and playlist content.

Settings surface

The settings page groups user choices by purpose. It keeps one form alive while the user moves between sections, so a change in one section remains available until the user saves or discards it. The page also shows operational tools such as backup, playlist reset, guide maintenance, app updates, and device-specific actions.

The surface follows this model:

ConcernUser-facing behavior
SectionsRelated controls appear together. Unsupported sections and rows stay hidden.
Staged changesMost controls take effect on Save. Discard restores the saved values.
Live previewsTheme and accent choices preview at once but remain staged for persistence.
Immediate controlsPIN and lock actions apply at once because they protect the next action.
Exit safetyNavigation, reload, close, and update-driven quit can ask the user to save, discard, or stay.
Data toolsBackup, guide cleanup, playlist reset, update, and hosted-device actions show their scope and progress.

The URL identifies the active section. Section changes do not recreate the page or its form. An unknown or unsupported section returns to the default section. The page counts changed leaf values and marks the sections that contain them. A separate notice identifies saved choices that still need a restart before the running app uses them. apps/…/settings.component.ts• L91-101 apps/…/settings.component.ts• L216-240 apps/…/settings.component.ts• L266-307

The form hydrates only after the settings store has loaded. A read failure warns that the visible defaults may not be saved values. A failed write keeps the edit available for retry and keeps the user in settings. Save is unavailable for an invalid form. apps/…/settings-form.facade.ts• L144-187 apps/…/settings.component.ts• L418-483 apps/…/settings-unsaved-changes-dialog.component.ts• L11-24

Runtime capability surface

Runtime capabilities define which settings the current app can use. Desktop-only controls include external player paths, startup window mode, update channels, recording locations, and hosted server actions. Built-in players remain available across runtimes, while embedded MPV and managed external players appear only when the current runtime can launch them. Android-specific advanced settings appear only when Android support is present. Guide display choices can remain available when a portal supplies the guide, while XMLTV source management needs XMLTV support. apps/…/settings.component.ts• L181-197 apps/…/settings-form.facade.ts• L80-99 apps/…/settings-form.utils.ts• L64-149 apps/…/settings-options.ts• L140-193

The same rule applies to remote control, dashboard rails, source-server actions, and app updates. A saved value can stay in storage while its control is hidden in a runtime that cannot use it. This preserves a user's choices when the same data is later opened in a richer runtime. apps/…/settings.component.ts• L256-264 apps/…/settings-about-section.component.html• L83-130 apps/…/settings-about-section.component.html• L253-346

References: apps/…/settings.component.ts• L181-197 apps/…/settings.component.ts• L256-307 apps/…/settings-form.facade.ts• L80-99 apps/…/settings-form.utils.ts• L64-175 apps/…/settings-options.ts• L140-193 apps/…/settings-android-device-section.component.html• L1-30

Appearance controls

Appearance controls separate immediate visual feedback from saved state. Theme, system light and dark presets, and accent choices preview as the user selects them. Save commits them. Discard restores the saved appearance. Cover size and cover-title visibility remain ordinary staged choices. apps/…/settings-form.facade.ts• L208-237 apps/…/settings-form.facade.ts• L434-449

System mode keeps a light preset and a dark preset. The page shows choices that fit each device mode, so the user can understand both results before saving. apps/…/settings.component.form.spec.ts• L66-207

References: apps/…/settings-form.facade.ts• L208-251 apps/…/settings-form.facade.ts• L434-449 apps/…/settings.component.form.spec.ts• L66-207

Source server surface

The source-server section connects the app to a shared source service and shows whether that connection works. It can use a browser connection or a desktop bridge. A desktop runtime can also host the service for other devices on the local network or through a configured HTTPS or tunnel route. The About dialog explains the connection models and links to their setup guides. apps/…/settings-server-section.component.ts• L69-109 apps/…/settings-server-about-dialog.component.ts• L7-48 apps/…/settings-hosted-server.component.html• L1-14

The section validates the address before connecting, keeps a failed token available for correction, and clears the token after a successful connection. Local playlists can be previewed before they are copied to the shared service. Import creates new source identities and refreshes the shared list only after the request succeeds. A failed import leaves the preview available for retry. apps/…/settings-server-section.component.ts• L149-211 apps/…/settings-server-section.component.ts• L252-306

Connected sessions can expose viewing activity, favorites, and history synchronization. Each service keeps consent, pending work, review or conflict state, and the last known result visible instead of treating a local click as proof that the server accepted the change.

References: apps/…/settings-server-section.component.ts• L69-109 apps/…/settings-server-section.component.ts• L149-211 apps/…/settings-server-section.component.ts• L252-306 apps/…/settings-server-about-dialog.component.ts• L7-48 apps/…/settings-hosted-server.component.html• L1-145

Hosted server access

Hosted server access lets a desktop runtime make its source service available to other devices. The user chooses home-network access, custom HTTPS, or a tunnel. The settings surface reports whether the server is stopped, starting, running, stopping, or in error, then exposes the active endpoint and the actions that the current route permits. apps/…/settings-hosted-server.component.ts• L32-54 apps/…/settings-hosted-server.component.ts• L94-177 apps/…/settings-hosted-server.component.html• L15-145

The hosted server keeps drafts per access mode, so moving between modes does not discard unfinished connection details. Starting or stopping the server refreshes its status. Invalid addresses and failed server actions stay visible for correction. A managed tunnel can also retain a connector token outside the visible form and lets the user forget it when the server is stopped. apps/…/settings-hosted-server.component.ts• L187-245 apps/…/settings-hosted-server.component.ts• L263-381

References: apps/…/settings-hosted-server.component.ts• L32-54 apps/…/settings-hosted-server.component.ts• L94-177 apps/…/settings-hosted-server.component.ts• L187-245 apps/…/settings-hosted-server.component.ts• L263-381

Hosted device access

Hosted device access controls which other devices may use a hosted source service. The owner creates a short-lived invite shown as a QR code or link, compares a pending device's name and confirmation code, and approves or rejects the request. Approved devices can be granted or denied permission to approve more devices, and the owner can revoke them. apps/…/settings-hosted-devices.component.ts• L123-183 apps/…/settings-hosted-devices.component.html• L45-205

The device list refreshes while the panel is open and removes an invite after expiry or after it is claimed. Pairing is disabled when the active route does not meet its access rules. HTTPS hosting also supports a separate browser-pairing password that can be saved or cleared after confirmation. Failed list, pairing, approval, and password actions remain visible without claiming success. apps/…/settings-hosted-devices.component.ts• L109-120 apps/…/settings-hosted-devices.component.ts• L185-301 apps/…/settings-hosted-devices.component.html• L216-308

References: apps/…/settings-hosted-devices.component.ts• L64-120 apps/…/settings-hosted-devices.component.ts• L123-183 apps/…/settings-hosted-devices.component.ts• L185-301 apps/…/settings-hosted-devices.component.html• L45-205 apps/…/settings-hosted-devices.component.html• L216-308

Guide settings

Guide settings separate guide display from guide source management. View mode and time offset can shape a portal guide. XMLTV source lists, file selection, refresh, uploaded-guide preference, and data clearing appear only when the runtime supports XMLTV. Disabling the guide does not erase its saved choices. apps/…/settings-form.utils.ts• L137-175 apps/…/settings-epg.facade.ts• L30-71

Manual refresh bypasses normal freshness checks. Clearing guide data asks for confirmation, shows progress, and fetches configured sources again so the user does not remain at an empty guide. A failed clear remains visible and can be retried. apps/…/settings-epg.facade.ts• L73-157

References: apps/…/settings-form.utils.ts• L137-175 apps/…/settings-epg.facade.ts• L30-71 apps/…/settings-epg.facade.ts• L90-157

Backup and data surface

Backup and data controls combine settings backup with the destructive playlist reset. Export uses a desktop file picker when available and a browser download otherwise. Import restores supported shared data and then refreshes the open settings form from the store. This keeps the page aligned with restored values while preserving edits that are still staged. apps/…/settings.component.ts• L508-520 apps/…/settings-form.facade.ts• L380-391

Playlist reset shows source counts, the data that will be lost, retained downloads, and whether shared storage makes the action affect other devices. It runs through the active browser or desktop store, reports progress, and clears local parental locks after deletion. apps/…/settings-delete-all-playlists-dialog.component.html• L7-73 apps/…/settings-playlist-reset.facade.ts• L66-139

References: apps/…/settings.component.ts• L508-520 apps/…/settings-delete-all-playlists-dialog.component.html• L7-73 apps/…/settings-playlist-reset.facade.ts• L66-159

Settings persistence

The settings store is the shared source for application preferences. It starts with safe defaults, loads saved data, normalizes older or incomplete values, and writes accepted changes. The form keeps values that the current runtime does not render, so a browser session does not erase desktop-only or XMLTV settings.

The persistence flow is:

flowchart LR
    A[Saved settings] --> B[Load and normalize]
    B --> C[Shared settings store]
    C --> D[Settings form]
    D --> E[Save changed paths]
    E --> F[Store and desktop runtime]
    F --> C
    C --> G[Player, guide, portal, and dashboard behavior]

Save writes only the leaf paths changed on the form. If another surface changes a different value while the page is open, that newer value remains. Nested groups are merged so a changed dashboard rail does not replace another rail written elsewhere. apps/…/settings-form-rebase.ts• L17-57 apps/…/settings-form.facade.ts• L289-337

The form can also receive outside changes from a backup import, another settings writer, or a server-backed update. It rebases the saved baseline while keeping edits that the user still owns. EPG source identity and TMDB key state receive extra protection because those writes can finish after another update. An older save cannot clear a newer edit or restore an older value. apps/…/settings-form-rebase.ts• L94-179 apps/…/settings-form-writes.ts• L7-114 apps/…/settings-form.facade.ts• L477-508

The renderer stores the settings used by the page. In the desktop app, the merged result is also sent to the main process because startup and worker actions can run before the renderer is ready. The parental-lock value is excluded from this ordinary mirror because its dedicated writer owns that policy. A runtime update must succeed before Save reports completion. apps/…/settings-form.facade.ts• L289-377 apps/…/settings.component.outside-changes.spec.ts• L181-201

Appearance previews use the same saved contract but have a live path. A save applies the accepted language and appearance. Discard or a backup restore applies the saved appearance again. A newer preview remains active if an older asynchronous save finishes later. apps/…/settings-form.facade.ts• L402-449 apps/…/settings.component.form.spec.ts• L715-751

Update channels are staged settings in the About section. When the selected channel differs from the channel named by the current verdict, the user must save and check again. A downloaded result from another channel remains visible until a new check replaces it. Nightly selection shows a backup warning. Browser builds use the PWA update path rather than the desktop updater. apps/…/settings-about-section.component.ts• L88-157 apps/…/settings-about-section.component.ts• L167-185 apps/…/settings-about-section.component.html• L45-129

Metadata controls have state beside the staged form. An API key test checks the entered value without saving it. Cache status stays unknown when a read or clear fails. A short-lived TMDB transfer lets one device send a saved key to another only after the receiver confirms the active server and the transfer has not expired. apps/…/settings-tmdb-section.component.ts• L108-181 apps/…/settings-tmdb-section.component.ts• L140-153

References: apps/…/settings-form-rebase.ts• L17-179 apps/…/settings-form-writes.ts• L7-114 apps/…/settings-form.facade.ts• L289-377 apps/…/settings-about-section.component.ts• L88-185 apps/…/settings-tmdb-section.component.ts• L108-181

Unload protection

Unload protection covers exits that router navigation does not see. A browser session uses the native leave-page prompt. An Electron session routes close, reload, and update-driven quit through one save, discard, or stay decision. Failed save or runtime application keeps the user in settings. apps/…/settings.component.ts• L376-391 apps/…/settings-unsaved-changes-dialog.component.ts• L19-24

References: apps/…/settings.component.ts• L376-391 apps/…/settings.component.ts• L427-461 apps/…/settings-unsaved-changes-dialog.component.ts• L11-24

Settings search turns the page into a searchable set of visible controls. A shared registry supplies names, descriptions, keywords, section IDs, and capability rules. Search ranks matches in the active language. Selecting a result opens its section, scrolls to the row, and gives that row the normal focus and reveal treatment.

The search flow is:

sequenceDiagram
    participant User
    participant Shell as Header or command palette
    participant Index as Settings search index
    participant Page as Settings page
    participant Row as Setting row

    User->>Shell: Enter a setting name
    Shell->>Index: Search visible entries
    Index-->>Shell: Ranked matches
    User->>Shell: Select a match
    Shell->>Page: Open the owning section
    Page->>Row: Scroll to and reveal the row

The index removes entries that the runtime cannot render. Section counts use the same result set, and stable setting IDs connect a result to its row. This keeps search, navigation, and the visible settings surface aligned. Android-specific navigation follows the same capability check as the section itself. libs/…/settings-search.service.ts• L21-25 libs/…/settings-search.service.ts• L106-185 libs/…/settings-search-entries.ts• L22-108 apps/…/settings-options.ts• L167-193

References: libs/…/settings-search.service.ts• L21-25 libs/…/settings-search.service.ts• L106-185 libs/…/settings-search-entries.ts• L22-108 apps/…/settings-options.ts• L167-193

Parental lock policy

Parental lock is a content policy that hides selected categories or groups until the user enters a PIN. It covers Xtream live, movie, and series categories, Stalker categories, and M3U group titles. Enabling it requires a PIN before the protected state becomes active.

The policy has four related kinds of state:

StatePurpose
Feature settingRecords whether the policy is enabled and how long an unlocked session may remain idle.
PIN recordStores a protected PIN representation outside ordinary settings.
Lock storeMaps playlist identities to protected provider categories or group titles.
Session stateRecords whether this app session has passed the PIN. A restart locks it again.

The settings page handles enable, disable, PIN change, manual lock, unlock, and relock timing. The enable switch reflects the accepted policy rather than the user's request. A cancelled or failed PIN action therefore does not leave a false state on screen. A locked session cannot extend its own relock timer. apps/…/settings-parental-section.component.ts• L27-61 libs/…/parental-lock.service.ts• L258-372

PIN and relock lifecycle

The shared PIN dialog supports set mode and unlock mode. Set mode checks the PIN twice. Unlock mode verifies one PIN for the calling action. Invalid or mismatched input stays visible on the field that needs correction. Repeated wrong attempts use a shared cooldown that remains active if the dialog is reopened. libs/…/parental-lock-pin-dialog.component.ts• L31-59 libs/…/parental-lock-pin-dialog.component.ts• L154-245

An accepted PIN unlocks the current session. Manual lock, restart, or idle timeout requires the PIN again. The idle timer treats active audio or video playback as activity, so a long programme does not relock only because the user did not press a control. A zero timeout disables idle relocking. libs/…/parental-lock-idle-timer.ts• L72-122 apps/…/parental-lock-prompt.service.ts• L10-50

PIN and lock data use storage separate from the ordinary settings object. An unreadable store is a policy failure, not an empty policy. The safe result is to keep the session locked and withhold protected content. libs/…/parental-lock-storage.ts• L12-79 libs/…/parental-lock.service.ts• L90-129

References: apps/…/settings-parental-section.component.ts• L27-61 libs/…/parental-lock.service.ts• L258-372 libs/…/parental-lock-pin-dialog.component.ts• L31-59 libs/…/parental-lock-idle-timer.ts• L72-122 libs/…/parental-lock-storage.ts• L12-79

Protected content synchronization

Parental lock must affect both new reads and content already on screen. The lock service is the common policy source. Portal and playlist views use it to filter catalog data. An enforcement service refreshes affected data and removes selections or playback that became protected after a lock change.

The synchronization path is:

flowchart TD
    A[PIN or lock-store change] --> B[Parental lock service]
    B --> C[Renderer filters]
    B --> D[Desktop worker filter]
    B --> E[Enforcement refresh]
    C --> F[Portal and playlist catalogs]
    D --> F
    E --> G[Clear protected selection or playback]
    F --> H[Visible content]

Direct navigation uses the same policy. A bookmark or typed URL cannot bypass a filtered category list. A protected route requests the PIN and returns to the section root when the user does not unlock it. Detail pages also check the item's own category, which protects an item opened from search or an all-items view. libs/…/parental-lock-category.guard.ts• L37-151 libs/…/parental-lock-category.guard.ts• L21-61

Xtream, Stalker, and M3U sources use different category or group identifiers but share the same lock decision. If the desktop worker cannot receive current lock state, or the lock data cannot be read, the system withholds protected content instead of treating it as unlocked. A desktop-derived index is usable only after it agrees with the persisted lock store. libs/…/parental-lock.service.ts• L40-53 libs/…/parental-lock-bridge.ts• L8-26 libs/…/parental-lock-lock-store.service.ts• L47-117

Playlist policy lifecycle

Locks belong to playlist identity. Deleting one playlist removes its locks. Removing all playlists clears the full local lock store. Restore can replace locks for a playlist, while a source refresh keeps the policy when provider category rows are recreated. libs/…/parental-lock-playlist-cleanup.ts• L5-25 libs/…/parental-lock.service.ts• L479-509 libs/…/parental-lock-lock-store.service.ts• L299-331

The reset flow makes this scope clear before deletion. It names the source counts and the related loss of favorites, recent items, playback positions, and cached Xtream data. Downloads remain available. Shared storage gets an explicit device-wide warning. After confirmation, deletion reports progress and leaves a visible failure if it does not complete. apps/…/settings-delete-all-playlists-dialog.component.html• L7-73 apps/…/settings-playlist-reset.facade.ts• L97-159

References: libs/…/parental-lock-playlist-cleanup.ts• L5-25 libs/…/parental-lock.service.ts• L479-509 apps/…/settings-delete-all-playlists-dialog.component.html• L7-73 apps/…/settings-playlist-reset.facade.ts• L97-159

Settings are part of the application shell and share state and source lifecycles with playlist and portal systems. Read Application foundations for the shell view, Shared state, services, and data for shared state and data flow, Browser client for browser runtime behavior, and Hosted server and device access for the wider hosted access model.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the settings search registry, section visibility rules, navigation IDs, and row anchors aligned.
  • When adding a runtime-gated setting, update both the visible control and the search capability rule.
  • Keep player option availability aligned with the runtime launch capabilities.
  • Keep Android-specific navigation and the advanced settings action behind the same capability contract.
  • Keep the shared form, outside-change rebase, save revisions, and EPG or TMDB write acknowledgements aligned.
  • When changing a setting read by Electron startup or a worker, update renderer persistence and the desktop mirror as one contract.
  • Keep live appearance previews, Save, Discard, backup import, and asynchronous save ordering aligned.
  • Keep update-channel selection, verdict channel, retained downloads, save-and-check behavior, and nightly backup warning aligned.
  • Keep source-server validation, connection identity, token clearing, preview, import refresh, and retry behavior aligned.
  • Keep hosted server modes, saved drafts, status states, endpoint rules, route access checks, and connector-token handling aligned.
  • Keep hosted-device invite expiry, confirmation approval, approval delegation, revocation, list refresh, and browser-pairing password behavior aligned.
  • Keep guide display controls separate from XMLTV source controls and preserve runtime capability gates.
  • Keep backup scope, browser and desktop file paths, consent gates, busy state, playlist reload, and reset warnings aligned.
  • Keep the form visible after outside store writes, backup restore, discard, and asynchronous actions.
  • Keep parental-lock identifiers aligned across provider categories, desktop rows, Stalker categories, and M3U group titles.
  • Keep the persisted lock store, desktop lock index, catalog filters, route guards, and enforcement refresh synchronized.
  • Preserve the rule that playback keeps an active unlocked session and that a locked session cannot change its own timeout.
  • Keep PIN set validation, unlock verification, cooldown state, field errors, and focus behavior consistent.

Important failure modes

TriggerConsequenceGuard
Settings storage cannot be readDefaults can look like saved choices.Mark the load failure and warn the user.
Store or desktop runtime rejects a saveThe form can look changed while the next launch restores older values.Keep the form dirty, show the failure, and allow retry.
A slower save finishes after a newer editAn old snapshot can hide a newer choice.Apply acknowledgements only to the current save revision.
Another surface changes settings during SaveThe page can overwrite a value it did not edit.Write changed paths and rebase outside changes.
A hidden control is omitted from a saveA browser session can erase desktop-only or XMLTV values.Preserve stored values that the current form does not render.
Update channel changes without a new checkThe verdict can describe a different channel.Require Save and check again before replacing the verdict.
Hosted server route is not eligible for pairingThe user can see a server endpoint but cannot safely approve a device.Disable pairing and show the route-specific reason.
Hosted server status becomes stale during a start or stop actionThe page can offer controls for the wrong server state.Invalidate the read revision and refresh status after control actions.
A hosted invite expires or is claimedAn old QR code can appear usable.Poll device state and remove the invite when it expires or becomes inactive.
Hosted device or password action failsThe page can imply that access changed when the service rejected it.Keep the failure visible and refresh the relevant state.
Source import fails after previewThe page can claim sources exist when the server rejected them.Keep the preview and require a successful refresh.
Guide data clear failsThe page can suggest that stale guide data is gone.Keep the failure visible and leave the retry path open.
A dirty page closes or reloads during a decisionEdits can be lost or a stale close request can finish later.Share one pending save, discard, or stay decision across exit paths.
PIN or lock storage cannot be readProtected content could be exposed as unlocked.Keep the session locked and withhold protected content.
Worker lock state is missing or staleDesktop reads can show protected rows.Withhold protected categories until the derived state matches the store.
A protected route is opened directlyURL navigation can bypass the category filter.Check the route and item category before activation.
A lock changes while protected content is selectedCached content or playback can remain active.Clear protected selections and refresh affected catalogs.
A playlist is deleted without lock cleanupOld playlist identity can leave protected groups behind.Remove the playlist's lock record as part of deletion.
All playlists use shared storageA reset can remove sources for every connected device.Show the server-wide warning before confirmation.

Key files

FileWhy to read it
apps/…/settings.component.tsShows page lifecycle, capability-gated sections, routing, and save or discard flow.
apps/…/settings-form.facade.tsShows hydration, live appearance state, persistence, outside-change handling, and save ordering.
apps/…/settings-form-rebase.tsShows how store changes are adopted without dropping edits owned by the open form.
apps/…/settings-form-writes.tsShows acknowledgement tracking for EPG sources and TMDB keys.
apps/…/settings-form.utils.tsShows form shape, validation, normalization, and preservation of hidden values.
apps/…/settings-options.tsShows runtime-aware player choices and settings section visibility.
apps/…/settings-android-device-section.component.tsShows the Android-specific advanced settings entry point.
apps/…/settings-about-section.component.tsShows update-channel and verdict rules.
apps/…/settings-server-section.component.tsShows source-server connection, preview, import, and retry behavior.
apps/…/settings-hosted-server.component.tsShows hosted server modes, status, endpoint access, and connector management.
apps/…/settings-hosted-devices.component.tsShows device invites, approval, revocation, and browser-pairing password actions.
apps/…/settings-epg.facade.tsShows guide refresh and destructive guide-data maintenance.
apps/…/settings-playlist-reset.facade.tsShows reset scope, progress, storage choice, and lock cleanup.
libs/…/settings-search.service.tsShows capability-aware settings search and row reveal.
libs/…/parental-lock.service.tsDefines PIN lifecycle, session state, and content decisions.
libs/…/parental-lock-lock-store.service.tsShows playlist-scoped locks and desktop index agreement.
libs/…/parental-lock-pin-dialog.component.tsDefines PIN set, unlock, validation, and cooldown behavior.
apps/…/parental-lock-enforcement.service.tsShows how lock changes reach cached catalogs, selections, and playback.
libs/…/parental-lock-category.guard.tsShows direct-route protection for Xtream content.
libs/…/parental-lock-category.guard.tsShows direct-route protection for Stalker content.