diff --git a/backend/app/service/app.go b/backend/app/service/app.go index ee840f80d..6c60471b4 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -728,6 +728,14 @@ func (a AppService) GetAppUpdate() (*response.AppUpdateRes, error) { res.CanUpdate = true return res, err } + apps, _ := appRepo.GetBy(appRepo.WithResource(constant.AppResourceRemote)) + for _, app := range apps { + if app.Icon == "" { + res.CanUpdate = true + return res, err + } + } + list, err := getAppList() if err != nil { return res, err @@ -836,12 +844,16 @@ func (a AppService) SyncAppListFromRemote() (err error) { if err != nil { return err } - defer iconRes.Body.Close() body, err := io.ReadAll(iconRes.Body) if err != nil { return err } - iconStr := base64.StdEncoding.EncodeToString(body) + iconStr := "" + if !strings.Contains(string(body), "xml") { + iconStr = base64.StdEncoding.EncodeToString(body) + } + _ = iconRes.Body.Close() + app.Icon = iconStr app.TagsKey = l.AppProperty.Tags if l.AppProperty.Recommend > 0 { diff --git a/backend/cron/cron.go b/backend/cron/cron.go index b1ef463a5..93cb9c2c8 100644 --- a/backend/cron/cron.go +++ b/backend/cron/cron.go @@ -1,6 +1,8 @@ package cron import ( + "fmt" + mathRand "math/rand" "time" "github.com/1Panel-dev/1Panel/backend/app/model" @@ -41,7 +43,7 @@ func Run() { if _, err := global.Cron.AddJob("@daily", job.NewSSLJob()); err != nil { global.LOG.Errorf("can not add ssl corn job: %s", err.Error()) } - if _, err := global.Cron.AddJob("@daily", job.NewAppStoreJob()); err != nil { + if _, err := global.Cron.AddJob(fmt.Sprintf("%v %v * * *", mathRand.Intn(60), mathRand.Intn(3)), job.NewAppStoreJob()); err != nil { global.LOG.Errorf("can not add appstore corn job: %s", err.Error()) } diff --git a/backend/middleware/demo_handle.go b/backend/middleware/demo_handle.go index cb86c4016..f326dc9d2 100644 --- a/backend/middleware/demo_handle.go +++ b/backend/middleware/demo_handle.go @@ -27,6 +27,9 @@ var whiteUrlList = map[string]struct{}{ "/api/v1/databases/variables": {}, "/api/v1/databases/status": {}, "/api/v1/databases/baseinfo": {}, + + "/api/v1/waf/attack/stat": {}, + "/api/v1/waf/config/website": {}, } func DemoHandle() gin.HandlerFunc {