Documentation
¶
Index ¶
- Constants
- func AuthFilePath(dbPath string) string
- func BootstrapAuthFile(dbPath string, username string, password string) error
- func SaveCLIConfig(dbPath string, cfg CLIConfig) error
- type Backend
- func (b *Backend) BrowseDirectory(path string, mode string) (api.BrowseDirectoryResponse, error)
- func (b *Backend) BrowseDirectoryWithinRoot(path string, mode string, root string) (api.BrowseDirectoryResponse, error)
- func (b *Backend) BrowseDirectoryWithinRoots(path string, mode string, roots []string) (api.BrowseDirectoryResponse, error)
- func (b *Backend) CancelDupeCheck(sessionID string, jobID string) error
- func (b *Backend) CancelTrackerUpload(sessionID string, jobID string) error
- func (b *Backend) CheckDupes(path string, overrides api.ExternalIDOverrides, ...) (api.DupeCheckSummary, error)
- func (b *Backend) Close() error
- func (b *Backend) DeleteHistoryRelease(sourcePath string) error
- func (b *Backend) DeleteScreenshot(path string, overrides api.ExternalIDOverrides, ...) error
- func (b *Backend) DeleteTrackerImageURL(path string, overrides api.ExternalIDOverrides, ...) error
- func (b *Backend) DeleteUploadedImage(path string, imagePath string, host string) error
- func (b *Backend) DetectDiscType(ctx context.Context, path string) (string, error)
- func (b *Backend) DiscoverPlaylists(path string) ([]api.PlaylistInfo, error)
- func (b *Backend) ExportConfig() (string, error)
- func (b *Backend) FetchDescriptionBuilder(path string, overrides api.ExternalIDOverrides, ...) (api.DescriptionBuilderPreview, error)
- func (b *Backend) FetchMetadata(sessionID string, path string, sourceLookupURL string, ...) (api.MetadataPreview, error)
- func (b *Backend) FetchPreparation(sessionID string, path string, overrides api.ExternalIDOverrides, ...) (api.PreparationPreview, error)
- func (b *Backend) FetchScreenshotPlan(path string, overrides api.ExternalIDOverrides, ...) (api.ScreenshotPlan, error)
- func (b *Backend) FetchTrackerDryRun(sessionID string, path string, overrides api.ExternalIDOverrides, ...) (api.TrackerDryRunPreview, error)
- func (b *Backend) GenerateScreenshots(path string, overrides api.ExternalIDOverrides, ...) (api.ScreenshotResult, error)
- func (b *Backend) GetApplicationInfo() (api.ApplicationInfo, error)
- func (b *Backend) GetConfig() (string, error)
- func (b *Backend) GetDefaultConfig() (string, error)
- func (b *Backend) GetDupeCheckSnapshot(sessionID string, jobID string) (DupeCheckSnapshot, error)
- func (b *Backend) GetHistoryOverview(sourcePath string) (api.HistoryOverview, error)
- func (b *Backend) GetImageHostPolicyMetadata() (imagehostpolicy.Metadata, error)
- func (b *Backend) GetLogExclusions() ([]string, error)
- func (b *Backend) GetLogPath() (string, error)
- func (b *Backend) GetRecentLogs(limit int) ([]logging.Entry, error)
- func (b *Backend) GetTrackerUploadSnapshot(sessionID string, jobID string) (TrackerUploadSnapshot, error)
- func (b *Backend) ImportConfig(fileName, fileContent string) (string, []string, error)
- func (b *Backend) ImportMenuImages(path string, overrides api.ExternalIDOverrides, ...) error
- func (b *Backend) ListHistory() ([]api.HistoryEntry, error)
- func (b *Backend) ListKnownTrackers() ([]string, error)
- func (b *Backend) ListUploadCandidates(path string, overrides api.ExternalIDOverrides, ...) ([]api.ScreenshotImage, error)
- func (b *Backend) ListUploadedImages(path string, overrides api.ExternalIDOverrides, ...) ([]api.UploadedImageLink, error)
- func (b *Backend) LoadPlaylistSelection(path string) (api.PlaylistSelection, error)
- func (b *Backend) PreviewScreenshotFrame(path string, overrides api.ExternalIDOverrides, ...) (string, error)
- func (b *Backend) ReadScreenshotImage(path string) (string, error)
- func (b *Backend) RenderDescription(raw string) (string, error)
- func (b *Backend) ResetMetadata(sessionID string, path string, sourceLookupURL string, ...) (api.MetadataPreview, error)
- func (b *Backend) RetryFailedTrackerUpload(sessionID string, jobID string) (string, error)
- func (b *Backend) SaveConfig(payload string) error
- func (b *Backend) SaveDescriptionOverride(path string, groupKey string, raw string, trackers []string, ...) (api.DescriptionBuilderGroup, error)
- func (b *Backend) SaveFinalScreenshotSelections(path string, overrides api.ExternalIDOverrides, ...) error
- func (b *Backend) SavePlaylistSelection(path string, playlists []string, useAll bool) error
- func (b *Backend) SelectBlurayCandidate(path string, releaseID string) (api.MetadataPreview, error)
- func (b *Backend) StartDupeCheck(sessionID string, path string, overrides api.ExternalIDOverrides, ...) (string, error)
- func (b *Backend) StartLogStream(sessionID string) (string, error)
- func (b *Backend) StartTrackerUpload(sessionID string, path string, overrides api.ExternalIDOverrides, ...) (string, error)
- func (b *Backend) StopLogStream(sessionID string, streamID string) error
- func (b *Backend) StopSessionLogStreams(sessionID string)
- func (b *Backend) UpdateLogExclusions(patterns []string) error
- func (b *Backend) UploadImages(path string, overrides api.ExternalIDOverrides, ...) (api.UploadImagesResult, error)
- type CLIConfig
- type DupeCheckSnapshot
- type DupeCheckTrackerState
- type Options
- type Server
- type TrackerUploadSnapshot
- type TrackerUploadTrackerState
Constants ¶
const AuthFileName = authmaterial.WebAuthFileName
AuthFileName is the canonical web auth file name stored beside the database.
const AuthPasswordMinLength = authmaterial.AuthPasswordMinLength
AuthPasswordMinLength defines the minimum web auth password length.
Variables ¶
This section is empty.
Functions ¶
func AuthFilePath ¶
AuthFilePath returns the auth file path colocated with dbPath.
func BootstrapAuthFile ¶
BootstrapAuthFile creates the canonical auth file beside dbPath.
func SaveCLIConfig ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend owns the embedded web API runtime and request-scoped background jobs.
func NewBackend ¶
NewBackend constructs a Backend using a background context.
func NewBackendWithContext ¶
NewBackendWithContext opens the shared repository, creates the logger, and starts the core service when cfg validates. Invalid config keeps settings routes usable while core-backed routes report the initialization error.
func (*Backend) BrowseDirectory ¶
func (*Backend) BrowseDirectoryWithinRoot ¶
func (*Backend) BrowseDirectoryWithinRoots ¶
func (*Backend) CancelDupeCheck ¶
CancelDupeCheck requests cancellation only for a dupe job owned by sessionID.
func (*Backend) CancelTrackerUpload ¶
CancelTrackerUpload requests cancellation only for an upload job owned by sessionID.
func (*Backend) CheckDupes ¶
func (b *Backend) CheckDupes(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackersList []string) (api.DupeCheckSummary, error)
func (*Backend) Close ¶
Close stops active background work and releases runtime, repository, and log resources.
func (*Backend) DeleteHistoryRelease ¶
func (*Backend) DeleteScreenshot ¶
func (b *Backend) DeleteScreenshot(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, imagePath string) error
func (*Backend) DeleteTrackerImageURL ¶
func (b *Backend) DeleteTrackerImageURL(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, imageURL string) error
func (*Backend) DeleteUploadedImage ¶
func (*Backend) DetectDiscType ¶
func (*Backend) DiscoverPlaylists ¶
func (b *Backend) DiscoverPlaylists(path string) ([]api.PlaylistInfo, error)
func (*Backend) ExportConfig ¶
ExportConfig returns the exportable config, using plaintext secrets only when auth material for the exported snapshot's DB path explicitly allows unencrypted export.
func (*Backend) FetchDescriptionBuilder ¶
func (b *Backend) FetchDescriptionBuilder(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackersList []string, ignoreDupesFor []string) (api.DescriptionBuilderPreview, error)
func (*Backend) FetchMetadata ¶
func (b *Backend) FetchMetadata(sessionID string, path string, sourceLookupURL string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackersList []string, confirmBDMVRescan bool) (api.MetadataPreview, error)
func (*Backend) FetchPreparation ¶
func (b *Backend) FetchPreparation(sessionID string, path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackersList []string, ignoreDupesFor []string) (api.PreparationPreview, error)
func (*Backend) FetchScreenshotPlan ¶
func (b *Backend) FetchScreenshotPlan(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides) (api.ScreenshotPlan, error)
func (*Backend) FetchTrackerDryRun ¶
func (b *Backend) FetchTrackerDryRun(sessionID string, path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackersList []string, ignoreDupesFor []string, questionnaireAnswers map[string]map[string]string, descriptionGroups []api.DescriptionBuilderGroup, debug bool, noSeed bool, runLogLevel string) (api.TrackerDryRunPreview, error)
func (*Backend) GenerateScreenshots ¶
func (b *Backend) GenerateScreenshots(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, selections []api.ScreenshotSelection, purpose api.ScreenshotPurpose) (api.ScreenshotResult, error)
func (*Backend) GetApplicationInfo ¶
func (b *Backend) GetApplicationInfo() (api.ApplicationInfo, error)
func (*Backend) GetConfig ¶
GetConfig returns the current exportable config as JSON with encrypted secret fields for browser settings consumers.
func (*Backend) GetDefaultConfig ¶
func (*Backend) GetDupeCheckSnapshot ¶
func (b *Backend) GetDupeCheckSnapshot(sessionID string, jobID string) (DupeCheckSnapshot, error)
GetDupeCheckSnapshot returns a dupe job snapshot only to the session that started the job.
func (*Backend) GetHistoryOverview ¶
func (b *Backend) GetHistoryOverview(sourcePath string) (api.HistoryOverview, error)
func (*Backend) GetImageHostPolicyMetadata ¶
func (b *Backend) GetImageHostPolicyMetadata() (imagehostpolicy.Metadata, error)
func (*Backend) GetLogExclusions ¶
func (*Backend) GetLogPath ¶
func (*Backend) GetTrackerUploadSnapshot ¶
func (b *Backend) GetTrackerUploadSnapshot(sessionID string, jobID string) (TrackerUploadSnapshot, error)
GetTrackerUploadSnapshot returns an upload job snapshot only to the session that started the job.
func (*Backend) ImportConfig ¶
ImportConfig imports browser-uploaded config content, validates the saved and env-applied runtime forms, builds the replacement runtime, persists the non-env config, then attempts shared cookie migration before installing the runtime. Runtime build or save failures leave the persisted config and active runtime unchanged.
func (*Backend) ImportMenuImages ¶
func (b *Backend) ImportMenuImages(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, paths []string) error
func (*Backend) ListHistory ¶
func (b *Backend) ListHistory() ([]api.HistoryEntry, error)
func (*Backend) ListKnownTrackers ¶
func (*Backend) ListUploadCandidates ¶
func (b *Backend) ListUploadCandidates(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides) ([]api.ScreenshotImage, error)
func (*Backend) ListUploadedImages ¶
func (b *Backend) ListUploadedImages(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides) ([]api.UploadedImageLink, error)
func (*Backend) LoadPlaylistSelection ¶
func (b *Backend) LoadPlaylistSelection(path string) (api.PlaylistSelection, error)
func (*Backend) PreviewScreenshotFrame ¶
func (b *Backend) PreviewScreenshotFrame(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, timestampSeconds float64) (string, error)
func (*Backend) ReadScreenshotImage ¶
func (*Backend) ResetMetadata ¶
func (b *Backend) ResetMetadata(sessionID string, path string, sourceLookupURL string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackersList []string, confirmBDMVRescan bool) (api.MetadataPreview, error)
func (*Backend) RetryFailedTrackerUpload ¶
RetryFailedTrackerUpload starts a retry job for failed trackers only when sessionID owns the original upload job. The retry reuses the original job's run options, upload options, questionnaire answers, description groups, and ignore-dupe list instead of rebuilding them from current settings.
func (*Backend) SaveConfig ¶
SaveConfig validates encrypted browser settings, builds the replacement runtime, persists the non-env config, then attempts shared cookie migration before installing the runtime. Runtime build or save failures leave the persisted config and active runtime unchanged; env overrides apply only to the installed runtime config.
func (*Backend) SaveDescriptionOverride ¶
func (b *Backend) SaveDescriptionOverride(path string, groupKey string, raw string, trackers []string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides) (api.DescriptionBuilderGroup, error)
func (*Backend) SaveFinalScreenshotSelections ¶
func (b *Backend) SaveFinalScreenshotSelections(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, images []api.ScreenshotImage) error
func (*Backend) SavePlaylistSelection ¶
func (*Backend) SelectBlurayCandidate ¶
func (*Backend) StartDupeCheck ¶
func (b *Backend) StartDupeCheck(sessionID string, path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackers []string) (string, error)
func (*Backend) StartLogStream ¶
StartLogStream subscribes the browser session to live log events. Active streams are rebound when settings replace the runtime logger. If no logger or event hub is installed, it returns an error without registering a stream.
func (*Backend) StartTrackerUpload ¶
func (b *Backend) StartTrackerUpload(sessionID string, path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackers []string, ignoreDupesFor []string, questionnaireAnswers map[string]map[string]string, descriptionGroups []api.DescriptionBuilderGroup, debug bool, noSeed bool, runLogLevel string) (string, error)
StartTrackerUpload starts an upload job owned by sessionID for selected trackers and returns its job ID. Snapshots preserve partial upload counts returned with later tracker errors or cancellation. The job captures upload options at start time so failed-tracker retries reuse the original option set.
func (*Backend) StopLogStream ¶
StopLogStream stops streamID only when it belongs to sessionID. Unknown streams and streams owned by other sessions are treated as no-ops.
func (*Backend) StopSessionLogStreams ¶
StopSessionLogStreams closes all active log streams owned by sessionID.
func (*Backend) UpdateLogExclusions ¶
func (*Backend) UploadImages ¶
func (b *Backend) UploadImages(path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackersList []string, host string, images []api.ScreenshotImage) (api.UploadImagesResult, error)
type CLIConfig ¶
type CLIConfig struct {
Host string `json:"host"`
Port int `json:"port"`
OpenBrowser bool `json:"open_browser"`
TrustedProxies []string `json:"trusted_proxies"`
BaseURL string `json:"base_url"`
SessionTTL int `json:"session_ttl"`
}
func DefaultCLIConfig ¶
func DefaultCLIConfig() CLIConfig
func LoadCLIConfig ¶
type DupeCheckSnapshot ¶
type DupeCheckSnapshot struct {
JobID string `json:"jobID"`
SourcePath string `json:"sourcePath"`
Status string `json:"status"`
Trackers []DupeCheckTrackerState `json:"trackers"`
CompletedCount int `json:"completedCount"`
TotalCount int `json:"totalCount"`
Summary api.DupeCheckSummary `json:"summary"`
Error string `json:"error"`
StartedAt string `json:"startedAt"`
FinishedAt string `json:"finishedAt"`
}
type DupeCheckTrackerState ¶
type Options ¶
type Options struct {
// Config supplies the application configuration used by the backend.
Config config.Config
// CLIConfig supplies persisted or command-line web server settings.
CLIConfig CLIConfig
// DevelopmentNoAuth enables the development-only auth bypass for loopback hosts.
DevelopmentNoAuth bool
}
Options configures the embedded web UI server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server owns the embedded web UI HTTP server, backend services, auth stores, and event hub.
func New ¶
New constructs a server from application and web CLI configuration. It rejects development no-auth mode for non-loopback hosts.
func (*Server) Run ¶
Run binds the configured TCP address and serves until ctx is cancelled or a shutdown signal arrives.
func (*Server) RunAfterListen ¶ added in v0.2.0
RunAfterListen runs the server and calls afterListen once the TCP listener has bound successfully, before HTTP serving starts. If afterListen fails, the listener is closed and the server does not start accepting requests.
type TrackerUploadSnapshot ¶
type TrackerUploadSnapshot struct {
JobID string `json:"jobID"`
SourcePath string `json:"sourcePath"`
Status string `json:"status"`
CurrentTask string `json:"currentTask"`
CurrentTaskStatus string `json:"currentTaskStatus"`
CurrentMessage string `json:"currentMessage"`
CurrentCompletedPieces int `json:"currentCompletedPieces"`
CurrentTotalPieces int `json:"currentTotalPieces"`
CurrentPercent int `json:"currentPercent"`
CurrentHashRateMiB float64 `json:"currentHashRateMiB"`
Trackers []TrackerUploadTrackerState `json:"trackers"`
FailedTrackers []string `json:"failedTrackers"`
UploadedCount int `json:"uploadedCount"`
Error string `json:"error"`
StartedAt string `json:"startedAt"`
FinishedAt string `json:"finishedAt"`
}
TrackerUploadSnapshot reports frontend-visible state for a tracker upload job. UploadedCount is the sum of per-tracker accepted uploads, including partial counts returned with non-nil errors.
type TrackerUploadTrackerState ¶
type TrackerUploadTrackerState struct {
Tracker string `json:"tracker"`
Status string `json:"status"`
Task string `json:"task"`
TaskStatus string `json:"taskStatus"`
Message string `json:"message"`
CompletedPieces int `json:"completedPieces"`
TotalPieces int `json:"totalPieces"`
Percent int `json:"percent"`
HashRateMiB float64 `json:"hashRateMiB"`
UploadedCount int `json:"uploadedCount"`
StartedAt string `json:"startedAt"`
FinishedAt string `json:"finishedAt"`
}
TrackerUploadTrackerState reports frontend-visible state for one tracker in an upload job. UploadedCount includes accepted uploads returned before a later tracker error or cancellation.