summaryrefslogtreecommitdiff
path: root/danmaku
diff options
context:
space:
mode:
authorKeuin <[email protected]>2023-07-02 14:48:47 +0800
committerKeuin <[email protected]>2023-07-02 14:49:17 +0800
commitb6eb2c0da4e653c6fdd278bcbdcd55ec376cd481 (patch)
treebc0d58aedf6e8613d21351cd3cdfd8cd5b5999e2 /danmaku
parentb8d0d0c3b6b2ffe40921aa4c247c101dd0ce958d (diff)
Refactor: move RoomId type to the correct package. Type all room ID usages.
Diffstat (limited to 'danmaku')
-rw-r--r--danmaku/client.go4
-rw-r--r--danmaku/dmpkg/auth.go18
2 files changed, 11 insertions, 11 deletions
diff --git a/danmaku/client.go b/danmaku/client.go
index b785e23..c74a449 100644
--- a/danmaku/client.go
+++ b/danmaku/client.go
@@ -9,7 +9,7 @@ package danmaku
import (
"context"
"fmt"
- "github.com/keuin/slbr/common"
+ "github.com/keuin/slbr/bilibili"
"github.com/keuin/slbr/danmaku/dmpkg"
"nhooyr.io/websocket"
@@ -87,7 +87,7 @@ func (d *DanmakuClient) Disconnect() error {
return ws.Close(websocket.StatusInternalError, "disconnected")
}
-func (d *DanmakuClient) Authenticate(roomId common.RoomId, authKey string) error {
+func (d *DanmakuClient) Authenticate(roomId bilibili.RoomId, authKey string) error {
pkg := dmpkg.NewAuth(dmpkg.ProtoPlainJson, roomId, authKey)
data, err := pkg.Marshal()
if err != nil {
diff --git a/danmaku/dmpkg/auth.go b/danmaku/dmpkg/auth.go
index 5caf868..bb66f1d 100644
--- a/danmaku/dmpkg/auth.go
+++ b/danmaku/dmpkg/auth.go
@@ -8,23 +8,23 @@ package dmpkg
import (
"encoding/json"
"fmt"
- "github.com/keuin/slbr/common"
+ "github.com/keuin/slbr/bilibili"
)
type authInfo struct {
- UID uint64 `json:"uid"`
- RoomId uint64 `json:"roomid"`
- ProtoVer int `json:"protover"`
- Platform string `json:"platform"`
- Type int `json:"type"`
- Key string `json:"key"`
+ UID uint64 `json:"uid"`
+ RoomId bilibili.RoomId `json:"roomid"`
+ ProtoVer int `json:"protover"`
+ Platform string `json:"platform"`
+ Type int `json:"type"`
+ Key string `json:"key"`
}
// NewAuth creates a new authentication exchange.
-func NewAuth(protocol ProtocolVer, roomId common.RoomId, authKey string) (exc DanmakuExchange) {
+func NewAuth(protocol ProtocolVer, roomId bilibili.RoomId, authKey string) (exc DanmakuExchange) {
exc, _ = NewPlainExchange(OpConnect, authInfo{
UID: UidGuest,
- RoomId: uint64(roomId),
+ RoomId: roomId,
ProtoVer: int(protocol),
Platform: PlatformWeb,
Type: AuthTypeDefault,