diff --git a/lib/config.go b/lib/config.go index 2ec6ac9..a7e5553 100644 --- a/lib/config.go +++ b/lib/config.go @@ -12,6 +12,7 @@ type Config struct { Model int `json:"model" yaml:"model"` LogLevel string `json:"log_level" yaml:"log_level"` ShowBrowser bool `json:"show_browser" yaml:"show_browser"` + Scheme string `json:"scheme" yaml:"scheme"` Push struct { Ding struct { Enable bool `json:"enable" yaml:"enable"` diff --git a/lib/config_default.yml b/lib/config_default.yml index f783699..a85a9a9 100644 --- a/lib/config_default.yml +++ b/lib/config_default.yml @@ -17,6 +17,9 @@ log_level: "info" # 是否显示浏览器 show_browser: true +# 跳转学习强国的scheme,默认使用本仓库的action自建scheme,若需自行修改,可直接复制仓库下/docs/scheme.html到任意静态文件服务器 +scheme: "https://johlanse.github.io/study_xxqg/scheme.html?" + push: ding: diff --git a/lib/core.go b/lib/core.go index cfc6a98..7385522 100644 --- a/lib/core.go +++ b/lib/core.go @@ -171,18 +171,14 @@ func (c *Core) Login() ([]Cookie, error) { var result []byte buffer := bytes.NewBuffer(result) - //os.WriteFile("screen1.png", screen, 0666) - //_ = Clip(bytes.NewReader(screen), buffer, 0, 0, 525, 35, 755, 255, 0) _ = Clip(bytes.NewReader(screen), buffer, 0, 0, 529, 70, 748, 284, 0) c.Push("markdown", fmt.Sprintf("![screenshot](%v) \n>点开查看登录二维码\n>请在五分钟内完成扫码", "data:image/png;base64,"+base64.StdEncoding.EncodeToString(buffer.Bytes()))) c.Push("image", base64.StdEncoding.EncodeToString(buffer.Bytes())) - //os.WriteFile("screen.png", buffer.Bytes(), 0666) matrix := GetPaymentStr(bytes.NewReader(buffer.Bytes())) log.Debugln("已获取到二维码内容:" + matrix.GetText()) - c.Push("text", "https://techxuexi.js.org/jump/techxuexi-20211023.html?"+url.QueryEscape(matrix.GetText())) - c.Push("text", matrix.GetText()) + c.Push("text", GetConfig().Scheme+url.QueryEscape(matrix.GetText())) qrcodeTerminal.New2(qrcodeTerminal.ConsoleColors.BrightBlack, qrcodeTerminal.ConsoleColors.BrightWhite, qrcodeTerminal.QRCodeRecoveryLevels.Low).Get(matrix.GetText()).Print() _, err = page.WaitForNavigation(playwright.PageWaitForNavigationOptions{