methods

package
v2.16.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: GPL-3.0 Imports: 72 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrForbidden = errors.New("client role does not permit this method")

ErrForbidden is returned when a client's role does not grant the capability a method requires.

View Source
var ErrLocalhostOnly = errors.New("method is only available from localhost")

ErrLocalhostOnly is returned when a non-localhost client invokes a method that is restricted to local administration only.

View Source
var ErrNotAllowed = errors.New("not allowed")

ErrNotAllowed is returned when a run request is not allowed.

Functions

func CancelIndexing added in v2.7.0

func CancelIndexing() bool

CancelIndexing cancels the currently running indexing operation - used for testing

func ClearIndexingStatus added in v2.7.0

func ClearIndexingStatus()

ClearIndexingStatus clears the global indexing status - used for testing

func ClearScrapingStatus added in v2.12.0

func ClearScrapingStatus()

ClearScrapingStatus resets the global scraping status — used for testing.

func GenerateMediaDB added in v2.7.0

func GenerateMediaDB(
	ctx context.Context,
	pl platforms.Platform,
	cfg *config.Instance,
	ns chan<- models.Notification,
	systems []systemdefs.System,
	db *database.Database,
	pauser *syncutil.Pauser,
) error

func GenerateMediaDBRebuild added in v2.16.0

func GenerateMediaDBRebuild(
	ctx context.Context,
	pl platforms.Platform,
	cfg *config.Instance,
	ns chan<- models.Notification,
	systems []systemdefs.System,
	db *database.Database,
	pauser *syncutil.Pauser,
) error

GenerateMediaDBRebuild is GenerateMediaDB with a fresh start: the media database file is discarded and recreated before indexing, so everything — including scraped metadata — is rebuilt from scratch. User data (favourites, launcher overrides) lives in UserDB and is re-applied after indexing.

func HandleActiveMedia

func HandleActiveMedia(env requests.RequestEnv) (any, error)

func HandleAddMapping

func HandleAddMapping(env requests.RequestEnv) (any, error)

func HandleBackup added in v2.15.0

func HandleBackup(env requests.RequestEnv) (any, error)

func HandleBackupDelete added in v2.16.0

func HandleBackupDelete(env requests.RequestEnv) (any, error)

func HandleBackupInspect added in v2.16.0

func HandleBackupInspect(env requests.RequestEnv) (any, error)

func HandleBackupList added in v2.15.0

func HandleBackupList(env requests.RequestEnv) (any, error)

func HandleBackupRemoteList added in v2.16.0

func HandleBackupRemoteList(env requests.RequestEnv) (any, error)

func HandleBackupRemoteRestore added in v2.16.0

func HandleBackupRemoteRestore(env requests.RequestEnv) (any, error)

func HandleBackupRemoteRun added in v2.16.0

func HandleBackupRemoteRun(env requests.RequestEnv) (any, error)

func HandleBackupRestore added in v2.15.0

func HandleBackupRestore(env requests.RequestEnv) (any, error)

func HandleBackupStatus added in v2.16.0

func HandleBackupStatus(env requests.RequestEnv) (any, error)

func HandleClients added in v2.11.0

func HandleClients(env requests.RequestEnv) (any, error)

HandleClients lists paired clients (localhost-only).

func HandleClientsCurrent added in v2.16.0

func HandleClientsCurrent(env requests.RequestEnv) (any, error)

HandleClientsCurrent returns the current connection's paired role and effective capabilities. It is available to every accepted API connection.

func HandleClientsDelete added in v2.11.0

func HandleClientsDelete(env requests.RequestEnv) (any, error)

HandleClientsDelete revokes a paired client (localhost-only, forward-only; existing sessions survive until disconnect).

func HandleClientsPairCancel added in v2.11.0

func HandleClientsPairCancel(mgr PairingController) func(requests.RequestEnv) (any, error)

HandleClientsPairCancel returns a handler that cancels the active pairing flow. Localhost-only.

func HandleClientsPairStart added in v2.11.0

func HandleClientsPairStart(mgr PairingController) func(requests.RequestEnv) (any, error)

HandleClientsPairStart returns a handler that initiates a new pairing flow. Localhost-only — the user must have physical access to the device. The optional role param decides the permission role the paired client will receive (default member); this is the approval step, so the person physically at the device makes the choice.

func HandleConfirm added in v2.11.0

func HandleConfirm(env requests.RequestEnv) (any, error)

func HandleDeleteMapping

func HandleDeleteMapping(env requests.RequestEnv) (any, error)

func HandleGenerateMedia

func HandleGenerateMedia(env requests.RequestEnv) (any, error)

func HandleHealthCheck added in v2.7.1

func HandleHealthCheck(_ requests.RequestEnv) (any, error)

func HandleHistory

func HandleHistory(env requests.RequestEnv) (any, error)

func HandleInbox added in v2.8.0

func HandleInbox(env requests.RequestEnv) (any, error)

func HandleInboxClear added in v2.8.0

func HandleInboxClear(env requests.RequestEnv) (any, error)

func HandleInboxDelete added in v2.8.0

func HandleInboxDelete(env requests.RequestEnv) (any, error)

func HandleInputGamepad added in v2.10.0

func HandleInputGamepad(env requests.RequestEnv) (any, error)

func HandleInputKeyboard added in v2.10.0

func HandleInputKeyboard(env requests.RequestEnv) (any, error)

func HandleLaunchers added in v2.12.0

func HandleLaunchers(env requests.RequestEnv) (any, error)

func HandleLaunchersRefresh

func HandleLaunchersRefresh(env requests.RequestEnv) (any, error)

func HandleLogsDownload

func HandleLogsDownload(env requests.RequestEnv) (any, error)

func HandleMappings

func HandleMappings(env requests.RequestEnv) (any, error)

func HandleMedia

func HandleMedia(env requests.RequestEnv) (any, error)

func HandleMediaBrowse added in v2.10.0

func HandleMediaBrowse(env requests.RequestEnv) (any, error)

HandleMediaBrowse handles the media.browse API method for directory-style navigation of indexed media content.

func HandleMediaBrowseIndex added in v2.15.0

func HandleMediaBrowseIndex(env requests.RequestEnv) (any, error)

HandleMediaBrowseIndex handles the media.browse.index API method. It returns the ordered first-character buckets for a browse scope, each with a count and a ready-to-use seek cursor, so a client can draw a "jump to letter" rail and jump into the full ordered list in one round trip. media.browse itself is unchanged: the per-bucket cursor is a normal browse cursor.

func HandleMediaCleanOrphans added in v2.12.0

func HandleMediaCleanOrphans(env requests.RequestEnv) (any, error)

HandleMediaCleanOrphans removes missing Media records and their associated orphaned data (tags, properties, fully-orphaned titles). Returns the number of missing Media rows deleted.

func HandleMediaControl added in v2.10.0

func HandleMediaControl(env requests.RequestEnv) (any, error)

func HandleMediaGenerateCancel added in v2.7.0

func HandleMediaGenerateCancel(env requests.RequestEnv) (any, error)

func HandleMediaGenerateResume added in v2.11.0

func HandleMediaGenerateResume(env requests.RequestEnv) (any, error)

func HandleMediaHistory added in v2.10.0

func HandleMediaHistory(env requests.RequestEnv) (any, error)

func HandleMediaHistoryLatest added in v2.14.0

func HandleMediaHistoryLatest(env requests.RequestEnv) (any, error)

func HandleMediaHistoryTop added in v2.10.0

func HandleMediaHistoryTop(env requests.RequestEnv) (any, error)

func HandleMediaImage added in v2.12.0

func HandleMediaImage(env requests.RequestEnv) (any, error)

HandleMediaImage returns a single best-match image for a media record as a base64-encoded blob.

func HandleMediaLookup added in v2.10.0

func HandleMediaLookup(env requests.RequestEnv) (any, error)

func HandleMediaMeta added in v2.12.0

func HandleMediaMeta(env requests.RequestEnv) (any, error)

HandleMediaMeta returns the full metadata graph for a single Media record: the Media itself, its parent MediaTitle, System, level-separated Tags, and level-separated Properties. Binary payloads are not included; use media.image to fetch image bytes.

func HandleMediaMetaUpdate added in v2.15.0

func HandleMediaMetaUpdate(env requests.RequestEnv) (any, error)

func HandleMediaScrape added in v2.12.0

func HandleMediaScrape(env requests.RequestEnv) (any, error)

HandleMediaScrape starts a named scraper as a tracked background operation. Returns immediately with a null result; progress is broadcast as "media.scraping" notifications. Scraping and indexing are mutually exclusive.

func HandleMediaScrapeCancel added in v2.12.0

func HandleMediaScrapeCancel(env requests.RequestEnv) (any, error)

func HandleMediaScrapeResume added in v2.12.0

func HandleMediaScrapeResume(env requests.RequestEnv) (any, error)

HandleMediaScrapeResume manually resumes a paused media.scrape operation.

func HandleMediaScrapeStatus added in v2.12.0

func HandleMediaScrapeStatus(env requests.RequestEnv) (any, error)

HandleMediaScrapeStatus returns the latest known media.scrape status snapshot.

func HandleMediaSearch

func HandleMediaSearch(env requests.RequestEnv) (any, error)

func HandleMediaTags added in v2.7.0

func HandleMediaTags(env requests.RequestEnv) (any, error)

func HandleMediaTagsUpdate added in v2.12.0

func HandleMediaTagsUpdate(env requests.RequestEnv) (any, error)

func HandleMediaTitleParse added in v2.13.0

func HandleMediaTitleParse(
	env requests.RequestEnv,
) (any, error)

HandleMediaTitleParse computes a MediaTitle from a system ID and path without touching the filesystem or database. Used to preview the title parsing and slug generation that the media scanner would produce.

func HandlePlaytime added in v2.7.0

func HandlePlaytime(env requests.RequestEnv) (any, error)

func HandlePlaytimeLimits added in v2.7.0

func HandlePlaytimeLimits(env requests.RequestEnv) (any, error)

func HandlePlaytimeLimitsUpdate added in v2.7.0

func HandlePlaytimeLimitsUpdate(env requests.RequestEnv) (any, error)

func HandleProfiles added in v2.16.0

func HandleProfiles(env requests.RequestEnv) (any, error)

HandleProfiles lists all profiles.

func HandleProfilesActive added in v2.16.0

func HandleProfilesActive(env requests.RequestEnv) (any, error)

HandleProfilesActive returns the active profile, or null when none.

func HandleProfilesDelete added in v2.16.0

func HandleProfilesDelete(env requests.RequestEnv) (any, error)

HandleProfilesDelete removes a profile, deactivating it first if it is the active profile.

func HandleProfilesNew added in v2.16.0

func HandleProfilesNew(env requests.RequestEnv) (any, error)

HandleProfilesNew creates a new profile.

func HandleProfilesSwitch added in v2.16.0

func HandleProfilesSwitch(env requests.RequestEnv) (any, error)

HandleProfilesSwitch switches the active profile. A switch ID is a bearer credential: presenting one authorizes the switch with no PIN on every path (card scan, run API, or here), exactly like scanning the card. Switching by profile ID — picked from the visible list — is what the PIN protects. Passing neither profileId nor switchId deactivates (switches to the shared profile), which is always free: PINs gate entry only.

func HandleProfilesUpdate added in v2.16.0

func HandleProfilesUpdate(env requests.RequestEnv) (any, error)

HandleProfilesUpdate updates an existing profile.

func HandleProfilesVerify added in v2.16.0

func HandleProfilesVerify(env requests.RequestEnv) (any, error)

HandleProfilesVerify verifies a profile credential without switching: either a profile ID plus its PIN, or a switch ID (a bearer credential — resolving it is the verification). Success returns the profile's identity and grants nothing server-side; clients use this to gate their own ad-hoc UI items behind a credential. PIN attempts share the same rate limiter as switching.

func HandleReaderWrite

func HandleReaderWrite(
	params json.RawMessage,
	allReaders []readers.Reader,
	lastScanned *tokens.Token,
	setWroteToken func(*tokens.Token),
) (any, error)

func HandleReaderWriteCancel

func HandleReaderWriteCancel(
	params json.RawMessage,
	allReaders []readers.Reader,
) (any, error)

func HandleReaders

func HandleReaders(allReaders []readers.Reader) (any, error)

func HandleReloadMappings

func HandleReloadMappings(env requests.RequestEnv) (any, error)

func HandleRun

func HandleRun(env requests.RequestEnv) (any, error)

func HandleRunRest

func HandleRunRest(
	cfg *config.Instance,
	st *state.State,
	itq chan<- tokens.Token,
) http.HandlerFunc

func HandleScrapers added in v2.12.0

func HandleScrapers(env requests.RequestEnv) (any, error)

HandleScrapers returns the list of registered scrapers with their IDs and human-readable names.

func HandleScreenshot added in v2.10.0

func HandleScreenshot(env requests.RequestEnv) (any, error)

func HandleSettings

func HandleSettings(env requests.RequestEnv) (any, error)

func HandleSettingsAuthClaim added in v2.10.0

func HandleSettingsAuthClaim(env requests.RequestEnv, fetchWK wellKnownFetcher) (any, error)

HandleSettingsAuthClaim redeems a claim token against a remote auth server and stores the resulting credentials in auth.toml. It uses .well-known/zaparoo trust discovery to extend the credential to additional trusted domains.

func HandleSettingsAuthLink(env requests.RequestEnv, fetchWK wellKnownFetcher) (any, error)

HandleSettingsAuthLink starts a reverse link flow against the official Zaparoo API (or an explicit url param) and returns the user code and verification URLs to display. Progress is pushed via auth.link.status notifications and pollable via settings.auth.link.status.

func HandleSettingsAuthLinkCancel added in v2.16.0

func HandleSettingsAuthLinkCancel(env requests.RequestEnv) (any, error)

HandleSettingsAuthLinkCancel stops the active link flow, if any.

func HandleSettingsAuthLinkStatus added in v2.16.0

func HandleSettingsAuthLinkStatus(env requests.RequestEnv) (any, error)

HandleSettingsAuthLinkStatus returns the current link flow state.

func HandleSettingsAuthStatus added in v2.16.0

func HandleSettingsAuthStatus(env requests.RequestEnv) (any, error)

HandleSettingsAuthStatus reports whether Core has a local bearer for an allowed auth URL. It does not validate the token remotely and never exposes token material or credential domains.

func HandleSettingsAuthUnlink(env requests.RequestEnv) (any, error)

HandleSettingsAuthUnlink removes the device's online account credentials and marks remote backup unlinked. The claim/link flow tags every entry it creates with the root domain that created it (linked_via), so unlink removes the configured backup server's entry plus everything tagged with it — whatever the server's trusted list contained at link time. Credentials for other domains and API keys are untouched. The official backup-server device is revoked before local credentials are removed, so unlink never leaves a usable bearer behind.

func HandleSettingsReload

func HandleSettingsReload(env requests.RequestEnv) (any, error)

func HandleSettingsUpdate

func HandleSettingsUpdate(env requests.RequestEnv) (any, error)

func HandleStop

func HandleStop(env requests.RequestEnv) (any, error)

func HandleSystems

func HandleSystems(env requests.RequestEnv) (any, error)

func HandleTokens

func HandleTokens(env requests.RequestEnv) (any, error)

func HandleUI added in v2.16.0

func HandleUI(env requests.RequestEnv) (any, error)

func HandleUIRespond added in v2.16.0

func HandleUIRespond(env requests.RequestEnv) (any, error)

func HandleUpdateActiveMedia

func HandleUpdateActiveMedia(env requests.RequestEnv) (any, error)

func HandleUpdateApply added in v2.10.0

func HandleUpdateApply(
	env requests.RequestEnv,
	applyFn func(ctx context.Context, platformID, channel string) (string, error),
	restartFn func(),
) (any, error)

func HandleUpdateCheck added in v2.10.0

func HandleUpdateCheck(
	env requests.RequestEnv,
	checkFn func(ctx context.Context, platformID, channel string) (*updater.Result, error),
) (any, error)

func HandleUpdateMapping

func HandleUpdateMapping(env requests.RequestEnv) (any, error)

func HandleVersion

func HandleVersion(env requests.RequestEnv) (any, error)

func InitMediaThumbCache added in v2.14.1

func InitMediaThumbCache(pl platforms.Platform)

InitMediaThumbCache creates or replaces the process-wide thumb cache for the given platform and reaps any stale-version directories. Must be called once during service start, before any media.image requests are handled. Uses atomic store so concurrent StartWithReady calls in tests do not race.

func IsIndexing added in v2.11.0

func IsIndexing() bool

IsIndexing reports whether media indexing is currently in progress.

func IsScrapingRunning added in v2.12.0

func IsScrapingRunning() bool

IsScrapingRunning reports whether a media.scrape operation is currently active.

func PublishScrapePauseStatus added in v2.12.0

func PublishScrapePauseStatus(ns chan<- models.Notification, paused, throttled bool)

func ResumeMediaScrape added in v2.14.0

func ResumeMediaScrape(env *requests.RequestEnv, operation database.ScrapingOperation) error

func SetIndexingForTest added in v2.16.0

func SetIndexingForTest()

SetIndexingForTest marks indexing as in progress - used for testing.

func WipeMediaThumbCache added in v2.14.1

func WipeMediaThumbCache()

WipeMediaThumbCache removes all cached thumbnails. Called after a successful scrape (image sources may have changed) or media reindex so the cache does not serve stale art.

func WipeMediaThumbCacheSystems added in v2.16.0

func WipeMediaThumbCacheSystems(systemIDs []string)

WipeMediaThumbCacheSystems removes cached thumbnails only for the supplied systems. Other system directories and resolved request memos remain warm.

Types

type NoContent

type NoContent struct{}

type PairingController added in v2.11.0

type PairingController interface {
	StartPairing(role string) (pin string, expiresAt time.Time, err error)
	CountClients() (int, error)
	CancelPairing()
}

PairingController is the subset of PairingManager needed by the RPC handlers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL