diff --git a/config.json b/config.json index 641f6c6..fb27c94 100644 --- a/config.json +++ b/config.json @@ -39,6 +39,6 @@ "owner": "ongtrieuhau", "repo": "web-giao-ban", "token": "ENC(abS+Aa/rBa8ydyLgFvGmDrJ5Vc9KOVTFu52PX4rCcA+88edzq5J6yWu05DPTTHWZEw2wKz+8RmXbt+jTTexJi+zATOg=)", - "current_version": "v1.0.0" + "current_version": "v1.0.1" } } \ No newline at end of file diff --git a/config/config.go b/config/config.go index 0e5d5fe..a2686ad 100644 --- a/config/config.go +++ b/config/config.go @@ -149,8 +149,8 @@ func DefaultConfig() *AppConfig { Updater: UpdaterConfig{ Enabled: true, GiteaURL: "https://i.dh-his.com", - Owner: "hdhiswork", - Repo: "DUAN", + Owner: "ongtrieuhau", + Repo: "web-giao-ban", Token: "", CurrentVersion: "v1.0.0", }, @@ -208,6 +208,14 @@ func LoadConfig(path string) (*AppConfig, error) { cfg.DecryptedDBPassword = decDB cfg.DecryptedUpdaterToken = decTok + // Auto-migrate legacy owner & repo + if cfg.Updater.Owner == "" || cfg.Updater.Owner == "hdhiswork" { + cfg.Updater.Owner = "ongtrieuhau" + } + if cfg.Updater.Repo == "" || cfg.Updater.Repo == "DUAN" { + cfg.Updater.Repo = "web-giao-ban" + } + currentConfig = cfg return cfg, nil } diff --git a/public/admin.html b/public/admin.html index 33be078..9b0c7d3 100644 --- a/public/admin.html +++ b/public/admin.html @@ -206,11 +206,11 @@
- +
- +
diff --git a/public/admin.js b/public/admin.js index f8db2bf..d24c88d 100644 --- a/public/admin.js +++ b/public/admin.js @@ -86,8 +86,10 @@ async function loadConfig() { // Gitea Updater document.getElementById('cfgGiteaUrl').value = cfg.updater.gitea_url || 'https://i.dh-his.com'; - document.getElementById('cfgGiteaOwner').value = cfg.updater.owner || 'hdhiswork'; - document.getElementById('cfgGiteaRepo').value = cfg.updater.repo || 'DUAN'; + const owner = (cfg.updater.owner && cfg.updater.owner !== 'hdhiswork') ? cfg.updater.owner : 'ongtrieuhau'; + const repo = (cfg.updater.repo && cfg.updater.repo !== 'DUAN') ? cfg.updater.repo : 'web-giao-ban'; + document.getElementById('cfgGiteaOwner').value = owner; + document.getElementById('cfgGiteaRepo').value = repo; document.getElementById('cfgGiteaToken').value = ''; const ver = cfg.updater.current_version || 'v1.0.0'; diff --git a/updater/updater.go b/updater/updater.go index a13a408..4733995 100644 --- a/updater/updater.go +++ b/updater/updater.go @@ -52,12 +52,12 @@ func CheckUpdate() (*CheckResult, error) { baseURL = "https://i.dh-his.com" } owner := cfg.Updater.Owner - if owner == "" { - owner = "hdhiswork" + if owner == "" || owner == "hdhiswork" { + owner = "ongtrieuhau" } repo := cfg.Updater.Repo - if repo == "" { - repo = "DUAN" + if repo == "" || repo == "DUAN" { + repo = "web-giao-ban" } apiURL := fmt.Sprintf("%s/api/v1/repos/%s/%s/releases/latest", baseURL, owner, repo)