From bc4e9f3c9589597d4afcfb4537660e03ff58b110 Mon Sep 17 00:00:00 2001
From: wdvxdr
Date: Fri, 18 Mar 2022 21:14:45 +0800
Subject: [PATCH] client: delete GetVipInfo
This api is broken.
---
client/http_api.go | 46 ----------------------------------
client/internal/highway/bdh.go | 11 +++++---
2 files changed, 7 insertions(+), 50 deletions(-)
diff --git a/client/http_api.go b/client/http_api.go
index 3d37f998..35ae0b63 100644
--- a/client/http_api.go
+++ b/client/http_api.go
@@ -11,7 +11,6 @@ import (
"net/textproto"
"net/url"
"strconv"
- "strings"
"github.com/pkg/errors"
@@ -21,51 +20,6 @@ import (
"github.com/Mrs4s/MiraiGo/utils"
)
-/* -------- VipInfo -------- */
-
-type VipInfo struct {
- Uin int64
- Name string
- Level int
- LevelSpeed float64
- VipLevel string
- VipGrowthSpeed int
- VipGrowthTotal int
-}
-
-func (c *QQClient) GetVipInfo(target int64) (*VipInfo, error) {
- b, err := utils.HttpGetBytes(fmt.Sprintf("https://h5.vip.qq.com/p/mc/cardv2/other?platform=1&qq=%d&adtag=geren&aid=mvip.pingtai.mobileqq.androidziliaoka.fromqita", target), c.getCookiesWithDomain("h5.vip.qq.com"))
- if err != nil {
- return nil, err
- }
- ret := VipInfo{Uin: target}
- b = b[bytes.Index(b, []byte(``))+24:]
- t := b[:bytes.Index(b, []byte(``))]
- ret.Name = string(t)
- b = b[bytes.Index(b, []byte(`LV`))+17:]
- t = b[:bytes.Index(b, []byte(`
`))]
- ret.Level, _ = strconv.Atoi(string(t))
- b = b[bytes.Index(b, []byte(``))+35:]
- b = b[bytes.Index(b, []byte(`
`))+3:]
- t = b[:bytes.Index(b, []byte(`倍`))]
- ret.LevelSpeed, _ = strconv.ParseFloat(string(t), 64)
- b = b[bytes.Index(b, []byte(``))+35:]
- b = b[bytes.Index(b, []byte(`
`))+3:]
- st := string(b[:bytes.Index(b, []byte(`
`))])
- st = strings.Replace(st, "
", "", 1)
- st = strings.Replace(st, "", "", 1)
- ret.VipLevel = st
- b = b[bytes.Index(b, []byte(`
`))+35:]
- b = b[bytes.Index(b, []byte(`
`))+3:]
- t = b[:bytes.Index(b, []byte(`
`))]
- ret.VipGrowthSpeed, _ = strconv.Atoi(string(t))
- b = b[bytes.Index(b, []byte(`
`))+35:]
- b = b[bytes.Index(b, []byte(`
`))+3:]
- t = b[:bytes.Index(b, []byte(`
`))]
- ret.VipGrowthTotal, _ = strconv.Atoi(string(t))
- return &ret, nil
-}
-
/* -------- GroupHonorInfo -------- */
type (
diff --git a/client/internal/highway/bdh.go b/client/internal/highway/bdh.go
index 3b1e8fc6..97d571f3 100644
--- a/client/internal/highway/bdh.go
+++ b/client/internal/highway/bdh.go
@@ -57,11 +57,14 @@ func (s *Session) UploadBDH(input BdhInput) ([]byte, error) {
}
const chunkSize = 256 * 1024
- var rspExt []byte
+ var rspExt, chunk []byte
offset := 0
- chunk := make([]byte, chunkSize)
+ if input.Size > chunkSize {
+ chunk = make([]byte, chunkSize)
+ } else {
+ chunk = make([]byte, input.Size)
+ }
for {
- chunk = chunk[:chunkSize]
rl, err := io.ReadFull(input.Body, chunk)
if errors.Is(err, io.EOF) {
break
@@ -121,7 +124,7 @@ func (s *Session) UploadBDHMultiThread(input BdhInput, threadCount int) ([]byte,
return nil, err
}
- const blockSize int64 = 1024 * 512
+ const blockSize int64 = 256 * 1024
var (
rspExt []byte
completedThread uint32