karin-plugin-mys-core 1.0.14 → 1.0.16
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/lib/apps/MiHoYoLogin.js +12 -6
- package/lib/apps/MysDevice.js +7 -6
- package/lib/apps/UIDManage.js +9 -6
- package/lib/chunk-5LRGHP36.js +0 -0
- package/lib/{chunk-KJAYW3SO.js → chunk-5ZBRGVPY.js} +47 -16
- package/lib/{chunk-V2MCX7HT.js → chunk-F42OUZOV.js} +22 -9
- package/lib/core/index.js +3 -2
- package/lib/exports/database/index.js +2 -2
- package/lib/exports/mys/index.d.ts +9 -1
- package/lib/exports/mys/index.js +5 -4
- package/lib/exports/render/index.js +2 -2
- package/lib/web.config.d.ts +10 -0
- package/lib/web.config.js +142 -0
- package/package.json +1 -1
- package/lib/{chunk-IASM5MM5.js → chunk-ER4WMJJ6.js} +3 -3
- package/lib/{chunk-A5FZEOIN.js → chunk-S3ALDDWH.js} +3 -3
- package/lib/{chunk-YFMJTWDG.js → chunk-SXPDBSIW.js} +3 -3
package/lib/apps/MiHoYoLogin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShowBindAccountCmdFunc
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-5ZBRGVPY.js";
|
|
4
|
+
import "../chunk-S3ALDDWH.js";
|
|
5
5
|
import {
|
|
6
6
|
UserInfo,
|
|
7
7
|
fetchQRcode,
|
|
@@ -9,14 +9,15 @@ import {
|
|
|
9
9
|
getTokenByGameToken,
|
|
10
10
|
getUserFullInfo,
|
|
11
11
|
queryQRcode
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-F42OUZOV.js";
|
|
13
|
+
import "../chunk-ER4WMJJ6.js";
|
|
14
|
+
import "../chunk-5LRGHP36.js";
|
|
15
|
+
import "../chunk-SXPDBSIW.js";
|
|
16
16
|
import "../chunk-UIPRZFST.js";
|
|
17
17
|
import {
|
|
18
18
|
common_exports
|
|
19
19
|
} from "../chunk-RX4VMVAI.js";
|
|
20
|
+
import "../chunk-SHLPPEAY.js";
|
|
20
21
|
import "../chunk-MLKGABMK.js";
|
|
21
22
|
|
|
22
23
|
// src/apps/MiHoYoLogin.ts
|
|
@@ -226,6 +227,7 @@ var BindCookie = async (userId, cookieObj, perm, Serv) => {
|
|
|
226
227
|
return {
|
|
227
228
|
Serv: Serv || "mihoyo" /* cn */,
|
|
228
229
|
uids: [],
|
|
230
|
+
mains: [],
|
|
229
231
|
message: errMsg.pop() || ""
|
|
230
232
|
};
|
|
231
233
|
})();
|
|
@@ -249,6 +251,10 @@ var BindCookie = async (userId, cookieObj, perm, Serv) => {
|
|
|
249
251
|
acc[cur.columnKey] = cur.data;
|
|
250
252
|
return acc;
|
|
251
253
|
}, {}),
|
|
254
|
+
...uidList.mains.reduce((acc, cur) => {
|
|
255
|
+
acc[cur.columnKey] = cur.data;
|
|
256
|
+
return acc;
|
|
257
|
+
}, {}),
|
|
252
258
|
ltuids: userInfo.ltuids.add(cookieParams.ltuid, true)
|
|
253
259
|
});
|
|
254
260
|
await userInfo.saveMysAccountInfo(cookieParams.ltuid, {
|
package/lib/apps/MysDevice.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeviceInfo,
|
|
3
3
|
UserInfo
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-F42OUZOV.js";
|
|
5
|
+
import "../chunk-ER4WMJJ6.js";
|
|
6
|
+
import "../chunk-5LRGHP36.js";
|
|
7
|
+
import "../chunk-SXPDBSIW.js";
|
|
8
8
|
import "../chunk-UIPRZFST.js";
|
|
9
9
|
import "../chunk-RX4VMVAI.js";
|
|
10
|
+
import "../chunk-SHLPPEAY.js";
|
|
10
11
|
import "../chunk-MLKGABMK.js";
|
|
11
12
|
|
|
12
13
|
// src/apps/MysDevice.ts
|
|
@@ -19,13 +20,13 @@ var BindMysDevice = karin.command(
|
|
|
19
20
|
const cnLtuidInfoList = ltuidInfoList.filter((info) => info.type === "mihoyo" /* cn */);
|
|
20
21
|
if (cnLtuidInfoList.length === 0) {
|
|
21
22
|
if (ltuidInfoList.length === 0) {
|
|
22
|
-
e.reply("\u6682\u672A\u7ED1\u5B9A\u56FD\u670D\u7C73\u6E38\u793E\u8D26\u53F7\uFF0C\u8BF7\u5148\u201C#\u7C73\u6E38\u793E\
|
|
23
|
+
e.reply("\u6682\u672A\u7ED1\u5B9A\u56FD\u670D\u7C73\u6E38\u793E\u8D26\u53F7\uFF0C\u8BF7\u5148\u4F7F\u7528 \u201C#\u7C73\u6E38\u793E\u767B\u5F55\u201D \u8FDB\u884C\u7ED1\u5B9A\uFF01", { at: true });
|
|
23
24
|
} else {
|
|
24
25
|
e.reply("\u56FD\u9645\u670D\u6682\u4E0D\u9700\u8981\u7ED1\u5B9A\u8BBE\u5907\u3002", { at: true });
|
|
25
26
|
}
|
|
26
27
|
return true;
|
|
27
28
|
}
|
|
28
|
-
e.reply("\u8BF7\u53D1\u9001\u8BBE\u5907\u4FE1\u606F(\u5EFA\u8BAE\u79C1\u804A\u53D1\u9001)\uFF0C\u6216\u8005\u53D1\u9001\u201C\u53D6\u6D88\u201D\u53D6\u6D88\u7ED1\u5B9A", { at: true });
|
|
29
|
+
e.reply("\u8BF7\u53D1\u9001\u8BBE\u5907\u4FE1\u606F(\u5EFA\u8BAE\u79C1\u804A\u53D1\u9001)\uFF0C\u6216\u8005\u53D1\u9001 \u201C\u53D6\u6D88\u201D \u53D6\u6D88\u7ED1\u5B9A", { at: true });
|
|
29
30
|
const ctx = await karin.ctx(e);
|
|
30
31
|
if (/^#?取消(绑定)?/.test(ctx.msg)) {
|
|
31
32
|
e.reply("\u5DF2\u53D6\u6D88\u7ED1\u5B9A", { at: true });
|
package/lib/apps/UIDManage.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BindUID,
|
|
3
|
+
ChangeMainUID,
|
|
3
4
|
ShowBindAccount,
|
|
4
5
|
ShowBindAccountCmdFunc,
|
|
5
6
|
UnbindAccount,
|
|
6
7
|
UnbindUID
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-5ZBRGVPY.js";
|
|
9
|
+
import "../chunk-S3ALDDWH.js";
|
|
10
|
+
import "../chunk-F42OUZOV.js";
|
|
11
|
+
import "../chunk-ER4WMJJ6.js";
|
|
12
|
+
import "../chunk-5LRGHP36.js";
|
|
13
|
+
import "../chunk-SXPDBSIW.js";
|
|
13
14
|
import "../chunk-UIPRZFST.js";
|
|
14
15
|
import "../chunk-RX4VMVAI.js";
|
|
16
|
+
import "../chunk-SHLPPEAY.js";
|
|
15
17
|
import "../chunk-MLKGABMK.js";
|
|
16
18
|
export {
|
|
17
19
|
BindUID,
|
|
20
|
+
ChangeMainUID,
|
|
18
21
|
ShowBindAccount,
|
|
19
22
|
ShowBindAccountCmdFunc,
|
|
20
23
|
UnbindAccount,
|
|
File without changes
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
DefaultLayoutComponent,
|
|
3
3
|
React,
|
|
4
4
|
ReactRender
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-S3ALDDWH.js";
|
|
6
6
|
import {
|
|
7
7
|
MysGame,
|
|
8
8
|
UserInfo
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-F42OUZOV.js";
|
|
10
10
|
import {
|
|
11
11
|
dir
|
|
12
12
|
} from "./chunk-SHLPPEAY.js";
|
|
@@ -78,19 +78,13 @@ var BindUID = karin.command(
|
|
|
78
78
|
bindUids[uid] = { perm: 0 /* BIND */, ltuid: "" };
|
|
79
79
|
}
|
|
80
80
|
await userInfo.saveUserInfo({
|
|
81
|
-
[Game.
|
|
82
|
-
[Game.
|
|
81
|
+
[Game.columnKey.main]: uid,
|
|
82
|
+
[Game.columnKey.uids]: bindUids
|
|
83
83
|
});
|
|
84
84
|
await handler.call(`MYS.${Game.game}.ShowUID`, { e });
|
|
85
85
|
return true;
|
|
86
86
|
}
|
|
87
87
|
);
|
|
88
|
-
var getMainUid = (uid, mainUid, bindUids) => {
|
|
89
|
-
if (mainUid !== uid) return mainUid;
|
|
90
|
-
const filterUids = Object.entries(bindUids).filter((value) => value[1].perm !== 4 /* DEL */);
|
|
91
|
-
if (filterUids.length > 0) return filterUids[0][0];
|
|
92
|
-
return "";
|
|
93
|
-
};
|
|
94
88
|
var UnbindUID = karin.command(
|
|
95
89
|
/^#?(.*?)(删除|解绑)uid(?:\s*(.+))?$/i,
|
|
96
90
|
async (e, next) => {
|
|
@@ -124,10 +118,49 @@ var UnbindUID = karin.command(
|
|
|
124
118
|
e.reply("UID\u672A\u7ED1\u5B9A\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u8F93\u5165\uFF01", { at: true });
|
|
125
119
|
return "break";
|
|
126
120
|
}
|
|
121
|
+
const getMainUid = (uid2, mainUid2, bindUids2) => {
|
|
122
|
+
if (mainUid2 !== uid2) return mainUid2;
|
|
123
|
+
const filterUids = Object.entries(bindUids2).filter((value) => value[1].perm !== 4 /* DEL */);
|
|
124
|
+
if (filterUids.length > 0) return filterUids[0][0];
|
|
125
|
+
return "";
|
|
126
|
+
};
|
|
127
127
|
const mainUid = getMainUid(delUid, userInfo.main_uid, bindUids);
|
|
128
128
|
await userInfo.saveUserInfo({
|
|
129
|
-
[Game.
|
|
130
|
-
[Game.
|
|
129
|
+
[Game.columnKey.main]: mainUid,
|
|
130
|
+
[Game.columnKey.uids]: bindUids
|
|
131
|
+
});
|
|
132
|
+
await handler.call(`MYS.${Game.game}.ShowUID`, { e });
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
var ChangeMainUID = karin.command(
|
|
137
|
+
/^#?(.*?)(切换|更改)uid(?:\s*(.+))?$/i,
|
|
138
|
+
async (e, next) => {
|
|
139
|
+
const msgMatch = e.msg.match(/^#?(?<prefix>.*?)(切换|更改)uid(?:\s*(?<idx>.+))?$/i)?.groups;
|
|
140
|
+
const Game = MysGame.match(msgMatch.prefix?.trim() || "");
|
|
141
|
+
if (!Game) return next();
|
|
142
|
+
const uid = msgMatch.idx?.trim();
|
|
143
|
+
const idx = +uid.split(".")[0];
|
|
144
|
+
if (isNaN(idx)) {
|
|
145
|
+
e.reply("\u8BF7\u6B63\u786E\u63D0\u4F9B\u8981\u5207\u6362\u7684\u6E38\u620FUID\u6216\u5E8F\u53F7\uFF01", { at: true });
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
const userInfo = await Game.UserInfo.create(e.userId);
|
|
149
|
+
let mainUid = uid;
|
|
150
|
+
const bindUids = userInfo.bind_uids;
|
|
151
|
+
if (idx <= 1e4) {
|
|
152
|
+
const filterUids = Object.entries(bindUids).filter((value) => value[1].perm !== 4 /* DEL */);
|
|
153
|
+
if (idx > filterUids.length || idx <= 0) {
|
|
154
|
+
e.reply("UID\u5E8F\u53F7\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u8F93\u5165\uFF01", { at: true });
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
mainUid = filterUids[idx - 1][0];
|
|
158
|
+
} else if (!bindUids[mainUid] || bindUids[mainUid].perm === 4 /* DEL */) {
|
|
159
|
+
e.reply("UID\u672A\u7ED1\u5B9A\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u8F93\u5165\uFF01", { at: true });
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
await userInfo.saveUserInfo({
|
|
163
|
+
[Game.columnKey.main]: mainUid
|
|
131
164
|
});
|
|
132
165
|
await handler.call(`MYS.${Game.game}.ShowUID`, { e });
|
|
133
166
|
return true;
|
|
@@ -161,10 +194,7 @@ var ShowBindAccountCmdFunc = async (e) => {
|
|
|
161
194
|
const gameUserInfo = await Game.UserInfo.create(e.userId);
|
|
162
195
|
data.bindUids.push({
|
|
163
196
|
gameName: Game.name,
|
|
164
|
-
uids: Object.entries(gameUserInfo.bind_uids).filter(([, info]) => info.ltuid === ltuidInfo.ltuid).map(([uid, info]) => ({
|
|
165
|
-
uid,
|
|
166
|
-
perm: info.perm
|
|
167
|
-
}))
|
|
197
|
+
uids: Object.entries(gameUserInfo.bind_uids).filter(([, info]) => info.ltuid === ltuidInfo.ltuid).map(([uid, info]) => ({ uid, perm: info.perm }))
|
|
168
198
|
});
|
|
169
199
|
});
|
|
170
200
|
renderData.AccountList.push(data);
|
|
@@ -228,6 +258,7 @@ var UnbindAccount = karin.command(
|
|
|
228
258
|
export {
|
|
229
259
|
BindUID,
|
|
230
260
|
UnbindUID,
|
|
261
|
+
ChangeMainUID,
|
|
231
262
|
ShowBindAccountCmdFunc,
|
|
232
263
|
ShowBindAccount,
|
|
233
264
|
UnbindAccount
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
MysAccountInfoDB,
|
|
3
3
|
MysDeviceInfoDB,
|
|
4
4
|
MysUserInfoDB
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ER4WMJJ6.js";
|
|
6
6
|
import {
|
|
7
7
|
DeviceCfg
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
dir
|
|
11
|
-
} from "./chunk-SHLPPEAY.js";
|
|
8
|
+
} from "./chunk-SXPDBSIW.js";
|
|
12
9
|
import {
|
|
13
10
|
common_exports
|
|
14
11
|
} from "./chunk-RX4VMVAI.js";
|
|
12
|
+
import {
|
|
13
|
+
dir
|
|
14
|
+
} from "./chunk-SHLPPEAY.js";
|
|
15
15
|
|
|
16
16
|
// src/exports/mys/api/apis.ts
|
|
17
17
|
import lodash2 from "node-karin/lodash";
|
|
@@ -119,7 +119,7 @@ var MysGame = new class MysGame2 {
|
|
|
119
119
|
return void 0;
|
|
120
120
|
}
|
|
121
121
|
RegisterGame(Game) {
|
|
122
|
-
this.#games.set(Game.
|
|
122
|
+
this.#games.set(Game.game, Game);
|
|
123
123
|
}
|
|
124
124
|
async forEachGame(fn) {
|
|
125
125
|
if (this.num === 0) return;
|
|
@@ -130,7 +130,6 @@ var MysGame = new class MysGame2 {
|
|
|
130
130
|
}();
|
|
131
131
|
var RegisterGameBase = class {
|
|
132
132
|
game;
|
|
133
|
-
columnKey;
|
|
134
133
|
/** @description 游戏名称 */
|
|
135
134
|
name;
|
|
136
135
|
/** @description 指令前缀 */
|
|
@@ -139,12 +138,17 @@ var RegisterGameBase = class {
|
|
|
139
138
|
UserInfo;
|
|
140
139
|
constructor(game, name, prefixs, userInfo, refreshFuc) {
|
|
141
140
|
this.game = game;
|
|
142
|
-
this.columnKey = `${game}-uids`;
|
|
143
141
|
this.name = name;
|
|
144
142
|
this.prefixs = prefixs;
|
|
145
143
|
this.UserInfo = userInfo;
|
|
146
144
|
this.refresh = refreshFuc;
|
|
147
145
|
}
|
|
146
|
+
get columnKey() {
|
|
147
|
+
return {
|
|
148
|
+
uids: `${this.game}-uids`,
|
|
149
|
+
main: `${this.game}-main`
|
|
150
|
+
};
|
|
151
|
+
}
|
|
148
152
|
get prefix() {
|
|
149
153
|
return new RegExp(`^(${this.prefixs.join("|")})$`, "i");
|
|
150
154
|
}
|
|
@@ -219,6 +223,7 @@ var UserInfo = class _UserInfo extends BaseUserInfo {
|
|
|
219
223
|
static async refreshUid(options, perm) {
|
|
220
224
|
let message = "";
|
|
221
225
|
const uids = [];
|
|
226
|
+
const mains = [];
|
|
222
227
|
if (MysGame.num > 0) {
|
|
223
228
|
const res = (await (await getUserGameRolesByCookie.initDevice(options)).request(null)).data;
|
|
224
229
|
if (res?.retcode === 0) {
|
|
@@ -244,9 +249,16 @@ var UserInfo = class _UserInfo extends BaseUserInfo {
|
|
|
244
249
|
});
|
|
245
250
|
uids.push({
|
|
246
251
|
name: Game.name,
|
|
247
|
-
columnKey: Game.columnKey,
|
|
252
|
+
columnKey: Game.columnKey.uids,
|
|
248
253
|
data: bindUids
|
|
249
254
|
});
|
|
255
|
+
if (!userInfo.main_uid || !bindUids[userInfo.main_uid]) {
|
|
256
|
+
mains.push({
|
|
257
|
+
name: Game.name,
|
|
258
|
+
columnKey: Game.columnKey.main,
|
|
259
|
+
data: Array.from(uidList)[0] || ""
|
|
260
|
+
});
|
|
261
|
+
}
|
|
250
262
|
});
|
|
251
263
|
} else if (res?.retcode === -100) {
|
|
252
264
|
message = "Cookie\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0#\u626B\u7801\u767B\u5F55\u6216#\u5237\u65B0Cookie\uFF01";
|
|
@@ -257,6 +269,7 @@ var UserInfo = class _UserInfo extends BaseUserInfo {
|
|
|
257
269
|
return {
|
|
258
270
|
Serv: options.type,
|
|
259
271
|
uids,
|
|
272
|
+
mains,
|
|
260
273
|
message
|
|
261
274
|
};
|
|
262
275
|
}
|
package/lib/core/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import "../chunk-5LRGHP36.js";
|
|
1
2
|
import {
|
|
2
3
|
CoreCfg,
|
|
3
4
|
DeviceCfg
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-SHLPPEAY.js";
|
|
5
|
+
} from "../chunk-SXPDBSIW.js";
|
|
6
6
|
import "../chunk-UIPRZFST.js";
|
|
7
7
|
import "../chunk-RX4VMVAI.js";
|
|
8
|
+
import "../chunk-SHLPPEAY.js";
|
|
8
9
|
import "../chunk-MLKGABMK.js";
|
|
9
10
|
export {
|
|
10
11
|
CoreCfg,
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
Table,
|
|
15
15
|
UidPermission,
|
|
16
16
|
createTable
|
|
17
|
-
} from "../../chunk-
|
|
18
|
-
import "../../chunk-SHLPPEAY.js";
|
|
17
|
+
} from "../../chunk-ER4WMJJ6.js";
|
|
19
18
|
import "../../chunk-RX4VMVAI.js";
|
|
19
|
+
import "../../chunk-SHLPPEAY.js";
|
|
20
20
|
import "../../chunk-MLKGABMK.js";
|
|
21
21
|
export {
|
|
22
22
|
Database,
|
|
@@ -272,7 +272,6 @@ declare const MysGame: {
|
|
|
272
272
|
};
|
|
273
273
|
declare class RegisterGameBase<GameUserInfoTableType extends BaseUserInfoTableType> {
|
|
274
274
|
game: string;
|
|
275
|
-
columnKey: `${string}-uids`;
|
|
276
275
|
/** @description 游戏名称 */
|
|
277
276
|
name: gameName;
|
|
278
277
|
/** @description 指令前缀 */
|
|
@@ -286,6 +285,10 @@ declare class RegisterGameBase<GameUserInfoTableType extends BaseUserInfoTableTy
|
|
|
286
285
|
userId: string;
|
|
287
286
|
cookie: string;
|
|
288
287
|
} & BaseltuidInfoType) => Promise<string[]>);
|
|
288
|
+
get columnKey(): {
|
|
289
|
+
uids: `${string}-uids`;
|
|
290
|
+
main: `${string}-main`;
|
|
291
|
+
};
|
|
289
292
|
get prefix(): RegExp;
|
|
290
293
|
}
|
|
291
294
|
|
|
@@ -374,6 +377,11 @@ interface RefreshUidResultType {
|
|
|
374
377
|
columnKey: `${string}-uids`;
|
|
375
378
|
data: BaseGameUIDInfoTableType<string>[`${string}-uids`];
|
|
376
379
|
}[];
|
|
380
|
+
mains: {
|
|
381
|
+
name: string;
|
|
382
|
+
columnKey: `${string}-main`;
|
|
383
|
+
data: string;
|
|
384
|
+
}[];
|
|
377
385
|
message: string;
|
|
378
386
|
}
|
|
379
387
|
|
package/lib/exports/mys/index.js
CHANGED
|
@@ -15,12 +15,13 @@ import {
|
|
|
15
15
|
getUserFullInfo,
|
|
16
16
|
getUserGameRolesByCookie,
|
|
17
17
|
queryQRcode
|
|
18
|
-
} from "../../chunk-
|
|
19
|
-
import "../../chunk-
|
|
20
|
-
import "../../chunk-
|
|
21
|
-
import "../../chunk-
|
|
18
|
+
} from "../../chunk-F42OUZOV.js";
|
|
19
|
+
import "../../chunk-ER4WMJJ6.js";
|
|
20
|
+
import "../../chunk-5LRGHP36.js";
|
|
21
|
+
import "../../chunk-SXPDBSIW.js";
|
|
22
22
|
import "../../chunk-UIPRZFST.js";
|
|
23
23
|
import "../../chunk-RX4VMVAI.js";
|
|
24
|
+
import "../../chunk-SHLPPEAY.js";
|
|
24
25
|
import "../../chunk-MLKGABMK.js";
|
|
25
26
|
export {
|
|
26
27
|
BaseUserInfo,
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
DefaultLayoutComponent,
|
|
3
3
|
React,
|
|
4
4
|
ReactRender
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-SHLPPEAY.js";
|
|
5
|
+
} from "../../chunk-S3ALDDWH.js";
|
|
7
6
|
import "../../chunk-RX4VMVAI.js";
|
|
7
|
+
import "../../chunk-SHLPPEAY.js";
|
|
8
8
|
import "../../chunk-MLKGABMK.js";
|
|
9
9
|
export {
|
|
10
10
|
DefaultLayoutComponent,
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CoreCfg,
|
|
3
|
+
DeviceCfg
|
|
4
|
+
} from "./chunk-SXPDBSIW.js";
|
|
5
|
+
import "./chunk-UIPRZFST.js";
|
|
6
|
+
import "./chunk-RX4VMVAI.js";
|
|
7
|
+
import {
|
|
8
|
+
dir
|
|
9
|
+
} from "./chunk-SHLPPEAY.js";
|
|
10
|
+
import "./chunk-MLKGABMK.js";
|
|
11
|
+
|
|
12
|
+
// src/web.config.ts
|
|
13
|
+
import { components, defineConfig, logger } from "node-karin";
|
|
14
|
+
import lodash from "node-karin/lodash";
|
|
15
|
+
var FormatValue = (key, value) => {
|
|
16
|
+
const { format } = key.match(/=(?<format>.*)$/)?.groups || {};
|
|
17
|
+
switch (format) {
|
|
18
|
+
case "int":
|
|
19
|
+
return { key: key.replace(/=(.*)$/, "").replace(/-/g, "."), value: parseInt(value) };
|
|
20
|
+
case "float":
|
|
21
|
+
return { key: key.replace(/=(.*)$/, "").replace(/-/g, "."), value: parseFloat(value) };
|
|
22
|
+
default:
|
|
23
|
+
return { key: key.replace(/-/g, "."), value };
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var web_config_default = defineConfig({
|
|
27
|
+
/** 插件信息配置 */
|
|
28
|
+
info: {
|
|
29
|
+
id: dir.name,
|
|
30
|
+
name: "Mys-Core",
|
|
31
|
+
version: dir.version,
|
|
32
|
+
description: dir.pkg.description,
|
|
33
|
+
author: [
|
|
34
|
+
{
|
|
35
|
+
name: dir.pkg.author,
|
|
36
|
+
avatar: "https://github.com/babanbang.png"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
/** 动态渲染的组件 */
|
|
41
|
+
components: () => [
|
|
42
|
+
components.accordion.create("accordion-config-key" /* Config */, {
|
|
43
|
+
label: "\u57FA\u7840\u8BBE\u7F6E",
|
|
44
|
+
children: [
|
|
45
|
+
components.accordion.createItem("accordion-githubProxy-item-key", {
|
|
46
|
+
title: "GitHub \u4EE3\u7406\u8BBE\u7F6E",
|
|
47
|
+
subtitle: "\u7528\u4E8E\u4E0B\u8F7D\u63D2\u4EF6\u8D44\u6E90",
|
|
48
|
+
children: [
|
|
49
|
+
components.input.url("githubProxyUrl", {
|
|
50
|
+
label: "GitHub \u4EE3\u7406\u5730\u5740",
|
|
51
|
+
defaultValue: CoreCfg.get("githubProxyUrl")
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
}),
|
|
57
|
+
components.divider.horizontal("divider-config-end"),
|
|
58
|
+
components.accordion.create("accordion-device-key" /* Device */, {
|
|
59
|
+
label: "\u7C73\u6E38\u793E\u8BBE\u5907\u4FE1\u606F\u8BBE\u7F6E",
|
|
60
|
+
children: [
|
|
61
|
+
components.accordion.createItem("accordion-device-item-key", {
|
|
62
|
+
title: "\u5982\u679C\u4E0D\u77E5\u9053\u8FD9\u662F\u4EC0\u4E48\u8BF7\u52FF\u4FEE\u6539",
|
|
63
|
+
subtitle: "-- \u9ED8\u8BA4\u8BBE\u5907\u4FE1\u606F --",
|
|
64
|
+
className: "ml-4 mr-4",
|
|
65
|
+
children: [
|
|
66
|
+
components.input.number("version=int", {
|
|
67
|
+
defaultValue: DeviceCfg.get("version") + "",
|
|
68
|
+
label: "androidVersion",
|
|
69
|
+
rules: [
|
|
70
|
+
{ max: 15, min: 10 }
|
|
71
|
+
],
|
|
72
|
+
isRequired: true
|
|
73
|
+
}),
|
|
74
|
+
components.input.string("name", {
|
|
75
|
+
defaultValue: DeviceCfg.get("name"),
|
|
76
|
+
label: "deviceName",
|
|
77
|
+
isRequired: true
|
|
78
|
+
}),
|
|
79
|
+
components.input.string("board", {
|
|
80
|
+
defaultValue: DeviceCfg.get("board"),
|
|
81
|
+
label: "deviceBoard",
|
|
82
|
+
isRequired: true
|
|
83
|
+
}),
|
|
84
|
+
components.input.string("model", {
|
|
85
|
+
defaultValue: DeviceCfg.get("model"),
|
|
86
|
+
label: "deviceModel",
|
|
87
|
+
isRequired: true
|
|
88
|
+
}),
|
|
89
|
+
components.input.string("product", {
|
|
90
|
+
defaultValue: DeviceCfg.get("product"),
|
|
91
|
+
label: "deviceProduct",
|
|
92
|
+
isRequired: true
|
|
93
|
+
}),
|
|
94
|
+
components.input.string("fingerprint", {
|
|
95
|
+
defaultValue: DeviceCfg.get("fingerprint"),
|
|
96
|
+
label: "deviceFingerprint",
|
|
97
|
+
className: "w-full",
|
|
98
|
+
isRequired: true
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
})
|
|
104
|
+
],
|
|
105
|
+
/** 前端点击保存之后调用的方法 */
|
|
106
|
+
save: (changeConfig) => {
|
|
107
|
+
const CfgMap = {
|
|
108
|
+
["accordion-config-key" /* Config */]: CoreCfg,
|
|
109
|
+
["accordion-device-key" /* Device */]: DeviceCfg
|
|
110
|
+
};
|
|
111
|
+
try {
|
|
112
|
+
lodash.forEach(changeConfig, (childrenValue, accordionKey) => {
|
|
113
|
+
switch (accordionKey) {
|
|
114
|
+
case "accordion-config-key" /* Config */:
|
|
115
|
+
case "accordion-device-key" /* Device */: {
|
|
116
|
+
childrenValue.forEach((children) => {
|
|
117
|
+
lodash.forEach(children, (value, childrenKey) => {
|
|
118
|
+
const { key, value: formatValue } = FormatValue(childrenKey, value);
|
|
119
|
+
CfgMap[accordionKey].set(key, formatValue, false);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.values(CfgMap).forEach((cfg) => cfg.save());
|
|
127
|
+
} catch (err) {
|
|
128
|
+
logger.error(err);
|
|
129
|
+
return {
|
|
130
|
+
success: false,
|
|
131
|
+
message: "\u4FDD\u5B58\u5931\u8D25\uFF1A" + err.message
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
success: true,
|
|
136
|
+
message: "\u4FDD\u5B58\u6210\u529F"
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
export {
|
|
141
|
+
web_config_default as default
|
|
142
|
+
};
|
package/package.json
CHANGED