diff --git a/backend/app/service/app.go b/backend/app/service/app.go index c5c4e9d80..c2d52a7e0 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -782,8 +782,8 @@ func (a AppService) SyncAppListFromRemote() (err error) { for _, v := range versions { version := v.Name detail := detailsMap[version] - - dockerComposeUrl := fmt.Sprintf("%s/%s/%s/%s", baseRemoteUrl, app.Key, version, "docker-compose.yml") + versionUrl := fmt.Sprintf("%s/%s/%s", baseRemoteUrl, app.Key, version) + dockerComposeUrl := fmt.Sprintf("%s/%s", versionUrl, "docker-compose.yml") composeRes, err := http.Get(dockerComposeUrl) if err != nil { return err @@ -796,7 +796,7 @@ func (a AppService) SyncAppListFromRemote() (err error) { paramByte, _ := json.Marshal(v.AppForm) detail.Params = string(paramByte) - detail.DownloadUrl = v.DownloadUrl + detail.DownloadUrl = fmt.Sprintf("%s/%s", versionUrl, app.Key+"-"+version+".tar.gz") detail.DownloadCallBackUrl = v.DownloadCallBackUrl detail.Update = true detail.LastModified = v.LastModified diff --git a/backend/app/service/app_utils.go b/backend/app/service/app_utils.go index a1cdcbe5a..3a071f6db 100644 --- a/backend/app/service/app_utils.go +++ b/backend/app/service/app_utils.go @@ -318,20 +318,21 @@ func upgradeInstall(installId uint, detailId uint, backup bool) error { return } servicesMap := value.(map[string]interface{}) - index := 0 - oldServiceName := "" - for k := range servicesMap { - oldServiceName = k - index++ - if index > 0 { - break + if len(servicesMap) == 1 { + index := 0 + oldServiceName := "" + for k := range servicesMap { + oldServiceName = k + index++ + if index > 0 { + break + } + } + servicesMap[install.ServiceName] = servicesMap[oldServiceName] + if install.ServiceName != oldServiceName { + delete(servicesMap, oldServiceName) } } - servicesMap[install.ServiceName] = servicesMap[oldServiceName] - if install.ServiceName != oldServiceName { - delete(servicesMap, oldServiceName) - } - envs := make(map[string]interface{}) if upErr = json.Unmarshal([]byte(install.Env), &envs); upErr != nil { return @@ -518,7 +519,7 @@ func downloadApp(app model.App, appDetail model.AppDetail, appInstall *model.App _ = fileOp.CreateDir(appVersionDir, 0755) } global.LOG.Infof("download app[%s] from %s", app.Name, appDetail.DownloadUrl) - filePath := path.Join(appVersionDir, appDetail.Version+".tar.gz") + filePath := path.Join(appVersionDir, app.Key+"-"+appDetail.Version+".tar.gz") defer func() { if err != nil { @@ -533,7 +534,7 @@ func downloadApp(app model.App, appDetail model.AppDetail, appInstall *model.App global.LOG.Errorf("download app[%s] error %v", app.Name, err) return } - if err = fileOp.Decompress(filePath, appVersionDir, files.TarGz); err != nil { + if err = fileOp.Decompress(filePath, appResourceDir, files.TarGz); err != nil { global.LOG.Errorf("decompress app[%s] error %v", app.Name, err) return } diff --git a/backend/app/service/setting.go b/backend/app/service/setting.go index a3f7f48da..e34e3064b 100644 --- a/backend/app/service/setting.go +++ b/backend/app/service/setting.go @@ -103,6 +103,12 @@ func (u *SettingService) Update(key, value string) error { if err := ntp.UpdateSystemTimeZone(value); err != nil { return err } + case "AppStoreLastModified": + exist, _ := settingRepo.Get(settingRepo.WithByKey("AppStoreLastModified")) + if exist.ID == 0 { + _ = settingRepo.Create("AppStoreLastModified", value) + return nil + } } if err := settingRepo.Update(key, value); err != nil { @@ -128,6 +134,7 @@ func (u *SettingService) Update(key, value string) error { } case "UserName", "Password": _ = global.SESSION.Clean() + } return nil