webserver

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: GPL-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

AuthFileName is the canonical web auth file name stored beside the database.

View Source
const AuthPasswordMinLength = authmaterial.AuthPasswordMinLength

AuthPasswordMinLength defines the minimum web auth password length.

Variables

This section is empty.

Functions

func AuthFilePath

func AuthFilePath(dbPath string) string

AuthFilePath returns the auth file path colocated with dbPath.

func BootstrapAuthFile

func BootstrapAuthFile(dbPath string, username string, password string) error

BootstrapAuthFile creates the canonical auth file beside dbPath.

func SaveCLIConfig

func SaveCLIConfig(dbPath string, cfg CLIConfig) error

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend(cfg config.Config, hub *eventHub) (*Backend, error)

func NewBackendWithContext

func NewBackendWithContext(ctx context.Context, cfg config.Config, hub *eventHub) (*Backend, error)

func (*Backend) BrowseDirectory

func (b *Backend) BrowseDirectory(path string, mode string) (api.BrowseDirectoryResponse, error)

func (*Backend) BrowseDirectoryWithinRoot

func (b *Backend) BrowseDirectoryWithinRoot(path string, mode string, root string) (api.BrowseDirectoryResponse, error)

func (*Backend) BrowseDirectoryWithinRoots

func (b *Backend) BrowseDirectoryWithinRoots(path string, mode string, roots []string) (api.BrowseDirectoryResponse, error)

func (*Backend) CancelDupeCheck

func (b *Backend) CancelDupeCheck(sessionID string, jobID string) error

CancelDupeCheck requests cancellation only for a dupe job owned by sessionID.

func (*Backend) CancelTrackerUpload

func (b *Backend) CancelTrackerUpload(sessionID string, jobID string) error

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

func (b *Backend) Close() error

func (*Backend) DeleteHistoryRelease

func (b *Backend) DeleteHistoryRelease(sourcePath string) error

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 (b *Backend) DeleteUploadedImage(path string, imagePath string, host string) error

func (*Backend) DetectDiscType

func (b *Backend) DetectDiscType(ctx context.Context, path string) (string, error)

func (*Backend) DiscoverPlaylists

func (b *Backend) DiscoverPlaylists(path string) ([]api.PlaylistInfo, error)

func (*Backend) ExportConfig

func (b *Backend) ExportConfig() (string, error)

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

func (b *Backend) GetConfig() (string, error)

func (*Backend) GetDefaultConfig

func (b *Backend) GetDefaultConfig() (string, error)

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 (b *Backend) GetLogExclusions() ([]string, error)

func (*Backend) GetLogPath

func (b *Backend) GetLogPath() (string, error)

func (*Backend) GetRecentLogs

func (b *Backend) GetRecentLogs(limit int) ([]logging.Entry, error)

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

func (b *Backend) ImportConfig(fileName, fileContent string) (string, []string, error)

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 (b *Backend) ListKnownTrackers() ([]string, error)

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 (b *Backend) ReadScreenshotImage(path string) (string, error)

func (*Backend) RenderDescription

func (b *Backend) RenderDescription(raw string) (string, error)

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

func (b *Backend) RetryFailedTrackerUpload(sessionID string, jobID string) (string, error)

RetryFailedTrackerUpload starts a retry job for failed trackers only when sessionID owns the original upload job.

func (*Backend) SaveConfig

func (b *Backend) SaveConfig(payload string) error

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 (b *Backend) SavePlaylistSelection(path string, playlists []string, useAll bool) error

func (*Backend) SelectBlurayCandidate

func (b *Backend) SelectBlurayCandidate(path string, releaseID string) (api.MetadataPreview, error)

func (*Backend) StartDupeCheck

func (b *Backend) StartDupeCheck(sessionID string, path string, overrides api.ExternalIDOverrides, nameOverrides api.ReleaseNameOverrides, trackers []string) (string, error)

func (*Backend) StartLogStream

func (b *Backend) StartLogStream(sessionID string) (string, error)

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)

func (*Backend) StopLogStream

func (b *Backend) StopLogStream(sessionID string, streamID string) error

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

func (b *Backend) StopSessionLogStreams(sessionID string)

StopSessionLogStreams closes all active log streams owned by sessionID.

func (*Backend) UpdateLogExclusions

func (b *Backend) UpdateLogExclusions(patterns []string) error

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

func LoadCLIConfig(dbPath string) (CLIConfig, error)

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 DupeCheckTrackerState struct {
	Tracker    string              `json:"tracker"`
	Status     string              `json:"status"`
	Message    string              `json:"message"`
	Result     api.DupeCheckResult `json:"result"`
	StartedAt  string              `json:"startedAt"`
	FinishedAt string              `json:"finishedAt"`
}

type Options

type Options struct {
	Config            config.Config
	CLIConfig         CLIConfig
	DevelopmentNoAuth bool
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(opts Options) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

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"`
}

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"`
}

Jump to

Keyboard shortcuts

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