File size: 714 Bytes
d669ddb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package common

import (
	"encoding/json"

	"github.com/Harry-zklcdc/bing-lib/lib/base58"
	"github.com/Harry-zklcdc/bing-lib/lib/request"
)

type tokenRespStruct struct {
	T  string `json:"T"`
	TP []int  `json:"TP"`
}

func init() {
	c := request.NewRequest()
	c.SetUrl(BypassServer + "/gettoken").Do()

	resp := tokenRespStruct{}
	err := json.Unmarshal(c.GetBody(), &resp)
	if err != nil {
		return
	}

	T = resp.T
	TP = resp.TP

	tmpR := []rune{}
	for i := 0; i < len(TP); i++ {
		tmpR = append(tmpR, rune(T[TP[i]]))
	}

	if base58.Decoding(string(tmpR)) != AUTHOR {
		SB = true
	}
}

func IsInArray(arr []string, str string) bool {
	for _, v := range arr {
		if v == str {
			return true
		}
	}
	return false
}