1+ import random
2+
13from lagrange .info import AppInfo , DeviceInfo
4+ from lagrange .pb .message .msg_push import MsgPushBody
25from lagrange .utils .binary .protobuf import proto_field , ProtoStruct
36
47
8+ # trpc.qq_new_tech.status_svc.StatusService.Register
59class _DeviceInfo (ProtoStruct ):
610 device_name : str = proto_field (1 )
711 vendor_os : str = proto_field (2 )
@@ -12,9 +16,9 @@ class _DeviceInfo(ProtoStruct):
1216
1317class PBRegisterRequest (ProtoStruct ):
1418 guid : str = proto_field (1 )
15- field_2 : int = proto_field (2 , default = 0 )
19+ kick_pc : int = proto_field (2 , default = 0 ) # ?
1620 current_version : str = proto_field (3 )
17- field_4 : int = proto_field (4 , default = 0 )
21+ field_4 : int = proto_field (4 , default = 0 ) # IsFirstRegisterProxyOnline
1822 locale_id : int = proto_field (5 , default = 2052 )
1923 device_info : _DeviceInfo = proto_field (6 )
2024 set_mute : int = proto_field (7 , default = 0 ) # ?
@@ -38,3 +42,80 @@ def build(cls, app: AppInfo, device: DeviceInfo) -> "PBRegisterRequest":
3842class PBRegisterResponse (ProtoStruct ):
3943 message : str = proto_field (2 )
4044 timestamp : int = proto_field (3 )
45+
46+
47+ # trpc.msg.register_proxy.RegisterProxy.SsoInfoSync
48+ class C2cMsgCookie (ProtoStruct ):
49+ last_msg_time : int = proto_field (1 )
50+
51+
52+ class SsoC2cInfo (ProtoStruct ):
53+ msg_cookie : C2cMsgCookie = proto_field (1 )
54+ last_msg_time : int = proto_field (2 )
55+ last_msg_cookie : C2cMsgCookie = proto_field (3 )
56+
57+ @classmethod
58+ def build (cls , last_msg_time = 0 ) -> "SsoC2cInfo" :
59+ return cls (
60+ msg_cookie = C2cMsgCookie (last_msg_time = last_msg_time ),
61+ last_msg_cookie = C2cMsgCookie (last_msg_time = last_msg_time ),
62+ last_msg_time = last_msg_time ,
63+ )
64+
65+
66+ class NormalCfg (ProtoStruct ):
67+ int_cfg : dict = proto_field (1 , default = None ) # dict[int, int]
68+
69+
70+ class CurrentAppState (ProtoStruct ):
71+ is_delay_request : bool = proto_field (1 )
72+ app_state : int = proto_field (2 )
73+ silence_state : int = proto_field (3 )
74+
75+ @classmethod
76+ def build (cls ) -> "CurrentAppState" :
77+ return cls (
78+ is_delay_request = False ,
79+ app_state = 0 ,
80+ silence_state = 0 ,
81+ )
82+
83+
84+ class UnknownInfo (ProtoStruct ):
85+ grp_code : int = proto_field (1 , default = 0 )
86+ f2 : int = proto_field (2 , default = 2 )
87+
88+
89+ class PBSsoInfoSyncRequest (ProtoStruct ):
90+ sync_flag : int = proto_field (1 )
91+ req_rand : int = proto_field (2 )
92+ current_active_stats : int = proto_field (4 )
93+ grp_last_msg_time : int = proto_field (5 )
94+ c2c_info : SsoC2cInfo = proto_field (6 )
95+ normal_cfg : NormalCfg = proto_field (8 )
96+ register_info : PBRegisterRequest = proto_field (9 )
97+ unknown_f10 : UnknownInfo = proto_field (10 )
98+ app_state : CurrentAppState = proto_field (11 )
99+
100+ @classmethod
101+ def build (cls , app : AppInfo , device : DeviceInfo ) -> "PBSsoInfoSyncRequest" :
102+ return cls (
103+ sync_flag = 735 ,
104+ req_rand = random .randint (114 , 514 ), # ?
105+ current_active_stats = 2 ,
106+ grp_last_msg_time = 0 ,
107+ c2c_info = SsoC2cInfo .build (),
108+ normal_cfg = NormalCfg (int_cfg = dict ()),
109+ register_info = PBRegisterRequest .build (app , device ),
110+ unknown_f10 = UnknownInfo (),
111+ app_state = CurrentAppState .build ()
112+ )
113+
114+
115+ class PBSsoInfoSyncResponse (ProtoStruct ):
116+ # f3: int = proto_field(3)
117+ # f4: int = proto_field(4)
118+ # f6: int = proto_field(6)
119+ reg_rsp : PBRegisterResponse = proto_field (7 )
120+ # f9: int = proto_field(9)
121+
0 commit comments