EnsureConnection
All checks were successful
Gitea Go Release Actions / Release Go Binary (amd64, darwin) (push) Successful in 1m4s
Gitea Go Release Actions / Release Go Binary (amd64, linux) (push) Successful in 1m14s
Gitea Go Release Actions / Release Go Binary (amd64, windows) (push) Successful in 1m11s
Gitea Go Release Actions / Release Go Binary (arm, linux) (push) Successful in 59s
Gitea Go Release Actions / Release Go Binary (arm64, darwin) (push) Successful in 1m0s
Gitea Go Release Actions / Release Go Binary (arm64, linux) (push) Successful in 57s
Gitea Go Release Actions / Release Go Binary (loong64, linux) (push) Successful in 57s
Gitea Go Release Actions / Release Go Binary (mips, linux) (push) Successful in 57s
Gitea Go Release Actions / Release Go Binary (riscv64, linux) (push) Successful in 52s

This commit is contained in:
yzqzss 2024-06-28 06:12:43 +08:00
parent 529d4dd692
commit 4a975ad74d
2 changed files with 29 additions and 0 deletions

View File

@ -175,6 +175,8 @@ func main() {
go InterruptHandler()
go ShowStatus(tracker)
huashijie_api.EnsureConnection(*tracker.HTTP_client)
Logger.Println("-- Start --")
for i := 0; i < BASE_CONCURRENCY; i++ {

View File

@ -5,6 +5,7 @@ import (
"io"
"math/rand"
"net/http"
"strings"
)
var XIAOMI_MODELS = []string{
@ -21,6 +22,32 @@ var XIAOMI_MODELS = []string{
"MDE5",
}
func EnsureConnection(client http.Client) {
// https://app.huashijie.art/api/update/checkUpdate
req, err := http.NewRequest("GET", "https://app.huashijie.art/api/update/checkUpdate", nil)
if err != nil {
panic(err)
}
req.Header.Add("Referer", "https://app.huashijie.art/")
req.Header.Add("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 9; MI 8 SE MIUI/V12.0.2.0.PEBCNXM)")
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
text := string(body)
fmt.Println(text)
if !strings.Contains(text, "update_ver_code") {
panic("NotImplementedError: " + text)
}
}
func GetWorkDetailResponse(client http.Client, work_id string) ([]byte, int) {
req, err := http.NewRequest("GET", "https://app.huashijie.art/api/work/detailV2", nil)
if err != nil {