SealSkin
Server Reference

config_store

Loading, saving and resolving the YAML configuration.

Installed applications are stored as references plus overrides: the record names the store and the store app id, and overrides holds only the fields the administrator changed. resolve_app merges the processed store entry with those overrides to produce the InstalledApp the rest of the server works with. Store updates therefore apply automatically after every cache refresh, and the file stays small enough to edit by hand.

attributelogger
= logging.getLogger(__name__)
attributeSAFE_NAME_RE
= re.compile('^[A-Za-z0-9 _.-]+$')
attributeSTORE_ENTRY_FIELDStuple[str, ...]
= ('name', 'logo', 'url', 'provider', 'provider_config')
attributeLEGACY_TEMPLATE_KEYS
= {'SELKIES_IS_MANUAL_RESOLUTION_MODE': 'SELKIES_MANUAL_RESOLUTION', 'SELKIES_H264_CRF': 'SELKIES_VIDEO_CRF', 'SELKIES_H264_FULLCOLOR': 'SELKIES_VIDEO_FULLCOLOR', 'SELKIES_H264_STREAMING_MODE': 'SELKIES_VIDEO_STREAMING_MODE', 'SELKIES_H264_PAINTOVER_CRF': 'SELKIES_VIDEO_PAINTOVER_CRF', 'SELKIES_H264_PAINTOVER_BURST_FRAMES': 'SELKIES_VIDEO_PAINTOVER_BURST_FRAMES'}
attributeLEGACY_CLIPBOARD_KEYS
= ('SELKIES_CLIPBOARD_ENABLED', 'SELKIES_CLIPBOARD_IN_ENABLED', 'SELKIES_CLIPBOARD_OUT_ENABLED')
attributeLEGACY_ENCODER_NAMES
= {'x264enc': 'h264enc', 'x264enc-striped': 'h264enc-striped'}
funcis_safe_name(name) -> bool

Tell whether a store or template name is safe to use in a file path.

paramnamestr

Name supplied by an administrator.

Returns

bool

True when the name only contains letters, digits, spaces, _,

funcdeep_merge(base, overrides) -> dict[str, Any]

Recursively merge overrides into a copy of base.

Dictionaries are merged key by key; lists and scalars in overrides replace the base value.

parambasedict[str, Any]

Base dictionary (not modified).

paramoverridesdict[str, Any]

Values that win.

Returns

dict

A new merged dictionary.

funcdiff_overrides(full, base) -> dict[str, Any]

Return the subset of full that differs from base.

Nested dictionaries are compared recursively so an override only records the leaves that changed.

paramfulldict[str, Any]

Complete desired values.

parambasedict[str, Any]

Reference values (the store entry).

Returns

dict

A dictionary suitable for InstalledAppRecord.overrides.

funcensure_config_dir() -> None

Create the configuration directories if they do not exist.

Returns

None
funcload_app_stores() -> None

Load app_stores.yml into state.app_stores.

A default store pointing at the LinuxServer catalogue is written when the file does not exist.

Returns

None
funcsave_app_stores_sync() -> None

Write state.app_stores to disk synchronously.

Returns

None
funcsave_app_stores() -> None

Write state.app_stores to disk.

Returns

None
funcget_store(store_name) -> AppStore | None

Return the configured store with the given name, if any.

paramstore_namestr

Returns

app.models.AppStore | None
funcstore_cache_file(store_name) -> str

Return the cache file path of a store.

paramstore_namestr

Returns

str
func_extract_apps(data) -> list[dict[str, Any]]

Return the app list from a parsed store document.

paramdataAny

Returns

list[dict[str, typing.Any]]
func_read_cached_script_b64(store_name, app_id, suffix='') -> str | None

Return the cached autostart script of an app as base64, if present.

paramstore_namestr
paramapp_idstr
paramsuffixstr
= ''

Returns

str | None
funcprocess_store_content(content, store_name) -> list[dict[str, Any]]

Parse a store document into the entries the clients and resolver use.

Cached autostart scripts are injected as base64 and nested extension lists are flattened, matching what the admin UI sends back at install time.

paramcontentstr

Raw YAML text of the store.

paramstore_namestr

Store name, used to locate the autostart cache.

Returns

list

List of app dictionaries.

funcload_store_entries() -> None

Parse every cached store into state.store_entries.

Returns

None
funcget_store_entry(store_name, app_id) -> dict[str, Any] | None

Return the processed store entry for an app, if the store knows it.

paramstore_namestr
paramapp_idstr

Returns

dict[str, typing.Any] | None
func_fetch_and_cache_app_store(store) -> None

Refresh one store's cache file using ETag conditional requests.

paramstoreAppStore

Returns

None
funcrefresh_store_caches() -> None

Refresh every configured store's cache and reload store entries.

Returns

None
funcfetch_store_apps(store_name, url, refresh) -> list[dict[str, Any]]

Return the processed app list of a store, fetching it when needed.

paramstore_namestr

Store name (validated by the caller).

paramurlstr

Store URL.

paramrefreshbool

Ignore the cache and fetch from url.

Returns

list

Processed app entries.

funcautostart_cache_path(app, suffix='') -> str | None

Return the cache file for an app's repository autostart script.

paramappInstalledApp | InstalledAppRecord

Installed app or record; source must name a configured store.

paramsuffixstr
= ''

"" for X11 or "-wayland".

Returns

str | None

The path, or None when the store is unknown.

func_fetch_and_cache_single_script(store_name, base_url, app_id, suffix='') -> None

Fetch one autostart script into the cache using ETag conditional requests.

paramstore_namestr
parambase_urlstr
paramapp_idstr
paramsuffixstr
= ''

Returns

None
funcrefresh_autostart_caches() -> None

Fetch autostart scripts for every store app that declares one.

Returns

None
funcrefresh_autostart_for_app(app) -> None

Refresh the cached autostart scripts of a single installed app.

paramappInstalledApp

The resolved installed app.

Returns

None
func_store_base(record) -> dict[str, Any] | None

Return the store entry restricted to the fields an installed app derives.

paramrecordInstalledAppRecord

Returns

dict[str, typing.Any] | None
funcresolve_app(record) -> InstalledApp | None

Compute the effective installed app from a record.

paramrecordInstalledAppRecord

Reference plus overrides as stored on disk.

Returns

InstalledApp | None

The resolved InstalledApp, or None (logged) when the

funcrecord_from_app(app, existing=None) -> InstalledAppRecord

Convert a full installed app into a reference-plus-overrides record.

paramappInstalledApp

Complete app as received from the admin UI.

paramexistingInstalledAppRecord | None
= None

Current record of the same app, whose overrides are replaced.

Returns

app.models.InstalledAppRecord

The record to persist.

funcapply_partial_update(record, patch) -> InstalledAppRecord

Merge a partial update into a record.

Record fields (users, groups, template, ...) are set directly; everything else is deep-merged into overrides.

paramrecordInstalledAppRecord

Current record.

parampatchdict[str, Any]

Partial InstalledApp shaped dictionary.

Returns

app.models.InstalledAppRecord

The updated record (a new object).

func_migrate_legacy_record(raw) -> InstalledAppRecord

Convert a pre-0.2 full snapshot into a reference-plus-overrides record.

paramrawdict[str, Any]

Returns

app.models.InstalledAppRecord
funcload_installed_apps() -> None

Load installed_apps.yml into state.installed_records and resolve.

Legacy full-snapshot records are migrated once and the file rewritten. Invalid records are skipped with a log line instead of clearing the list.

Returns

None
funcresolve_all_apps() -> None

Re-resolve every record into state.installed_apps.

Returns

None
func_records_for_disk() -> list[dict[str, Any]]

Serialise the records, dropping empty overrides for readability.

Returns

list[dict[str, typing.Any]]
funcsave_installed_apps_sync() -> None

Write the installed app records synchronously.

Returns

None
funcsave_installed_apps() -> None

Write the installed app records to disk.

Returns

None
funcset_record(record) -> InstalledApp | None

Store a record in memory and resolve it.

paramrecordInstalledAppRecord

The record to keep.

Returns

InstalledApp | None

The resolved app, or None if it could not be resolved (the record

funcremove_record(app_id) -> None

Forget an installed app.

paramapp_idstr

Returns

None
func_is_true(value) -> bool
paramvalueAny

Returns

bool
funcmigrate_legacy_template_settings(template_settings) -> dict[str, Any]

Return template_settings with pre-refresh Selkies keys translated.

Renamed keys move to their current name unless the current name is already present. The three clipboard booleans collapse into the SELKIES_ENABLE_CLIPBOARD policy (true, in, out or false), and encoder spellings the current Selkies no longer lists are mapped onto the encoders that serve them. Unknown keys pass through untouched.

paramtemplate_settingsdict[str, Any]

Returns

dict[str, typing.Any]
func_load_templates_from(directory, source) -> None

Load every YAML template in directory into state.

paramdirectorystr
paramsourcestr

Returns

None
funcload_app_templates() -> None

Load default and user templates into state.app_templates.

A blank Default template is created when none exist.

Returns

None
functemplate_filename(name) -> str

Return the file name derived from a template name.

paramnamestr

Returns

str
funcsave_app_template(template) -> None

Write a template to the user template directory and reload.

When a template of that name was loaded from a differently named file (for example after a hand edit) the existing file is reused so no orphan is left behind.

paramtemplateAppTemplate

Template to save.

Returns

None
funcdelete_app_template(name) -> None

Delete a user template by name.

paramnamestr

Template name.

Returns

None
funcload_sessions() -> None

Load persisted sessions into state.sessions.

Returns

None
funcsave_sessions() -> None

Persist state.sessions to disk.

Returns

None
funcload_public_shares() -> None

Load public share metadata into state.public_shares.

Returns

None
funcsave_public_shares() -> None

Persist state.public_shares to disk.

Returns

None