config

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultInputHistoryLimit = 20

Variables

View Source
var ErrSecretEncryptionHelperUnavailable = errors.New("config secret encryption helper unavailable")

ErrSecretEncryptionHelperUnavailable means encrypted secret operations need web auth helper material that is not available for the config's DB path.

Functions

func ApplyEnvOverrides

func ApplyEnvOverrides(cfg *Config)

func BackupToYAML

func BackupToYAML(cfg *Config, baseDir string) (string, error)

BackupToYAML creates a timestamped YAML backup of the current config. Returns the path to the backup file.

func DisableUnsupportedTrackerImageRehosts

func DisableUnsupportedTrackerImageRehosts(cfg *Config) []string

DisableUnsupportedTrackerImageRehosts turns off img_rehost for trackers that have no image-host policy and returns the tracker names that changed.

func EmbeddedExampleYAML

func EmbeddedExampleYAML() []byte

func ExportFromDatabaseToPlaintextYAML

func ExportFromDatabaseToPlaintextYAML(ctx context.Context, outputPath string, repo interface {
	LoadFullConfig(ctx context.Context, dest any) error
}) error

ExportFromDatabaseToPlaintextYAML loads config from database, applies environment overrides, and writes the resulting config to a YAML file without encrypting secret fields.

func ExportFromDatabaseToYAML

func ExportFromDatabaseToYAML(ctx context.Context, outputPath string, repo interface {
	LoadFullConfig(ctx context.Context, dest any) error
}) error

ExportFromDatabaseToYAML loads config from database, applies environment overrides, and writes the resulting config to a YAML file.

func ExportToJSON

func ExportToJSON(cfg *Config) (string, error)

ExportToJSON serializes the config to a JSON string.

func ExportToPlaintextJSON

func ExportToPlaintextJSON(cfg *Config) (string, error)

ExportToPlaintextJSON serializes the config to JSON without encrypting secret fields.

func ExportToPlaintextYAML

func ExportToPlaintextYAML(cfg *Config, path string) error

ExportToPlaintextYAML writes the config to a YAML file without encrypting secret fields.

func ExportToYAML

func ExportToYAML(cfg *Config, path string) error

ExportToYAML writes the config to a YAML file.

func LoadFromDatabaseWithRepairReport added in v0.2.0

func LoadFromDatabaseWithRepairReport(ctx context.Context, repo fullConfigLoader) (*Config, DatabaseRepairReport, error)

LoadFromDatabaseWithRepairReport loads and decrypts full config from repo, overlaying stored raw sections onto embedded defaults. The returned report identifies repaired root sections; if raw section-map loading fails but legacy struct loading succeeds, the report carries repair context without scheduling section persistence. On error the returned config is nil.

func LoadSectionFromDatabase

func LoadSectionFromDatabase(ctx context.Context, section string, dest any, repo interface {
	LoadConfigSection(ctx context.Context, section string, dest any) error
}) error

LoadSectionFromDatabase retrieves a single config section from the repository.

func MergeMissingTrackerDefaults

func MergeMissingTrackerDefaults(cfg *Config) (bool, error)

MergeMissingTrackerDefaults backfills tracker stubs from the embedded example config so older saved configs can discover newly added trackers in the GUI. Existing exact tracker names are preserved; ASCII case variants of "BTN" are treated as the BTN entry so default backfill and legacy metadata tokens do not create a duplicate canonical "BTN" entry. CZT keeps user credentials in Passkey only, so stale URL, APIKey, and AnnounceURL values are removed while preserving the passkey. Legacy Metadata.BTNAPI is moved into the BTN tracker APIKey when needed, then cleared once a tracker token is available. The returned flag reports whether cfg was modified.

func ResolveBTNAPIToken

func ResolveBTNAPIToken(cfg Config) string

ResolveBTNAPIToken returns the BTN tracker API key from ASCII case variants of "BTN" before falling back to the legacy metadata-level token. Fuzzy or Unicode-equivalent tracker names are not treated as aliases.

func ResolveTrackerDomain

func ResolveTrackerDomain(cfg *Config, trackerNameOrDomain string) (string, string)

ResolveTrackerDomain resolves a tracker name or raw domain into a domain name and its configured URL.

func RewrapSecretsInDatabase

func RewrapSecretsInDatabase(ctx context.Context, repo interface {
	LoadFullConfig(ctx context.Context, dest any) error
	SaveFullConfig(ctx context.Context, cfg any) error
}, oldMaterial, newMaterial authmaterial.Material) error

RewrapSecretsInDatabase decrypts stored config secrets with oldMaterial, re-encrypts them with newMaterial, and saves the updated config.

func RewrapSecretsInDatabaseWithFallback

func RewrapSecretsInDatabaseWithFallback(ctx context.Context, repo interface {
	LoadFullConfig(ctx context.Context, dest any) error
	SaveFullConfig(ctx context.Context, cfg any) error
}, sourceMaterials []authmaterial.Material, newMaterial authmaterial.Material) error

RewrapSecretsInDatabaseWithFallback decrypts stored config secrets using the first matching source material, then re-encrypts them with newMaterial.

func SaveSectionToDatabase

func SaveSectionToDatabase(ctx context.Context, section string, data any, repo interface {
	SaveConfigSection(ctx context.Context, section string, data any) error
}) error

SaveSectionToDatabase persists a single config section to the repository.

func SaveSectionsToDatabase added in v0.2.0

func SaveSectionsToDatabase(ctx context.Context, cfg *Config, sections []string, repo interface {
	SaveConfigSection(ctx context.Context, section string, data any) error
}) error

SaveSectionsToDatabase persists only selected root config sections. Section names may use exported field names or root yaml/json tag aliases, and every requested name is canonicalized before any write. Only selected sections are prepared for secret encryption; repositories that support batch section saves receive all selected payloads in one call, preserving same-root unknown stored fields when the full raw config is available. Repositories without batch support can save one canonical section only; multi-section requests fail before any write.

func SaveToDatabase

func SaveToDatabase(ctx context.Context, cfg *Config, repo interface {
	SaveFullConfig(ctx context.Context, cfg any) error
}) error

SaveToDatabase persists the config to the repository.

Types

type ArrIntegrationConfig

type ArrIntegrationConfig struct {
	UseSonarr     bool   `yaml:"use_sonarr"`
	SonarrURL     string `yaml:"sonarr_url"`
	SonarrAPIKey  string `yaml:"sonarr_api_key"`
	SonarrURL1    string `yaml:"sonarr_url_1"`
	SonarrAPIKey1 string `yaml:"sonarr_api_key_1"`
	SonarrURL2    string `yaml:"sonarr_url_2"`
	SonarrAPIKey2 string `yaml:"sonarr_api_key_2"`
	SonarrURL3    string `yaml:"sonarr_url_3"`
	SonarrAPIKey3 string `yaml:"sonarr_api_key_3"`
	UseRadarr     bool   `yaml:"use_radarr"`
	RadarrURL     string `yaml:"radarr_url"`
	RadarrAPIKey  string `yaml:"radarr_api_key"`
	RadarrURL1    string `yaml:"radarr_url_1"`
	RadarrAPIKey1 string `yaml:"radarr_api_key_1"`
	RadarrURL2    string `yaml:"radarr_url_2"`
	RadarrAPIKey2 string `yaml:"radarr_api_key_2"`
	RadarrURL3    string `yaml:"radarr_url_3"`
	RadarrAPIKey3 string `yaml:"radarr_api_key_3"`
	EmbyDir       string `yaml:"emby_dir"`
	EmbyTVDir     string `yaml:"emby_tv_dir"`
}

type CSVList

type CSVList []string

func (*CSVList) UnmarshalYAML

func (c *CSVList) UnmarshalYAML(value *yaml.Node) error

type ClientSetupConfig

type ClientSetupConfig struct {
	DefaultClient string  `yaml:"default_torrent_client"`
	InjectClients CSVList `yaml:"injecting_client_list"`
	SearchClients CSVList `yaml:"searching_client_list"`
}

type Config

type Config struct {
	MainSettings       MainSettingsConfig             `yaml:"main_settings"`
	ImageHosting       ImageHostingConfig             `yaml:"image_hosting"`
	Metadata           MetadataConfig                 `yaml:"metadata"`
	ScreenshotHandling ScreenshotHandlingConfig       `yaml:"screenshot_handling"`
	Description        DescriptionSettingsConfig      `yaml:"description_settings"`
	ClientSetup        ClientSetupConfig              `yaml:"client_setup"`
	ArrIntegration     ArrIntegrationConfig           `yaml:"arr_integration"`
	TorrentCreation    TorrentCreationConfig          `yaml:"torrent_creation"`
	PostUpload         PostUploadConfig               `yaml:"post_upload"`
	Logging            LoggingConfig                  `yaml:"logging"`
	Trackers           TrackersConfig                 `yaml:"trackers"`
	TorrentClients     map[string]TorrentClientConfig `yaml:"torrent_clients"`
	// contains filtered or unexported fields
}

func DecryptConfigSecrets

func DecryptConfigSecrets(cfg *Config) (*Config, error)

DecryptConfigSecrets returns a cloned config where known encrypted secret fields are decrypted. Helper material is required only when at least one secret envelope is present.

func DecryptImportedConfigSecrets added in v0.2.0

func DecryptImportedConfigSecrets(cfg *Config) (*Config, error)

DecryptImportedConfigSecrets decrypts native-import secret envelopes and marks the returned config so later persistence cannot silently fall back to plaintext if destination helper material is unavailable.

func EncryptConfigSecrets

func EncryptConfigSecrets(cfg *Config) (*Config, error)

EncryptConfigSecrets returns a cloned config where known secret fields are encrypted. If helper material is unavailable, configs with imported or existing encrypted envelopes fail instead of falling back to plaintext.

func ImportFromJSON

func ImportFromJSON(payload string) (*Config, error)

ImportFromJSON deserializes plaintext JSON config (for example, ExportToPlaintextJSON output) without attempting secret decryption.

func ImportFromJSONEncrypted

func ImportFromJSONEncrypted(payload string) (*Config, error)

ImportFromJSONEncrypted deserializes JSON config that contains encrypted secret envelopes (for example, ExportToJSON output) and decrypts secrets.

func ImportFromYAML

func ImportFromYAML(path string) (*Config, error)

ImportFromYAML reads the config from a YAML file.

func Load

func Load(path string) (Config, error)

func LoadEmbeddedDefaultConfig

func LoadEmbeddedDefaultConfig() (*Config, error)

func LoadFromDatabase

func LoadFromDatabase(ctx context.Context, repo fullConfigLoader) (*Config, error)

LoadFromDatabase loads the full config from the repository, overlaying saved sections onto embedded defaults so older persisted configs pick up newly added options while preserving explicit zero values and decrypted secrets.

func LoadFromDatabaseWithDefaultBackfill added in v0.2.0

func LoadFromDatabaseWithDefaultBackfill(ctx context.Context, repo fullConfigLoader) (*Config, bool, error)

LoadFromDatabaseWithDefaultBackfill returns a loaded config plus a changed flag indicating whether embedded defaults filled fields missing from storage. The flag is based on raw stored JSON key presence before Config unmarshaling, so explicit false, zero, and empty values do not look like missing fields.

func (Config) Validate

func (c Config) Validate() error

Validate checks the loaded configuration values needed before runtime services can safely start or save settings.

type DatabaseRepairReport added in v0.2.0

type DatabaseRepairReport struct {
	BackfilledDefaults bool
	ChangedSections    []string
	InvalidPaths       []string
}

DatabaseRepairReport describes load-time repairs needed after overlaying stored config onto embedded defaults. BackfilledDefaults reports missing defaults, invalid stored objects, or legacy fallback context repaired in memory. ChangedSections contains sorted JSON root section names that should be persisted; roots with invalid object-shaped input are excluded because the stored subtree was not safely reusable. InvalidPaths contains dotted raw-config paths whose stored value could not be used as an object.

type DescriptionSettingsConfig

type DescriptionSettingsConfig struct {
	LogoSize                int    `yaml:"logo_size"`
	LogoLanguage            string `yaml:"logo_language"`
	ThumbnailSize           int    `yaml:"thumbnail_size"`
	ScreensPerRow           string `yaml:"screens_per_row"`
	EpisodeOverview         bool   `yaml:"episode_overview"`
	TonemappedHeader        string `yaml:"tonemapped_header"`
	MultiScreens            int    `yaml:"multiScreens"`
	PackThumbSize           int    `yaml:"pack_thumb_size"`
	CharLimit               int    `yaml:"charLimit"`
	FileLimit               int    `yaml:"fileLimit"`
	ProcessLimit            int    `yaml:"processLimit"`
	CustomDescriptionHeader string `yaml:"custom_description_header"`
	ScreenshotHeader        string `yaml:"screenshot_header"`
	DiscMenuHeader          string `yaml:"disc_menu_header"`
	CustomSignature         string `yaml:"custom_signature"`
	AddBlurayLink           bool   `yaml:"add_bluray_link"`
	UseBlurayImages         bool   `yaml:"use_bluray_images"`
	BlurayImageSize         int    `yaml:"bluray_image_size"`
}

type ImageHostingConfig

type ImageHostingConfig struct {
	Host1           string `yaml:"img_host_1"`
	Host2           string `yaml:"img_host_2"`
	Host3           string `yaml:"img_host_3"`
	Host4           string `yaml:"img_host_4"`
	Host5           string `yaml:"img_host_5"`
	Host6           string `yaml:"img_host_6"`
	ImgBBAPI        string `yaml:"imgbb_api"`
	LensdumpAPI     string `yaml:"lensdump_api"`
	PTScreensAPI    string `yaml:"ptscreens_api"`
	OnlyImageAPI    string `yaml:"onlyimage_api"`
	DalexniAPI      string `yaml:"dalexni_api"`
	PassTheImageAPI string `yaml:"passtheima_ge_api"`
	ZiplineURL      string `yaml:"zipline_url"`
	ZiplineAPIKey   string `yaml:"zipline_api_key"`
	SeedpoolCDNAPI  string `yaml:"seedpool_cdn_api"`
	ShareXURL       string `yaml:"sharex_url"`
	ShareXAPIKey    string `yaml:"sharex_api_key"`
	UTPPMAPI        string `yaml:"utppm_api"`
	LostimgEnabled  bool   `yaml:"lostimg_enabled"`
	LostimgAPI      string `yaml:"lostimg_api"`
}

type LoggingConfig

type LoggingConfig struct {
	Level          string `yaml:"level"`
	FileEnabled    bool   `yaml:"file_enabled"`
	MaxTotalSizeMB int    `yaml:"max_total_size_mb"`
	MaxFiles       int    `yaml:"max_files"`
}

type MainSettingsConfig

type MainSettingsConfig struct {
	UpdateNotification  bool   `yaml:"update_notification"`
	VerboseNotification bool   `yaml:"verbose_notification"`
	TMDBAPI             string `yaml:"tmdb_api"`
	TrackerPassChecks   int    `yaml:"tracker_pass_checks"`
	InputHistoryLimit   int    `yaml:"input_history_limit"`
	DBPath              string `yaml:"db_path"`
	UseFavicons         bool   `yaml:"use_favicons"`
	FaviconOnly         bool   `yaml:"favicon_only"`
}

func (*MainSettingsConfig) UnmarshalJSON

func (c *MainSettingsConfig) UnmarshalJSON(data []byte) error

func (*MainSettingsConfig) UnmarshalYAML

func (c *MainSettingsConfig) UnmarshalYAML(value *yaml.Node) error

type MetadataConfig

type MetadataConfig struct {
	BTNAPI                    string  `yaml:"btn_api"`
	SkipAutoTorrent           bool    `yaml:"skip_auto_torrent"`
	SkipTrackerFilenameLookup bool    `yaml:"skip_tracker_filename_lookup"`
	UseLargestPlaylist        bool    `yaml:"use_largest_playlist"`
	KeepImages                bool    `yaml:"keep_images"`
	OnlyID                    bool    `yaml:"only_id"`
	UserOverrides             bool    `yaml:"user_overrides"`
	PingUnit3D                bool    `yaml:"ping_unit3d"`
	GetBlurayInfo             bool    `yaml:"get_bluray_info"`
	BlurayScore               float64 `yaml:"bluray_score"`
	BluraySingleScore         float64 `yaml:"bluray_single_score"`
	CheckPredb                bool    `yaml:"check_predb"`
}

type PostUploadConfig

type PostUploadConfig struct {
	InjectDelay              int  `yaml:"inject_delay"`
	ShowUploadDuration       bool `yaml:"show_upload_duration"`
	PrintTrackerMessages     bool `yaml:"print_tracker_messages"`
	PrintTrackerLinks        bool `yaml:"print_tracker_links"`
	MaxConcurrentTrackers    int  `yaml:"max_concurrent_tracker_uploads"`
	SearchRequests           bool `yaml:"search_requests"`
	CrossSeeding             bool `yaml:"cross_seeding"`
	CrossSeedCheckEverything bool `yaml:"cross_seed_check_everything"`
}

type ScreenshotHandlingConfig

type ScreenshotHandlingConfig struct {
	Screens              int     `yaml:"screens"`
	MinSuccessfulUploads int     `yaml:"min_successful_image_uploads"`
	CutoffScreens        int     `yaml:"cutoff_screens"`
	FrameOverlay         bool    `yaml:"frame_overlay"`
	OverlayTextSize      int     `yaml:"overlay_text_size"`
	ProcessLimit         int     `yaml:"process_limit"`
	MaxConcurrentUploads int     `yaml:"max_concurrent_uploads"`
	FFmpegLimit          bool    `yaml:"ffmpeg_limit"`
	ToneMap              bool    `yaml:"tone_map"`
	UseLibplacebo        bool    `yaml:"use_libplacebo"`
	FFmpegCompression    int     `yaml:"ffmpeg_compression"`
	TonemapAlgorithm     string  `yaml:"algorithm"`
	Desat                float64 `yaml:"desat"`
}

type StringList

type StringList []string

func (*StringList) UnmarshalJSON

func (l *StringList) UnmarshalJSON(data []byte) error

func (*StringList) UnmarshalYAML

func (l *StringList) UnmarshalYAML(value *yaml.Node) error

type TorrentClientConfig

type TorrentClientConfig struct {
	Type          string     `yaml:"type"`
	TorrentClient string     `yaml:"torrent_client"`
	URL           string     `yaml:"url"`
	QuiProxyURL   string     `yaml:"qui_proxy_url"`
	WatchFolder   string     `yaml:"watch_folder"`
	StorageDir    string     `yaml:"torrent_storage_dir"`
	Username      string     `yaml:"username"`
	Password      string     `yaml:"password"`
	Category      string     `yaml:"category"`
	Tags          []string   `yaml:"tags"`
	TLSSkipVerify *bool      `yaml:"tls_skip_verify"`
	Linking       string     `yaml:"linking"`
	AllowFallback *bool      `yaml:"allow_fallback"`
	LinkedFolder  StringList `yaml:"linked_folder"`
	LocalPath     StringList `yaml:"local_path"`
	RemotePath    StringList `yaml:"remote_path"`

	QbitURL                string   `yaml:"qbit_url"`
	QbitPort               int      `yaml:"qbit_port"`
	QbitUser               string   `yaml:"qbit_user"`
	QbitPass               string   `yaml:"qbit_pass"`
	QbitCategoryValue      string   `yaml:"qbit_cat"`
	QbitTag                string   `yaml:"qbit_tag"`
	QbitTagsValue          []string `yaml:"qbit_tags"`
	QbitCrossCategory      string   `yaml:"qbit_cross_cat"`
	QbitCrossTag           string   `yaml:"qbit_cross_tag"`
	UseTrackerAsTag        bool     `yaml:"use_tracker_as_tag"`
	VerifyWebUICertificate *bool    `yaml:"verify_webui_certificate"`
}

func (TorrentClientConfig) ClientType

func (c TorrentClientConfig) ClientType() string

func (TorrentClientConfig) FallbackAllowed

func (c TorrentClientConfig) FallbackAllowed() bool

func (TorrentClientConfig) LinkingMode

func (c TorrentClientConfig) LinkingMode() string

func (TorrentClientConfig) MarshalJSON

func (c TorrentClientConfig) MarshalJSON() ([]byte, error)

func (TorrentClientConfig) MarshalYAML

func (c TorrentClientConfig) MarshalYAML() (any, error)

func (TorrentClientConfig) QbitCategory

func (c TorrentClientConfig) QbitCategory() string

func (TorrentClientConfig) QbitHost

func (c TorrentClientConfig) QbitHost() string

func (TorrentClientConfig) QbitPassword

func (c TorrentClientConfig) QbitPassword() string

func (TorrentClientConfig) QbitTLSSkipVerify

func (c TorrentClientConfig) QbitTLSSkipVerify() bool

func (TorrentClientConfig) QbitTags

func (c TorrentClientConfig) QbitTags() string

func (TorrentClientConfig) QbitUsername

func (c TorrentClientConfig) QbitUsername() string

func (TorrentClientConfig) UsesQuiProxy

func (c TorrentClientConfig) UsesQuiProxy() bool

type TorrentCreationConfig

type TorrentCreationConfig struct {
	MkbrrThreads   int  `yaml:"mkbrr_threads"`
	PreferMax16    bool `yaml:"prefer_max_16_torrent"`
	RehashCooldown int  `yaml:"rehash_cooldown"`
}

type TrackerConfig

type TrackerConfig struct {
	LinkDirName         string         `yaml:"link_dir_name" json:"LinkDirName"`
	APIKey              string         `yaml:"api_key" json:"APIKey"`
	PTPAPIUser          string         `yaml:"ApiUser" json:"ApiUser"`
	PTPAPIKey           string         `yaml:"ApiKey" json:"ApiKey"`
	Username            string         `yaml:"username" json:"Username"`
	Password            string         `yaml:"password" json:"Password"`
	Passkey             string         `yaml:"passkey" json:"Passkey"`
	AnnounceURL         string         `yaml:"announce_url" json:"AnnounceURL"`
	MyAnnounceURL       string         `yaml:"my_announce_url" json:"MyAnnounceURL"`
	URL                 string         `yaml:"url" json:"URL"`
	FaviconURL          string         `yaml:"favicon_url" json:"FaviconURL"`
	UploaderStatus      bool           `yaml:"uploader_status" json:"UploaderStatus"`
	CustomLayout        string         `yaml:"custom_layout" json:"CustomLayout"`
	TagForCustomRelease string         `yaml:"tag_for_custom_release" json:"TagForCustomRelease"`
	CheckForRules       bool           `yaml:"check_for_rules" json:"CheckForRules"`
	ModQ                bool           `yaml:"modq" json:"ModQ"`
	Draft               bool           `yaml:"draft" json:"Draft"`
	DraftDefault        bool           `yaml:"draft_default" json:"DraftDefault"`
	Anon                bool           `yaml:"anon" json:"Anon"`
	ShowGroupIfAnon     bool           `yaml:"show_group_if_anon" json:"ShowGroupIfAnon"`
	BhdRSSKey           string         `yaml:"bhd_rss_key" json:"BhdRSSKey"`
	CheckRequests       bool           `yaml:"check_requests" json:"CheckRequests"`
	FullMediainfo       bool           `yaml:"full_mediainfo" json:"FullMediainfo"`
	UploaderName        string         `yaml:"uploader_name" json:"UploaderName"`
	ImgRehost           bool           `yaml:"img_rehost" json:"ImgRehost"`
	ImageHost           string         `yaml:"image_host" json:"ImageHost"`
	TorrentClient       string         `yaml:"torrent_client" json:"TorrentClient"`
	UseSpanishTitle     bool           `yaml:"use_spanish_title" json:"UseSpanishTitle"`
	UseItalianTitle     bool           `yaml:"use_italian_title" json:"UseItalianTitle"`
	OTPURI              string         `yaml:"otp_uri" json:"OTPURI"`
	SkipIfRehash        bool           `yaml:"skip_if_rehash" json:"SkipIfRehash"`
	PreferMTV           bool           `yaml:"prefer_mtv_torrent" json:"PreferMTV"`
	PTGenAPI            string         `yaml:"ptgen_api" json:"PTGenAPI"`
	AddWebSourceToDesc  bool           `yaml:"add_web_source_to_desc" json:"AddWebSourceToDesc"`
	UseMetadataName     bool           `yaml:"use_metadata_name" json:"UseMetadataName"`
	InjectDelay         *int           `yaml:"inject_delay" json:"InjectDelay"`
	ImageCount          int            `yaml:"image_count" json:"ImageCount"`
	Channel             string         `yaml:"channel" json:"Channel"`
	ImgAPI              string         `yaml:"img_api" json:"ImgAPI"`
	PronfoAPIKey        string         `yaml:"pronfo_api_key" json:"PronfoAPIKey"`
	PronfoTheme         string         `yaml:"pronfo_theme" json:"PronfoTheme"`
	PronfoRAPIID        string         `yaml:"pronfo_rapi_id" json:"PronfoRAPIID"`
	APIUpload           bool           `yaml:"api_upload" json:"APIUpload"`
	Exclusive           bool           `yaml:"exclusive" json:"Exclusive"`
	LoginQuestion       string         `yaml:"login_question" json:"LoginQuestion"`
	LoginAnswer         string         `yaml:"login_answer" json:"LoginAnswer"`
	UserID              string         `yaml:"user_id" json:"UserID"`
	Filebrowser         string         `yaml:"filebrowser" json:"Filebrowser"`
	Internal            bool           `yaml:"internal" json:"Internal"`
	InternalGroups      []string       `yaml:"internal_groups" json:"InternalGroups"`
	Unknown             map[string]any `yaml:"-" json:"-"`
}

type TrackerDefaultsMergeReport added in v0.2.0

type TrackerDefaultsMergeReport struct {
	Changed         bool
	ChangedSections []string
}

TrackerDefaultsMergeReport describes semantic tracker-default changes made by MergeMissingTrackerDefaultsWithReport. Changed reports whether cfg was modified; ChangedSections contains sorted JSON root section names to persist, including Metadata when a legacy metadata BTN token is cleared.

func MergeMissingTrackerDefaultsWithReport added in v0.2.0

func MergeMissingTrackerDefaultsWithReport(cfg *Config) (TrackerDefaultsMergeReport, error)

MergeMissingTrackerDefaultsWithReport backfills semantic tracker defaults and reports the root sections that should be persisted. It may initialize nil tracker maps for runtime use without marking cfg changed. Legacy Metadata.BTNAPI is copied to the BTN tracker before Metadata is marked for clearing so callers can persist both affected sections together.

type TrackersConfig

type TrackersConfig struct {
	DefaultTrackers  CSVList                  `yaml:"default_trackers" json:"DefaultTrackers"`
	PreferredTracker string                   `yaml:"preferred_tracker" json:"PreferredTracker"`
	Trackers         map[string]TrackerConfig `yaml:"-" json:"Trackers"`
}

func (TrackersConfig) MarshalJSON

func (t TrackersConfig) MarshalJSON() ([]byte, error)

func (TrackersConfig) MarshalYAML

func (t TrackersConfig) MarshalYAML() (any, error)

func (*TrackersConfig) UnmarshalJSON

func (t *TrackersConfig) UnmarshalJSON(data []byte) error

func (*TrackersConfig) UnmarshalYAML

func (t *TrackersConfig) UnmarshalYAML(value *yaml.Node) error

Directories

Path Synopsis
Package importer dispatches configuration imports to the appropriate parser based on file extension.
Package importer dispatches configuration imports to the appropriate parser based on file extension.

Jump to

Keyboard shortcuts

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