update: global config
This commit is contained in:
parent
71018eb2f4
commit
f3bc933a99
@ -115,6 +115,7 @@ type (
|
|||||||
AuthConfig {
|
AuthConfig {
|
||||||
Mobile MobileAuthenticateConfig `json:"mobile"`
|
Mobile MobileAuthenticateConfig `json:"mobile"`
|
||||||
Email EmailAuthticateConfig `json:"email"`
|
Email EmailAuthticateConfig `json:"email"`
|
||||||
|
Device DeviceAuthticateConfig `json:"device"`
|
||||||
Register PubilcRegisterConfig `json:"register"`
|
Register PubilcRegisterConfig `json:"register"`
|
||||||
}
|
}
|
||||||
PubilcRegisterConfig {
|
PubilcRegisterConfig {
|
||||||
@ -134,6 +135,14 @@ type (
|
|||||||
EnableDomainSuffix bool `json:"enable_domain_suffix"`
|
EnableDomainSuffix bool `json:"enable_domain_suffix"`
|
||||||
DomainSuffixList string `json:"domain_suffix_list"`
|
DomainSuffixList string `json:"domain_suffix_list"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceAuthticateConfig {
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
ShowAds bool `json:"show_ads"`
|
||||||
|
EnableSecurity bool `json:"enable_security"`
|
||||||
|
OnlyRealDevice bool `json:"only_real_device"`
|
||||||
|
}
|
||||||
|
|
||||||
RegisterConfig {
|
RegisterConfig {
|
||||||
StopRegister bool `json:"stop_register"`
|
StopRegister bool `json:"stop_register"`
|
||||||
EnableTrial bool `json:"enable_trial"`
|
EnableTrial bool `json:"enable_trial"`
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package common
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/perfect-panel/server/internal/svc"
|
"github.com/perfect-panel/server/internal/svc"
|
||||||
"github.com/perfect-panel/server/internal/types"
|
"github.com/perfect-panel/server/internal/types"
|
||||||
@ -67,9 +68,12 @@ func (l *GetGlobalConfigLogic) GetGlobalConfig() (resp *types.GetGlobalConfigRes
|
|||||||
for _, method := range authMethods {
|
for _, method := range authMethods {
|
||||||
if *method.Enabled {
|
if *method.Enabled {
|
||||||
methods = append(methods, method.Method)
|
methods = append(methods, method.Method)
|
||||||
|
if method.Method == "device" {
|
||||||
|
_ = json.Unmarshal([]byte(method.Config), &resp.Auth.Device)
|
||||||
|
resp.Auth.Device.Enable = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resp.OAuthMethods = methods
|
|
||||||
|
|
||||||
webAds, err := l.svcCtx.SystemModel.FindOneByKey(l.ctx, "WebAD")
|
webAds, err := l.svcCtx.SystemModel.FindOneByKey(l.ctx, "WebAD")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -118,6 +118,7 @@ type ApplicationVersion struct {
|
|||||||
type AuthConfig struct {
|
type AuthConfig struct {
|
||||||
Mobile MobileAuthenticateConfig `json:"mobile"`
|
Mobile MobileAuthenticateConfig `json:"mobile"`
|
||||||
Email EmailAuthticateConfig `json:"email"`
|
Email EmailAuthticateConfig `json:"email"`
|
||||||
|
Device DeviceAuthticateConfig `json:"device"`
|
||||||
Register PubilcRegisterConfig `json:"register"`
|
Register PubilcRegisterConfig `json:"register"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,6 +518,13 @@ type DeleteUserSubscribeRequest struct {
|
|||||||
UserSubscribeId int64 `json:"user_subscribe_id"`
|
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DeviceAuthticateConfig struct {
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
ShowAds bool `json:"show_ads"`
|
||||||
|
EnableSecurity bool `json:"enable_security"`
|
||||||
|
OnlyRealDevice bool `json:"only_real_device"`
|
||||||
|
}
|
||||||
|
|
||||||
type DeviceLoginRequest struct {
|
type DeviceLoginRequest struct {
|
||||||
Identifier string `json:"identifier" validate:"required"`
|
Identifier string `json:"identifier" validate:"required"`
|
||||||
IP string `header:"X-Original-Forwarded-For"`
|
IP string `header:"X-Original-Forwarded-For"`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user