Docker Build (Gitea) / Build and Push Docker Image (push) Successful in 47s
展示层与标识符全量改名: - module github.com/v03413/bepusdt → git.viaeon.com/admin/vupay(含全部 import) - 二进制/镜像/容器/DB 名 bepusdt → vupay(Dockerfile、workflow IMAGE、compose、docs) - 显示名 BEpusdt → VUPAY(前端 title、后端 banner、version 命令、通知文案) - 默认路径 /var/lib/bepusdt → /var/lib/vupay,/var/log/bepusdt → /var/log/vupay - Telegram 通知的频道按钮原来指向上游 t.me 群,改成站点链接(否则改名后是死链) 刻意保留(运行语义,改了会坏): - api_type 取值 "epusdt" / "epusdt_order"(库里存量数据按此匹配) - 表前缀 bep_(bep_order / bep_conf / …,改需 RENAME TABLE 迁移) - 签名函数 EpusdtSign 与 handler 包名 epusdt(对外协议语义,非品牌) - 所有加密/会话派生的字面量原样不动 验证:gofmt 通过、go build ./... 通过、全仓 grep -i bepusdt 归零
54 lines
1.5 KiB
Go
54 lines
1.5 KiB
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
|
|
"git.viaeon.com/admin/vupay/app/model"
|
|
"git.viaeon.com/admin/vupay/app/task"
|
|
"git.viaeon.com/admin/vupay/app/utils"
|
|
"github.com/urfave/cli/v3"
|
|
"golang.org/x/crypto/bcrypt"
|
|
)
|
|
|
|
var Reset = &cli.Command{
|
|
Name: "reset",
|
|
Usage: "忘记密码时,此命令可重置账号密码登录入口",
|
|
Flags: []cli.Flag{SQLiteFlag, PostgresDSNFlag, MysqlDSNFlag},
|
|
Before: func(ctx context.Context, c *cli.Command) (context.Context, error) {
|
|
sqlite := c.String("sqlite")
|
|
postgres := c.String("postgres")
|
|
mysql := c.String("mysql")
|
|
if err := model.Init(sqlite, postgres, mysql); err != nil {
|
|
return ctx, fmt.Errorf("数据库初始化失败 %w", err)
|
|
}
|
|
|
|
return ctx, task.Init()
|
|
},
|
|
After: func(ctx context.Context, c *cli.Command) error {
|
|
model.Close()
|
|
|
|
return nil
|
|
},
|
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
|
hash := utils.Md5String(time.Now().String())
|
|
|
|
username := hash[8:16]
|
|
password := hash[0:8]
|
|
entrance := fmt.Sprintf("/%s", hash[10:20])
|
|
encrypt, _ := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
|
|
|
model.SetK(model.AdminSecure, entrance)
|
|
model.SetK(model.AdminUsername, username)
|
|
model.SetK(model.AdminPassword, string(encrypt))
|
|
|
|
fmt.Println("重置成功,对应信息如下:")
|
|
fmt.Printf("管理员账号:%s\n管理员密码:%s\n后台管理入口:%s\n", username, password, entrance)
|
|
fmt.Println("请妥善保存以上信息!")
|
|
fmt.Println("-------------------------------")
|
|
|
|
return nil
|
|
},
|
|
}
|