common

package
v1.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent = "Mozilla/5.0 (Linux; Android 13; 22011211C Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/104.0.5112.97 Mobile Safari/537.36 miHoYoBBS/" + AppVersion

	RefererApp = "https://app.mihoyo.com"
	RefererAct = "https://act.mihoyo.com"

	AppVersion    = "2.81.1"
	AppIdMiyoushe = "bll8iq97cem8" // 米游社
)
View Source
const (
	RetCodeQRCodeExpired           = -106  // 二维码过期
	RetCodeSendPhoneCodeFrequently = -3101 // 发送验证码频率过快
	RetCodeGameHasSigned           = -5003 // 已签到
	RetCodeForumHasSigned          = 1008  // 打卡失败或重复打卡
	RetCodeForumNeedVerification   = 1034  // 需要验证码
)
View Source
const (
	GameIdBH3 = "1" // 崩坏3
	GameIdYS  = "2" // 原神
	GameIdBH2 = "3" // 崩坏学园2
	GameIdWD  = "4" // 未定事件簿
	GameIdDBY = "5" // 大别野
	GameIdSR  = "6" // 崩坏:星穹铁道
	GameIdZZZ = "8" // 绝区零

	GameNameBH3 = "bh3"
	GameNameYS  = "hk4e"
	GameNameBH2 = "bh2"
	GameNameWD  = "nxx"
	GameNameDBY = "plat"
	GameNameSR  = "hkrpg"
	GameNameZZZ = "nap"

	GameBizBH3CN = GameNameBH3 + "_" + cn
	GameBizYSCN  = GameNameYS + "_" + cn
	GameBizBH2CN = GameNameBH2 + "_" + cn
	GameBizWDCN  = GameNameWD + "_" + cn
	GameBizSRCN  = GameNameSR + "_" + cn
	GameBizZZZCN = GameNameZZZ + "_" + cn

	ForumIdSR = "53"

	XRpcSignGame = "x-rpc-signgame"
)
View Source
const (
	// AppSaltK2 https://blog.starudream.cn/2023/11/09/miyoushe-salt-2.62.2/
	AppSaltK2 = "QVu5OdwEWxkq9ygpYBgDprR5tI471HWQ" // 2.81.1
	// AppSalt6X https://github.com/UIGF-org/mihoyo-api-collect/issues/1
	AppSalt6X = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v"
)

Variables

This section is empty.

Functions

func CToken

func CToken(account config.Account) []*http.Cookie

CToken generate base cookie_token auth cookies

func Exec

func Exec[T any](r *resty.Request, method, url string, ds ...int) (t T, _ error)

func GetAigisData added in v1.4.0

func GetAigisData(err error) (*Aigis, *AigisData)

func GetHeaders added in v1.4.0

func GetHeaders(err error) http.Header

func IsRetCode

func IsRetCode(err error, rc int) bool

func R

func R(vs ...any) *resty.Request

func RSAEncrypt added in v1.4.0

func RSAEncrypt(content string) string

func SToken

func SToken(account config.Account) []*http.Cookie

SToken generate base stoken auth cookies

Types

type Aigis added in v1.4.0

type Aigis struct {
	SessionId string `json:"session_id"`
	MmtType   int    `json:"mmt_type"`
	Data      string `json:"data"`
}

type AigisData added in v1.4.0

type AigisData struct {
	Challenge  string `json:"challenge"`
	Gt         string `json:"gt"`
	NewCaptcha int    `json:"new_captcha"`
	Success    int    `json:"success"`
}

type BaseResp

type BaseResp[T any] struct {
	RetCode *int   `json:"retcode"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

func (*BaseResp[T]) GetRetCode

func (t *BaseResp[T]) GetRetCode() int

func (*BaseResp[T]) IsSuccess

func (t *BaseResp[T]) IsSuccess() bool

func (*BaseResp[T]) String

func (t *BaseResp[T]) String() string

type Verification

type Verification struct {
	Challenge string `json:"challenge"`
	Validate  string `json:"validate"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL