mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-23 08:00:55 +00:00
* feat: change isProductPro logic (#12712) * fix: tighten frontend RBAC permission guards (#12717) * fix: tighten frontend RBAC permission guards * feat: add permission directive coverage * refactor frontend global store usage * serve frontend routes with fallback --------- Co-authored-by: CityFun <31820853+zhengkunwang223@users.noreply.github.com>
80 lines
1.7 KiB
Go
80 lines
1.7 KiB
Go
package global
|
|
|
|
import (
|
|
"context"
|
|
|
|
badger_db "github.com/1Panel-dev/1Panel/agent/init/cache/db"
|
|
"github.com/go-playground/validator/v10"
|
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
|
"github.com/robfig/cron/v3"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/viper"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
var (
|
|
DB *gorm.DB
|
|
MonitorDB *gorm.DB
|
|
GPUMonitorDB *gorm.DB
|
|
TaskDB *gorm.DB
|
|
CoreDB *gorm.DB
|
|
AlertDB *gorm.DB
|
|
|
|
LOG *logrus.Logger
|
|
CONF ServerConfig
|
|
VALID *validator.Validate
|
|
CACHE *badger_db.Cache
|
|
Viper *viper.Viper
|
|
|
|
Dir SystemDir
|
|
|
|
Cron *cron.Cron
|
|
MonitorCronID cron.EntryID
|
|
|
|
IsMaster bool
|
|
|
|
I18n *i18n.Localizer
|
|
|
|
AlertBaseJobID cron.EntryID
|
|
AlertResourceJobID cron.EntryID
|
|
|
|
TaskCtxMap = make(map[string]context.CancelFunc)
|
|
)
|
|
|
|
func RepoURL() string {
|
|
if CONF.Base.IsEnterprise {
|
|
return "https://resource.fit2cloud.com/1panel/package/enterprise"
|
|
}
|
|
if CONF.Base.IsFxplay {
|
|
return "https://resource.fit2cloud.com/1panel/package/fusionxplay"
|
|
}
|
|
if CONF.Base.Edition != "intl" {
|
|
return "https://resource.fit2cloud.com/1panel/package/v2"
|
|
}
|
|
return "https://resource.1panel.pro/v2"
|
|
}
|
|
func ResourceURL() string {
|
|
if CONF.Base.IsEnterprise {
|
|
return "https://resource.fit2cloud.com/1panel/resource/v2"
|
|
}
|
|
if CONF.Base.IsFxplay {
|
|
return "https://resource.fit2cloud.com/1panel/resource/v2"
|
|
}
|
|
if CONF.Base.Edition != "intl" {
|
|
return "https://resource.fit2cloud.com/1panel/resource/v2"
|
|
}
|
|
return "https://resource.1panel.pro/v2/resource"
|
|
}
|
|
func AppRepoURL() string {
|
|
if CONF.Base.IsEnterprise {
|
|
return "https://apps-assets.fit2cloud.com"
|
|
}
|
|
if CONF.Base.IsFxplay {
|
|
return "https://apps-assets.fit2cloud.com"
|
|
}
|
|
if CONF.Base.Edition != "intl" {
|
|
return "https://apps-assets.fit2cloud.com"
|
|
}
|
|
return "https://apps.1panel.pro"
|
|
}
|