karin-plugin-mys-core 1.0.4 → 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 +13 -12
- package/lib/apps/MysDevice.js +12 -13
- package/lib/apps/UIDManage.js +13 -12
- package/lib/{array-DuqoS2wx.d.ts → array-CCexQ14j.d.ts} +1 -1
- package/lib/chunk-AY34PPJT.js +72 -0
- package/lib/{chunk-3BIQN6QA.js → chunk-BWFWWHCT.js} +20 -1
- package/lib/{chunk-JKZ5NRPX.js → chunk-BXA3VAQC.js} +3 -2
- package/lib/{chunk-WQK5RDUV.js → chunk-DJTJKSNN.js} +157 -164
- package/lib/chunk-UC6INRYV.js +0 -0
- package/lib/chunk-UX2BDLJF.js +6 -0
- package/lib/{chunk-NC54IKOY.js → chunk-ZZ5BYFNK.js} +83 -6
- 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 +1 -1
- package/lib/exports/database/dbs/sqlite3.js +1 -1
- package/lib/exports/database/dbs/table.js +1 -1
- package/lib/exports/database/index.js +8 -9
- package/lib/exports/database/tables/index.js +6 -7
- package/lib/exports/database/tables/mysAccountInfo.js +1 -1
- package/lib/exports/database/tables/mysDeviceInfo.js +2 -3
- package/lib/exports/database/tables/mysUserInfo.js +1 -1
- 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 +2 -2
- package/lib/exports/mys/api/apis.js +10 -11
- package/lib/exports/mys/api/app.js +3 -4
- package/lib/exports/mys/api/define.js +10 -11
- package/lib/exports/mys/api/index.js +13 -14
- package/lib/exports/mys/index.d.ts +3 -3
- package/lib/exports/mys/index.js +15 -17
- package/lib/exports/mys/types/index.d.ts +2 -2
- package/lib/exports/mys/types/index.js +1 -7
- package/lib/exports/mys/types/user/game.d.ts +2 -13
- package/lib/exports/mys/types/user/game.js +1 -7
- package/lib/exports/mys/types/user/index.d.ts +2 -2
- package/lib/exports/mys/types/user/index.js +1 -7
- package/lib/exports/mys/types/user/userInfo.d.ts +2 -2
- package/lib/exports/mys/user/deviceInfo.js +3 -4
- package/lib/exports/mys/user/game.d.ts +15 -4
- package/lib/exports/mys/user/game.js +5 -3
- package/lib/exports/mys/user/index.d.ts +1 -1
- package/lib/exports/mys/user/index.js +16 -15
- package/lib/exports/mys/user/userInfo.js +10 -11
- 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 -3
- 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-CDBMB57U.js +0 -52
- package/lib/chunk-T6MFN2MO.js +0 -23
- package/lib/common-Dw5l6Uud.d.ts +0 -33
- package/lib/exports/utils/render.d.ts +0 -27
- package/lib/exports/utils/render.js +0 -7
- 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-FOAQZIZ2.js} +0 -0
package/lib/apps/MiHoYoLogin.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShowBindAccountCmdFunc
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ZZ5BYFNK.js";
|
|
4
|
+
import "../chunk-UX2BDLJF.js";
|
|
5
|
+
import "../chunk-AY34PPJT.js";
|
|
4
6
|
import {
|
|
5
7
|
UserInfo,
|
|
6
8
|
fetchQRcode,
|
|
@@ -8,23 +10,24 @@ import {
|
|
|
8
10
|
getTokenByGameToken,
|
|
9
11
|
getUserFullInfo,
|
|
10
12
|
queryQRcode
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-BH4S574A.js";
|
|
13
|
-
import "../chunk-3BIQN6QA.js";
|
|
14
|
-
import "../chunk-G5W5WAY5.js";
|
|
13
|
+
} from "../chunk-DJTJKSNN.js";
|
|
15
14
|
import "../chunk-7VAWV6ZE.js";
|
|
16
15
|
import "../chunk-LJSDSOY6.js";
|
|
17
16
|
import "../chunk-CFS2WFOO.js";
|
|
18
17
|
import "../chunk-MWYDWDR4.js";
|
|
19
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-FOAQZIZ2.js";
|
|
20
19
|
import "../chunk-WCX7WZAQ.js";
|
|
20
|
+
import "../chunk-BH4S574A.js";
|
|
21
|
+
import "../chunk-BWFWWHCT.js";
|
|
22
|
+
import "../chunk-G5W5WAY5.js";
|
|
21
23
|
import "../chunk-XQWTJIT4.js";
|
|
22
24
|
import "../chunk-7SZX3RBZ.js";
|
|
25
|
+
import "../chunk-2DHTKQ34.js";
|
|
23
26
|
import "../chunk-W4DBT7AD.js";
|
|
24
27
|
import "../chunk-Z5I6A73Y.js";
|
|
28
|
+
import "../chunk-BNSHDFFN.js";
|
|
25
29
|
import "../chunk-HTH25YE2.js";
|
|
26
30
|
import "../chunk-7ZQQ76WC.js";
|
|
27
|
-
import "../chunk-BNSHDFFN.js";
|
|
28
31
|
import "../chunk-SEWEEPJN.js";
|
|
29
32
|
import "../chunk-EAVXU4Q2.js";
|
|
30
33
|
import "../chunk-G547WVGV.js";
|
|
@@ -34,18 +37,16 @@ import "../chunk-7KEG6SDX.js";
|
|
|
34
37
|
import "../chunk-FBWSEBAW.js";
|
|
35
38
|
import "../chunk-JVJQKRJ4.js";
|
|
36
39
|
import "../chunk-LYTNREAI.js";
|
|
40
|
+
import "../chunk-SHW6FHIB.js";
|
|
37
41
|
import "../chunk-K5U2O3HH.js";
|
|
38
42
|
import "../chunk-I7XZONDN.js";
|
|
39
|
-
import "../chunk-SHW6FHIB.js";
|
|
40
43
|
import "../chunk-JRH4JC43.js";
|
|
41
|
-
import "../chunk-
|
|
44
|
+
import "../chunk-UC6INRYV.js";
|
|
42
45
|
import {
|
|
43
46
|
common_exports
|
|
44
47
|
} from "../chunk-LG34FPBI.js";
|
|
45
|
-
import "../chunk-CDBMB57U.js";
|
|
46
|
-
import "../chunk-2DHTKQ34.js";
|
|
47
48
|
import "../chunk-SHLPPEAY.js";
|
|
48
|
-
import "../chunk-
|
|
49
|
+
import "../chunk-BXA3VAQC.js";
|
|
49
50
|
import "../chunk-6PIXUPZ6.js";
|
|
50
51
|
import "../chunk-MLKGABMK.js";
|
|
51
52
|
|
package/lib/apps/MysDevice.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UserInfo
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import {
|
|
5
|
-
DeviceInfo
|
|
6
|
-
} from "../chunk-BH4S574A.js";
|
|
7
|
-
import "../chunk-3BIQN6QA.js";
|
|
8
|
-
import "../chunk-G5W5WAY5.js";
|
|
3
|
+
} from "../chunk-DJTJKSNN.js";
|
|
9
4
|
import "../chunk-7VAWV6ZE.js";
|
|
10
5
|
import "../chunk-LJSDSOY6.js";
|
|
11
6
|
import "../chunk-CFS2WFOO.js";
|
|
12
7
|
import "../chunk-MWYDWDR4.js";
|
|
13
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-FOAQZIZ2.js";
|
|
14
9
|
import "../chunk-WCX7WZAQ.js";
|
|
10
|
+
import {
|
|
11
|
+
DeviceInfo
|
|
12
|
+
} from "../chunk-BH4S574A.js";
|
|
13
|
+
import "../chunk-BWFWWHCT.js";
|
|
14
|
+
import "../chunk-G5W5WAY5.js";
|
|
15
15
|
import "../chunk-XQWTJIT4.js";
|
|
16
16
|
import "../chunk-7SZX3RBZ.js";
|
|
17
|
+
import "../chunk-2DHTKQ34.js";
|
|
17
18
|
import "../chunk-W4DBT7AD.js";
|
|
18
19
|
import "../chunk-Z5I6A73Y.js";
|
|
20
|
+
import "../chunk-BNSHDFFN.js";
|
|
19
21
|
import "../chunk-HTH25YE2.js";
|
|
20
22
|
import "../chunk-7ZQQ76WC.js";
|
|
21
|
-
import "../chunk-BNSHDFFN.js";
|
|
22
23
|
import "../chunk-SEWEEPJN.js";
|
|
23
24
|
import "../chunk-EAVXU4Q2.js";
|
|
24
25
|
import "../chunk-G547WVGV.js";
|
|
@@ -28,16 +29,14 @@ import "../chunk-7KEG6SDX.js";
|
|
|
28
29
|
import "../chunk-FBWSEBAW.js";
|
|
29
30
|
import "../chunk-JVJQKRJ4.js";
|
|
30
31
|
import "../chunk-LYTNREAI.js";
|
|
32
|
+
import "../chunk-SHW6FHIB.js";
|
|
31
33
|
import "../chunk-K5U2O3HH.js";
|
|
32
34
|
import "../chunk-I7XZONDN.js";
|
|
33
|
-
import "../chunk-SHW6FHIB.js";
|
|
34
35
|
import "../chunk-JRH4JC43.js";
|
|
35
|
-
import "../chunk-
|
|
36
|
+
import "../chunk-UC6INRYV.js";
|
|
36
37
|
import "../chunk-LG34FPBI.js";
|
|
37
|
-
import "../chunk-CDBMB57U.js";
|
|
38
|
-
import "../chunk-2DHTKQ34.js";
|
|
39
38
|
import "../chunk-SHLPPEAY.js";
|
|
40
|
-
import "../chunk-
|
|
39
|
+
import "../chunk-BXA3VAQC.js";
|
|
41
40
|
import "../chunk-6PIXUPZ6.js";
|
|
42
41
|
import "../chunk-MLKGABMK.js";
|
|
43
42
|
|
package/lib/apps/UIDManage.js
CHANGED
|
@@ -4,24 +4,27 @@ import {
|
|
|
4
4
|
ShowBindAccountCmdFunc,
|
|
5
5
|
UnbindAccount,
|
|
6
6
|
UnbindUID
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-G5W5WAY5.js";
|
|
7
|
+
} from "../chunk-ZZ5BYFNK.js";
|
|
8
|
+
import "../chunk-UX2BDLJF.js";
|
|
9
|
+
import "../chunk-AY34PPJT.js";
|
|
10
|
+
import "../chunk-DJTJKSNN.js";
|
|
12
11
|
import "../chunk-7VAWV6ZE.js";
|
|
13
12
|
import "../chunk-LJSDSOY6.js";
|
|
14
13
|
import "../chunk-CFS2WFOO.js";
|
|
15
14
|
import "../chunk-MWYDWDR4.js";
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-FOAQZIZ2.js";
|
|
17
16
|
import "../chunk-WCX7WZAQ.js";
|
|
17
|
+
import "../chunk-BH4S574A.js";
|
|
18
|
+
import "../chunk-BWFWWHCT.js";
|
|
19
|
+
import "../chunk-G5W5WAY5.js";
|
|
18
20
|
import "../chunk-XQWTJIT4.js";
|
|
19
21
|
import "../chunk-7SZX3RBZ.js";
|
|
22
|
+
import "../chunk-2DHTKQ34.js";
|
|
20
23
|
import "../chunk-W4DBT7AD.js";
|
|
21
24
|
import "../chunk-Z5I6A73Y.js";
|
|
25
|
+
import "../chunk-BNSHDFFN.js";
|
|
22
26
|
import "../chunk-HTH25YE2.js";
|
|
23
27
|
import "../chunk-7ZQQ76WC.js";
|
|
24
|
-
import "../chunk-BNSHDFFN.js";
|
|
25
28
|
import "../chunk-SEWEEPJN.js";
|
|
26
29
|
import "../chunk-EAVXU4Q2.js";
|
|
27
30
|
import "../chunk-G547WVGV.js";
|
|
@@ -31,16 +34,14 @@ import "../chunk-7KEG6SDX.js";
|
|
|
31
34
|
import "../chunk-FBWSEBAW.js";
|
|
32
35
|
import "../chunk-JVJQKRJ4.js";
|
|
33
36
|
import "../chunk-LYTNREAI.js";
|
|
37
|
+
import "../chunk-SHW6FHIB.js";
|
|
34
38
|
import "../chunk-K5U2O3HH.js";
|
|
35
39
|
import "../chunk-I7XZONDN.js";
|
|
36
|
-
import "../chunk-SHW6FHIB.js";
|
|
37
40
|
import "../chunk-JRH4JC43.js";
|
|
38
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-UC6INRYV.js";
|
|
39
42
|
import "../chunk-LG34FPBI.js";
|
|
40
|
-
import "../chunk-CDBMB57U.js";
|
|
41
|
-
import "../chunk-2DHTKQ34.js";
|
|
42
43
|
import "../chunk-SHLPPEAY.js";
|
|
43
|
-
import "../chunk-
|
|
44
|
+
import "../chunk-BXA3VAQC.js";
|
|
44
45
|
import "../chunk-6PIXUPZ6.js";
|
|
45
46
|
import "../chunk-MLKGABMK.js";
|
|
46
47
|
export {
|
|
@@ -23,7 +23,7 @@ declare class Config<C extends Record<string, any>> {
|
|
|
23
23
|
* @description 立即保存配置
|
|
24
24
|
*/
|
|
25
25
|
save(): void;
|
|
26
|
-
watch(): this;
|
|
26
|
+
watch(fnc?: (self: Config<C>, oldData: C, newData: C) => Promise<void> | void): this;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
declare class EnhancedArray<T> extends Array<T> {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
common_exports
|
|
3
|
+
} from "./chunk-LG34FPBI.js";
|
|
4
|
+
|
|
5
|
+
// src/exports/render/render.ts
|
|
6
|
+
import karin, { config, existToMkdirSync, karinPathBase } from "node-karin";
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { renderToString } from "react-dom/server";
|
|
11
|
+
var ReactRender = class {
|
|
12
|
+
#renderCfg;
|
|
13
|
+
#pluginOptions;
|
|
14
|
+
constructor(cfg, pluginOptions = {}) {
|
|
15
|
+
this.#renderCfg = cfg;
|
|
16
|
+
this.#pluginOptions = pluginOptions;
|
|
17
|
+
}
|
|
18
|
+
get plugin() {
|
|
19
|
+
return {
|
|
20
|
+
...this.#pluginOptions,
|
|
21
|
+
name: this.#renderCfg.name,
|
|
22
|
+
version: this.#renderCfg.version,
|
|
23
|
+
resources: {
|
|
24
|
+
default: path.join(this.#renderCfg.pluginDir, "resources").replace(/\\/g, "/"),
|
|
25
|
+
download: this.#renderCfg.ResourcesDir.replace(/\\/g, "/")
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
get karin() {
|
|
30
|
+
return {
|
|
31
|
+
version: config.pkg().version
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async template(template, component, props, options = {}) {
|
|
35
|
+
const element = React.createElement(component, props);
|
|
36
|
+
const appHtml = renderToString(element);
|
|
37
|
+
const cssPath = path.join(this.plugin.resources.default, "styles", `${this.#renderCfg.name}.css`).replace(/\\/g, "/");
|
|
38
|
+
const Html = `
|
|
39
|
+
<!DOCTYPE html>
|
|
40
|
+
<html lang="zh-CN">
|
|
41
|
+
<head>
|
|
42
|
+
<meta charset="UTF-8">
|
|
43
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
44
|
+
<link rel="stylesheet" href="${cssPath}">
|
|
45
|
+
</head>
|
|
46
|
+
<body>
|
|
47
|
+
${appHtml}
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
|
50
|
+
`;
|
|
51
|
+
const saveDir = path.join(karinPathBase, "temp", "html", this.#renderCfg.name, template);
|
|
52
|
+
existToMkdirSync(saveDir);
|
|
53
|
+
const savePath = path.join(saveDir, `${options.render?.name || template}-${common_exports.randomString(8, "Lower")}.html`).replace(/\\/g, "/");
|
|
54
|
+
fs.writeFileSync(savePath, Html, "utf-8");
|
|
55
|
+
const image = await karin.render({
|
|
56
|
+
type: options.type || "jpeg",
|
|
57
|
+
omitBackground: options.type === "png",
|
|
58
|
+
selector: "container",
|
|
59
|
+
setViewport: {
|
|
60
|
+
deviceScaleFactor: 2
|
|
61
|
+
},
|
|
62
|
+
...options.render || {},
|
|
63
|
+
file: savePath
|
|
64
|
+
});
|
|
65
|
+
if (!image) return null;
|
|
66
|
+
return "base64://" + image;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
ReactRender
|
|
72
|
+
};
|
|
@@ -21,7 +21,26 @@ var MysGame = new class MysGame2 {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}();
|
|
24
|
+
var RegisterGameBase = class {
|
|
25
|
+
game;
|
|
26
|
+
columnKey;
|
|
27
|
+
/** @description 游戏名称 */
|
|
28
|
+
name;
|
|
29
|
+
/** @description 指令前缀匹配 */
|
|
30
|
+
prefix;
|
|
31
|
+
refresh;
|
|
32
|
+
UserInfo;
|
|
33
|
+
constructor(game, name, prefix, userInfo, refreshFuc) {
|
|
34
|
+
this.game = game;
|
|
35
|
+
this.columnKey = `${game}-uids`;
|
|
36
|
+
this.name = name;
|
|
37
|
+
this.prefix = prefix;
|
|
38
|
+
this.UserInfo = userInfo;
|
|
39
|
+
this.refresh = refreshFuc;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
24
42
|
|
|
25
43
|
export {
|
|
26
|
-
MysGame
|
|
44
|
+
MysGame,
|
|
45
|
+
RegisterGameBase
|
|
27
46
|
};
|
|
@@ -117,8 +117,9 @@ var Config = class {
|
|
|
117
117
|
logger.error(err);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
watch() {
|
|
121
|
-
watch(this.#ConfigPath, () => {
|
|
120
|
+
watch(fnc) {
|
|
121
|
+
watch(this.#ConfigPath, async (oldData, newData) => {
|
|
122
|
+
fnc && await fnc(this, oldData, newData);
|
|
122
123
|
this.loadConfig();
|
|
123
124
|
});
|
|
124
125
|
return this;
|
|
@@ -3,32 +3,32 @@ import {
|
|
|
3
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
|
+
MysDeviceInfoDB
|
|
13
|
+
} from "./chunk-BNSHDFFN.js";
|
|
11
14
|
import {
|
|
12
15
|
MysUserInfoDB
|
|
13
16
|
} from "./chunk-HTH25YE2.js";
|
|
14
17
|
import {
|
|
15
18
|
MysAccountInfoDB
|
|
16
19
|
} from "./chunk-7ZQQ76WC.js";
|
|
17
|
-
import {
|
|
18
|
-
MysDeviceInfoDB
|
|
19
|
-
} from "./chunk-BNSHDFFN.js";
|
|
20
20
|
import {
|
|
21
21
|
common_exports
|
|
22
22
|
} from "./chunk-LG34FPBI.js";
|
|
23
|
-
import {
|
|
24
|
-
RenderTemplate
|
|
25
|
-
} from "./chunk-CDBMB57U.js";
|
|
26
23
|
import {
|
|
27
24
|
dir
|
|
28
25
|
} from "./chunk-SHLPPEAY.js";
|
|
29
26
|
import {
|
|
30
27
|
Config
|
|
31
|
-
} from "./chunk-
|
|
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
|
};
|
|
File without changes
|