Merge branch 'old/master' into old
This commit is contained in:
@@ -12,9 +12,6 @@ const SiteConfigKey = "system:site_config"
|
||||
// SubscribeConfigKey Subscribe Config Key
|
||||
const SubscribeConfigKey = "system:subscribe_config"
|
||||
|
||||
// ApplicationKey Application Key
|
||||
const ApplicationKey = "system:application"
|
||||
|
||||
// RegisterConfigKey Register Config Key
|
||||
const RegisterConfigKey = "system:register_config"
|
||||
|
||||
@@ -51,26 +48,12 @@ const AuthCodeCacheKey = "auth:verify:email"
|
||||
// AuthCodeTelephoneCacheKey Register Code Cache Key
|
||||
const AuthCodeTelephoneCacheKey = "auth:verify:telephone"
|
||||
|
||||
// ServerUserListCacheKey Server User List Cache Key
|
||||
const ServerUserListCacheKey = "server:user_list:id:"
|
||||
|
||||
// ServerConfigCacheKey Server Config Cache Key
|
||||
const ServerConfigCacheKey = "server:config:id:"
|
||||
|
||||
// CommonStat Cache Key
|
||||
// CommonStatCacheKey CommonStat Cache Key
|
||||
const CommonStatCacheKey = "common:stat"
|
||||
|
||||
// ServerStatusCacheKey Server Status Cache Key
|
||||
const ServerStatusCacheKey = "server:status:id:"
|
||||
|
||||
// ServerCountCacheKey Server Count Cache Key
|
||||
const ServerCountCacheKey = "server:count"
|
||||
|
||||
// UserBindTelegramCacheKey User Bind Telegram Cache Key
|
||||
const UserBindTelegramCacheKey = "user:bind:telegram:code:"
|
||||
|
||||
const CacheSmsCount = "cache:sms:count"
|
||||
|
||||
// SendIntervalKeyPrefix Auth Code Send Interval Key Prefix
|
||||
const SendIntervalKeyPrefix = "send:interval:"
|
||||
|
||||
|
||||
+101
-4
@@ -1,6 +1,8 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/perfect-panel/server/pkg/logger"
|
||||
"github.com/perfect-panel/server/pkg/orm"
|
||||
)
|
||||
@@ -19,12 +21,14 @@ type Config struct {
|
||||
Node NodeConfig `yaml:"Node"`
|
||||
Mobile MobileConfig `yaml:"Mobile"`
|
||||
Email EmailConfig `yaml:"Email"`
|
||||
Device DeviceConfig `yaml:"device"`
|
||||
Verify Verify `yaml:"Verify"`
|
||||
VerifyCode VerifyCode `yaml:"VerifyCode"`
|
||||
Register RegisterConfig `yaml:"Register"`
|
||||
Subscribe SubscribeConfig `yaml:"Subscribe"`
|
||||
Invite InviteConfig `yaml:"Invite"`
|
||||
Telegram Telegram `yaml:"Telegram"`
|
||||
Log Log `yaml:"Log"`
|
||||
Administrator struct {
|
||||
Email string `yaml:"Email" default:"admin@ppanel.dev"`
|
||||
Password string `yaml:"Password" default:"password"`
|
||||
@@ -52,9 +56,11 @@ type Verify struct {
|
||||
|
||||
type SubscribeConfig struct {
|
||||
SingleModel bool `yaml:"SingleModel" default:"false"`
|
||||
SubscribePath string `yaml:"SubscribePath" default:"/api/subscribe"`
|
||||
SubscribePath string `yaml:"SubscribePath" default:"/v1/subscribe/config"`
|
||||
SubscribeDomain string `yaml:"SubscribeDomain" default:""`
|
||||
PanDomain bool `yaml:"PanDomain" default:"false"`
|
||||
UserAgentLimit bool `yaml:"UserAgentLimit" default:"false"`
|
||||
UserAgentList string `yaml:"UserAgentList" default:""`
|
||||
}
|
||||
|
||||
type RegisterConfig struct {
|
||||
@@ -91,6 +97,14 @@ type MobileConfig struct {
|
||||
Whitelist []string `yaml:"whitelist"`
|
||||
}
|
||||
|
||||
type DeviceConfig struct {
|
||||
Enable bool `yaml:"enable" default:"true"`
|
||||
ShowAds bool `yaml:"show_ads"`
|
||||
EnableSecurity bool `yaml:"enable_security"`
|
||||
OnlyRealDevice bool `yaml:"only_real_device"`
|
||||
SecuritySecret string `yaml:"security_secret"`
|
||||
}
|
||||
|
||||
type SiteConfig struct {
|
||||
Host string `yaml:"Host" default:""`
|
||||
SiteName string `yaml:"SiteName" default:""`
|
||||
@@ -102,9 +116,76 @@ type SiteConfig struct {
|
||||
}
|
||||
|
||||
type NodeConfig struct {
|
||||
NodeSecret string `yaml:"NodeSecret" default:""`
|
||||
NodePullInterval int64 `yaml:"NodePullInterval" default:"60"`
|
||||
NodePushInterval int64 `yaml:"NodePushInterval" default:"60"`
|
||||
NodeSecret string `yaml:"NodeSecret" default:""`
|
||||
NodePullInterval int64 `yaml:"NodePullInterval" default:"60"`
|
||||
NodePushInterval int64 `yaml:"NodePushInterval" default:"60"`
|
||||
TrafficReportThreshold int64 `yaml:"TrafficReportThreshold" default:"0"`
|
||||
IPStrategy string `yaml:"IPStrategy" default:""`
|
||||
DNS []NodeDNS `yaml:"DNS"`
|
||||
Block []string `yaml:"Block" `
|
||||
Outbound []NodeOutbound `yaml:"Outbound"`
|
||||
}
|
||||
|
||||
func (n *NodeConfig) Marshal() ([]byte, error) {
|
||||
type Alias NodeConfig
|
||||
return json.Marshal(&struct {
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(n),
|
||||
})
|
||||
}
|
||||
|
||||
func (n *NodeConfig) Unmarshal(data []byte) error {
|
||||
type Alias NodeConfig
|
||||
aux := &struct {
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(n),
|
||||
}
|
||||
return json.Unmarshal(data, &aux)
|
||||
}
|
||||
|
||||
type NodeDNS struct {
|
||||
Proto string `json:"proto"`
|
||||
Address string `json:"address"`
|
||||
Domains []string `json:"domains"`
|
||||
}
|
||||
|
||||
func (n *NodeDNS) Marshal() ([]byte, error) {
|
||||
type Alias NodeDNS
|
||||
return json.Marshal(&struct {
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(n),
|
||||
})
|
||||
}
|
||||
|
||||
func (n *NodeDNS) Unmarshal(data []byte) error {
|
||||
type Alias NodeDNS
|
||||
aux := &struct {
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(n),
|
||||
}
|
||||
return json.Unmarshal(data, &aux)
|
||||
}
|
||||
|
||||
type NodeOutbound struct {
|
||||
Name string `json:"name"`
|
||||
Protocol string `json:"protocol"`
|
||||
Address string `json:"address"`
|
||||
Port int64 `json:"port"`
|
||||
Password string `json:"password"`
|
||||
Rules []string `json:"rules"`
|
||||
}
|
||||
|
||||
func (n *NodeOutbound) Marshal() ([]byte, error) {
|
||||
type Alias NodeOutbound
|
||||
return json.Marshal(&struct {
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(n),
|
||||
})
|
||||
}
|
||||
|
||||
type File struct {
|
||||
@@ -145,3 +226,19 @@ type VerifyCode struct {
|
||||
Limit int64 `yaml:"Limit" default:"15"`
|
||||
Interval int64 `yaml:"Interval" default:"60"`
|
||||
}
|
||||
|
||||
type Log struct {
|
||||
AutoClear bool `yaml:"AutoClear" default:"true"`
|
||||
ClearDays int64 `yaml:"ClearDays" default:"7"`
|
||||
}
|
||||
|
||||
type NodeDBConfig struct {
|
||||
NodeSecret string
|
||||
NodePullInterval int64
|
||||
NodePushInterval int64
|
||||
TrafficReportThreshold int64
|
||||
IPStrategy string
|
||||
DNS string
|
||||
Block string
|
||||
Outbound string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user