Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sdk-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
sdk-api
Commits
1551ed74
Commit
1551ed74
authored
Jun 25, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update bot config
parent
74925d01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
config.toml
config.toml
+6
-0
config.go
config/config.go
+5
-6
user.go
server/user.go
+8
-1
No files found.
config.toml
View file @
1551ed74
...
@@ -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
config/config.go
View file @
1551ed74
...
@@ -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
)
{
...
...
server/user.go
View file @
1551ed74
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment