karin-plugin-mys-core 1.0.3 → 1.0.5
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.
- package/README.md +1031 -76
- package/lib/apps/MiHoYoLogin.js +19 -18
- package/lib/apps/MysDevice.js +16 -17
- package/lib/apps/UIDManage.js +17 -16
- package/lib/{array-DuqoS2wx.d.ts → array-CCexQ14j.d.ts} +1 -1
- package/lib/{chunk-KN5SHBVI.js → chunk-7ZQQ76WC.js} +1 -1
- package/lib/chunk-AY34PPJT.js +72 -0
- package/lib/{chunk-COKAJ7V6.js → chunk-BH4S574A.js} +1 -1
- package/lib/{chunk-UVMX6WUC.js → chunk-BNSHDFFN.js} +4 -4
- package/lib/{chunk-3BIQN6QA.js → chunk-BWFWWHCT.js} +20 -1
- package/lib/{chunk-JKZ5NRPX.js → chunk-BXA3VAQC.js} +3 -2
- package/lib/{chunk-RWBRS7SA.js → chunk-DJTJKSNN.js} +162 -169
- package/lib/{chunk-5NA7ZPDS.js → chunk-EAVXU4Q2.js} +3 -0
- package/lib/{chunk-7WESXE4X.js → chunk-HTH25YE2.js} +1 -1
- package/lib/chunk-UX2BDLJF.js +6 -0
- package/lib/chunk-WCX7WZAQ.js +0 -0
- package/lib/{chunk-HNODD2IL.js → chunk-ZZ5BYFNK.js} +83 -6
- package/lib/{define-BWuQ7acM.d.ts → define-B9r20dK6.d.ts} +4 -5
- package/lib/exports/config/array.d.ts +1 -1
- package/lib/exports/config/config.d.ts +1 -1
- package/lib/exports/config/config.js +1 -1
- package/lib/exports/config/index.d.ts +1 -1
- package/lib/exports/config/index.js +1 -1
- package/lib/exports/database/database.js +1 -1
- package/lib/exports/database/dbs/base.js +1 -1
- package/lib/exports/database/dbs/index.js +2 -2
- package/lib/exports/database/dbs/sqlite3.js +1 -1
- package/lib/exports/database/dbs/table.d.ts +3 -0
- package/lib/exports/database/dbs/table.js +2 -2
- package/lib/exports/database/index.js +12 -13
- package/lib/exports/database/tables/index.js +10 -11
- package/lib/exports/database/tables/mysAccountInfo.js +3 -3
- package/lib/exports/database/tables/mysDeviceInfo.js +5 -6
- package/lib/exports/database/tables/mysUserInfo.js +3 -3
- package/lib/exports/database/types/index.js +3 -3
- package/lib/exports/database/types/tables/index.js +3 -3
- package/lib/exports/mys/api/apis.d.ts +5 -5
- package/lib/exports/mys/api/apis.js +14 -15
- package/lib/exports/mys/api/app.js +7 -8
- package/lib/exports/mys/api/define.d.ts +1 -1
- package/lib/exports/mys/api/define.js +14 -15
- package/lib/exports/mys/api/index.d.ts +2 -2
- package/lib/exports/mys/api/index.js +17 -18
- package/lib/exports/mys/index.d.ts +5 -3
- package/lib/exports/mys/index.js +20 -22
- package/lib/exports/mys/types/api/define.d.ts +1 -1
- package/lib/exports/mys/types/api/index.d.ts +1 -1
- package/lib/exports/mys/types/index.d.ts +4 -2
- package/lib/exports/mys/types/index.js +1 -7
- package/lib/exports/mys/types/user/game.d.ts +17 -4
- package/lib/exports/mys/types/user/index.d.ts +4 -2
- package/lib/exports/mys/types/user/index.js +1 -7
- package/lib/exports/mys/types/user/userInfo.d.ts +40 -8
- package/lib/exports/mys/types/user/userInfo.js +1 -7
- package/lib/exports/mys/user/deviceInfo.js +8 -9
- package/lib/exports/mys/user/game.d.ts +16 -3
- package/lib/exports/mys/user/game.js +5 -3
- package/lib/exports/mys/user/index.d.ts +5 -3
- package/lib/exports/mys/user/index.js +20 -19
- package/lib/exports/mys/user/userInfo.d.ts +49 -6
- package/lib/exports/mys/user/userInfo.js +14 -15
- package/lib/exports/render/index.d.ts +3 -0
- package/lib/exports/render/index.js +13 -0
- package/lib/exports/render/render.d.ts +38 -0
- package/lib/exports/render/render.js +9 -0
- package/lib/exports/utils/common.d.ts +33 -1
- package/lib/exports/utils/index.d.ts +1 -2
- package/lib/exports/utils/index.js +1 -5
- package/package.json +11 -2
- package/resources/styles/karin-plugin-mys-core.css +1059 -0
- package/lib/chunk-HVYNK5BN.js +0 -45
- package/lib/chunk-IVZICDGW.js +0 -19
- package/lib/common-Dw5l6Uud.d.ts +0 -33
- package/lib/exports/utils/render.d.ts +0 -21
- package/lib/exports/utils/render.js +0 -7
- package/lib/index-DEEWbZ0V.d.ts +0 -102
- package/resources/template/ShowBindAccount/index.css +0 -1
- package/resources/template/ShowBindAccount/index.html +0 -65
- package/resources/template/ShowBindDevice/index.html +0 -20
- package/resources/template/ShowBindDevice/inex.css +0 -1
- package/resources/template/layout/default.css +0 -1
- package/resources/template/layout/default.html +0 -27
- /package/lib/{chunk-ARLTXJFJ.js → chunk-UC6INRYV.js} +0 -0
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeviceInfo
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BH4S574A.js";
|
|
4
4
|
import {
|
|
5
5
|
MysGame
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BWFWWHCT.js";
|
|
7
7
|
import {
|
|
8
8
|
MysApp,
|
|
9
9
|
MysHosts
|
|
10
10
|
} from "./chunk-G5W5WAY5.js";
|
|
11
|
-
import {
|
|
12
|
-
Config
|
|
13
|
-
} from "./chunk-JKZ5NRPX.js";
|
|
14
|
-
import {
|
|
15
|
-
MysAccountInfoDB
|
|
16
|
-
} from "./chunk-KN5SHBVI.js";
|
|
17
11
|
import {
|
|
18
12
|
MysDeviceInfoDB
|
|
19
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BNSHDFFN.js";
|
|
20
14
|
import {
|
|
21
15
|
MysUserInfoDB
|
|
22
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HTH25YE2.js";
|
|
17
|
+
import {
|
|
18
|
+
MysAccountInfoDB
|
|
19
|
+
} from "./chunk-7ZQQ76WC.js";
|
|
23
20
|
import {
|
|
24
21
|
common_exports
|
|
25
22
|
} from "./chunk-LG34FPBI.js";
|
|
26
|
-
import {
|
|
27
|
-
RenderTemplate
|
|
28
|
-
} from "./chunk-HVYNK5BN.js";
|
|
29
23
|
import {
|
|
30
24
|
dir
|
|
31
25
|
} from "./chunk-SHLPPEAY.js";
|
|
26
|
+
import {
|
|
27
|
+
Config
|
|
28
|
+
} from "./chunk-BXA3VAQC.js";
|
|
29
|
+
|
|
30
|
+
// src/exports/mys/api/apis.ts
|
|
31
|
+
import lodash from "node-karin/lodash";
|
|
32
32
|
|
|
33
33
|
// src/core/config/device.ts
|
|
34
34
|
import path from "path";
|
|
@@ -43,160 +43,10 @@ var DefaultDevice = {
|
|
|
43
43
|
};
|
|
44
44
|
var DeviceCfg = new Config(`${dir.name}:device`, ConfigPath, DefaultDevice, {}).watch();
|
|
45
45
|
|
|
46
|
-
// src/core/render.ts
|
|
47
|
-
var Render = new RenderTemplate(dir);
|
|
48
|
-
|
|
49
46
|
// src/exports/mys/api/define.ts
|
|
50
47
|
import md5 from "md5";
|
|
51
48
|
import { logger, redis } from "node-karin";
|
|
52
49
|
import axios, { AxiosHeaders } from "node-karin/axios";
|
|
53
|
-
|
|
54
|
-
// src/exports/mys/user/userInfo.ts
|
|
55
|
-
var BaseUserInfo = class {
|
|
56
|
-
userId;
|
|
57
|
-
#ltuidMap = /* @__PURE__ */ new Map();
|
|
58
|
-
constructor(userId) {
|
|
59
|
-
this.userId = userId;
|
|
60
|
-
}
|
|
61
|
-
get ltuids() {
|
|
62
|
-
return this.UserInfo.ltuids;
|
|
63
|
-
}
|
|
64
|
-
get stuids() {
|
|
65
|
-
return this.UserInfo.stuids;
|
|
66
|
-
}
|
|
67
|
-
get deviceList() {
|
|
68
|
-
return this.UserInfo.deviceList;
|
|
69
|
-
}
|
|
70
|
-
get LtuidInfoList() {
|
|
71
|
-
return Array.from(this.#ltuidMap.values()).map((info) => Object.freeze(info)).sort((a, b) => +a.ltuid - +b.ltuid);
|
|
72
|
-
}
|
|
73
|
-
async initMysAccountInfo(UserInfo2, initAll) {
|
|
74
|
-
this.UserInfo = UserInfo2;
|
|
75
|
-
this.#ltuidMap.clear();
|
|
76
|
-
const idList = Array.from(/* @__PURE__ */ new Set([...UserInfo2.ltuids, ...UserInfo2.stuids]));
|
|
77
|
-
if (initAll) {
|
|
78
|
-
const MysAccountInfoList = await (await MysAccountInfoDB()).findAllByPks(idList);
|
|
79
|
-
MysAccountInfoList.forEach((MysAccountInfo) => {
|
|
80
|
-
this.#ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
|
|
81
|
-
});
|
|
82
|
-
} else {
|
|
83
|
-
const self = this;
|
|
84
|
-
const mainLtuid = self.bind_uids?.[self.main_uid]?.ltuid;
|
|
85
|
-
if (mainLtuid) {
|
|
86
|
-
const MysAccountInfo = await (await MysAccountInfoDB()).findByPk(mainLtuid);
|
|
87
|
-
MysAccountInfo && this.#ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
getLtuidInfo(ltuid) {
|
|
92
|
-
return Object.freeze(this.#ltuidMap.get(ltuid));
|
|
93
|
-
}
|
|
94
|
-
async getDeviceInfoList() {
|
|
95
|
-
return await (await MysDeviceInfoDB()).findAllByPks(this.deviceList);
|
|
96
|
-
}
|
|
97
|
-
async saveUserInfo(data) {
|
|
98
|
-
await this.UserInfo.save(data);
|
|
99
|
-
}
|
|
100
|
-
async saveMysAccountInfo(ltuid, data) {
|
|
101
|
-
let MysAccountInfo = this.#ltuidMap.get(ltuid);
|
|
102
|
-
if (!MysAccountInfo) {
|
|
103
|
-
MysAccountInfo = await (await MysAccountInfoDB()).findByPk(ltuid, true);
|
|
104
|
-
}
|
|
105
|
-
await MysAccountInfo.save(data);
|
|
106
|
-
this.#ltuidMap.set(ltuid, { ...MysAccountInfo, ...data });
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
var UserInfo = class _UserInfo extends BaseUserInfo {
|
|
110
|
-
static async create(userId, initAll = false) {
|
|
111
|
-
const userInfo = new BaseUserInfo(userId);
|
|
112
|
-
userInfo.refresh = async () => {
|
|
113
|
-
const UserInfoData = await (await MysUserInfoDB()).findByPk(userId, true);
|
|
114
|
-
await userInfo.initMysAccountInfo(UserInfoData, initAll);
|
|
115
|
-
return userInfo;
|
|
116
|
-
};
|
|
117
|
-
return await userInfo.refresh();
|
|
118
|
-
}
|
|
119
|
-
static async refreshUid(options, perm) {
|
|
120
|
-
let message = "";
|
|
121
|
-
const uids = [];
|
|
122
|
-
if (MysGame.num > 0) {
|
|
123
|
-
const res = (await getUserGameRolesByCookie.init(options).request(null)).data;
|
|
124
|
-
if (res?.retcode === 0) {
|
|
125
|
-
await MysGame.forEachGame(async (Game) => {
|
|
126
|
-
const uidList = Game.refresh(res.data.list);
|
|
127
|
-
const userInfo = await Game.UserInfo.create(options.userId);
|
|
128
|
-
const bindUids = userInfo.bind_uids;
|
|
129
|
-
uidList.forEach((uid) => {
|
|
130
|
-
if (!(uid in bindUids) || bindUids[uid].perm < perm) {
|
|
131
|
-
bindUids[uid] = {
|
|
132
|
-
perm,
|
|
133
|
-
ltuid: options.ltuid
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
uids.push({
|
|
138
|
-
name: Game.name,
|
|
139
|
-
columnKey: Game.columnKey,
|
|
140
|
-
data: bindUids
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
} else if (res?.retcode === -100) {
|
|
144
|
-
message = "Cookie\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\u6216#\u5237\u65B0Cookie\uFF01";
|
|
145
|
-
} else {
|
|
146
|
-
message = res?.message || "\u5237\u65B0UID\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF01";
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return {
|
|
150
|
-
Serv: options.type,
|
|
151
|
-
uids,
|
|
152
|
-
message
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
static async refreshCookie(stokenParams, serv) {
|
|
156
|
-
if (Array.isArray(serv)) {
|
|
157
|
-
for (const s of serv) {
|
|
158
|
-
const res2 = await _UserInfo.refreshCookie(stokenParams, s);
|
|
159
|
-
if (Object.keys(res2.cookieParams).length > 0) {
|
|
160
|
-
return res2;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return {
|
|
164
|
-
Serv: "mihoyo" /* cn */,
|
|
165
|
-
cookieParams: {},
|
|
166
|
-
message: "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01"
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
const res = (await getCookieTokenBySToken.init(null).request({
|
|
170
|
-
stoken: new URLSearchParams({
|
|
171
|
-
stoken: stokenParams.stoken,
|
|
172
|
-
mid: stokenParams.mid,
|
|
173
|
-
uid: stokenParams.stuid
|
|
174
|
-
}).toString(),
|
|
175
|
-
method: serv === "mihoyo" /* cn */ ? "GET" : "POST"
|
|
176
|
-
})).data;
|
|
177
|
-
let message = "";
|
|
178
|
-
let cookieParams = {};
|
|
179
|
-
if (res?.retcode === -100) {
|
|
180
|
-
message = "\u767B\u5F55\u72B6\u6001\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
|
|
181
|
-
} else if (res?.data?.cookie_token) {
|
|
182
|
-
cookieParams = {
|
|
183
|
-
ltuid: stokenParams.stuid,
|
|
184
|
-
ltoken: stokenParams.stoken,
|
|
185
|
-
cookie_token: res.data.cookie_token,
|
|
186
|
-
account_id: stokenParams.stuid
|
|
187
|
-
};
|
|
188
|
-
} else {
|
|
189
|
-
message = "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
|
|
190
|
-
}
|
|
191
|
-
return {
|
|
192
|
-
Serv: serv,
|
|
193
|
-
cookieParams,
|
|
194
|
-
message
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
// src/exports/mys/api/define.ts
|
|
200
50
|
var DefineApi = class {
|
|
201
51
|
#apiInfo;
|
|
202
52
|
/** @description 是否使用Fp请求 */
|
|
@@ -402,7 +252,6 @@ var DefineApi = class {
|
|
|
402
252
|
};
|
|
403
253
|
|
|
404
254
|
// src/exports/mys/api/apis.ts
|
|
405
|
-
import lodash from "node-karin/lodash";
|
|
406
255
|
var fetchQRcode = new DefineApi(
|
|
407
256
|
(self, data) => ({
|
|
408
257
|
Method: "POST",
|
|
@@ -494,7 +343,155 @@ var getDeviceFp = new DefineApi((self, data) => ({
|
|
|
494
343
|
HeaderFn: self.OkHttpHeaders
|
|
495
344
|
}));
|
|
496
345
|
|
|
346
|
+
// src/exports/mys/user/userInfo.ts
|
|
347
|
+
var BaseUserInfo = class {
|
|
348
|
+
userId;
|
|
349
|
+
ltuidMap = /* @__PURE__ */ new Map();
|
|
350
|
+
constructor(userId) {
|
|
351
|
+
this.userId = userId;
|
|
352
|
+
}
|
|
353
|
+
get ltuids() {
|
|
354
|
+
return this.UserInfo.ltuids;
|
|
355
|
+
}
|
|
356
|
+
get stuids() {
|
|
357
|
+
return this.UserInfo.stuids;
|
|
358
|
+
}
|
|
359
|
+
get deviceList() {
|
|
360
|
+
return this.UserInfo.deviceList;
|
|
361
|
+
}
|
|
362
|
+
get LtuidInfoList() {
|
|
363
|
+
return Array.from(this.ltuidMap.values()).map((info) => Object.freeze(info)).sort((a, b) => +a.ltuid - +b.ltuid);
|
|
364
|
+
}
|
|
365
|
+
async initMysAccountInfo(UserInfo2, initAll) {
|
|
366
|
+
this.UserInfo = UserInfo2;
|
|
367
|
+
this.ltuidMap.clear();
|
|
368
|
+
const idList = Array.from(/* @__PURE__ */ new Set([...UserInfo2.ltuids, ...UserInfo2.stuids]));
|
|
369
|
+
if (initAll) {
|
|
370
|
+
const MysAccountInfoList = await (await MysAccountInfoDB()).findAllByPks(idList);
|
|
371
|
+
MysAccountInfoList.forEach((MysAccountInfo) => {
|
|
372
|
+
this.ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
|
|
373
|
+
});
|
|
374
|
+
} else {
|
|
375
|
+
const self = this;
|
|
376
|
+
const mainLtuid = self.bind_uids?.[self.main_uid]?.ltuid;
|
|
377
|
+
if (mainLtuid) {
|
|
378
|
+
const MysAccountInfo = await (await MysAccountInfoDB()).findByPk(mainLtuid);
|
|
379
|
+
MysAccountInfo && this.ltuidMap.set(MysAccountInfo.ltuid, MysAccountInfo);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
getLtuidInfo(ltuid) {
|
|
384
|
+
return Object.freeze(this.ltuidMap.get(ltuid));
|
|
385
|
+
}
|
|
386
|
+
async getDeviceInfoList() {
|
|
387
|
+
return await (await MysDeviceInfoDB()).findAllByPks(this.deviceList);
|
|
388
|
+
}
|
|
389
|
+
async saveUserInfo(data) {
|
|
390
|
+
await this.UserInfo.save(data);
|
|
391
|
+
}
|
|
392
|
+
async saveMysAccountInfo(ltuid, data) {
|
|
393
|
+
let MysAccountInfo = this.ltuidMap.get(ltuid);
|
|
394
|
+
if (!MysAccountInfo) {
|
|
395
|
+
MysAccountInfo = await (await MysAccountInfoDB()).findByPk(ltuid, true);
|
|
396
|
+
}
|
|
397
|
+
await MysAccountInfo.save(data);
|
|
398
|
+
this.ltuidMap.set(ltuid, { ...MysAccountInfo, ...data });
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
var UserInfo = class _UserInfo extends BaseUserInfo {
|
|
402
|
+
static async create(userId, initAll = false) {
|
|
403
|
+
const userInfo = new BaseUserInfo(userId);
|
|
404
|
+
userInfo.refresh = async () => {
|
|
405
|
+
const UserInfoData = await (await MysUserInfoDB()).findByPk(userId, true);
|
|
406
|
+
await userInfo.initMysAccountInfo(UserInfoData, initAll);
|
|
407
|
+
return userInfo;
|
|
408
|
+
};
|
|
409
|
+
return await userInfo.refresh();
|
|
410
|
+
}
|
|
411
|
+
static async refreshUid(options, perm) {
|
|
412
|
+
let message = "";
|
|
413
|
+
const uids = [];
|
|
414
|
+
if (MysGame.num > 0) {
|
|
415
|
+
const res = (await getUserGameRolesByCookie.init(options).request(null)).data;
|
|
416
|
+
if (res?.retcode === 0) {
|
|
417
|
+
await MysGame.forEachGame(async (Game) => {
|
|
418
|
+
const uidList = Game.refresh(res.data.list);
|
|
419
|
+
const userInfo = await Game.UserInfo.create(options.userId);
|
|
420
|
+
const bindUids = userInfo.bind_uids;
|
|
421
|
+
uidList.forEach((uid) => {
|
|
422
|
+
if (!(uid in bindUids) || bindUids[uid].perm < perm) {
|
|
423
|
+
bindUids[uid] = {
|
|
424
|
+
perm,
|
|
425
|
+
ltuid: options.ltuid
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
uids.push({
|
|
430
|
+
name: Game.name,
|
|
431
|
+
columnKey: Game.columnKey,
|
|
432
|
+
data: bindUids
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
} else if (res?.retcode === -100) {
|
|
436
|
+
message = "Cookie\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\u6216#\u5237\u65B0Cookie\uFF01";
|
|
437
|
+
} else {
|
|
438
|
+
message = res?.message || "\u5237\u65B0UID\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF01";
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return {
|
|
442
|
+
Serv: options.type,
|
|
443
|
+
uids,
|
|
444
|
+
message
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
static async refreshCookie(stokenParams, serv) {
|
|
448
|
+
if (Array.isArray(serv)) {
|
|
449
|
+
for (const s of serv) {
|
|
450
|
+
const res2 = await _UserInfo.refreshCookie(stokenParams, s);
|
|
451
|
+
if (Object.keys(res2.cookieParams).length > 0) {
|
|
452
|
+
return res2;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return {
|
|
456
|
+
Serv: "mihoyo" /* cn */,
|
|
457
|
+
cookieParams: {},
|
|
458
|
+
message: "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01"
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
const res = (await getCookieTokenBySToken.init(null).request({
|
|
462
|
+
stoken: new URLSearchParams({
|
|
463
|
+
stoken: stokenParams.stoken,
|
|
464
|
+
mid: stokenParams.mid,
|
|
465
|
+
uid: stokenParams.stuid
|
|
466
|
+
}).toString(),
|
|
467
|
+
method: serv === "mihoyo" /* cn */ ? "GET" : "POST"
|
|
468
|
+
})).data;
|
|
469
|
+
let message = "";
|
|
470
|
+
let cookieParams = {};
|
|
471
|
+
if (res?.retcode === -100) {
|
|
472
|
+
message = "\u767B\u5F55\u72B6\u6001\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
|
|
473
|
+
} else if (res?.data?.cookie_token) {
|
|
474
|
+
cookieParams = {
|
|
475
|
+
ltuid: stokenParams.stuid,
|
|
476
|
+
ltoken: stokenParams.stoken,
|
|
477
|
+
cookie_token: res.data.cookie_token,
|
|
478
|
+
account_id: stokenParams.stuid
|
|
479
|
+
};
|
|
480
|
+
} else {
|
|
481
|
+
message = "\u83B7\u53D6Cookie\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\uFF01";
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
Serv: serv,
|
|
485
|
+
cookieParams,
|
|
486
|
+
message
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
|
|
497
491
|
export {
|
|
492
|
+
BaseUserInfo,
|
|
493
|
+
UserInfo,
|
|
494
|
+
DefineApi,
|
|
498
495
|
fetchQRcode,
|
|
499
496
|
queryQRcode,
|
|
500
497
|
getTokenByGameToken,
|
|
@@ -502,9 +499,5 @@ export {
|
|
|
502
499
|
getCookieTokenBySToken,
|
|
503
500
|
getUserGameRolesByCookie,
|
|
504
501
|
getUserFullInfo,
|
|
505
|
-
getDeviceFp
|
|
506
|
-
Render,
|
|
507
|
-
BaseUserInfo,
|
|
508
|
-
UserInfo,
|
|
509
|
-
DefineApi
|
|
502
|
+
getDeviceFp
|
|
510
503
|
};
|
|
@@ -9,6 +9,9 @@ var Table = class {
|
|
|
9
9
|
#DataDir;
|
|
10
10
|
#tableName;
|
|
11
11
|
#type;
|
|
12
|
+
/**
|
|
13
|
+
* @param type Db: 直接保存在sqlite数据中、 File: 保存在单个json文件中、 Dir: 保存在多个json文件的目录中、Schema中除pk外每一个键值对应一个文件 e.g tableName/user/key.json
|
|
14
|
+
*/
|
|
12
15
|
constructor(DataDir, tableName, type) {
|
|
13
16
|
this.#Database = Database.get();
|
|
14
17
|
this.#dialect = this.#Database.dialect;
|
|
File without changes
|
|
@@ -1,10 +1,87 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ReactRender
|
|
3
|
+
} from "./chunk-AY34PPJT.js";
|
|
4
|
+
import {
|
|
3
5
|
UserInfo
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DJTJKSNN.js";
|
|
5
7
|
import {
|
|
6
8
|
MysGame
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BWFWWHCT.js";
|
|
10
|
+
import {
|
|
11
|
+
dir
|
|
12
|
+
} from "./chunk-SHLPPEAY.js";
|
|
13
|
+
|
|
14
|
+
// src/template/layout/DefaultLayout.tsx
|
|
15
|
+
import React from "react";
|
|
16
|
+
|
|
17
|
+
// src/template/render.ts
|
|
18
|
+
var Render = new ReactRender(dir, {});
|
|
19
|
+
|
|
20
|
+
// src/template/layout/DefaultLayout.tsx
|
|
21
|
+
var DefaultLayoutComponent = ({
|
|
22
|
+
children
|
|
23
|
+
}) => {
|
|
24
|
+
const { plugin, karin: karin2 } = Render;
|
|
25
|
+
return /* @__PURE__ */ React.createElement(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: "relative flex w-[600px] flex-col pb-10 font-[HYWenHei-55W] text-white",
|
|
29
|
+
id: "container",
|
|
30
|
+
style: { fontFamily: "HYWenHei-55W, sans-serif" }
|
|
31
|
+
},
|
|
32
|
+
children,
|
|
33
|
+
/* @__PURE__ */ React.createElement("div", { className: "absolute bottom-0 left-0 flex w-full items-center justify-center bg-black px-0 py-2.5 text-base" }, /* @__PURE__ */ React.createElement("span", null, "Created\xA0by\xA0Karin"), /* @__PURE__ */ React.createElement("strong", { className: "pt-1.5 text-[10px] font-bold text-[#f2c06f]" }, "v", karin2.version), /* @__PURE__ */ React.createElement("span", null, "\xA0&&\xA0", plugin.name), /* @__PURE__ */ React.createElement("strong", { className: "pt-1.5 text-[10px] font-bold text-[#f2c06f]" }, "v", plugin.version))
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/template/ShowBindAccount/ShowBindAccount.tsx
|
|
38
|
+
import React2 from "react";
|
|
39
|
+
var ShowBindAccountComponent = ({
|
|
40
|
+
User,
|
|
41
|
+
AccountList
|
|
42
|
+
}) => {
|
|
43
|
+
const plugin = Render.plugin;
|
|
44
|
+
return /* @__PURE__ */ React2.createElement(DefaultLayoutComponent, null, /* @__PURE__ */ React2.createElement("div", { className: "bg-[#f6f0e6] px-[18px] pb-9 pt-5" }, /* @__PURE__ */ React2.createElement(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: "absolute -top-2.5 right-0 z-[5] h-[72px] w-[150px] bg-contain bg-center bg-no-repeat opacity-50",
|
|
48
|
+
style: { backgroundImage: `url('${plugin.resources.default}/image/mys-logo.png')` }
|
|
49
|
+
}
|
|
50
|
+
), /* @__PURE__ */ React2.createElement("div", { className: "mb-3 flex items-center gap-2.5" }, /* @__PURE__ */ React2.createElement("img", { className: "h-10 w-10 flex-none rounded-full object-cover", src: User.avatar, alt: "avatar" }), /* @__PURE__ */ React2.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__ */ React2.createElement(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: "mb-3 flex flex-col gap-1.5 rounded-lg border border-black/[0.06] bg-white p-3 shadow-[0_2px_6px_rgba(0,0,0,0.04)]",
|
|
54
|
+
key: account.ltuid
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ React2.createElement("div", { className: "relative flex items-center justify-between gap-2" }, /* @__PURE__ */ React2.createElement("span", { className: "flex text-sm font-semibold text-[#3f7dd1]" }, "MYS UID (", idx + 1, ")\uFF1A", account.ltuid), /* @__PURE__ */ React2.createElement("div", { className: "flex items-center gap-2" }, account.permission >= 1 && /* @__PURE__ */ React2.createElement("span", { className: "inline-block rounded-xl bg-gradient-to-b from-[#34bc5b] to-[#2ea94b] px-2 py-1 text-xs font-semibold text-white shadow-[0_1px_0_rgba(0,0,0,0.06)_inset]" }, "cookie"), account.permission >= 2 && /* @__PURE__ */ React2.createElement("span", { className: "inline-block rounded-xl bg-gradient-to-b from-[#f6d86a] to-[#f1c40f] px-2 py-1 text-xs font-semibold text-black/85" }, "stoken"))),
|
|
57
|
+
account.bindUids.map((bindUid, bindIdx) => /* @__PURE__ */ React2.createElement(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: `flex items-center gap-3 rounded-md px-1 py-1.5 ${bindIdx > 0 ? "relative pt-3 before:absolute before:left-[5%] before:right-0 before:top-0 before:h-px before:w-[90%] before:rounded-sm before:bg-[#3f7dd1]" : ""}`,
|
|
61
|
+
key: bindUid.gameName
|
|
62
|
+
},
|
|
63
|
+
/* @__PURE__ */ React2.createElement(
|
|
64
|
+
"img",
|
|
65
|
+
{
|
|
66
|
+
className: "flex w-10 items-center justify-center rounded-[10px]",
|
|
67
|
+
src: `${plugin.resources.default}/image/launcher-icon/${bindUid.gameName}.png`,
|
|
68
|
+
alt: bindUid.gameName
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ React2.createElement("div", { className: "grid flex-auto grid-cols-3 gap-2" }, bindUid.uids.map((info) => /* @__PURE__ */ React2.createElement(
|
|
72
|
+
"span",
|
|
73
|
+
{
|
|
74
|
+
key: info.uid,
|
|
75
|
+
className: `relative flex items-center justify-center overflow-visible break-all rounded-lg bg-black/[0.06] px-2 py-1.5 text-[13px] font-semibold text-[#111] ${info.perm === 4 ? "text-black/60 after:absolute after:left-[8%] after:right-[8%] after:top-1/2 after:h-px after:rounded-sm after:bg-[#d32f2f] after:-translate-y-1/2" : ""}`
|
|
76
|
+
},
|
|
77
|
+
info.uid
|
|
78
|
+
)))
|
|
79
|
+
))
|
|
80
|
+
)) : /* @__PURE__ */ React2.createElement("div", { className: "my-3 px-5 py-5 text-center font-semibold text-[#6b6b6b]" }, "\u6682\u672A\u7ED1\u5B9A\u8D26\u53F7")));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// src/template/ShowBindDevice/ShowBindDevice.tsx
|
|
84
|
+
import React3 from "react";
|
|
8
85
|
|
|
9
86
|
// src/apps/UIDManage.ts
|
|
10
87
|
import karin, { handler, segment } from "node-karin";
|
|
@@ -85,8 +162,8 @@ var ShowBindAccountCmdFunc = async (e) => {
|
|
|
85
162
|
const renderData = {
|
|
86
163
|
User: {
|
|
87
164
|
userId: e.userId,
|
|
88
|
-
avatar: e.
|
|
89
|
-
nickname:
|
|
165
|
+
avatar: await e.bot.getAvatarUrl(e.userId, 100),
|
|
166
|
+
nickname: e.contact.name
|
|
90
167
|
},
|
|
91
168
|
AccountList: []
|
|
92
169
|
};
|
|
@@ -117,7 +194,7 @@ var ShowBindAccountCmdFunc = async (e) => {
|
|
|
117
194
|
renderData.AccountList.push(data);
|
|
118
195
|
}
|
|
119
196
|
}
|
|
120
|
-
const image = await Render.template("ShowBindAccount", renderData);
|
|
197
|
+
const image = await Render.template("ShowBindAccount", ShowBindAccountComponent, renderData);
|
|
121
198
|
image && e.reply(segment.image(image), { at: true });
|
|
122
199
|
return true;
|
|
123
200
|
};
|
|
@@ -104,18 +104,17 @@ D extends Record<string, any> | null = null, U extends Record<string, any> | nul
|
|
|
104
104
|
row: any;
|
|
105
105
|
}>;
|
|
106
106
|
};
|
|
107
|
-
interface
|
|
107
|
+
interface BaseltuidInfoType {
|
|
108
108
|
ltuid: string;
|
|
109
109
|
type: MysAccountType;
|
|
110
110
|
/** @description 未绑定则使用deviceList中首个设备 */
|
|
111
111
|
deviceMd5: string;
|
|
112
112
|
}
|
|
113
|
-
interface
|
|
113
|
+
interface UidInfoType extends BaseltuidInfoType {
|
|
114
114
|
uid: string;
|
|
115
|
+
userId: string;
|
|
115
116
|
cookie: string;
|
|
116
117
|
stoken: string;
|
|
117
|
-
userId: string;
|
|
118
|
-
owner: boolean;
|
|
119
118
|
}
|
|
120
119
|
interface DeviceInfoType {
|
|
121
120
|
id: string;
|
|
@@ -128,4 +127,4 @@ interface DeviceInfoType {
|
|
|
128
127
|
product: string;
|
|
129
128
|
}
|
|
130
129
|
|
|
131
|
-
export { type ApiInfoFn as A, type BaseMysRes as B, type DeviceInfoType as D, type RequestResult as R, type
|
|
130
|
+
export { type ApiInfoFn as A, type BaseMysRes as B, type DeviceInfoType as D, type RequestResult as R, type UidInfoType as U, type BaseltuidInfoType as a, DefineApi as b };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { E as EnhancedArray } from '../../array-
|
|
1
|
+
export { E as EnhancedArray } from '../../array-CCexQ14j.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as Config } from '../../array-
|
|
1
|
+
export { C as Config } from '../../array-CCexQ14j.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as Config, E as EnhancedArray } from '../../array-
|
|
1
|
+
export { C as Config, E as EnhancedArray } from '../../array-CCexQ14j.js';
|
|
2
2
|
export { ConfigDefine, ConfigDefineArray } from './types/config.js';
|
|
@@ -7,9 +7,9 @@ import "../../chunk-7KEG6SDX.js";
|
|
|
7
7
|
import "../../chunk-FBWSEBAW.js";
|
|
8
8
|
import "../../chunk-JVJQKRJ4.js";
|
|
9
9
|
import "../../chunk-LYTNREAI.js";
|
|
10
|
+
import "../../chunk-SHW6FHIB.js";
|
|
10
11
|
import "../../chunk-K5U2O3HH.js";
|
|
11
12
|
import "../../chunk-I7XZONDN.js";
|
|
12
|
-
import "../../chunk-SHW6FHIB.js";
|
|
13
13
|
import "../../chunk-JRH4JC43.js";
|
|
14
14
|
import "../../chunk-SHLPPEAY.js";
|
|
15
15
|
import "../../chunk-MLKGABMK.js";
|
|
@@ -5,9 +5,9 @@ import "../../../chunk-7KEG6SDX.js";
|
|
|
5
5
|
import "../../../chunk-FBWSEBAW.js";
|
|
6
6
|
import "../../../chunk-JVJQKRJ4.js";
|
|
7
7
|
import "../../../chunk-LYTNREAI.js";
|
|
8
|
+
import "../../../chunk-SHW6FHIB.js";
|
|
8
9
|
import "../../../chunk-K5U2O3HH.js";
|
|
9
10
|
import "../../../chunk-I7XZONDN.js";
|
|
10
|
-
import "../../../chunk-SHW6FHIB.js";
|
|
11
11
|
import "../../../chunk-JRH4JC43.js";
|
|
12
12
|
import "../../../chunk-MLKGABMK.js";
|
|
13
13
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../../chunk-SEWEEPJN.js";
|
|
2
2
|
import {
|
|
3
3
|
Table
|
|
4
|
-
} from "../../../chunk-
|
|
4
|
+
} from "../../../chunk-EAVXU4Q2.js";
|
|
5
5
|
import "../../../chunk-G547WVGV.js";
|
|
6
6
|
import "../../../chunk-EMAUATE3.js";
|
|
7
7
|
import {
|
|
@@ -11,9 +11,9 @@ import "../../../chunk-7KEG6SDX.js";
|
|
|
11
11
|
import "../../../chunk-FBWSEBAW.js";
|
|
12
12
|
import "../../../chunk-JVJQKRJ4.js";
|
|
13
13
|
import "../../../chunk-LYTNREAI.js";
|
|
14
|
+
import "../../../chunk-SHW6FHIB.js";
|
|
14
15
|
import "../../../chunk-K5U2O3HH.js";
|
|
15
16
|
import "../../../chunk-I7XZONDN.js";
|
|
16
|
-
import "../../../chunk-SHW6FHIB.js";
|
|
17
17
|
import "../../../chunk-JRH4JC43.js";
|
|
18
18
|
import "../../../chunk-SHLPPEAY.js";
|
|
19
19
|
import "../../../chunk-MLKGABMK.js";
|
|
@@ -7,9 +7,9 @@ import "../../../chunk-7KEG6SDX.js";
|
|
|
7
7
|
import "../../../chunk-FBWSEBAW.js";
|
|
8
8
|
import "../../../chunk-JVJQKRJ4.js";
|
|
9
9
|
import "../../../chunk-LYTNREAI.js";
|
|
10
|
+
import "../../../chunk-SHW6FHIB.js";
|
|
10
11
|
import "../../../chunk-K5U2O3HH.js";
|
|
11
12
|
import "../../../chunk-I7XZONDN.js";
|
|
12
|
-
import "../../../chunk-SHW6FHIB.js";
|
|
13
13
|
import "../../../chunk-JRH4JC43.js";
|
|
14
14
|
import "../../../chunk-SHLPPEAY.js";
|
|
15
15
|
import "../../../chunk-MLKGABMK.js";
|
|
@@ -5,6 +5,9 @@ declare class Table<TableType extends Record<string, any>, DBType extends Databa
|
|
|
5
5
|
#private;
|
|
6
6
|
initCache: DatabaseClassInstance<TableType, DBType>;
|
|
7
7
|
modelSchema: Record<keyof TableType, ModelAttributeColumnOptions<Model>>;
|
|
8
|
+
/**
|
|
9
|
+
* @param type Db: 直接保存在sqlite数据中、 File: 保存在单个json文件中、 Dir: 保存在多个json文件的目录中、Schema中除pk外每一个键值对应一个文件 e.g tableName/user/key.json
|
|
10
|
+
*/
|
|
8
11
|
constructor(DataDir: string, tableName: string, type: DBType);
|
|
9
12
|
init(Schema: Record<keyof TableType, ModelAttributeColumnOptions<Model>>): Promise<() => Promise<DatabaseClassInstance<TableType, DBType>>>;
|
|
10
13
|
addSchem<newTableType extends ExtraTableType>(newSchema: Record<keyof newTableType, ModelAttributeColumnOptions<Model>>): Promise<() => Promise<DatabaseClassInstance<TableType & newTableType, DBType>>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Table
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-EAVXU4Q2.js";
|
|
4
4
|
import "../../../chunk-G547WVGV.js";
|
|
5
5
|
import "../../../chunk-EMAUATE3.js";
|
|
6
6
|
import "../../../chunk-Y3J3J5B2.js";
|
|
@@ -8,9 +8,9 @@ import "../../../chunk-7KEG6SDX.js";
|
|
|
8
8
|
import "../../../chunk-FBWSEBAW.js";
|
|
9
9
|
import "../../../chunk-JVJQKRJ4.js";
|
|
10
10
|
import "../../../chunk-LYTNREAI.js";
|
|
11
|
+
import "../../../chunk-SHW6FHIB.js";
|
|
11
12
|
import "../../../chunk-K5U2O3HH.js";
|
|
12
13
|
import "../../../chunk-I7XZONDN.js";
|
|
13
|
-
import "../../../chunk-SHW6FHIB.js";
|
|
14
14
|
import "../../../chunk-JRH4JC43.js";
|
|
15
15
|
import "../../../chunk-SHLPPEAY.js";
|
|
16
16
|
import "../../../chunk-MLKGABMK.js";
|