Commit 1551ed74 authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

update bot config

parent 74925d01
...@@ -18,3 +18,9 @@ rpc = "https://sepolia.rpc.aonnet.io" ...@@ -18,3 +18,9 @@ rpc = "https://sepolia.rpc.aonnet.io"
# 0x0000000077024042e797Ae28A163C27E389CC5b2 # 0x0000000077024042e797Ae28A163C27E389CC5b2
private_key = "39494cd233573c94d6b4d24847f2f4d5da9d0b384b61f3ad4fae9abd5c48e6fc" private_key = "39494cd233573c94d6b4d24847f2f4d5da9d0b384b61f3ad4fae9abd5c48e6fc"
[tg_bot]
tokens = [
"5000822884:AAHtZnIGjV1yYMfN6s_pAzoiZWDf5JWWTko",
"5000134281:AAHSCMPYCszE49fe06PBaNYKAhQxd45Yq-E"
]
\ No newline at end of file
...@@ -8,15 +8,10 @@ import ( ...@@ -8,15 +8,10 @@ import (
type Config struct { type Config struct {
Debug bool `toml:"debug"` Debug bool `toml:"debug"`
Sender SenderConfig `toml:"sender"`
MySQL MysqlConfig `toml:"mysql"` MySQL MysqlConfig `toml:"mysql"`
Server ServerConfig `toml:"server"` Server ServerConfig `toml:"server"`
GasSender GasSenderConfig `toml:"gas_sender"` GasSender GasSenderConfig `toml:"gas_sender"`
} TGBot TGBotConfig `toml:"tg_bot"`
type SenderConfig struct {
EmailUsername string `json:"email_username"`
EmailPassword string `json:"email_password"`
} }
type MysqlConfig struct { type MysqlConfig struct {
...@@ -38,6 +33,10 @@ type GasSenderConfig struct { ...@@ -38,6 +33,10 @@ type GasSenderConfig struct {
RPC string `toml:"rpc"` RPC string `toml:"rpc"`
} }
type TGBotConfig struct {
Tokens []string `toml:"tokens"`
}
var confPath = flag.String("c", "config.toml", "config file path") var confPath = flag.String("c", "config.toml", "config file path")
func New() (config *Config, err error) { func New() (config *Config, err error) {
......
...@@ -21,7 +21,14 @@ func checkUser(c *gin.Context) { ...@@ -21,7 +21,14 @@ func checkUser(c *gin.Context) {
} }
switch req.Platform { switch req.Platform {
case constant.PlatformTelegram: case constant.PlatformTelegram:
ok, userId := util.VerifyInitData(req.InitData, "5000822884:AAHtZnIGjV1yYMfN6s_pAzoiZWDf5JWWTko") var ok bool
var userId string
for _, token := range conf.TGBot.Tokens {
ok, userId = util.VerifyInitData(req.InitData, token)
if ok {
break
}
}
if !ok { if !ok {
c.JSON(200, withError("invalid initData")) c.JSON(200, withError("invalid initData"))
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment