/** * Navidrome MCP Server - Settings save messages * Copyright (C) 2025 * SPDX-License-Identifier: AGPL-3.0-or-later */ import type { Config } from '../config.js'; import { type SettingsFile } from '../config/store.js'; /** The process that serves the settings page, which decides the first Save's next step. */ export type SettingsPageHost = 'mcp-setup' | 'jukebox-setup' | 'jukebox-settings' | 'settings-command'; /** * How a host that waits on a Save took over: it owns the player port, or another player already does. * The url is the player's base address, which for another player can differ from the saved scheme. * A started player also gives the launch key it holds, so its link opens it with no login. */ export type SaveTakeover = { mode: 'started'; url: string; launchKey: string; } | { mode: 'attached'; url: string; }; /** A host start failure that no settings change fixes, so the page shows its message as the remedy. */ export declare class HostStartError extends Error { } interface NextStep { text: string; /** The page shows it as a link after the text. */ url?: string; /** The link's target when it differs from `url`, so the launch key opens the player but never shows on the page. */ href?: string; } type Restart = 'mcp' | 'player'; /** The banner of a second launch names the same live-applied keys and condition, so both build from these. */ export declare const LIVE_AUTH_FIELDS = "Ask for the admin password on this computer and Admin login allowed from"; export declare const LIVE_APPLY_WHEN = "the player runs from settings.json and Access already uses a password"; export interface SaveChange { /** settings.json as read before this save. */ storedFile: SettingsFile; /** storedFile with the normalizations the save applies, which the runtime already reads the same way. */ storedSettings: SettingsFile; saved: SettingsFile; adminPasswordChanged: boolean; /** True when the save cleared a store notice, such as a quoted number the store read as a number. */ clearedStoreNotice: boolean; } interface LaterSave { message: string; /** True when the message adds no restart or live-apply line to the saved-to sentence, or says nothing changed. */ brief: boolean; } /** * Names only the restarts the changed sections need, leaving out one that the next steps already * name. writeSettings prunes empty values, and the runtime reads an empty value as an absent one. * The brief flag ignores next steps, so a caller that sends some must not send the flag. */ export declare function laterSaveMessage(savedTo: string, change: SaveChange, namedInNextSteps?: Restart | null): LaterSave; /** * Replaces every restart line after a Save over a store that gave no usable config or a Save a host took over. * In MCP setup mode over a usable store it replaces only the MCP restart line, since a running player may have read that store. * A host that took over gives the player's address. Otherwise the address comes from the saved port and TLS paths, not the defaults. * Only the started player's link carries its launch key, since every other link's step names a start first, and that start makes a new key. */ export declare function firstSaveSteps(host: SettingsPageHost, webui: Config['webui'], takeover: SaveTakeover | null): NextStep[]; export {}; //# sourceMappingURL=save-message.d.ts.map