karin-plugin-mys-core 1.0.11 → 1.0.13

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 (156) hide show
  1. package/README.md +1 -1
  2. package/lib/apps/MiHoYoLogin.js +7 -38
  3. package/lib/apps/MysDevice.js +6 -37
  4. package/lib/apps/UIDManage.js +7 -38
  5. package/lib/{chunk-4BTKE3LO.js → chunk-567NAKP4.js} +300 -189
  6. package/lib/{chunk-BBJ4U2IY.js → chunk-A5FZEOIN.js} +75 -4
  7. package/lib/{chunk-AFLOM3CG.js → chunk-G564WWA7.js} +6 -10
  8. package/lib/chunk-HKSHKXRI.js +21 -0
  9. package/lib/chunk-IASM5MM5.js +639 -0
  10. package/lib/{chunk-5DXIT7UB.js → chunk-RX4VMVAI.js} +0 -5
  11. package/lib/chunk-UIPRZFST.js +184 -0
  12. package/lib/core/index.d.ts +20 -0
  13. package/lib/core/index.js +10 -0
  14. package/lib/exports/config/index.d.ts +56 -1
  15. package/lib/exports/config/index.js +3 -9
  16. package/lib/exports/database/index.d.ts +78 -12
  17. package/lib/exports/database/index.js +12 -40
  18. package/lib/exports/mys/index.d.ts +379 -14
  19. package/lib/exports/mys/index.js +10 -43
  20. package/lib/exports/render/index.d.ts +36 -3
  21. package/lib/exports/render/index.js +3 -8
  22. package/lib/exports/utils/index.d.ts +45 -2
  23. package/lib/exports/utils/index.js +1 -4
  24. package/lib/{exports/database/types/dbs/base.d.ts → mysUserInfo-BsyEENbc.d.ts} +60 -1
  25. package/package.json +6 -1
  26. package/resources/image/frame-logo.webp +0 -0
  27. package/resources/image/launcher-icon//345/216/237/347/245/236.webp +0 -0
  28. package/resources/image/launcher-icon//345/264/251/345/235/2173.webp +0 -0
  29. package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.webp +0 -0
  30. 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
  31. 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
  32. package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.webp +0 -0
  33. package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.webp +0 -0
  34. package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.webp +0 -0
  35. package/resources/image/mys-core-logo.webp +0 -0
  36. package/resources/image/mys-logo.webp +0 -0
  37. package/lib/chunk-2BVJS5VE.js +0 -49
  38. package/lib/chunk-3ERB3ILC.js +0 -0
  39. package/lib/chunk-3JN5WYUN.js +0 -135
  40. package/lib/chunk-7KEG6SDX.js +0 -0
  41. package/lib/chunk-7VAWV6ZE.js +0 -0
  42. package/lib/chunk-ARLTXJFJ.js +0 -0
  43. package/lib/chunk-CFS2WFOO.js +0 -0
  44. package/lib/chunk-DMJ5OQR6.js +0 -73
  45. package/lib/chunk-EDNBKOMS.js +0 -30
  46. package/lib/chunk-FBWSEBAW.js +0 -0
  47. package/lib/chunk-FOAQZIZ2.js +0 -0
  48. package/lib/chunk-G5W5WAY5.js +0 -64
  49. package/lib/chunk-G7TMVDGP.js +0 -68
  50. package/lib/chunk-HJ6HX5HB.js +0 -29
  51. package/lib/chunk-I7XZONDN.js +0 -13
  52. package/lib/chunk-JRH4JC43.js +0 -0
  53. package/lib/chunk-JVJQKRJ4.js +0 -89
  54. package/lib/chunk-K5U2O3HH.js +0 -0
  55. package/lib/chunk-KQVWWGRH.js +0 -31
  56. package/lib/chunk-LBLGKL3W.js +0 -77
  57. package/lib/chunk-LJSDSOY6.js +0 -0
  58. package/lib/chunk-LYTNREAI.js +0 -0
  59. package/lib/chunk-MPZP23EX.js +0 -219
  60. package/lib/chunk-MWYDWDR4.js +0 -0
  61. package/lib/chunk-PMFOX5HA.js +0 -80
  62. package/lib/chunk-PYTECG57.js +0 -0
  63. package/lib/chunk-SEWEEPJN.js +0 -0
  64. package/lib/chunk-SHW6FHIB.js +0 -10
  65. package/lib/chunk-T7W4DXRM.js +0 -0
  66. package/lib/chunk-TTN7NFCA.js +0 -109
  67. package/lib/chunk-W4DBT7AD.js +0 -0
  68. package/lib/chunk-WCX7WZAQ.js +0 -0
  69. package/lib/chunk-Z5I6A73Y.js +0 -0
  70. package/lib/chunk-ZTOR2DXG.js +0 -38
  71. package/lib/common-BlI5Gsw_.d.ts +0 -35
  72. package/lib/define-B9r20dK6.d.ts +0 -130
  73. package/lib/exports/config/array.d.ts +0 -1
  74. package/lib/exports/config/array.js +0 -7
  75. package/lib/exports/config/config.d.ts +0 -56
  76. package/lib/exports/config/config.js +0 -12
  77. package/lib/exports/database/database.d.ts +0 -30
  78. package/lib/exports/database/database.js +0 -22
  79. package/lib/exports/database/dbs/base.d.ts +0 -25
  80. package/lib/exports/database/dbs/base.js +0 -19
  81. package/lib/exports/database/dbs/index.d.ts +0 -4
  82. package/lib/exports/database/dbs/index.js +0 -29
  83. package/lib/exports/database/dbs/sqlite3.d.ts +0 -27
  84. package/lib/exports/database/dbs/sqlite3.js +0 -23
  85. package/lib/exports/database/dbs/table.d.ts +0 -20
  86. package/lib/exports/database/dbs/table.js +0 -25
  87. package/lib/exports/database/tables/index.d.ts +0 -9
  88. package/lib/exports/database/tables/index.js +0 -40
  89. package/lib/exports/database/tables/mysAccountInfo.d.ts +0 -9
  90. package/lib/exports/database/tables/mysAccountInfo.js +0 -27
  91. package/lib/exports/database/tables/mysDeviceInfo.d.ts +0 -9
  92. package/lib/exports/database/tables/mysDeviceInfo.js +0 -27
  93. package/lib/exports/database/tables/mysUserInfo.d.ts +0 -9
  94. package/lib/exports/database/tables/mysUserInfo.js +0 -27
  95. package/lib/exports/database/types/database.d.ts +0 -6
  96. package/lib/exports/database/types/database.js +0 -1
  97. package/lib/exports/database/types/dbs/base.js +0 -11
  98. package/lib/exports/database/types/dbs/index.d.ts +0 -2
  99. package/lib/exports/database/types/dbs/index.js +0 -12
  100. package/lib/exports/database/types/index.d.ts +0 -6
  101. package/lib/exports/database/types/index.js +0 -24
  102. package/lib/exports/database/types/tables/index.d.ts +0 -5
  103. package/lib/exports/database/types/tables/index.js +0 -13
  104. package/lib/exports/database/types/tables/mysAccountInfo.d.ts +0 -14
  105. package/lib/exports/database/types/tables/mysAccountInfo.js +0 -7
  106. package/lib/exports/database/types/tables/mysDeviceInfo.d.ts +0 -19
  107. package/lib/exports/database/types/tables/mysDeviceInfo.js +0 -1
  108. package/lib/exports/database/types/tables/mysUserInfo.d.ts +0 -32
  109. package/lib/exports/database/types/tables/mysUserInfo.js +0 -7
  110. package/lib/exports/mys/api/apis.d.ts +0 -82
  111. package/lib/exports/mys/api/apis.js +0 -56
  112. package/lib/exports/mys/api/app.d.ts +0 -60
  113. package/lib/exports/mys/api/app.js +0 -32
  114. package/lib/exports/mys/api/define.d.ts +0 -6
  115. package/lib/exports/mys/api/define.js +0 -42
  116. package/lib/exports/mys/api/index.d.ts +0 -11
  117. package/lib/exports/mys/api/index.js +0 -63
  118. package/lib/exports/mys/types/api/define.d.ts +0 -6
  119. package/lib/exports/mys/types/api/define.js +0 -1
  120. package/lib/exports/mys/types/api/index.d.ts +0 -6
  121. package/lib/exports/mys/types/api/index.js +0 -2
  122. package/lib/exports/mys/types/index.d.ts +0 -12
  123. package/lib/exports/mys/types/index.js +0 -6
  124. package/lib/exports/mys/types/user/game.d.ts +0 -23
  125. package/lib/exports/mys/types/user/game.js +0 -1
  126. package/lib/exports/mys/types/user/index.d.ts +0 -12
  127. package/lib/exports/mys/types/user/index.js +0 -3
  128. package/lib/exports/mys/types/user/userInfo.d.ts +0 -43
  129. package/lib/exports/mys/types/user/userInfo.js +0 -1
  130. package/lib/exports/mys/user/deviceInfo.d.ts +0 -11
  131. package/lib/exports/mys/user/deviceInfo.js +0 -30
  132. package/lib/exports/mys/user/game.d.ts +0 -40
  133. package/lib/exports/mys/user/game.js +0 -9
  134. package/lib/exports/mys/user/index.d.ts +0 -14
  135. package/lib/exports/mys/user/index.js +0 -52
  136. package/lib/exports/mys/user/userInfo.d.ts +0 -53
  137. package/lib/exports/mys/user/userInfo.js +0 -44
  138. package/lib/exports/render/render.d.ts +0 -38
  139. package/lib/exports/render/render.js +0 -12
  140. package/lib/exports/utils/common.d.ts +0 -1
  141. package/lib/exports/utils/common.js +0 -15
  142. package/lib/exports/utils/types/common.d.ts +0 -11
  143. package/lib/exports/utils/types/common.js +0 -1
  144. package/lib/exports/utils/types/index.d.ts +0 -1
  145. package/lib/exports/utils/types/index.js +0 -2
  146. package/resources/image/frame-logo.png +0 -0
  147. package/resources/image/launcher-icon//345/216/237/347/245/236.png +0 -0
  148. package/resources/image/launcher-icon//345/264/251/345/235/2173.png +0 -0
  149. package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.png +0 -0
  150. 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
  151. 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
  152. package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.png +0 -0
  153. package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.png +0 -0
  154. package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.png +0 -0
  155. package/resources/image/mys-core-logo.png +0 -0
  156. package/resources/image/mys-logo.png +0 -0
@@ -1,50 +1,310 @@
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";
6
+ import {
7
+ DeviceCfg
8
+ } from "./chunk-HKSHKXRI.js";
20
9
  import {
21
10
  dir
22
11
  } from "./chunk-SHLPPEAY.js";
23
- import {
24
- Config
25
- } from "./chunk-TTN7NFCA.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";
32
18
 
33
- // src/core/config/device.ts
34
- var DefaultDevice = {
35
- version: 12,
36
- name: "aurora",
37
- board: "24031PN0DC",
38
- model: "24031PN0DC",
39
- product: "aurora",
40
- fingerprint: "Xiaomi/aurora/aurora:12/V417IR/813:user/release-keys"
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"
41
29
  };
42
- var DeviceCfg = new Config(`${dir.name}:device`, dir.ConfigDir, DefaultDevice, {}).watch();
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
+ });
43
78
 
44
79
  // src/exports/mys/api/define.ts
45
- import md5 from "md5";
80
+ import md52 from "md5";
46
81
  import { logger, redis } from "node-karin";
47
82
  import axios, { AxiosHeaders } from "node-karin/axios";
83
+
84
+ // src/exports/mys/user/deviceInfo.ts
85
+ import md5 from "md5";
86
+ var DeviceInfo = class {
87
+ static async get(Md5) {
88
+ return await (await MysDeviceInfoDB()).findByPk(Md5);
89
+ }
90
+ static async create(userId, deviceInfo) {
91
+ const deviceMd5 = md5([
92
+ userId,
93
+ deviceInfo.deviceId || "",
94
+ deviceInfo.name || "",
95
+ deviceInfo.board || "",
96
+ deviceInfo.model || "",
97
+ deviceInfo.oaid || "",
98
+ deviceInfo.version || "",
99
+ deviceInfo.fingerprint || "",
100
+ deviceInfo.product || ""
101
+ ].join("_"));
102
+ const MysDeviceInfo = await (await MysDeviceInfoDB()).findByPk(deviceMd5, true);
103
+ await MysDeviceInfo.save(deviceInfo);
104
+ return deviceMd5;
105
+ }
106
+ };
107
+
108
+ // src/exports/mys/user/game.ts
109
+ var MysGame = new class MysGame2 {
110
+ #games = /* @__PURE__ */ new Map();
111
+ get num() {
112
+ return this.#games.size;
113
+ }
114
+ match(prefix) {
115
+ if (!prefix || this.#games.size === 0) return void 0;
116
+ for (const Game of this.#games.values()) {
117
+ if (Game.prefix.test(prefix)) return Game;
118
+ }
119
+ return void 0;
120
+ }
121
+ RegisterGame(Game) {
122
+ this.#games.set(Game.columnKey, Game);
123
+ }
124
+ async forEachGame(fn) {
125
+ if (this.num === 0) return;
126
+ for (const Game of this.#games.values()) {
127
+ if (await fn(Game) === "break") break;
128
+ }
129
+ }
130
+ }();
131
+ var RegisterGameBase = class {
132
+ game;
133
+ columnKey;
134
+ /** @description 游戏名称 */
135
+ name;
136
+ /** @description 指令前缀 */
137
+ prefixs;
138
+ refresh;
139
+ UserInfo;
140
+ constructor(game, name, prefixs, userInfo, refreshFuc) {
141
+ this.game = game;
142
+ this.columnKey = `${game}-uids`;
143
+ this.name = name;
144
+ this.prefixs = prefixs;
145
+ this.UserInfo = userInfo;
146
+ this.refresh = refreshFuc;
147
+ }
148
+ get prefix() {
149
+ return new RegExp(`^(${this.prefixs.join("|")})$`, "i");
150
+ }
151
+ };
152
+
153
+ // src/exports/mys/user/userInfo.ts
154
+ import lodash from "node-karin/lodash";
155
+ var BaseUserInfo = class {
156
+ userId;
157
+ ltuidMap = /* @__PURE__ */ new Map();
158
+ constructor(userId) {
159
+ this.userId = userId;
160
+ }
161
+ get ltuids() {
162
+ return this.UserInfo.ltuids;
163
+ }
164
+ get stuids() {
165
+ return this.UserInfo.stuids;
166
+ }
167
+ get deviceList() {
168
+ return this.UserInfo.deviceList;
169
+ }
170
+ get LtuidInfoList() {
171
+ return Array.from(this.ltuidMap.values()).map((info) => Object.freeze(info)).sort((a, b) => +a.ltuid - +b.ltuid);
172
+ }
173
+ async initMysAccountInfo(UserInfo2, initAll) {
174
+ this.UserInfo = UserInfo2;
175
+ this.ltuidMap.clear();
176
+ const idList = Array.from(/* @__PURE__ */ new Set([...UserInfo2.ltuids, ...UserInfo2.stuids]));
177
+ if (initAll) {
178
+ const MysAccountInfoList = await (await MysAccountInfoDB()).findAllByPks(idList);
179
+ MysAccountInfoList.forEach((MysAccountInfo) => {
180
+ this.ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
181
+ });
182
+ } else {
183
+ const self = this;
184
+ const mainLtuid = self.bind_uids?.[self.main_uid]?.ltuid;
185
+ if (mainLtuid) {
186
+ const MysAccountInfo = await (await MysAccountInfoDB()).findByPk(mainLtuid);
187
+ MysAccountInfo && this.ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
188
+ }
189
+ }
190
+ }
191
+ getLtuidInfo(ltuid) {
192
+ return Object.freeze(this.ltuidMap.get(ltuid));
193
+ }
194
+ async getDeviceInfoList() {
195
+ return await (await MysDeviceInfoDB()).findAllByPks(this.deviceList);
196
+ }
197
+ async saveUserInfo(data) {
198
+ await this.UserInfo.save(data);
199
+ }
200
+ async saveMysAccountInfo(ltuid, data) {
201
+ let MysAccountInfo = this.ltuidMap.get(ltuid);
202
+ if (!MysAccountInfo) {
203
+ MysAccountInfo = await (await MysAccountInfoDB()).findByPk(ltuid, true);
204
+ }
205
+ await MysAccountInfo.save(data);
206
+ this.ltuidMap.set(ltuid, { ...MysAccountInfo, ...data });
207
+ }
208
+ };
209
+ var UserInfo = class _UserInfo extends BaseUserInfo {
210
+ static async create(userId, initAll = false) {
211
+ const userInfo = new BaseUserInfo(userId);
212
+ userInfo.refresh = async () => {
213
+ const UserInfoData = await (await MysUserInfoDB()).findByPk(userId, true);
214
+ await userInfo.initMysAccountInfo(UserInfoData, initAll);
215
+ return userInfo;
216
+ };
217
+ return await userInfo.refresh();
218
+ }
219
+ static async refreshUid(options, perm) {
220
+ let message = "";
221
+ const uids = [];
222
+ if (MysGame.num > 0) {
223
+ const res = (await (await getUserGameRolesByCookie.initDevice(options)).request(null)).data;
224
+ if (res?.retcode === 0) {
225
+ await MysGame.forEachGame(async (Game) => {
226
+ const uidList = new Set(await Game.refresh(res.data.list, options));
227
+ const userInfo = await Game.UserInfo.create(options.userId);
228
+ const bindUids = userInfo.bind_uids;
229
+ uidList.forEach((uid) => {
230
+ if (!bindUids[uid] || bindUids[uid].perm < perm) {
231
+ bindUids[uid] = {
232
+ perm,
233
+ ltuid: options.ltuid
234
+ };
235
+ }
236
+ });
237
+ lodash.forEach(bindUids, (info, uid) => {
238
+ if (!uidList.has(uid) && info?.ltuid === options.ltuid) {
239
+ bindUids[uid] = {
240
+ perm: 0 /* BIND */,
241
+ ltuid: ""
242
+ };
243
+ }
244
+ });
245
+ uids.push({
246
+ name: Game.name,
247
+ columnKey: Game.columnKey,
248
+ data: bindUids
249
+ });
250
+ });
251
+ } else if (res?.retcode === -100) {
252
+ message = "Cookie\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\u6216#\u5237\u65B0Cookie\uFF01";
253
+ } else {
254
+ message = res?.message || "\u5237\u65B0UID\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF01";
255
+ }
256
+ }
257
+ return {
258
+ Serv: options.type,
259
+ uids,
260
+ message
261
+ };
262
+ }
263
+ static async refreshCookie(stokenParams, serv) {
264
+ if (Array.isArray(serv)) {
265
+ for (const s of serv) {
266
+ const res2 = await _UserInfo.refreshCookie(stokenParams, s);
267
+ if (Object.keys(res2.cookieParams).length > 0) {
268
+ return res2;
269
+ }
270
+ }
271
+ return {
272
+ Serv: "mihoyo" /* cn */,
273
+ cookieParams: {},
274
+ message: "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01"
275
+ };
276
+ }
277
+ const res = (await getCookieTokenBySToken.init(null).request({
278
+ stoken: new URLSearchParams({
279
+ stoken: stokenParams.stoken,
280
+ mid: stokenParams.mid,
281
+ uid: stokenParams.stuid
282
+ }).toString(),
283
+ method: serv === "mihoyo" /* cn */ ? "GET" : "POST"
284
+ })).data;
285
+ let message = "";
286
+ let cookieParams = {};
287
+ if (res?.retcode === -100) {
288
+ message = "\u767B\u5F55\u72B6\u6001\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
289
+ } else if (res?.data?.cookie_token) {
290
+ cookieParams = {
291
+ ltuid: stokenParams.stuid,
292
+ ltoken: stokenParams.stoken,
293
+ cookie_token: res.data.cookie_token,
294
+ account_id: stokenParams.stuid
295
+ };
296
+ } else {
297
+ message = "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
298
+ }
299
+ return {
300
+ Serv: serv,
301
+ cookieParams,
302
+ message
303
+ };
304
+ }
305
+ };
306
+
307
+ // src/exports/mys/api/define.ts
48
308
  var DefineApi = class {
49
309
  #apiInfo;
50
310
  /** @description 是否使用Fp请求 */
@@ -153,12 +413,12 @@ var DefineApi = class {
153
413
  const t = Math.floor(Date.now() / 1e3);
154
414
  let DS = `salt=${MysApp.salt[saltKey]}&t=${t}&r=${r}`;
155
415
  if (query || body) DS += `&b=${body}&q=${query}`;
156
- return `${t},${r},${md5(DS)}`;
416
+ return `${t},${r},${md52(DS)}`;
157
417
  }
158
418
  getDS2(saltKey, query = "", body = "") {
159
419
  const r = 100001 + Math.floor(Math.random() * 1e5);
160
420
  const t = Math.floor(Date.now() / 1e3);
161
- return `${t},${r},${md5(`salt=${MysApp.salt[saltKey]}&t=${t}&r=${r}&b=${body}&q=${query}`)}`;
421
+ return `${t},${r},${md52(`salt=${MysApp.salt[saltKey]}&t=${t}&r=${r}&b=${body}&q=${query}`)}`;
162
422
  }
163
423
  NoHeaders = (options = {}) => ({});
164
424
  BaseCnHeaders = () => ({
@@ -323,7 +583,7 @@ var getDeviceFp = new DefineApi((self, data) => ({
323
583
  Body: (function() {
324
584
  const body = {
325
585
  device_fp: "38d7faa51d2b6",
326
- device_id: lodash.sampleSize("0123456789abcdef", 16).join(""),
586
+ device_id: lodash2.sampleSize("0123456789abcdef", 16).join(""),
327
587
  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
588
  platform: "2",
329
589
  seed_id: crypto.randomUUID(),
@@ -341,161 +601,12 @@ var getDeviceFp = new DefineApi((self, data) => ({
341
601
  HeaderFn: self.OkHttpHeaders
342
602
  }));
343
603
 
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
604
  export {
605
+ MysApp,
606
+ MysHosts,
607
+ DeviceInfo,
608
+ MysGame,
609
+ RegisterGameBase,
499
610
  BaseUserInfo,
500
611
  UserInfo,
501
612
  DefineApi,
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  dir
3
3
  } from "./chunk-SHLPPEAY.js";
4
+ import {
5
+ common_exports
6
+ } from "./chunk-RX4VMVAI.js";
4
7
 
5
8
  // src/exports/render/index.ts
6
- import React2 from "react";
9
+ import React3 from "react";
7
10
 
8
11
  // src/exports/render/layout/DefaultLayout.tsx
9
12
  import { config } from "node-karin";
@@ -32,14 +35,14 @@ var DefaultLayoutComponent = ({
32
35
  ), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-MYS-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, mysPlugin.name), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", mysPlugin.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" })), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
33
36
  "img",
34
37
  {
35
- src: `${dir.pluginDir}/resources/image/mys-core-logo.png`,
38
+ src: `${dir.pluginDir}/resources/image/mys-core-logo.webp`,
36
39
  alt: "MysCore Logo",
37
40
  className: "h-6 w-6 rounded-sm"
38
41
  }
39
42
  ), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "MysCore"), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", dir.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" }), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
40
43
  "img",
41
44
  {
42
- src: `${dir.pluginDir}/resources/image/frame-logo.png`,
45
+ src: `${dir.pluginDir}/resources/image/frame-logo.webp`,
43
46
  alt: "Karin Logo",
44
47
  className: "h-6 w-6 rounded-sm"
45
48
  }
@@ -47,7 +50,75 @@ var DefaultLayoutComponent = ({
47
50
  );
48
51
  };
49
52
 
53
+ // src/exports/render/render.ts
54
+ import karin, { absPath, config as config2, existToMkdirSync, karinPathBase } from "node-karin";
55
+ import fs from "fs";
56
+ import path from "path";
57
+ import React2 from "react";
58
+ import { renderToString } from "react-dom/server";
59
+ var ReactRender = class {
60
+ #renderCfg;
61
+ #pluginOptions;
62
+ constructor(cfg, pluginOptions = {}) {
63
+ this.#renderCfg = cfg;
64
+ this.#pluginOptions = pluginOptions;
65
+ }
66
+ get plugin() {
67
+ return {
68
+ ...this.#pluginOptions,
69
+ name: this.#renderCfg.name,
70
+ version: this.#renderCfg.version,
71
+ resources: {
72
+ default: absPath(path.join(this.#renderCfg.pluginDir, "resources")),
73
+ download: absPath(this.#renderCfg.ResourcesDir)
74
+ }
75
+ };
76
+ }
77
+ get karin() {
78
+ return {
79
+ version: config2.pkg().version
80
+ };
81
+ }
82
+ async template(template, component, props, options = {}) {
83
+ const element = React2.createElement(component, props);
84
+ const appHtml = renderToString(element);
85
+ const coreCssPath = absPath(path.join(dir.pluginDir, "resources", "styles", `${dir.name}.css`));
86
+ const cssPath = this.#renderCfg.name !== dir.name ? absPath(path.join(this.plugin.resources.default, "styles", `${this.#renderCfg.name}.css`)) : "";
87
+ const Html = `
88
+ <!DOCTYPE html>
89
+ <html lang="zh-CN">
90
+ <head>
91
+ <meta charset="UTF-8">
92
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
93
+ <link rel="stylesheet" href="${coreCssPath}">
94
+ <link rel="stylesheet" href="${cssPath}">
95
+ </head>
96
+ <body>
97
+ ${appHtml}
98
+ </body>
99
+ </html>
100
+ `;
101
+ const saveDir = path.join(karinPathBase, "temp", "html", this.#renderCfg.name, template);
102
+ existToMkdirSync(saveDir);
103
+ const savePath = path.join(saveDir, `${options.render?.name || template}-${common_exports.randomString(8, "Lower")}.html`);
104
+ fs.writeFileSync(savePath, Html, "utf-8");
105
+ const image = await karin.render({
106
+ type: options.type || "jpeg",
107
+ omitBackground: options.type === "png",
108
+ selector: "container",
109
+ setViewport: {
110
+ deviceScaleFactor: 3
111
+ },
112
+ ...options.render || {},
113
+ file: absPath(savePath)
114
+ });
115
+ if (!image) return null;
116
+ return "base64://" + image;
117
+ }
118
+ };
119
+
50
120
  export {
51
121
  DefaultLayoutComponent,
52
- React2 as React
122
+ ReactRender,
123
+ React3 as React
53
124
  };
@@ -1,16 +1,12 @@
1
1
  import {
2
2
  DefaultLayoutComponent,
3
- React
4
- } from "./chunk-BBJ4U2IY.js";
5
- import {
3
+ React,
6
4
  ReactRender
7
- } from "./chunk-LBLGKL3W.js";
5
+ } from "./chunk-A5FZEOIN.js";
8
6
  import {
7
+ MysGame,
9
8
  UserInfo
10
- } from "./chunk-4BTKE3LO.js";
11
- import {
12
- MysGame
13
- } from "./chunk-2BVJS5VE.js";
9
+ } from "./chunk-567NAKP4.js";
14
10
  import {
15
11
  dir
16
12
  } from "./chunk-SHLPPEAY.js";
@@ -25,7 +21,7 @@ var ShowBindAccountComponent = ({
25
21
  "div",
26
22
  {
27
23
  className: "absolute -top-2.5 right-0 z-[5] h-[72px] w-[150px] bg-contain bg-center bg-no-repeat opacity-50",
28
- style: { backgroundImage: `url('${plugin.resources.default}/image/mys-logo.png')` }
24
+ style: { backgroundImage: `url('${plugin.resources.default}/image/mys-logo.webp')` }
29
25
  }
30
26
  ), /* @__PURE__ */ React.createElement("div", { className: "mb-3 flex items-center gap-2.5" }, /* @__PURE__ */ React.createElement("img", { className: "h-10 w-10 flex-none rounded-full object-cover", src: User.avatar, alt: "avatar" }), /* @__PURE__ */ React.createElement("span", { className: "min-w-0 overflow-anywhere break-words text-sm text-[#222]" }, User.nickname, " (", User.userId, ")")), AccountList && AccountList.length > 0 ? AccountList.map((account, idx) => /* @__PURE__ */ React.createElement(
31
27
  "div",
@@ -44,7 +40,7 @@ var ShowBindAccountComponent = ({
44
40
  "img",
45
41
  {
46
42
  className: "flex w-10 items-center justify-center rounded-[10px]",
47
- src: `${plugin.resources.default}/image/launcher-icon/${bindUid.gameName}.png`,
43
+ src: `${plugin.resources.default}/image/launcher-icon/${bindUid.gameName}.webp`,
48
44
  alt: bindUid.gameName
49
45
  }
50
46
  ),