karin-plugin-mys-core 1.0.4 → 1.0.6
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 +1045 -79
- 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-3BIQN6QA.js → chunk-BWFWWHCT.js} +20 -1
- package/lib/{chunk-JKZ5NRPX.js → chunk-BXA3VAQC.js} +3 -2
- package/lib/chunk-CZZETPLY.js +281 -0
- package/lib/{chunk-WQK5RDUV.js → chunk-DJTJKSNN.js} +157 -164
- package/lib/chunk-NUOK4VFP.js +72 -0
- package/lib/chunk-UC6INRYV.js +0 -0
- package/lib/chunk-UX2BDLJF.js +6 -0
- 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 +13 -5
- package/resources/image/frame-logo.png +0 -0
- package/resources/image/mys-core-logo.png +0 -0
- package/resources/styles/karin-plugin-mys-core.css +1095 -0
- package/lib/apps/MiHoYoLogin.d.ts +0 -7
- package/lib/apps/MysDevice.d.ts +0 -5
- package/lib/apps/UIDManage.d.ts +0 -10
- package/lib/chunk-CDBMB57U.js +0 -52
- package/lib/chunk-NC54IKOY.js +0 -179
- 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-CZZETPLY.js";
|
|
4
|
+
import "../chunk-UX2BDLJF.js";
|
|
5
|
+
import "../chunk-NUOK4VFP.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-CZZETPLY.js";
|
|
8
|
+
import "../chunk-UX2BDLJF.js";
|
|
9
|
+
import "../chunk-NUOK4VFP.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> {
|
|
@@ -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;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ReactRender
|
|
3
|
+
} from "./chunk-NUOK4VFP.js";
|
|
4
|
+
import {
|
|
5
|
+
UserInfo
|
|
6
|
+
} from "./chunk-DJTJKSNN.js";
|
|
7
|
+
import {
|
|
8
|
+
MysGame
|
|
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
|
+
bgColor,
|
|
24
|
+
mysPlugin
|
|
25
|
+
}) => {
|
|
26
|
+
const { plugin, karin: karin2 } = Render;
|
|
27
|
+
return /* @__PURE__ */ React.createElement(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: `relative flex w-[600px] flex-col pb-10 font-[HYWenHei-55W] text-black ${bgColor}`,
|
|
31
|
+
id: "container",
|
|
32
|
+
style: { fontFamily: "HYWenHei-55W, sans-serif" }
|
|
33
|
+
},
|
|
34
|
+
children,
|
|
35
|
+
/* @__PURE__ */ React.createElement("div", { className: "absolute bottom-0 left-0 flex w-full items-center justify-center gap-4 px-4 py-2.5 text-sm" }, mysPlugin && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
|
|
36
|
+
"img",
|
|
37
|
+
{
|
|
38
|
+
src: `${mysPlugin.logoPath}`,
|
|
39
|
+
alt: "Mys Plugin Logo",
|
|
40
|
+
className: "h-6 w-6 rounde"
|
|
41
|
+
}
|
|
42
|
+
), /* @__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(
|
|
43
|
+
"img",
|
|
44
|
+
{
|
|
45
|
+
src: `${plugin.resources.default}/image/mys-core-logo.png`,
|
|
46
|
+
alt: "MysCore Logo",
|
|
47
|
+
className: "h-6 w-6 rounded-sm"
|
|
48
|
+
}
|
|
49
|
+
), /* @__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", plugin.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(
|
|
50
|
+
"img",
|
|
51
|
+
{
|
|
52
|
+
src: `${plugin.resources.default}/image/frame-logo.png`,
|
|
53
|
+
alt: "Karin Logo",
|
|
54
|
+
className: "h-6 w-6 rounded-sm"
|
|
55
|
+
}
|
|
56
|
+
), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "IS DRIVEN BY"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-1.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "Karin"), /* @__PURE__ */ React.createElement("strong", { className: "text-[10px] font-bold text-[#f2c06f]" }, "v", karin2.version)))))
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/template/ShowBindAccount/ShowBindAccount.tsx
|
|
61
|
+
import React2 from "react";
|
|
62
|
+
var ShowBindAccountComponent = ({
|
|
63
|
+
User,
|
|
64
|
+
AccountList
|
|
65
|
+
}) => {
|
|
66
|
+
const plugin = Render.plugin;
|
|
67
|
+
return /* @__PURE__ */ React2.createElement(DefaultLayoutComponent, { bgColor: "bg-[#f6f0e6]" }, /* @__PURE__ */ React2.createElement("div", { className: "px-[18px] pb-9 pt-5" }, /* @__PURE__ */ React2.createElement(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: "absolute -top-2.5 right-0 z-[5] h-[72px] w-[150px] bg-contain bg-center bg-no-repeat opacity-50",
|
|
71
|
+
style: { backgroundImage: `url('${plugin.resources.default}/image/mys-logo.png')` }
|
|
72
|
+
}
|
|
73
|
+
), /* @__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(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
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)]",
|
|
77
|
+
key: account.ltuid
|
|
78
|
+
},
|
|
79
|
+
/* @__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"))),
|
|
80
|
+
account.bindUids.map((bindUid, bindIdx) => /* @__PURE__ */ React2.createElement(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
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]" : ""}`,
|
|
84
|
+
key: bindUid.gameName
|
|
85
|
+
},
|
|
86
|
+
/* @__PURE__ */ React2.createElement(
|
|
87
|
+
"img",
|
|
88
|
+
{
|
|
89
|
+
className: "flex w-10 items-center justify-center rounded-[10px]",
|
|
90
|
+
src: `${plugin.resources.default}/image/launcher-icon/${bindUid.gameName}.png`,
|
|
91
|
+
alt: bindUid.gameName
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ React2.createElement("div", { className: "grid flex-auto grid-cols-3 gap-2" }, bindUid.uids.map((info) => /* @__PURE__ */ React2.createElement(
|
|
95
|
+
"span",
|
|
96
|
+
{
|
|
97
|
+
key: info.uid,
|
|
98
|
+
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" : ""}`
|
|
99
|
+
},
|
|
100
|
+
info.uid
|
|
101
|
+
)))
|
|
102
|
+
))
|
|
103
|
+
)) : /* @__PURE__ */ React2.createElement("div", { className: "my-3 px-5 py-5 text-center font-semibold text-[#6b6b6b]" }, "\u6682\u672A\u7ED1\u5B9A\u8D26\u53F7")));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/template/ShowBindDevice/ShowBindDevice.tsx
|
|
107
|
+
import React3 from "react";
|
|
108
|
+
|
|
109
|
+
// src/apps/UIDManage.ts
|
|
110
|
+
import karin, { handler, segment } from "node-karin";
|
|
111
|
+
var BindUID = karin.command(
|
|
112
|
+
/^#?(.*?)绑定uid(?:\s*(.+))?$/i,
|
|
113
|
+
async (e, next) => {
|
|
114
|
+
const msgMatch = e.msg.match(/^#?(?<prefix>.*?)绑定uid(?:\s*(?<uid>.+))?$/i)?.groups;
|
|
115
|
+
const Game = MysGame.match(msgMatch.prefix?.trim() || "");
|
|
116
|
+
if (!Game) return next();
|
|
117
|
+
const uid = msgMatch.uid?.trim();
|
|
118
|
+
if (!uid) {
|
|
119
|
+
e.reply("\u8BF7\u63D0\u4F9B\u8981\u7ED1\u5B9A\u7684\u6E38\u620FUID\uFF01", { at: true });
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
const userInfo = await Game.UserInfo.create(e.userId);
|
|
123
|
+
const bindUids = userInfo.bind_uids;
|
|
124
|
+
if (!(uid in bindUids)) {
|
|
125
|
+
bindUids[uid] = { perm: 0 /* BIND */, ltuid: "" };
|
|
126
|
+
}
|
|
127
|
+
await userInfo.saveUserInfo({
|
|
128
|
+
[Game.game + "-main"]: uid,
|
|
129
|
+
[Game.game + "-uids"]: bindUids
|
|
130
|
+
});
|
|
131
|
+
await handler.call(`MYS.${Game.game}.ShowUID`, { e });
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
var getMainUid = (uid, mainUid, bindUids) => {
|
|
136
|
+
if (mainUid !== uid) return mainUid;
|
|
137
|
+
const filterUids = Object.entries(bindUids).filter((value) => value[1].perm !== 4 /* DEL */);
|
|
138
|
+
if (filterUids.length > 0) return filterUids[0][0];
|
|
139
|
+
return "";
|
|
140
|
+
};
|
|
141
|
+
var UnbindUID = karin.command(
|
|
142
|
+
/^#?(.*?)(删除|解绑)uid(?:\s*(.+))?$/i,
|
|
143
|
+
async (e, next) => {
|
|
144
|
+
const msgMatch = e.msg.match(/^#?(?<prefix>.*?)(删除|解绑)uid(?:\s*(?<idx>.+))?$/i)?.groups;
|
|
145
|
+
const Game = MysGame.match(msgMatch.prefix?.trim() || "");
|
|
146
|
+
if (!Game) return next();
|
|
147
|
+
const uid = msgMatch.idx?.trim();
|
|
148
|
+
const idx = +uid.split(".")[0];
|
|
149
|
+
if (isNaN(idx)) {
|
|
150
|
+
e.reply("\u8BF7\u6B63\u786E\u63D0\u4F9B\u8981\u89E3\u7ED1\u7684\u6E38\u620FUID\u6216\u5E8F\u53F7\uFF01", { at: true });
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
const userInfo = await Game.UserInfo.create(e.userId);
|
|
154
|
+
const bindUids = userInfo.bind_uids;
|
|
155
|
+
let delUid = uid;
|
|
156
|
+
if (idx <= 1e4) {
|
|
157
|
+
const filterUids = Object.entries(bindUids).filter((value) => value[1].perm !== 4 /* DEL */);
|
|
158
|
+
if (idx > filterUids.length || idx <= 0) {
|
|
159
|
+
e.reply("UID\u5E8F\u53F7\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u8F93\u5165\uFF01", { at: true });
|
|
160
|
+
return "break";
|
|
161
|
+
}
|
|
162
|
+
delUid = filterUids[idx - 1][0];
|
|
163
|
+
}
|
|
164
|
+
if (delUid in bindUids) {
|
|
165
|
+
if (bindUids[delUid].perm === 0 /* BIND */) {
|
|
166
|
+
delete bindUids[delUid];
|
|
167
|
+
} else {
|
|
168
|
+
bindUids[delUid].perm = 4 /* DEL */;
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
e.reply("UID\u672A\u7ED1\u5B9A\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u8F93\u5165\uFF01", { at: true });
|
|
172
|
+
return "break";
|
|
173
|
+
}
|
|
174
|
+
const mainUid = getMainUid(delUid, userInfo.main_uid, bindUids);
|
|
175
|
+
await userInfo.saveUserInfo({
|
|
176
|
+
[Game.game + "-main"]: mainUid,
|
|
177
|
+
[Game.game + "-uids"]: bindUids
|
|
178
|
+
});
|
|
179
|
+
await handler.call(`MYS.${Game.game}.ShowUID`, { e });
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
var ShowBindAccountCmdFunc = async (e) => {
|
|
184
|
+
const userInfo = await UserInfo.create(e.userId, true);
|
|
185
|
+
const renderData = {
|
|
186
|
+
User: {
|
|
187
|
+
userId: e.userId,
|
|
188
|
+
avatar: await e.bot.getAvatarUrl(e.userId, 100),
|
|
189
|
+
nickname: e.contact.name
|
|
190
|
+
},
|
|
191
|
+
AccountList: []
|
|
192
|
+
};
|
|
193
|
+
const ltuidInfoList = userInfo.LtuidInfoList;
|
|
194
|
+
if (ltuidInfoList.length > 0) {
|
|
195
|
+
for (const ltuidInfo of ltuidInfoList) {
|
|
196
|
+
const data = {
|
|
197
|
+
ltuid: ltuidInfo.ltuid,
|
|
198
|
+
permission: 0 /* BIND */,
|
|
199
|
+
bindUids: []
|
|
200
|
+
};
|
|
201
|
+
if (ltuidInfo.cookie) {
|
|
202
|
+
data.permission += 1 /* CK */;
|
|
203
|
+
}
|
|
204
|
+
if (ltuidInfo.stoken) {
|
|
205
|
+
data.permission += 2 /* ST */;
|
|
206
|
+
}
|
|
207
|
+
await MysGame.forEachGame(async (Game) => {
|
|
208
|
+
const gameUserInfo = await Game.UserInfo.create(e.userId);
|
|
209
|
+
data.bindUids.push({
|
|
210
|
+
gameName: Game.name,
|
|
211
|
+
uids: Object.entries(gameUserInfo.bind_uids).filter(([, info]) => info.ltuid === ltuidInfo.ltuid).map(([uid, info]) => ({
|
|
212
|
+
uid,
|
|
213
|
+
perm: info.perm
|
|
214
|
+
}))
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
renderData.AccountList.push(data);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const image = await Render.template("ShowBindAccount", ShowBindAccountComponent, renderData, {
|
|
221
|
+
type: "png"
|
|
222
|
+
});
|
|
223
|
+
image && e.reply(segment.image(image), { at: true });
|
|
224
|
+
return true;
|
|
225
|
+
};
|
|
226
|
+
var ShowBindAccount = karin.command(
|
|
227
|
+
/^#?(米游社|mys)账号(列表)?$/i,
|
|
228
|
+
ShowBindAccountCmdFunc
|
|
229
|
+
);
|
|
230
|
+
var UnbindAccount = karin.command(
|
|
231
|
+
/^#?(删除|解绑)(米游社|mys)账号(?:\s*(.+))?$/i,
|
|
232
|
+
async (e) => {
|
|
233
|
+
const msgMatch = e.msg.match(/^#?(删除|解绑)(米游社|mys)账号(?:\s*(?<idx>.+))?$/i)?.groups;
|
|
234
|
+
const uid = msgMatch.idx?.trim();
|
|
235
|
+
const idx = +uid.split(".")[0];
|
|
236
|
+
if (isNaN(idx)) {
|
|
237
|
+
e.reply("\u8BF7\u6B63\u786E\u63D0\u4F9B\u8981\u89E3\u7ED1\u7684\u7C73\u6E38\u793EUID\u6216\u5E8F\u53F7\uFF01", { at: true });
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
const userInfo = await UserInfo.create(e.userId, true);
|
|
241
|
+
let ltuidInfo;
|
|
242
|
+
const ltuidInfoList = userInfo.LtuidInfoList;
|
|
243
|
+
if (idx < 1e4) {
|
|
244
|
+
if (idx > ltuidInfoList.length || idx <= 0) {
|
|
245
|
+
e.reply("\u7C73\u6E38\u793EUID\u5E8F\u53F7\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u8F93\u5165\uFF01", { at: true });
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
ltuidInfo = ltuidInfoList[idx - 1];
|
|
249
|
+
} else {
|
|
250
|
+
ltuidInfo = ltuidInfoList.find((info) => info.ltuid === uid);
|
|
251
|
+
if (!ltuidInfo) {
|
|
252
|
+
e.reply("\u7C73\u6E38\u793EUID\u672A\u7ED1\u5B9A\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u8F93\u5165\uFF01", { at: true });
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const ltuid = ltuidInfo.ltuid;
|
|
257
|
+
await ltuidInfo.destroy();
|
|
258
|
+
await userInfo.saveUserInfo({
|
|
259
|
+
ltuids: userInfo.ltuids.remove(ltuid),
|
|
260
|
+
stuids: userInfo.stuids.remove(ltuid)
|
|
261
|
+
});
|
|
262
|
+
await MysGame.forEachGame(async (Game) => {
|
|
263
|
+
const gameUserInfo = await Game.UserInfo.create(e.userId);
|
|
264
|
+
const bindUids = gameUserInfo.bind_uids;
|
|
265
|
+
for (const uid2 in bindUids) {
|
|
266
|
+
if (bindUids[uid2].ltuid === ltuid) {
|
|
267
|
+
bindUids[uid2].perm = 0 /* BIND */;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
return await ShowBindAccountCmdFunc(e);
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
export {
|
|
276
|
+
BindUID,
|
|
277
|
+
UnbindUID,
|
|
278
|
+
ShowBindAccountCmdFunc,
|
|
279
|
+
ShowBindAccount,
|
|
280
|
+
UnbindAccount
|
|
281
|
+
};
|