MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / GetNewDeviceVerifyURL

Method GetNewDeviceVerifyURL

client/client.go:229–270  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227}
228
229func (c *QQClient) GetNewDeviceVerifyURL() (string, error) {
230 if c.Sig().NewDeviceVerifyURL == "" {
231 return "", errors.New("no verify_url found")
232 }
233
234 queryParams := func() url.Values {
235 parsedURL, err := url.Parse(c.Sig().NewDeviceVerifyURL)
236 if err != nil {
237 return url.Values{}
238 }
239 return parsedURL.Query()
240 }()
241
242 request, _ := json.Marshal(&NTNewDeviceQrCodeRequest{
243 StrDevAuthToken: queryParams.Get("sig"),
244 Uint32Flag: 1,
245 Uint32UrlType: 0,
246 StrUinToken: queryParams.Get("uin-token"),
247 StrDevType: c.Version().OS,
248 StrDevName: c.Device().DeviceName,
249 })
250
251 resp, err := func() (*NTNewDeviceQrCodeResponse, error) {
252 resp, err := http.Post(fmt.Sprintf("https://oidb.tim.qq.com/v3/oidbinterface/oidb_0xc9e_8?uid=%d&getqrcode=1&sdkappid=39998&actype=2", c.Uin),
253 "application/json", bytes.NewReader(request))
254 if err != nil {
255 return nil, err
256 }
257 defer resp.Body.Close()
258 data, _ := io.ReadAll(resp.Body)
259 var response NTNewDeviceQrCodeResponse
260 err = json.Unmarshal(data, &response)
261 if err != nil {
262 return nil, err
263 }
264 return &response, nil
265 }()
266 if err != nil {
267 return "", err
268 }
269 return resp.StrURL, nil
270}
271
272func (c *QQClient) NewDeviceVerify(verifyURL string) error {
273 original := func() string {

Callers 1

mainFunction · 0.80

Calls 7

SigMethod · 0.95
VersionMethod · 0.95
DeviceMethod · 0.95
ReadAllMethod · 0.80
UnmarshalMethod · 0.80
MarshalMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected