From ba4df0c76fda224b37cc0893ef04af8d0a4bb6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sat, 31 May 2025 18:48:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E8=AF=95=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E5=AE=89=E8=A3=85=E5=BA=94=E7=94=A8=E4=B8=8D=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E9=9D=A2=E6=9D=BF=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/data/app.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/data/app.go b/internal/data/app.go index 893b7b36..47ad0ccf 100644 --- a/internal/data/app.go +++ b/internal/data/app.go @@ -9,6 +9,7 @@ import ( "github.com/expr-lang/expr" "github.com/go-rat/utils/collect" "github.com/hashicorp/go-version" + "github.com/knadh/koanf/v2" "github.com/leonelquinteros/gotext" "github.com/spf13/cast" "gorm.io/gorm" @@ -21,14 +22,16 @@ import ( type appRepo struct { t *gotext.Locale + conf *koanf.Koanf db *gorm.DB cache biz.CacheRepo task biz.TaskRepo } -func NewAppRepo(t *gotext.Locale, db *gorm.DB, cache biz.CacheRepo, task biz.TaskRepo) biz.AppRepo { +func NewAppRepo(t *gotext.Locale, conf *koanf.Koanf, db *gorm.DB, cache biz.CacheRepo, task biz.TaskRepo) biz.AppRepo { return &appRepo{ t: t, + conf: conf, db: db, cache: cache, task: task, @@ -166,7 +169,7 @@ func (r *appRepo) Install(channel, slug string) error { continue } if ch.Slug == channel { - if vs.GreaterThan(panel) { + if vs.GreaterThan(panel) && !r.conf.Bool("app.debug") { return errors.New(r.t.Get("app %s requires panel version %s, current version %s", item.Name, ch.Panel, app.Version)) } shellUrl = ch.Install @@ -221,7 +224,7 @@ func (r *appRepo) UnInstall(slug string) error { continue } if ch.Slug == installed.Channel { - if vs.GreaterThan(panel) { + if vs.GreaterThan(panel) && !r.conf.Bool("app.debug") { return errors.New(r.t.Get("app %s requires panel version %s, current version %s", item.Name, ch.Panel, app.Version)) } shellUrl = ch.Uninstall @@ -276,7 +279,7 @@ func (r *appRepo) Update(slug string) error { continue } if ch.Slug == installed.Channel { - if vs.GreaterThan(panel) { + if vs.GreaterThan(panel) && !r.conf.Bool("app.debug") { return errors.New(r.t.Get("app %s requires panel version %s, current version %s", item.Name, ch.Panel, app.Version)) } shellUrl = ch.Update