feat(wip): site category

This commit is contained in:
Jacky 2024-10-24 23:09:16 +08:00
parent ed3c02fc6f
commit 7ad5cac3b8
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
73 changed files with 713 additions and 235 deletions

View file

@ -42,7 +42,7 @@ type Node struct {
var mutex sync.Mutex
type TNodeMap map[int]*Node
type TNodeMap map[uint64]*Node
var NodeMap TNodeMap

View file

@ -16,11 +16,11 @@ import (
)
type ConfigPayload struct {
CertID int `json:"cert_id"`
CertID uint64 `json:"cert_id"`
ServerName []string `json:"server_name"`
ChallengeMethod string `json:"challenge_method"`
DNSCredentialID int `json:"dns_credential_id"`
ACMEUserID int `json:"acme_user_id"`
DNSCredentialID uint64 `json:"dns_credential_id"`
ACMEUserID uint64 `json:"acme_user_id"`
KeyType certcrypto.KeyType `json:"key_type"`
Resource *model.CertificateResource `json:"resource,omitempty"`
MustStaple bool `json:"must_staple"`

View file

@ -80,7 +80,7 @@ func SyncToRemoteServer(c *model.Config, newFilepath string) (err error) {
return
}
func SyncRenameOnRemoteServer(origPath, newPath string, syncNodeIds []int) (err error) {
func SyncRenameOnRemoteServer(origPath, newPath string, syncNodeIds []uint64) (err error) {
if origPath == "" || newPath == "" || len(syncNodeIds) == 0 {
return
}

View file

@ -18,7 +18,7 @@ func Proxy() gin.HandlerFunc {
c.Next()
return
}
id := cast.ToInt(nodeID)
id := cast.ToUint64(nodeID)
if id == 0 {
c.Next()
return

View file

@ -16,7 +16,7 @@ func ProxyWs() gin.HandlerFunc {
c.Next()
return
}
id := cast.ToInt(nodeID)
id := cast.ToUint64(nodeID)
if id == 0 {
c.Next()
return

View file

@ -46,16 +46,16 @@ func secureSessionIDCacheKey(sessionId string) string {
return fmt.Sprintf("2fa_secure_session:_%s", sessionId)
}
func SetSecureSessionID(userId int) (sessionId string) {
func SetSecureSessionID(userId uint64) (sessionId string) {
sessionId = uuid.NewString()
cache.Set(secureSessionIDCacheKey(sessionId), userId, 5*time.Minute)
return
}
func VerifySecureSessionID(sessionId string, userId int) bool {
func VerifySecureSessionID(sessionId string, userId uint64) bool {
if v, ok := cache.Get(secureSessionIDCacheKey(sessionId)); ok {
if v.(int) == userId {
if v.(uint64) == userId {
return true
}
}

View file

@ -15,7 +15,7 @@ const ExpiredTime = 24 * time.Hour
type JWTClaims struct {
Name string `json:"name"`
UserID int `json:"user_id"`
UserID uint64 `json:"user_id"`
jwt.RegisteredClaims
}