Default the update repo to the Gitea host
Settles the first open question in claude.md: the update endpoint is gitea.apointless.space/bsncubed/ipswap. It was left empty — which disables the checker — only because the host was unconfirmed. Load unmarshals over the defaults, so an absent update_repo takes the new default while an explicitly empty one stays empty. That distinction is the off switch, and forks depend on it, so it is now pinned by a test. Adds the config package's first tests while here: the defaulting rules above, the repair path for a nonsensical mask style or poll interval, and the guarantee that a corrupt config.json still yields usable defaults rather than stopping the app from starting. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,7 +64,7 @@ type Settings struct {
|
||||
|
||||
// UpdateRepo is the Gitea repo polled for releases, as
|
||||
// "https://host/owner/repo". Empty disables the update checker entirely,
|
||||
// which is the default until the host is confirmed.
|
||||
// which is what a fork or a private build should set it to.
|
||||
UpdateRepo string `json:"update_repo"`
|
||||
|
||||
// ActivePollSeconds is how often the live adapter state is re-read to work
|
||||
@@ -73,12 +73,16 @@ type Settings struct {
|
||||
}
|
||||
|
||||
// Default is the settings a fresh install starts with.
|
||||
// DefaultUpdateRepo is where release builds look for updates. Set it to "" in
|
||||
// config.json (or clear the field in Settings) to turn the check off entirely.
|
||||
const DefaultUpdateRepo = "https://gitea.apointless.space/bsncubed/ipswap"
|
||||
|
||||
func Default() Settings {
|
||||
return Settings{
|
||||
MaskStyle: MaskPrefix,
|
||||
StartWithWindows: false,
|
||||
CheckUpdates: true,
|
||||
UpdateRepo: "",
|
||||
UpdateRepo: DefaultUpdateRepo,
|
||||
ActivePollSeconds: 30,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user