fix: default updater owner & repo to ongtrieuhau/web-giao-ban
This commit is contained in:
+1
-1
@@ -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"
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -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
|
||||
}
|
||||
|
||||
+2
-2
@@ -206,11 +206,11 @@
|
||||
<div class="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="block font-semibold text-slate-700 mb-1">Tổ chức / Owner:</label>
|
||||
<input type="text" id="cfgGiteaOwner" class="w-full rounded-lg border border-slate-300 px-3 py-2 bg-slate-50 font-mono outline-none focus:ring-2 focus:ring-indigo-500" value="hdhiswork">
|
||||
<input type="text" id="cfgGiteaOwner" class="w-full rounded-lg border border-slate-300 px-3 py-2 bg-slate-50 font-mono outline-none focus:ring-2 focus:ring-indigo-500" value="ongtrieuhau">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block font-semibold text-slate-700 mb-1">Repository:</label>
|
||||
<input type="text" id="cfgGiteaRepo" class="w-full rounded-lg border border-slate-300 px-3 py-2 bg-slate-50 font-mono outline-none focus:ring-2 focus:ring-indigo-500" value="DUAN">
|
||||
<input type="text" id="cfgGiteaRepo" class="w-full rounded-lg border border-slate-300 px-3 py-2 bg-slate-50 font-mono outline-none focus:ring-2 focus:ring-indigo-500" value="web-giao-ban">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+4
-2
@@ -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';
|
||||
|
||||
+4
-4
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user