feat: add editable software download catalog

This commit is contained in:
2026-11-01 22:46:07 +08:00
parent d8e708caec
commit 0820db0a5d
13 changed files with 421 additions and 16 deletions
+16 -3
View File
@@ -13,9 +13,18 @@ type RelatedLink struct {
URL string `json:"url"`
}
type Download struct {
Name string `json:"name"`
Version string `json:"version"`
URL string `json:"url"`
ID string `json:"id"`
Name string `json:"name"`
Category string `json:"category"`
Description string `json:"description"`
Files []DownloadFile `json:"files"`
// Read old settings and submissions without losing existing download links.
Version string `json:"version,omitempty"`
URL string `json:"url,omitempty"`
}
type DownloadFile struct {
Label string `json:"label"`
URL string `json:"url"`
}
type Settings struct {
Name Localized `json:"name"`
@@ -122,6 +131,10 @@ func settingsDefaults(data any) any {
if value, exists := object["relatedLinks"]; !exists || value == nil {
object["relatedLinks"] = initialRelatedLinks()
}
var downloads []Download
if decodeData(object["downloads"], &downloads) == nil {
object["downloads"] = normalizeDownloads(downloads)
}
}
return data
}