From 46967db3ae801dd43fc186f6c279d7e7b2100184 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 6 Feb 2025 18:15:06 +0800 Subject: [PATCH] feat: Merge from dev (#7808) --- agent/app/api/v2/app.go | 6 +- agent/app/dto/app.go | 21 ++++-- agent/app/dto/response/app.go | 49 +++++++------- agent/app/model/app.go | 23 +++++++ agent/app/model/tag.go | 7 +- agent/app/repo/common.go | 6 ++ agent/app/service/app.go | 53 ++++++++++----- agent/app/service/app_utils.go | 67 +++++++++++++++++-- agent/app/service/website.go | 13 +++- agent/go.mod | 3 + agent/go.sum | 25 +++++++ agent/init/migration/migrate.go | 2 + agent/init/migration/migrations/init.go | 20 ++++++ agent/utils/common/common.go | 10 +-- agent/utils/ssl/client.go | 12 ++++ frontend/src/api/interface/app.ts | 13 ++++ frontend/src/views/app-store/apps/index.vue | 22 ++---- frontend/src/views/app-store/detail/index.vue | 6 +- .../views/app-store/detail/params/index.vue | 4 ++ .../app-store/installed/detail/index.vue | 8 ++- .../src/views/app-store/installed/index.vue | 6 +- frontend/src/views/home/app/index.vue | 4 +- .../website/runtime/php/create/index.vue | 4 ++ .../website/ssl/dns-account/create/index.vue | 9 ++- .../basic/load-balance/operate/index.vue | 2 +- 25 files changed, 300 insertions(+), 95 deletions(-) diff --git a/agent/app/api/v2/app.go b/agent/app/api/v2/app.go index d9a06a9ed..7f1cf22fe 100644 --- a/agent/app/api/v2/app.go +++ b/agent/app/api/v2/app.go @@ -21,7 +21,7 @@ func (b *BaseApi) SearchApp(c *gin.Context) { if err := helper.CheckBindAndValidate(&req, c); err != nil { return } - list, err := appService.PageApp(req) + list, err := appService.PageApp(c, req) if err != nil { helper.InternalServer(c, err) return @@ -91,7 +91,7 @@ func (b *BaseApi) GetApp(c *gin.Context) { helper.BadRequest(c, err) return } - appDTO, err := appService.GetApp(appKey) + appDTO, err := appService.GetApp(c, appKey) if err != nil { helper.InternalServer(c, err) return @@ -186,7 +186,7 @@ func (b *BaseApi) InstallApp(c *gin.Context) { } func (b *BaseApi) GetAppTags(c *gin.Context) { - tags, err := appService.GetAppTags() + tags, err := appService.GetAppTags(c) if err != nil { helper.InternalServer(c, err) return diff --git a/agent/app/dto/app.go b/agent/app/dto/app.go index 5e39e9ff9..388158210 100644 --- a/agent/app/dto/app.go +++ b/agent/app/dto/app.go @@ -64,7 +64,7 @@ type AppDefine struct { } type LocalAppAppDefine struct { - AppProperty model.App `json:"additionalProperties" yaml:"additionalProperties"` + AppProperty AppProperty `json:"additionalProperties" yaml:"additionalProperties"` } type LocalAppParam struct { @@ -86,6 +86,7 @@ type AppProperty struct { Tags []string `json:"tags"` ShortDescZh string `json:"shortDescZh"` ShortDescEn string `json:"shortDescEn"` + Description Locale `json:"description"` Key string `json:"key"` Required []string `json:"Required"` CrossVersionUpdate bool `json:"crossVersionUpdate"` @@ -109,9 +110,20 @@ type AppConfigVersion struct { } type Tag struct { - Key string `json:"key"` - Name string `json:"name"` - Sort int `json:"sort"` + Key string `json:"key"` + Name string `json:"name"` + Sort int `json:"sort"` + Locales Locale `json:"locales"` +} + +type Locale struct { + En string `json:"en"` + Ja string `json:"ja"` + Ms string `json:"ms"` + PtBr string `json:"pt-br" yaml:"pt-br"` + Ru string `json:"ru"` + ZhHant string `json:"zh-hant" yaml:"zh-hant"` + Zh string `json:"zh"` } type AppForm struct { @@ -123,6 +135,7 @@ type AppFormFields struct { Type string `json:"type"` LabelZh string `json:"labelZh"` LabelEn string `json:"labelEn"` + Label Locale `json:"label"` Required bool `json:"required"` Default interface{} `json:"default"` EnvKey string `json:"envKey"` diff --git a/agent/app/dto/response/app.go b/agent/app/dto/response/app.go index 94c367ee4..81dfe8581 100644 --- a/agent/app/dto/response/app.go +++ b/agent/app/dto/response/app.go @@ -10,8 +10,8 @@ import ( ) type AppRes struct { - Items []*AppDto `json:"items"` - Total int64 `json:"total"` + Items []*AppItem `json:"items"` + Total int64 `json:"total"` } type AppUpdateRes struct { @@ -23,33 +23,34 @@ type AppUpdateRes struct { type AppDTO struct { model.App - Installed bool `json:"installed"` - Versions []string `json:"versions"` - Tags []model.Tag `json:"tags"` + Installed bool `json:"installed"` + Versions []string `json:"versions"` + Tags []TagDTO `json:"tags"` } -type AppDto struct { - Name string `json:"name"` - Key string `json:"key"` - ID uint `json:"id"` - ShortDescZh string `json:"shortDescZh"` - ShortDescEn string `json:"shortDescEn"` - Icon string `json:"icon"` - Type string `json:"type"` - Status string `json:"status"` - Resource string `json:"resource"` - Installed bool `json:"installed"` - Versions []string `json:"versions"` - Limit int `json:"limit"` - Tags []model.Tag `json:"tags"` - Github string `json:"github"` - Website string `json:"website"` - GpuSupport bool `json:"gpuSupport"` - Recommend int `json:"recommend"` +type AppItem struct { + Name string `json:"name"` + Key string `json:"key"` + ID uint `json:"id"` + Description string `json:"description"` + Icon string `json:"icon"` + Type string `json:"type"` + Status string `json:"status"` + Resource string `json:"resource"` + Installed bool `json:"installed"` + Versions []string `json:"versions"` + Limit int `json:"limit"` + Tags []TagDTO `json:"tags"` + Github string `json:"github"` + Website string `json:"website"` + GpuSupport bool `json:"gpuSupport"` + Recommend int `json:"recommend"` } type TagDTO struct { - model.Tag + ID uint `json:"id"` + Key string `json:"key"` + Name string `json:"name"` } type AppInstalledCheck struct { diff --git a/agent/app/model/app.go b/agent/app/model/app.go index 836c89218..04b7b4285 100644 --- a/agent/app/model/app.go +++ b/agent/app/model/app.go @@ -1,6 +1,8 @@ package model import ( + "encoding/json" + "github.com/gin-gonic/gin" "path/filepath" "strings" @@ -48,3 +50,24 @@ func (i *App) GetAppResourcePath() string { } return filepath.Join(global.Dir.RemoteAppResourceDir, i.Key) } + +func getLang(c *gin.Context) string { + lang := c.GetHeader("Accept-Language") + if lang == "" { + lang = "en" + } + return lang +} + +func (i *App) GetDescription(ctx *gin.Context) string { + var translations = make(map[string]string) + _ = json.Unmarshal([]byte(i.Description), &translations) + lang := strings.ToLower(getLang(ctx)) + if desc, ok := translations[lang]; ok && desc != "" { + return desc + } + if lang == "zh" { + return i.ShortDescZh + } + return i.ShortDescEn +} diff --git a/agent/app/model/tag.go b/agent/app/model/tag.go index 2afc4d9b5..c4812b568 100644 --- a/agent/app/model/tag.go +++ b/agent/app/model/tag.go @@ -2,7 +2,8 @@ package model type Tag struct { BaseModel - Key string `json:"key" gorm:"not null"` - Name string `json:"name" gorm:"not null"` - Sort int `json:"sort" gorm:"not null;default:1"` + Key string `json:"key" gorm:"not null"` + Name string `json:"name" gorm:"not null"` + Sort int `json:"sort" gorm:"not null;default:1"` + Translations string `json:"translations"` } diff --git a/agent/app/repo/common.go b/agent/app/repo/common.go index fadd2fd8d..5b0f7f39e 100644 --- a/agent/app/repo/common.go +++ b/agent/app/repo/common.go @@ -42,6 +42,12 @@ func WithByName(name string) DBOption { } } +func WithByLowerName(name string) DBOption { + return func(g *gorm.DB) *gorm.DB { + return g.Where("LOWER(name) = LOWER(?)", name) + } +} + func WithByLikeName(name string) DBOption { return func(g *gorm.DB) *gorm.DB { if len(name) == 0 { diff --git a/agent/app/service/app.go b/agent/app/service/app.go index acaa1dbdf..561548bd7 100644 --- a/agent/app/service/app.go +++ b/agent/app/service/app.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "github.com/gin-gonic/gin" "net/http" "os" "path" @@ -35,9 +36,9 @@ type AppService struct { } type IAppService interface { - PageApp(req request.AppSearch) (interface{}, error) - GetAppTags() ([]response.TagDTO, error) - GetApp(key string) (*response.AppDTO, error) + PageApp(ctx *gin.Context, req request.AppSearch) (interface{}, error) + GetAppTags(ctx *gin.Context) ([]response.TagDTO, error) + GetApp(ctx *gin.Context, key string) (*response.AppDTO, error) GetAppDetail(appId uint, version, appType string) (response.AppDetailDTO, error) Install(req request.AppInstallCreate) (*model.AppInstall, error) SyncAppListFromRemote(taskID string) error @@ -54,7 +55,7 @@ func NewIAppService() IAppService { return &AppService{} } -func (a AppService) PageApp(req request.AppSearch) (interface{}, error) { +func (a AppService) PageApp(ctx *gin.Context, req request.AppSearch) (interface{}, error) { var opts []repo.DBOption opts = append(opts, appRepo.OrderByRecommend()) if req.Name != "" { @@ -102,31 +103,31 @@ func (a AppService) PageApp(req request.AppSearch) (interface{}, error) { if err != nil { return nil, err } - var appDTOs []*response.AppDto + var appDTOs []*response.AppItem info := &dto.SettingInfo{} if req.Type == "php" { info, _ = NewISettingService().GetSettingInfo() } + lang := strings.ToLower(common.GetLang(ctx)) for _, ap := range apps { if req.Type == "php" { if ap.RequiredPanelVersion == 0 || !common.CompareAppVersion(fmt.Sprintf("%f", ap.RequiredPanelVersion), info.SystemVersion) { continue } } - appDTO := &response.AppDto{ + appDTO := &response.AppItem{ ID: ap.ID, Name: ap.Name, Key: ap.Key, Type: ap.Type, Icon: ap.Icon, - ShortDescZh: ap.ShortDescZh, - ShortDescEn: ap.ShortDescEn, Resource: ap.Resource, Limit: ap.Limit, Website: ap.Website, Github: ap.Github, GpuSupport: ap.GpuSupport, Recommend: ap.Recommend, + Description: ap.GetDescription(ctx), } appDTOs = append(appDTOs, appDTO) appTags, err := appTagRepo.GetByAppId(ap.ID) @@ -137,7 +138,7 @@ func (a AppService) PageApp(req request.AppSearch) (interface{}, error) { for _, at := range appTags { tagIds = append(tagIds, at.TagId) } - tags, err := tagRepo.GetByIds(tagIds) + tags, err := getAppTags(ap.ID, lang) if err != nil { continue } @@ -151,21 +152,29 @@ func (a AppService) PageApp(req request.AppSearch) (interface{}, error) { return res, nil } -func (a AppService) GetAppTags() ([]response.TagDTO, error) { +func (a AppService) GetAppTags(ctx *gin.Context) ([]response.TagDTO, error) { tags, err := tagRepo.All() if err != nil { return nil, err } var res []response.TagDTO + lang := strings.ToLower(common.GetLang(ctx)) for _, tag := range tags { - res = append(res, response.TagDTO{ - Tag: tag, - }) + tagDTO := response.TagDTO{ + ID: tag.ID, + Key: tag.Key, + } + var translations = make(map[string]string) + _ = json.Unmarshal([]byte(tag.Translations), &translations) + if name, ok := translations[lang]; ok { + tagDTO.Name = name + } + res = append(res, tagDTO) } return res, nil } -func (a AppService) GetApp(key string) (*response.AppDTO, error) { +func (a AppService) GetApp(ctx *gin.Context, key string) (*response.AppDTO, error) { var appDTO response.AppDTO if key == "postgres" { key = "postgresql" @@ -175,6 +184,7 @@ func (a AppService) GetApp(key string) (*response.AppDTO, error) { return nil, err } appDTO.App = app + appDTO.App.Description = app.GetDescription(ctx) details, err := appDetailRepo.GetBy(appDetailRepo.WithAppId(app.ID)) if err != nil { return nil, err @@ -192,6 +202,11 @@ func (a AppService) GetApp(key string) (*response.AppDTO, error) { if hasLatest { appDTO.Versions = append([]string{"latest"}, appDTO.Versions...) } + tags, err := getAppTags(app.ID, strings.ToLower(common.GetLang(ctx))) + if err != nil { + return nil, err + } + appDTO.Tags = tags return &appDTO, nil } @@ -334,7 +349,7 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App err = buserr.WithDetail("Err1PanelNetworkFailed", err.Error(), nil) return } - if list, _ := appInstallRepo.ListBy(repo.WithByName(req.Name)); len(list) > 0 { + if list, _ := appInstallRepo.ListBy(repo.WithByLowerName(req.Name)); len(list) > 0 { err = buserr.New("ErrAppNameExist") return } @@ -928,10 +943,12 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) { oldAppIds []uint ) for _, tag := range list.Extra.Tags { + translations, _ := json.Marshal(tag.Locales) tags = append(tags, &model.Tag{ - Key: tag.Key, - Name: tag.Name, - Sort: tag.Sort, + Name: tag.Name, + Translations: string(translations), + Sort: tag.Sort, + Key: tag.Key, }) } deleteCustomApp() diff --git a/agent/app/service/app_utils.go b/agent/app/service/app_utils.go index 10af12c9c..2f3fd9b6b 100644 --- a/agent/app/service/app_utils.go +++ b/agent/app/service/app_utils.go @@ -1185,6 +1185,8 @@ func getApps(oldApps []model.App, items []dto.AppDefine, systemVersion string, t app.Key = key app.ShortDescZh = config.ShortDescZh app.ShortDescEn = config.ShortDescEn + description, _ := json.Marshal(config.Description) + app.Description = string(description) app.Website = config.Website app.Document = config.Document app.Github = config.Github @@ -1287,14 +1289,31 @@ func handleLocalApp(appDir string) (app *model.App, err error) { err = buserr.WithMap("ErrFileParseApp", map[string]interface{}{"name": "data.yml", "err": err.Error()}, err) return } - app = &localAppDefine.AppProperty + appDefine := localAppDefine.AppProperty + app = &model.App{} + app.Name = appDefine.Name + app.TagsKey = append(appDefine.Tags, "Local") + app.Type = appDefine.Type + app.CrossVersionUpdate = appDefine.CrossVersionUpdate + app.Limit = appDefine.Limit + app.Recommend = appDefine.Recommend + app.Website = appDefine.Website + app.Github = appDefine.Github + app.Document = appDefine.Document + if appDefine.ShortDescZh != "" { + appDefine.Description.Zh = appDefine.ShortDescZh + } + if appDefine.ShortDescEn != "" { + appDefine.Description.En = appDefine.ShortDescEn + } + desc, _ := json.Marshal(appDefine.Description) + app.Description = string(desc) + app.Key = "local" + appDefine.Key + app.Resource = constant.AppResourceLocal app.Status = constant.AppNormal app.Recommend = 9999 - app.TagsKey = append(app.TagsKey, "Local") - app.Key = "local" + app.Key - readMePath := path.Join(appDir, "README.md") - readMeByte, err := fileOp.GetContent(readMePath) + readMeByte, err := fileOp.GetContent(path.Join(appDir, "README.md")) if err == nil { app.ReadMe = string(readMeByte) } @@ -1760,3 +1779,41 @@ func RequestDownloadCallBack(downloadCallBackUrl string) { } _, _, _ = req_helper.HandleRequest(downloadCallBackUrl, http.MethodGet, constant.TimeOut5s) } + +func getAppTags(appID uint, lang string) ([]response.TagDTO, error) { + appTags, err := appTagRepo.GetByAppId(appID) + if err != nil { + return nil, err + } + var tagIds []uint + for _, at := range appTags { + tagIds = append(tagIds, at.TagId) + } + tags, err := tagRepo.GetByIds(tagIds) + if err != nil { + return nil, err + } + var res []response.TagDTO + for _, t := range tags { + if t.Name != "" { + tagDTO := response.TagDTO{ + ID: t.ID, + Key: t.Key, + Name: t.Name, + } + res = append(res, tagDTO) + } else { + var translations = make(map[string]string) + _ = json.Unmarshal([]byte(t.Translations), &translations) + if name, ok := translations[lang]; ok { + tagDTO := response.TagDTO{ + ID: t.ID, + Key: t.Key, + Name: name, + } + res = append(res, tagDTO) + } + } + } + return res, nil +} diff --git a/agent/app/service/website.go b/agent/app/service/website.go index 2f8465dc7..d321426fb 100644 --- a/agent/app/service/website.go +++ b/agent/app/service/website.go @@ -2235,7 +2235,18 @@ func (w WebsiteService) UpdateAntiLeech(req request.NginxAntiLeechUpdate) (err e } newBlock.Directives = append(newBlock.Directives, ifDir) newDirective.Block = newBlock - block.Directives = append(block.Directives, &newDirective) + index := -1 + for i, directive := range block.Directives { + if directive.GetName() == "include" { + index = i + break + } + } + if index != -1 { + block.Directives = append(block.Directives[:index], append([]components.IDirective{&newDirective}, block.Directives[index:]...)...) + } else { + block.Directives = append(block.Directives, &newDirective) + } } if err = nginx.WriteConfig(nginxFull.SiteConfig.Config, nginx.IndentedStyle); err != nil { diff --git a/agent/go.mod b/agent/go.mod index 81c6c9252..6c4ea144e 100644 --- a/agent/go.mod +++ b/agent/go.mod @@ -128,6 +128,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.128 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/in-toto/in-toto-golang v0.5.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -196,6 +197,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.1065 // indirect github.com/therootcompany/xz v1.0.1 // indirect github.com/theupdateframework/notary v0.7.0 // indirect + github.com/tjfoc/gmsm v1.4.1 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/tonistiigi/fsutil v0.0.0-20240424095704-91a3fc46842c // indirect @@ -210,6 +212,7 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.mongodb.org/mongo-driver v1.12.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect diff --git a/agent/go.sum b/agent/go.sum index 5862aacaf..c6573d931 100644 --- a/agent/go.sum +++ b/agent/go.sum @@ -396,6 +396,7 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -503,6 +504,8 @@ github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.128 h1:kQ2Agpfy7Ze1ajn9xCQG9G6T7XIbqv+FBDS/U98W9Mk= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.128/go.mod h1:JWz2ujO9X3oU5wb6kXp+DpR2UuDj2SldDbX8T0FSuhI= github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -684,6 +687,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSrwhe88TQQ= @@ -915,6 +919,8 @@ github.com/therootcompany/xz v1.0.1 h1:CmOtsn1CbtmyYiusbfmhmkpAAETj0wBIH6kCYaX+x github.com/therootcompany/xz v1.0.1/go.mod h1:3K3UH1yCKgBneZYhuQUvJ9HPD19UEXEI0BWbMn8qNMY= github.com/theupdateframework/notary v0.7.0 h1:QyagRZ7wlSpjT5N2qQAh/pN+DVqgekv4DzbAiAiEL3c= github.com/theupdateframework/notary v0.7.0/go.mod h1:c9DRxcmhHmVLDay4/2fUYdISnHqbFDGRSlXPO0AhYWw= +github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho= +github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -948,7 +954,9 @@ github.com/volcengine/volc-sdk-golang v1.0.189 h1:VMDTHWYXakXJtZqPYn0As/h4eB0c4i github.com/volcengine/volc-sdk-golang v1.0.189/go.mod h1:u0VtPvlXWpXDTmc9IHkaW1q+5Jjwus4oAqRhNMDRInE= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -956,6 +964,7 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -968,6 +977,8 @@ go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQc go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= +go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE= +go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -1034,6 +1045,7 @@ golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= @@ -1042,8 +1054,11 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1121,6 +1136,7 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -1129,11 +1145,13 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1233,6 +1251,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -1242,6 +1262,8 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1252,10 +1274,13 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/agent/init/migration/migrate.go b/agent/init/migration/migrate.go index 76d31f4d4..f5021fbba 100644 --- a/agent/init/migration/migrate.go +++ b/agent/init/migration/migrate.go @@ -22,6 +22,8 @@ func InitAgentDB() { migrations.InitDefaultCA, migrations.InitPHPExtensions, migrations.InitBackup, + migrations.UpdateAppTag, + migrations.UpdateApp, }) if err := m.Migrate(); err != nil { global.LOG.Error(err) diff --git a/agent/init/migration/migrations/init.go b/agent/init/migration/migrations/init.go index ed42b2a87..1f7f0cf43 100644 --- a/agent/init/migration/migrations/init.go +++ b/agent/init/migration/migrations/init.go @@ -245,3 +245,23 @@ var InitBackup = &gormigrate.Migration{ return nil }, } + +var UpdateAppTag = &gormigrate.Migration{ + ID: "20250206-update-app-tag", + Migrate: func(tx *gorm.DB) error { + if err := tx.AutoMigrate(&model.Tag{}); err != nil { + return err + } + return nil + }, +} + +var UpdateApp = &gormigrate.Migration{ + ID: "20250206-update-app", + Migrate: func(tx *gorm.DB) error { + if err := tx.AutoMigrate(&model.App{}); err != nil { + return err + } + return nil + }, +} diff --git a/agent/utils/common/common.go b/agent/utils/common/common.go index 278d4db28..aaee4bf59 100644 --- a/agent/utils/common/common.go +++ b/agent/utils/common/common.go @@ -350,10 +350,10 @@ func FormatPercent(percent float64) string { return fmt.Sprintf("%.2f%%", percent) } -func GetLang(context *gin.Context) string { - lang := context.GetHeader("Accept-Language") - if strings.Contains(lang, "zh") { - return "zh" +func GetLang(c *gin.Context) string { + lang := c.GetHeader("Accept-Language") + if lang == "" { + lang = "en" } - return "en" + return lang } diff --git a/agent/utils/ssl/client.go b/agent/utils/ssl/client.go index 7595e475a..9f50badb4 100644 --- a/agent/utils/ssl/client.go +++ b/agent/utils/ssl/client.go @@ -4,6 +4,7 @@ import ( "crypto" "encoding/json" "github.com/go-acme/lego/v4/providers/dns/clouddns" + "github.com/go-acme/lego/v4/providers/dns/huaweicloud" "github.com/go-acme/lego/v4/providers/dns/rainyun" "github.com/go-acme/lego/v4/providers/dns/volcengine" "os" @@ -78,6 +79,7 @@ const ( TencentCloud DnsType = "TencentCloud" RainYun DnsType = "RainYun" Volcengine DnsType = "Volcengine" + HuaweiCloud DnsType = "HuaweiCloud" ) type DNSParam struct { @@ -92,6 +94,7 @@ type DNSParam struct { SecretID string `json:"secretID"` ClientID string `json:"clientID"` Password string `json:"password"` + Region string `json:"region"` } var ( @@ -198,6 +201,15 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web volcConfig.PollingInterval = pollingInterval volcConfig.TTL = ttl p, err = volcengine.NewDNSProviderConfig(volcConfig) + case HuaweiCloud: + huaweiCloudConfig := huaweicloud.NewDefaultConfig() + huaweiCloudConfig.AccessKeyID = param.AccessKey + huaweiCloudConfig.SecretAccessKey = param.SecretKey + huaweiCloudConfig.Region = param.Region + huaweiCloudConfig.PropagationTimeout = propagationTimeout + huaweiCloudConfig.PollingInterval = pollingInterval + huaweiCloudConfig.TTL = int32(ttl) + p, err = huaweicloud.NewDNSProviderConfig(huaweiCloudConfig) } if err != nil { return err diff --git a/frontend/src/api/interface/app.ts b/frontend/src/api/interface/app.ts index 3b2acc535..2119f4f34 100644 --- a/frontend/src/api/interface/app.ts +++ b/frontend/src/api/interface/app.ts @@ -8,6 +8,7 @@ export namespace App { tags: Tag[]; shortDescZh: string; shortDescEn: string; + description: string; author: string; source: string; type: string; @@ -18,6 +19,16 @@ export namespace App { readme: string; } + interface Locale { + zh: string; + en: string; + 'zh-Hant': string; + ja: string; + ms: string; + 'pt-br': string; + ru: string; + } + export interface AppDTO extends App { versions: string[]; installed: boolean; @@ -78,6 +89,7 @@ export namespace App { params?: FromParam[]; multiple?: boolean; allowCreate?: boolean; + label: Locale; } export interface FromFieldChild extends FromField { @@ -229,6 +241,7 @@ export namespace App { showValue?: string; required?: boolean; multiple?: boolean; + label: Locale; } export interface AppConfig { diff --git a/frontend/src/views/app-store/apps/index.vue b/frontend/src/views/app-store/apps/index.vue index 4c0593d12..2fbdd31a3 100644 --- a/frontend/src/views/app-store/apps/index.vue +++ b/frontend/src/views/app-store/apps/index.vue @@ -20,7 +20,7 @@ :type="activeTag === item.key ? 'primary' : ''" :plain="activeTag !== item.key" > - {{ language == 'zh' || language == 'tw' ? item.name : item.key }} + {{ item.name }}
@@ -42,7 +42,7 @@ @click="changeTag(item.key)" :key="item.key" > - {{ language == 'zh' || language == 'tw' ? item.name : item.key }} + {{ item.name }} @@ -118,22 +118,14 @@
- {{ - language == 'zh' || language == 'tw' - ? app.shortDescZh - : app.shortDescEn - }} + {{ app.description }}
- {{ - language == 'zh' || language == 'tw' - ? tag.name - : tag.key - }} + {{ tag.name }} @@ -193,7 +185,7 @@ import Install from '../detail/install/index.vue'; import router from '@/routers'; import { MsgSuccess } from '@/utils/message'; import { GlobalStore } from '@/store'; -import { getLanguage, newUUID } from '@/utils/util'; +import { newUUID } from '@/utils/util'; import Detail from '../detail/index.vue'; import TaskLog from '@/components/task-log/index.vue'; import { storeToRefs } from 'pinia'; @@ -205,8 +197,6 @@ const mobile = computed(() => { return globalStore.isMobile(); }); -const language = getLanguage(); - const paginationConfig = reactive({ cacheSizeKey: 'app-page-size', currentPage: 1, @@ -342,7 +332,7 @@ const changeTag = (key: string) => { const getTagValue = (key: string) => { const tag = tags.value.find((tag) => tag.key === key); if (tag) { - return language == 'zh' || language == 'tw' ? tag.name : tag.key; + return tag.name; } }; diff --git a/frontend/src/views/app-store/detail/index.vue b/frontend/src/views/app-store/detail/index.vue index 03491e59b..66041e4c4 100644 --- a/frontend/src/views/app-store/detail/index.vue +++ b/frontend/src/views/app-store/detail/index.vue @@ -11,7 +11,7 @@
- {{ language == 'zh' || language == 'tw' ? app.shortDescZh : app.shortDescEn }} + {{ app.description }}

@@ -72,14 +72,12 @@ import { ref } from 'vue'; import Install from './install/index.vue'; import router from '@/routers'; import { GlobalStore } from '@/store'; -import { getLanguage, computeSizeFromMB } from '@/utils/util'; +import { computeSizeFromMB } from '@/utils/util'; import { storeToRefs } from 'pinia'; const globalStore = GlobalStore(); const { isDarkTheme } = storeToRefs(globalStore); -const language = getLanguage(); - const app = ref({}); const appDetail = ref({}); const version = ref(''); diff --git a/frontend/src/views/app-store/detail/params/index.vue b/frontend/src/views/app-store/detail/params/index.vue index 599055364..6dd7fdc1a 100644 --- a/frontend/src/views/app-store/detail/params/index.vue +++ b/frontend/src/views/app-store/detail/params/index.vue @@ -260,6 +260,10 @@ const changeService = (value: string, services: App.AppService[]) => { const getLabel = (row: ParamObj): string => { const language = localStorage.getItem('lang') || 'zh'; + let lang = language == 'tw' ? 'zh-Hant' : language; + if (row.label && row.label[lang] != '') { + return row.label[lang]; + } if (language == 'zh' || language == 'tw') { return row.labelZh; } else { diff --git a/frontend/src/views/app-store/installed/detail/index.vue b/frontend/src/views/app-store/installed/detail/index.vue index f6f72a9c9..0fd4b5193 100644 --- a/frontend/src/views/app-store/installed/detail/index.vue +++ b/frontend/src/views/app-store/installed/detail/index.vue @@ -122,7 +122,6 @@ import { FormInstance } from 'element-plus'; import { Rules, checkNumberRange } from '@/global/form-rules'; import { MsgSuccess } from '@/utils/message'; import i18n from '@/lang'; -import { getLanguage } from '@/utils/util'; interface ParamProps { id: Number; @@ -205,6 +204,7 @@ const get = async () => { values: d.values, showValue: d.showValue, multiple: d.multiple, + label: d.label, }); rules.params[d.key] = [Rules.requiredInput]; if (d.rule) { @@ -229,7 +229,11 @@ const get = async () => { }; const getLabel = (row: EditForm): string => { - const language = getLanguage(); + const language = localStorage.getItem('lang') || 'zh'; + let lang = language == 'tw' ? 'zh-Hant' : language; + if (row.label && row.label[lang] != '') { + return row.label[lang]; + } if (language == 'zh' || language == 'tw') { return row.labelZh; } else { diff --git a/frontend/src/views/app-store/installed/index.vue b/frontend/src/views/app-store/installed/index.vue index 042ac9a63..c69ed2b0e 100644 --- a/frontend/src/views/app-store/installed/index.vue +++ b/frontend/src/views/app-store/installed/index.vue @@ -19,7 +19,7 @@ :type="activeTag === item.key ? 'primary' : ''" :plain="activeTag !== item.key" > - {{ language == 'zh' || language == 'tw' ? item.name : item.key }} + {{ item.name }}
@@ -41,7 +41,7 @@ @click="changeTag(item.key)" :key="item.key" > - {{ language == 'zh' || language == 'tw' ? item.name : item.key }} + {{ item.name }} @@ -484,7 +484,7 @@ const changeTag = (key: string) => { const getTagValue = (key: string) => { const tag = tags.value.find((tag) => tag.key === key); if (tag) { - return language == 'zh' || language == 'tw' ? tag.name : tag.key; + return tag.name; } }; diff --git a/frontend/src/views/home/app/index.vue b/frontend/src/views/home/app/index.vue index d35cf9acb..e4a31b052 100644 --- a/frontend/src/views/home/app/index.vue +++ b/frontend/src/views/home/app/index.vue @@ -55,9 +55,7 @@
- {{ - language == 'zh' || language == 'tw' ? app.shortDescZh : app.shortDescEn - }} + {{ app.description }}
diff --git a/frontend/src/views/website/runtime/php/create/index.vue b/frontend/src/views/website/runtime/php/create/index.vue index 5f3e058a3..535e7634e 100644 --- a/frontend/src/views/website/runtime/php/create/index.vue +++ b/frontend/src/views/website/runtime/php/create/index.vue @@ -286,6 +286,10 @@ const rules = ref({ const getLabel = (row: App.FromField): string => { const language = localStorage.getItem('lang') || 'zh'; + let lang = language == 'tw' ? 'zh-Hant' : language; + if (row.label && row.label[lang] != '') { + return row.label[lang]; + } if (language == 'zh' || language == 'tw') { return row.labelZh; } else { diff --git a/frontend/src/views/website/ssl/dns-account/create/index.vue b/frontend/src/views/website/ssl/dns-account/create/index.vue index 1e92d7667..e71e42bbc 100644 --- a/frontend/src/views/website/ssl/dns-account/create/index.vue +++ b/frontend/src/views/website/ssl/dns-account/create/index.vue @@ -19,14 +19,17 @@ {{ $t('ssl.deprecatedHelper') }} -
- +
+ - +
+ + +
diff --git a/frontend/src/views/website/website/config/basic/load-balance/operate/index.vue b/frontend/src/views/website/website/config/basic/load-balance/operate/index.vue index 6c6b2db8a..86a17b8c6 100644 --- a/frontend/src/views/website/website/config/basic/load-balance/operate/index.vue +++ b/frontend/src/views/website/website/config/basic/load-balance/operate/index.vue @@ -68,7 +68,7 @@ :prop="`servers.${index}.flag`" :rules="rules.flag" > - +