对齐 WSS 流程并更新配置
This commit is contained in:
@@ -3,3 +3,4 @@
|
|||||||
/bin/
|
/bin/
|
||||||
/frontend/node_modules/
|
/frontend/node_modules/
|
||||||
*.test
|
*.test
|
||||||
|
build/
|
||||||
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>虎牙抢购助手</title>
|
<title>虎牙抢购助手</title>
|
||||||
<script type="module" crossorigin src="/assets/index-qimuTmHR.js"></script>
|
<script type="module" crossorigin src="/assets/index-BkTscxvR.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-traqBmYm.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-traqBmYm.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"composite": true,
|
"composite": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Bundler",
|
||||||
"allowSyntheticDefaultImports": true
|
"allowSyntheticDefaultImports": true
|
||||||
},
|
},
|
||||||
"include": ["vite.config.ts"]
|
"include": ["vite.config.ts"]
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ func (s *WSSSession) sendRegisterGroup(ctx context.Context) error {
|
|||||||
|
|
||||||
func (s *WSSSession) callWSLaunch(ctx context.Context) error {
|
func (s *WSSSession) callWSLaunch(ctx context.Context) error {
|
||||||
req := &wsLaunchReq{UID: s.uid, GUID: s.guid, UA: WSSInitUA}
|
req := &wsLaunchReq{UID: s.uid, GUID: s.guid, UA: WSSInitUA}
|
||||||
resp, err := s.callWUPWithRequestID(ctx, "launch", "wsLaunch", req, -1)
|
resp, err := s.callWUPWithRequestIDAndTrace(ctx, "launch", "wsLaunch", req, -1, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -428,6 +428,10 @@ func (s *WSSSession) callWUP(ctx context.Context, service, method string, reqStr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *WSSSession) callWUPWithRequestID(ctx context.Context, service, method string, reqStruct taf.Marshaler, requestID int32) (*wup.Response, error) {
|
func (s *WSSSession) callWUPWithRequestID(ctx context.Context, service, method string, reqStruct taf.Marshaler, requestID int32) (*wup.Response, error) {
|
||||||
|
return s.callWUPWithRequestIDAndTrace(ctx, service, method, reqStruct, requestID, NewWSSCommandTrace())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *WSSSession) callWUPWithRequestIDAndTrace(ctx context.Context, service, method string, reqStruct taf.Marshaler, requestID int32, traceID string) (*wup.Response, error) {
|
||||||
wupReq := wup.NewRequest(service, method, requestID)
|
wupReq := wup.NewRequest(service, method, requestID)
|
||||||
wupReq.Timeout = 0
|
wupReq.Timeout = 0
|
||||||
if err := wupReq.WriteStruct("tReq", reqStruct); err != nil {
|
if err := wupReq.WriteStruct("tReq", reqStruct); err != nil {
|
||||||
@@ -439,7 +443,7 @@ func (s *WSSSession) callWUPWithRequestID(ctx context.Context, service, method s
|
|||||||
}
|
}
|
||||||
ctx, cancel := s.withTimeout(ctx)
|
ctx, cancel := s.withTimeout(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
payload, err := EncodeWSSCommand(WSSCmdWupReq, data, NewWSSCommandTrace())
|
payload, err := EncodeWSSCommand(WSSCmdWupReq, data, traceID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"huya-go/internal/taf"
|
"huya-go/internal/taf"
|
||||||
@@ -81,3 +82,17 @@ func TestGenerateWSSBaseinfoMatchesBrowserShape(t *testing.T) {
|
|||||||
t.Fatalf("wss baseinfo should not carry cookie/trace: cookie=%q trace=%q", cookie, traceID)
|
t.Fatalf("wss baseinfo should not carry cookie/trace: cookie=%q trace=%q", cookie, traceID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewWSSCommandTraceMatchesBrowserShape(t *testing.T) {
|
||||||
|
trace := NewWSSCommandTrace()
|
||||||
|
parts := strings.Split(trace, ":")
|
||||||
|
if len(parts) != 4 {
|
||||||
|
t.Fatalf("trace parts = %v", parts)
|
||||||
|
}
|
||||||
|
if parts[0] == "" || parts[1] == "" || parts[0] != parts[1] {
|
||||||
|
t.Fatalf("unexpected trace prefix: %q", trace)
|
||||||
|
}
|
||||||
|
if parts[2] != "0" || parts[3] != "0" {
|
||||||
|
t.Fatalf("trace suffix = %q, want :0:0", trace)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const (
|
|||||||
WSSCmdS2CRpcRspRsp int32 = 42
|
WSSCmdS2CRpcRspRsp int32 = 42
|
||||||
WSSCmdSignalUpgradeReq int32 = 105
|
WSSCmdSignalUpgradeReq int32 = 105
|
||||||
WSSCmdSignalUpgradeRsp int32 = 106
|
WSSCmdSignalUpgradeRsp int32 = 106
|
||||||
defaultWSSTraceEnableValue = 3
|
defaultWSSTraceEnableValue = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
// WSSCommand 是浏览器 JS 里的 HUYA.WebSocketCommand。
|
// WSSCommand 是浏览器 JS 里的 HUYA.WebSocketCommand。
|
||||||
|
|||||||
Reference in New Issue
Block a user