@@ -0,0 +1,50 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-think/openssl"
|
||||
)
|
||||
|
||||
func initialize(ctx *gin.Context) {
|
||||
ss := session.New(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
initData := ghome.InitializeData{
|
||||
BrandLogo: "http://gskd.sdo.com/ghome/ztc/logo/og/logo_xhdpi.png",
|
||||
BrandName: "盛趣游戏",
|
||||
ForceShowAgreement: 1,
|
||||
GreportLogLevel: "off",
|
||||
LogLevel: "off",
|
||||
LoginButton: []string{"official"},
|
||||
LoginIcon: []any{},
|
||||
NeedFloatWindowPermission: 1,
|
||||
NewDeviceIDServer: strings.ToUpper(openssl.Md5ToString(ss.GetDeviceID())),
|
||||
ShowGuestConfirm: 1,
|
||||
VoicetipButton: 1,
|
||||
}
|
||||
data, err := json.Marshal(initData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
encryptedData, err := openssl.Des3ECBEncrypt([]byte(data), ss.GetRandKey()[0:24], openssl.PKCS7_PADDING)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(ghome.InitializeResp{
|
||||
Code: 0,
|
||||
Msg: "ok",
|
||||
Data: base64.StdEncoding.EncodeToString(encryptedData),
|
||||
})
|
||||
}
|
||||
|
||||
func init() {
|
||||
router.AddHandler("v1", "POST", "/account/initialize", initialize)
|
||||
}
|
||||
Reference in New Issue
Block a user