karin-plugin-mys-core 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +1 -1
  2. package/lib/apps/MiHoYoLogin.js +6 -38
  3. package/lib/apps/MysDevice.js +5 -37
  4. package/lib/apps/UIDManage.js +6 -38
  5. package/lib/{chunk-JT3SU5UU.js → chunk-A5FZEOIN.js} +78 -6
  6. package/lib/{chunk-4BTKE3LO.js → chunk-HTL64YH2.js} +300 -178
  7. package/lib/chunk-IASM5MM5.js +639 -0
  8. package/lib/{chunk-5DXIT7UB.js → chunk-RX4VMVAI.js} +0 -5
  9. package/lib/{chunk-MQ52BX7O.js → chunk-SZHK7OGF.js} +9 -13
  10. package/lib/chunk-UIPRZFST.js +184 -0
  11. package/lib/exports/config/index.d.ts +56 -1
  12. package/lib/exports/config/index.js +3 -9
  13. package/lib/exports/database/index.d.ts +78 -12
  14. package/lib/exports/database/index.js +12 -40
  15. package/lib/exports/mys/index.d.ts +379 -14
  16. package/lib/exports/mys/index.js +9 -43
  17. package/lib/exports/render/index.d.ts +38 -4
  18. package/lib/exports/render/index.js +3 -8
  19. package/lib/exports/utils/index.d.ts +45 -2
  20. package/lib/exports/utils/index.js +1 -4
  21. package/lib/{exports/database/types/dbs/base.d.ts → mysUserInfo-BsyEENbc.d.ts} +60 -1
  22. package/package.json +1 -1
  23. package/resources/image/frame-logo.webp +0 -0
  24. package/resources/image/launcher-icon//345/216/237/347/245/236.webp +0 -0
  25. package/resources/image/launcher-icon//345/264/251/345/235/2173.webp +0 -0
  26. package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.webp +0 -0
  27. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/345/233/240/347/274/230/347/262/276/347/201/265.webp +0 -0
  28. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/346/230/237/347/251/271/351/223/201/351/201/223.webp +0 -0
  29. package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.webp +0 -0
  30. package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.webp +0 -0
  31. package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.webp +0 -0
  32. package/resources/image/mys-core-logo.webp +0 -0
  33. package/resources/image/mys-logo.webp +0 -0
  34. package/resources/styles/karin-plugin-mys-core.css +4 -4
  35. package/lib/chunk-2BVJS5VE.js +0 -49
  36. package/lib/chunk-3ERB3ILC.js +0 -0
  37. package/lib/chunk-3JN5WYUN.js +0 -135
  38. package/lib/chunk-7KEG6SDX.js +0 -0
  39. package/lib/chunk-7VAWV6ZE.js +0 -0
  40. package/lib/chunk-ARLTXJFJ.js +0 -0
  41. package/lib/chunk-CFS2WFOO.js +0 -0
  42. package/lib/chunk-DMJ5OQR6.js +0 -73
  43. package/lib/chunk-EDNBKOMS.js +0 -30
  44. package/lib/chunk-FBWSEBAW.js +0 -0
  45. package/lib/chunk-FOAQZIZ2.js +0 -0
  46. package/lib/chunk-G5W5WAY5.js +0 -64
  47. package/lib/chunk-G7TMVDGP.js +0 -68
  48. package/lib/chunk-HJ6HX5HB.js +0 -29
  49. package/lib/chunk-I7XZONDN.js +0 -13
  50. package/lib/chunk-JRH4JC43.js +0 -0
  51. package/lib/chunk-JVJQKRJ4.js +0 -89
  52. package/lib/chunk-K5U2O3HH.js +0 -0
  53. package/lib/chunk-KQVWWGRH.js +0 -31
  54. package/lib/chunk-LBLGKL3W.js +0 -77
  55. package/lib/chunk-LJSDSOY6.js +0 -0
  56. package/lib/chunk-LYTNREAI.js +0 -0
  57. package/lib/chunk-MPZP23EX.js +0 -219
  58. package/lib/chunk-MWYDWDR4.js +0 -0
  59. package/lib/chunk-PMFOX5HA.js +0 -80
  60. package/lib/chunk-PYTECG57.js +0 -0
  61. package/lib/chunk-SEWEEPJN.js +0 -0
  62. package/lib/chunk-SHW6FHIB.js +0 -10
  63. package/lib/chunk-T7W4DXRM.js +0 -0
  64. package/lib/chunk-TTN7NFCA.js +0 -109
  65. package/lib/chunk-W4DBT7AD.js +0 -0
  66. package/lib/chunk-WCX7WZAQ.js +0 -0
  67. package/lib/chunk-Z5I6A73Y.js +0 -0
  68. package/lib/chunk-ZTOR2DXG.js +0 -38
  69. package/lib/common-BlI5Gsw_.d.ts +0 -35
  70. package/lib/define-B9r20dK6.d.ts +0 -130
  71. package/lib/exports/config/array.d.ts +0 -1
  72. package/lib/exports/config/array.js +0 -7
  73. package/lib/exports/config/config.d.ts +0 -56
  74. package/lib/exports/config/config.js +0 -12
  75. package/lib/exports/database/database.d.ts +0 -30
  76. package/lib/exports/database/database.js +0 -22
  77. package/lib/exports/database/dbs/base.d.ts +0 -25
  78. package/lib/exports/database/dbs/base.js +0 -19
  79. package/lib/exports/database/dbs/index.d.ts +0 -4
  80. package/lib/exports/database/dbs/index.js +0 -29
  81. package/lib/exports/database/dbs/sqlite3.d.ts +0 -27
  82. package/lib/exports/database/dbs/sqlite3.js +0 -23
  83. package/lib/exports/database/dbs/table.d.ts +0 -20
  84. package/lib/exports/database/dbs/table.js +0 -25
  85. package/lib/exports/database/tables/index.d.ts +0 -9
  86. package/lib/exports/database/tables/index.js +0 -40
  87. package/lib/exports/database/tables/mysAccountInfo.d.ts +0 -9
  88. package/lib/exports/database/tables/mysAccountInfo.js +0 -27
  89. package/lib/exports/database/tables/mysDeviceInfo.d.ts +0 -9
  90. package/lib/exports/database/tables/mysDeviceInfo.js +0 -27
  91. package/lib/exports/database/tables/mysUserInfo.d.ts +0 -9
  92. package/lib/exports/database/tables/mysUserInfo.js +0 -27
  93. package/lib/exports/database/types/database.d.ts +0 -6
  94. package/lib/exports/database/types/database.js +0 -1
  95. package/lib/exports/database/types/dbs/base.js +0 -11
  96. package/lib/exports/database/types/dbs/index.d.ts +0 -2
  97. package/lib/exports/database/types/dbs/index.js +0 -12
  98. package/lib/exports/database/types/index.d.ts +0 -6
  99. package/lib/exports/database/types/index.js +0 -24
  100. package/lib/exports/database/types/tables/index.d.ts +0 -5
  101. package/lib/exports/database/types/tables/index.js +0 -13
  102. package/lib/exports/database/types/tables/mysAccountInfo.d.ts +0 -14
  103. package/lib/exports/database/types/tables/mysAccountInfo.js +0 -7
  104. package/lib/exports/database/types/tables/mysDeviceInfo.d.ts +0 -19
  105. package/lib/exports/database/types/tables/mysDeviceInfo.js +0 -1
  106. package/lib/exports/database/types/tables/mysUserInfo.d.ts +0 -32
  107. package/lib/exports/database/types/tables/mysUserInfo.js +0 -7
  108. package/lib/exports/mys/api/apis.d.ts +0 -82
  109. package/lib/exports/mys/api/apis.js +0 -56
  110. package/lib/exports/mys/api/app.d.ts +0 -60
  111. package/lib/exports/mys/api/app.js +0 -32
  112. package/lib/exports/mys/api/define.d.ts +0 -6
  113. package/lib/exports/mys/api/define.js +0 -42
  114. package/lib/exports/mys/api/index.d.ts +0 -11
  115. package/lib/exports/mys/api/index.js +0 -63
  116. package/lib/exports/mys/types/api/define.d.ts +0 -6
  117. package/lib/exports/mys/types/api/define.js +0 -1
  118. package/lib/exports/mys/types/api/index.d.ts +0 -6
  119. package/lib/exports/mys/types/api/index.js +0 -2
  120. package/lib/exports/mys/types/index.d.ts +0 -12
  121. package/lib/exports/mys/types/index.js +0 -6
  122. package/lib/exports/mys/types/user/game.d.ts +0 -23
  123. package/lib/exports/mys/types/user/game.js +0 -1
  124. package/lib/exports/mys/types/user/index.d.ts +0 -12
  125. package/lib/exports/mys/types/user/index.js +0 -3
  126. package/lib/exports/mys/types/user/userInfo.d.ts +0 -42
  127. package/lib/exports/mys/types/user/userInfo.js +0 -1
  128. package/lib/exports/mys/user/deviceInfo.d.ts +0 -11
  129. package/lib/exports/mys/user/deviceInfo.js +0 -30
  130. package/lib/exports/mys/user/game.d.ts +0 -40
  131. package/lib/exports/mys/user/game.js +0 -9
  132. package/lib/exports/mys/user/index.d.ts +0 -14
  133. package/lib/exports/mys/user/index.js +0 -52
  134. package/lib/exports/mys/user/userInfo.d.ts +0 -53
  135. package/lib/exports/mys/user/userInfo.js +0 -44
  136. package/lib/exports/render/render.d.ts +0 -38
  137. package/lib/exports/render/render.js +0 -12
  138. package/lib/exports/utils/common.d.ts +0 -1
  139. package/lib/exports/utils/common.js +0 -15
  140. package/lib/exports/utils/types/common.d.ts +0 -11
  141. package/lib/exports/utils/types/common.js +0 -1
  142. package/lib/exports/utils/types/index.d.ts +0 -1
  143. package/lib/exports/utils/types/index.js +0 -2
  144. package/resources/image/frame-logo.png +0 -0
  145. package/resources/image/launcher-icon//345/216/237/347/245/236.png +0 -0
  146. package/resources/image/launcher-icon//345/264/251/345/235/2173.png +0 -0
  147. package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.png +0 -0
  148. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/345/233/240/347/274/230/347/262/276/347/201/265.png +0 -0
  149. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/346/230/237/347/251/271/351/223/201/351/201/223.png +0 -0
  150. package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.png +0 -0
  151. package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.png +0 -0
  152. package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.png +0 -0
  153. package/resources/image/mys-core-logo.png +0 -0
  154. package/resources/image/mys-logo.png +0 -0
@@ -1,34 +1,80 @@
1
1
  import {
2
- MysGame
3
- } from "./chunk-2BVJS5VE.js";
4
- import {
5
- MysApp,
6
- MysHosts
7
- } from "./chunk-G5W5WAY5.js";
8
- import {
9
- DeviceInfo
10
- } from "./chunk-KQVWWGRH.js";
11
- import {
12
- MysAccountInfoDB
13
- } from "./chunk-EDNBKOMS.js";
14
- import {
15
- MysDeviceInfoDB
16
- } from "./chunk-ZTOR2DXG.js";
17
- import {
2
+ MysAccountInfoDB,
3
+ MysDeviceInfoDB,
18
4
  MysUserInfoDB
19
- } from "./chunk-HJ6HX5HB.js";
5
+ } from "./chunk-IASM5MM5.js";
20
6
  import {
21
7
  dir
22
8
  } from "./chunk-SHLPPEAY.js";
23
9
  import {
24
10
  Config
25
- } from "./chunk-TTN7NFCA.js";
11
+ } from "./chunk-UIPRZFST.js";
26
12
  import {
27
13
  common_exports
28
- } from "./chunk-5DXIT7UB.js";
14
+ } from "./chunk-RX4VMVAI.js";
29
15
 
30
16
  // src/exports/mys/api/apis.ts
31
- import lodash from "node-karin/lodash";
17
+ import lodash2 from "node-karin/lodash";
18
+
19
+ // src/exports/mys/api/app.ts
20
+ var version = { cn: "2.70.1", os: "1.5.0" };
21
+ var appId = 2;
22
+ var salt = {
23
+ os: "6cqshh5dhw73bzxn20oexa9k516chk7s",
24
+ "4X": "xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs",
25
+ "6X": "t0qEgfub6cvueAPgR5m9aQWWVciEer7v",
26
+ K2: "S9Hrn38d2b55PamfIR9BNA3Tx9sQTOem",
27
+ LK2: "sjdNFJB7XxyDWGIAk0eTV8AOCfMJmyEo",
28
+ PROD: "JwYDpKvLj6MrMqqYU6jTKF17KNO2PXoS"
29
+ };
30
+ var MysApp = Object.freeze({
31
+ version,
32
+ appId,
33
+ salt
34
+ });
35
+ var MysHosts = Object.freeze({
36
+ bbs: {
37
+ ["mihoyo" /* cn */]: "https://bbs-api.miyoushe.com/",
38
+ ["hoyolab" /* os */]: "https://bbs-api-os.mihoyo.com/"
39
+ },
40
+ web: {
41
+ ["mihoyo" /* cn */]: "https://api-takumi.mihoyo.com/",
42
+ ["hoyolab" /* os */]: "https://api-os-takumi.mihoyo.com/",
43
+ /** new web host */
44
+ miyoushe: "https://api-takumi.miyoushe.com/"
45
+ },
46
+ static: "https://api-takumi-static.mihoyo.com/",
47
+ record: {
48
+ ["mihoyo" /* cn */]: "https://api-takumi-record.mihoyo.com/",
49
+ ["hoyolab" /* os */]: "https://bbs-api-os.mihoyo.com/"
50
+ },
51
+ hk4e: {
52
+ ["mihoyo" /* cn */]: "https://hk4e-api.mihoyo.com/",
53
+ ["hoyolab" /* os */]: "https://hk4e-api-os.hoyoverse.com/"
54
+ },
55
+ hk4eGacha: "https://public-operation-hk4e.mihoyo.com/",
56
+ hk4eSdk: "https://hk4e-sdk.mihoyo.com/",
57
+ napGacha: {
58
+ ["mihoyo" /* cn */]: "https://public-operation-nap.mihoyo.com/",
59
+ ["hoyolab" /* os */]: "https://public-operation-nap-sg.hoyoverse.com/"
60
+ },
61
+ publicData: {
62
+ ["mihoyo" /* cn */]: "https://public-data-api.mihoyo.com/",
63
+ ["hoyolab" /* os */]: "https://sg-public-data-api.hoyoverse.com/"
64
+ },
65
+ napAct: {
66
+ ["mihoyo" /* cn */]: "https://act-nap-api.mihoyo.com/",
67
+ ["hoyolab" /* os */]: "https://sg-act-nap-api.mihoyo.com/"
68
+ },
69
+ passport: "https://passport-api.mihoyo.com/",
70
+ hk4eSg: {
71
+ ["hoyolab" /* os */]: "https://sg-hk4e-api.hoyolab.com/"
72
+ },
73
+ publicSg: {
74
+ ["hoyolab" /* os */]: "https://sg-public-api.hoyolab.com/",
75
+ hoyoverse: "https://sg-public-api.hoyoverse.com/"
76
+ }
77
+ });
32
78
 
33
79
  // src/core/config/device.ts
34
80
  var DefaultDevice = {
@@ -42,9 +88,234 @@ var DefaultDevice = {
42
88
  var DeviceCfg = new Config(`${dir.name}:device`, dir.ConfigDir, DefaultDevice, {}).watch();
43
89
 
44
90
  // src/exports/mys/api/define.ts
45
- import md5 from "md5";
91
+ import md52 from "md5";
46
92
  import { logger, redis } from "node-karin";
47
93
  import axios, { AxiosHeaders } from "node-karin/axios";
94
+
95
+ // src/exports/mys/user/deviceInfo.ts
96
+ import md5 from "md5";
97
+ var DeviceInfo = class {
98
+ static async get(Md5) {
99
+ return await (await MysDeviceInfoDB()).findByPk(Md5);
100
+ }
101
+ static async create(userId, deviceInfo) {
102
+ const deviceMd5 = md5([
103
+ userId,
104
+ deviceInfo.deviceId || "",
105
+ deviceInfo.name || "",
106
+ deviceInfo.board || "",
107
+ deviceInfo.model || "",
108
+ deviceInfo.oaid || "",
109
+ deviceInfo.version || "",
110
+ deviceInfo.fingerprint || "",
111
+ deviceInfo.product || ""
112
+ ].join("_"));
113
+ const MysDeviceInfo = await (await MysDeviceInfoDB()).findByPk(deviceMd5, true);
114
+ await MysDeviceInfo.save(deviceInfo);
115
+ return deviceMd5;
116
+ }
117
+ };
118
+
119
+ // src/exports/mys/user/game.ts
120
+ var MysGame = new class MysGame2 {
121
+ #games = /* @__PURE__ */ new Map();
122
+ get num() {
123
+ return this.#games.size;
124
+ }
125
+ match(prefix) {
126
+ if (!prefix || this.#games.size === 0) return void 0;
127
+ for (const Game of this.#games.values()) {
128
+ if (Game.prefix.test(prefix)) return Game;
129
+ }
130
+ return void 0;
131
+ }
132
+ RegisterGame(Game) {
133
+ this.#games.set(Game.columnKey, Game);
134
+ }
135
+ async forEachGame(fn) {
136
+ if (this.num === 0) return;
137
+ for (const Game of this.#games.values()) {
138
+ if (await fn(Game) === "break") break;
139
+ }
140
+ }
141
+ }();
142
+ var RegisterGameBase = class {
143
+ game;
144
+ columnKey;
145
+ /** @description 游戏名称 */
146
+ name;
147
+ /** @description 指令前缀 */
148
+ prefixs;
149
+ refresh;
150
+ UserInfo;
151
+ constructor(game, name, prefixs, userInfo, refreshFuc) {
152
+ this.game = game;
153
+ this.columnKey = `${game}-uids`;
154
+ this.name = name;
155
+ this.prefixs = prefixs;
156
+ this.UserInfo = userInfo;
157
+ this.refresh = refreshFuc;
158
+ }
159
+ get prefix() {
160
+ return new RegExp(`^(${this.prefixs.join("|")})$`, "i");
161
+ }
162
+ };
163
+
164
+ // src/exports/mys/user/userInfo.ts
165
+ import lodash from "node-karin/lodash";
166
+ var BaseUserInfo = class {
167
+ userId;
168
+ ltuidMap = /* @__PURE__ */ new Map();
169
+ constructor(userId) {
170
+ this.userId = userId;
171
+ }
172
+ get ltuids() {
173
+ return this.UserInfo.ltuids;
174
+ }
175
+ get stuids() {
176
+ return this.UserInfo.stuids;
177
+ }
178
+ get deviceList() {
179
+ return this.UserInfo.deviceList;
180
+ }
181
+ get LtuidInfoList() {
182
+ return Array.from(this.ltuidMap.values()).map((info) => Object.freeze(info)).sort((a, b) => +a.ltuid - +b.ltuid);
183
+ }
184
+ async initMysAccountInfo(UserInfo2, initAll) {
185
+ this.UserInfo = UserInfo2;
186
+ this.ltuidMap.clear();
187
+ const idList = Array.from(/* @__PURE__ */ new Set([...UserInfo2.ltuids, ...UserInfo2.stuids]));
188
+ if (initAll) {
189
+ const MysAccountInfoList = await (await MysAccountInfoDB()).findAllByPks(idList);
190
+ MysAccountInfoList.forEach((MysAccountInfo) => {
191
+ this.ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
192
+ });
193
+ } else {
194
+ const self = this;
195
+ const mainLtuid = self.bind_uids?.[self.main_uid]?.ltuid;
196
+ if (mainLtuid) {
197
+ const MysAccountInfo = await (await MysAccountInfoDB()).findByPk(mainLtuid);
198
+ MysAccountInfo && this.ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
199
+ }
200
+ }
201
+ }
202
+ getLtuidInfo(ltuid) {
203
+ return Object.freeze(this.ltuidMap.get(ltuid));
204
+ }
205
+ async getDeviceInfoList() {
206
+ return await (await MysDeviceInfoDB()).findAllByPks(this.deviceList);
207
+ }
208
+ async saveUserInfo(data) {
209
+ await this.UserInfo.save(data);
210
+ }
211
+ async saveMysAccountInfo(ltuid, data) {
212
+ let MysAccountInfo = this.ltuidMap.get(ltuid);
213
+ if (!MysAccountInfo) {
214
+ MysAccountInfo = await (await MysAccountInfoDB()).findByPk(ltuid, true);
215
+ }
216
+ await MysAccountInfo.save(data);
217
+ this.ltuidMap.set(ltuid, { ...MysAccountInfo, ...data });
218
+ }
219
+ };
220
+ var UserInfo = class _UserInfo extends BaseUserInfo {
221
+ static async create(userId, initAll = false) {
222
+ const userInfo = new BaseUserInfo(userId);
223
+ userInfo.refresh = async () => {
224
+ const UserInfoData = await (await MysUserInfoDB()).findByPk(userId, true);
225
+ await userInfo.initMysAccountInfo(UserInfoData, initAll);
226
+ return userInfo;
227
+ };
228
+ return await userInfo.refresh();
229
+ }
230
+ static async refreshUid(options, perm) {
231
+ let message = "";
232
+ const uids = [];
233
+ if (MysGame.num > 0) {
234
+ const res = (await (await getUserGameRolesByCookie.initDevice(options)).request(null)).data;
235
+ if (res?.retcode === 0) {
236
+ await MysGame.forEachGame(async (Game) => {
237
+ const uidList = new Set(await Game.refresh(res.data.list, options));
238
+ const userInfo = await Game.UserInfo.create(options.userId);
239
+ const bindUids = userInfo.bind_uids;
240
+ uidList.forEach((uid) => {
241
+ if (!bindUids[uid] || bindUids[uid].perm < perm) {
242
+ bindUids[uid] = {
243
+ perm,
244
+ ltuid: options.ltuid
245
+ };
246
+ }
247
+ });
248
+ lodash.forEach(bindUids, (info, uid) => {
249
+ if (!uidList.has(uid) && info?.ltuid === options.ltuid) {
250
+ bindUids[uid] = {
251
+ perm: 0 /* BIND */,
252
+ ltuid: ""
253
+ };
254
+ }
255
+ });
256
+ uids.push({
257
+ name: Game.name,
258
+ columnKey: Game.columnKey,
259
+ data: bindUids
260
+ });
261
+ });
262
+ } else if (res?.retcode === -100) {
263
+ message = "Cookie\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\u6216#\u5237\u65B0Cookie\uFF01";
264
+ } else {
265
+ message = res?.message || "\u5237\u65B0UID\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF01";
266
+ }
267
+ }
268
+ return {
269
+ Serv: options.type,
270
+ uids,
271
+ message
272
+ };
273
+ }
274
+ static async refreshCookie(stokenParams, serv) {
275
+ if (Array.isArray(serv)) {
276
+ for (const s of serv) {
277
+ const res2 = await _UserInfo.refreshCookie(stokenParams, s);
278
+ if (Object.keys(res2.cookieParams).length > 0) {
279
+ return res2;
280
+ }
281
+ }
282
+ return {
283
+ Serv: "mihoyo" /* cn */,
284
+ cookieParams: {},
285
+ message: "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01"
286
+ };
287
+ }
288
+ const res = (await getCookieTokenBySToken.init(null).request({
289
+ stoken: new URLSearchParams({
290
+ stoken: stokenParams.stoken,
291
+ mid: stokenParams.mid,
292
+ uid: stokenParams.stuid
293
+ }).toString(),
294
+ method: serv === "mihoyo" /* cn */ ? "GET" : "POST"
295
+ })).data;
296
+ let message = "";
297
+ let cookieParams = {};
298
+ if (res?.retcode === -100) {
299
+ message = "\u767B\u5F55\u72B6\u6001\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
300
+ } else if (res?.data?.cookie_token) {
301
+ cookieParams = {
302
+ ltuid: stokenParams.stuid,
303
+ ltoken: stokenParams.stoken,
304
+ cookie_token: res.data.cookie_token,
305
+ account_id: stokenParams.stuid
306
+ };
307
+ } else {
308
+ message = "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
309
+ }
310
+ return {
311
+ Serv: serv,
312
+ cookieParams,
313
+ message
314
+ };
315
+ }
316
+ };
317
+
318
+ // src/exports/mys/api/define.ts
48
319
  var DefineApi = class {
49
320
  #apiInfo;
50
321
  /** @description 是否使用Fp请求 */
@@ -153,12 +424,12 @@ var DefineApi = class {
153
424
  const t = Math.floor(Date.now() / 1e3);
154
425
  let DS = `salt=${MysApp.salt[saltKey]}&t=${t}&r=${r}`;
155
426
  if (query || body) DS += `&b=${body}&q=${query}`;
156
- return `${t},${r},${md5(DS)}`;
427
+ return `${t},${r},${md52(DS)}`;
157
428
  }
158
429
  getDS2(saltKey, query = "", body = "") {
159
430
  const r = 100001 + Math.floor(Math.random() * 1e5);
160
431
  const t = Math.floor(Date.now() / 1e3);
161
- return `${t},${r},${md5(`salt=${MysApp.salt[saltKey]}&t=${t}&r=${r}&b=${body}&q=${query}`)}`;
432
+ return `${t},${r},${md52(`salt=${MysApp.salt[saltKey]}&t=${t}&r=${r}&b=${body}&q=${query}`)}`;
162
433
  }
163
434
  NoHeaders = (options = {}) => ({});
164
435
  BaseCnHeaders = () => ({
@@ -323,7 +594,7 @@ var getDeviceFp = new DefineApi((self, data) => ({
323
594
  Body: (function() {
324
595
  const body = {
325
596
  device_fp: "38d7faa51d2b6",
326
- device_id: lodash.sampleSize("0123456789abcdef", 16).join(""),
597
+ device_id: lodash2.sampleSize("0123456789abcdef", 16).join(""),
327
598
  ext_fields: `{"proxyStatus":0,"isRoot":0,"romCapacity":"512","deviceName":"${self.DeviceInfo.brand}","productName":"${self.DeviceInfo.model}","romRemain":"456","hostname":"BuildHost","screenSize":"1096x2434","isTablet":0,"aaid":"","model":"${self.DeviceInfo.model}","brand":"${self.DeviceInfo.brand}","hardware":"qcom","deviceType":"${self.DeviceInfo.name}","devId":"REL","serialNumber":"unknown","sdCapacity":107433,"buildTime":"1633631032000","buildUser":"BuildUser","simState":1,"ramRemain":"96757","appUpdateTimeDiff":1722171241616,"deviceInfo":"${self.DeviceInfo.fingerprint}","vaid":"${self.DeviceInfo.oaid}","buildType":"user","sdkVersion":"30","ui_mode":"UI_MODE_TYPE_NORMAL","isMockLocation":0,"cpuType":"arm64-v8a","isAirMode":0,"ringMode":2,"chargeStatus":1,"manufacturer":"${self.DeviceInfo.brand}","emulatorStatus":0,"appMemory":"512","osVersion":"${self.DeviceInfo.version}","vendor":"unknown","accelerometer":"-0.084346995x8.73799x4.6301117","sdRemain":96600,"buildTags":"release-keys","packageName":"com.mihoyo.hyperion","networkType":"WiFi","oaid":"${self.DeviceInfo.oaid}","debugStatus":1,"ramCapacity":"107433","magnetometer":"-13.9125x-17.8875x-5.4750004","display":"${self.DeviceInfo.display}","appInstallTimeDiff":1717065300325,"packageVersion":"2.20.2","gyroscope":"0.017714571x-4.5813544E-4x0.0015271181","batteryStatus":76,"hasKeyboard":0,"board":"${self.DeviceInfo.board}"}`,
328
599
  platform: "2",
329
600
  seed_id: crypto.randomUUID(),
@@ -341,161 +612,12 @@ var getDeviceFp = new DefineApi((self, data) => ({
341
612
  HeaderFn: self.OkHttpHeaders
342
613
  }));
343
614
 
344
- // src/exports/mys/user/userInfo.ts
345
- import lodash2 from "node-karin/lodash";
346
- var BaseUserInfo = class {
347
- userId;
348
- ltuidMap = /* @__PURE__ */ new Map();
349
- constructor(userId) {
350
- this.userId = userId;
351
- }
352
- get ltuids() {
353
- return this.UserInfo.ltuids;
354
- }
355
- get stuids() {
356
- return this.UserInfo.stuids;
357
- }
358
- get deviceList() {
359
- return this.UserInfo.deviceList;
360
- }
361
- get LtuidInfoList() {
362
- return Array.from(this.ltuidMap.values()).map((info) => Object.freeze(info)).sort((a, b) => +a.ltuid - +b.ltuid);
363
- }
364
- async initMysAccountInfo(UserInfo2, initAll) {
365
- this.UserInfo = UserInfo2;
366
- this.ltuidMap.clear();
367
- const idList = Array.from(/* @__PURE__ */ new Set([...UserInfo2.ltuids, ...UserInfo2.stuids]));
368
- if (initAll) {
369
- const MysAccountInfoList = await (await MysAccountInfoDB()).findAllByPks(idList);
370
- MysAccountInfoList.forEach((MysAccountInfo) => {
371
- this.ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
372
- });
373
- } else {
374
- const self = this;
375
- const mainLtuid = self.bind_uids?.[self.main_uid]?.ltuid;
376
- if (mainLtuid) {
377
- const MysAccountInfo = await (await MysAccountInfoDB()).findByPk(mainLtuid);
378
- MysAccountInfo && this.ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
379
- }
380
- }
381
- }
382
- getLtuidInfo(ltuid) {
383
- return Object.freeze(this.ltuidMap.get(ltuid));
384
- }
385
- async getDeviceInfoList() {
386
- return await (await MysDeviceInfoDB()).findAllByPks(this.deviceList);
387
- }
388
- async saveUserInfo(data) {
389
- await this.UserInfo.save(data);
390
- }
391
- async saveMysAccountInfo(ltuid, data) {
392
- let MysAccountInfo = this.ltuidMap.get(ltuid);
393
- if (!MysAccountInfo) {
394
- MysAccountInfo = await (await MysAccountInfoDB()).findByPk(ltuid, true);
395
- }
396
- await MysAccountInfo.save(data);
397
- this.ltuidMap.set(ltuid, { ...MysAccountInfo, ...data });
398
- }
399
- };
400
- var UserInfo = class _UserInfo extends BaseUserInfo {
401
- static async create(userId, initAll = false) {
402
- const userInfo = new BaseUserInfo(userId);
403
- userInfo.refresh = async () => {
404
- const UserInfoData = await (await MysUserInfoDB()).findByPk(userId, true);
405
- await userInfo.initMysAccountInfo(UserInfoData, initAll);
406
- return userInfo;
407
- };
408
- return await userInfo.refresh();
409
- }
410
- static async refreshUid(options, perm) {
411
- let message = "";
412
- const uids = [];
413
- if (MysGame.num > 0) {
414
- const res = (await (await getUserGameRolesByCookie.initDevice(options)).request(null)).data;
415
- if (res?.retcode === 0) {
416
- await MysGame.forEachGame(async (Game) => {
417
- const uidList = new Set(await Game.refresh(res.data.list, options));
418
- const userInfo = await Game.UserInfo.create(options.userId);
419
- const bindUids = userInfo.bind_uids;
420
- uidList.forEach((uid) => {
421
- if (!bindUids[uid] || bindUids[uid].perm < perm) {
422
- bindUids[uid] = {
423
- perm,
424
- ltuid: options.ltuid
425
- };
426
- }
427
- });
428
- lodash2.forEach(bindUids, (info, uid) => {
429
- if (!uidList.has(uid) && info?.ltuid === options.ltuid) {
430
- bindUids[uid] = {
431
- perm: 0 /* BIND */,
432
- ltuid: ""
433
- };
434
- }
435
- });
436
- uids.push({
437
- name: Game.name,
438
- columnKey: Game.columnKey,
439
- data: bindUids
440
- });
441
- });
442
- } else if (res?.retcode === -100) {
443
- message = "Cookie\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\u6216#\u5237\u65B0Cookie\uFF01";
444
- } else {
445
- message = res?.message || "\u5237\u65B0UID\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF01";
446
- }
447
- }
448
- return {
449
- Serv: options.type,
450
- uids,
451
- message
452
- };
453
- }
454
- static async refreshCookie(stokenParams, serv) {
455
- if (Array.isArray(serv)) {
456
- for (const s of serv) {
457
- const res2 = await _UserInfo.refreshCookie(stokenParams, s);
458
- if (Object.keys(res2.cookieParams).length > 0) {
459
- return res2;
460
- }
461
- }
462
- return {
463
- Serv: "mihoyo" /* cn */,
464
- cookieParams: {},
465
- message: "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01"
466
- };
467
- }
468
- const res = (await getCookieTokenBySToken.init(null).request({
469
- stoken: new URLSearchParams({
470
- stoken: stokenParams.stoken,
471
- mid: stokenParams.mid,
472
- uid: stokenParams.stuid
473
- }).toString(),
474
- method: serv === "mihoyo" /* cn */ ? "GET" : "POST"
475
- })).data;
476
- let message = "";
477
- let cookieParams = {};
478
- if (res?.retcode === -100) {
479
- message = "\u767B\u5F55\u72B6\u6001\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
480
- } else if (res?.data?.cookie_token) {
481
- cookieParams = {
482
- ltuid: stokenParams.stuid,
483
- ltoken: stokenParams.stoken,
484
- cookie_token: res.data.cookie_token,
485
- account_id: stokenParams.stuid
486
- };
487
- } else {
488
- message = "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
489
- }
490
- return {
491
- Serv: serv,
492
- cookieParams,
493
- message
494
- };
495
- }
496
- };
497
-
498
615
  export {
616
+ MysApp,
617
+ MysHosts,
618
+ DeviceInfo,
619
+ MysGame,
620
+ RegisterGameBase,
499
621
  BaseUserInfo,
500
622
  UserInfo,
501
623
  DefineApi,