mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
feat: add sign-server flag
This commit is contained in:
parent
73bd3c92f3
commit
4ad7da7a9a
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/Mrs4s/MiraiGo/client"
|
"github.com/Mrs4s/MiraiGo/client"
|
||||||
"github.com/Mrs4s/MiraiGo/utils"
|
"github.com/Mrs4s/MiraiGo/utils"
|
||||||
"github.com/Mrs4s/MiraiGo/wrapper"
|
"github.com/Mrs4s/MiraiGo/wrapper"
|
||||||
|
"github.com/Mrs4s/go-cqhttp/internal/base"
|
||||||
"github.com/mattn/go-colorable"
|
"github.com/mattn/go-colorable"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@ -263,9 +264,13 @@ func fetchCaptcha(id string) string {
|
|||||||
|
|
||||||
func energy(uin uint64, id string, salt []byte) ([]byte, error) {
|
func energy(uin uint64, id string, salt []byte) ([]byte, error) {
|
||||||
// temporary solution
|
// temporary solution
|
||||||
|
signServer := "https://captcha.go-cqhttp.org/sdk/dandelion/energy"
|
||||||
|
if base.SignServerOverwrite != "" {
|
||||||
|
signServer = base.SignServerOverwrite
|
||||||
|
}
|
||||||
response, err := download.Request{
|
response, err := download.Request{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
URL: "https://captcha.go-cqhttp.org/sdk/dandelion/energy",
|
URL: signServer,
|
||||||
Header: map[string]string{"Content-Type": "application/x-www-form-urlencoded"},
|
Header: map[string]string{"Content-Type": "application/x-www-form-urlencoded"},
|
||||||
Body: bytes.NewReader([]byte(fmt.Sprintf("uin=%v&id=%s&salt=%s", uin, id, hex.EncodeToString(salt)))),
|
Body: bytes.NewReader([]byte(fmt.Sprintf("uin=%v&id=%s&salt=%s", uin, id, hex.EncodeToString(salt)))),
|
||||||
}.Bytes()
|
}.Bytes()
|
||||||
|
@ -23,20 +23,21 @@ var (
|
|||||||
|
|
||||||
// config file flags
|
// config file flags
|
||||||
var (
|
var (
|
||||||
Debug bool // 是否开启 debug 模式
|
Debug bool // 是否开启 debug 模式
|
||||||
RemoveReplyAt bool // 是否删除reply后的at
|
RemoveReplyAt bool // 是否删除reply后的at
|
||||||
ExtraReplyData bool // 是否上报额外reply信息
|
ExtraReplyData bool // 是否上报额外reply信息
|
||||||
IgnoreInvalidCQCode bool // 是否忽略无效CQ码
|
IgnoreInvalidCQCode bool // 是否忽略无效CQ码
|
||||||
SplitURL bool // 是否分割URL
|
SplitURL bool // 是否分割URL
|
||||||
ForceFragmented bool // 是否启用强制分片
|
ForceFragmented bool // 是否启用强制分片
|
||||||
SkipMimeScan bool // 是否跳过Mime扫描
|
SkipMimeScan bool // 是否跳过Mime扫描
|
||||||
ConvertWebpImage bool // 是否转换Webp图片
|
ConvertWebpImage bool // 是否转换Webp图片
|
||||||
ReportSelfMessage bool // 是否上报自身消息
|
ReportSelfMessage bool // 是否上报自身消息
|
||||||
UseSSOAddress bool // 是否使用服务器下发的新地址进行重连
|
UseSSOAddress bool // 是否使用服务器下发的新地址进行重连
|
||||||
LogForceNew bool // 是否在每次启动时强制创建全新的文件储存日志
|
LogForceNew bool // 是否在每次启动时强制创建全新的文件储存日志
|
||||||
LogColorful bool // 是否启用日志颜色
|
LogColorful bool // 是否启用日志颜色
|
||||||
FastStart bool // 是否为快速启动
|
FastStart bool // 是否为快速启动
|
||||||
AllowTempSession bool // 是否允许发送临时会话信息
|
AllowTempSession bool // 是否允许发送临时会话信息
|
||||||
|
SignServerOverwrite string // 使用特定的服务器进行签名
|
||||||
|
|
||||||
PostFormat string // 上报格式 string or array
|
PostFormat string // 上报格式 string or array
|
||||||
Proxy string // 存储 proxy_rewrite,用于设置代理
|
Proxy string // 存储 proxy_rewrite,用于设置代理
|
||||||
@ -60,6 +61,7 @@ func Parse() {
|
|||||||
flag.StringVar(&LittleWD, "w", "", "cover the working directory")
|
flag.StringVar(&LittleWD, "w", "", "cover the working directory")
|
||||||
d := flag.Bool("D", false, "debug mode")
|
d := flag.Bool("D", false, "debug mode")
|
||||||
flag.BoolVar(&FastStart, "faststart", false, "skip waiting 5 seconds")
|
flag.BoolVar(&FastStart, "faststart", false, "skip waiting 5 seconds")
|
||||||
|
flag.StringVar(&SignServerOverwrite, "sign-server", "", "use special server to sign tlv")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *d {
|
if *d {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user