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()
|
||||||
|
@ -37,6 +37,7 @@ var (
|
|||||||
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