node-karin 1.3.13 → 1.3.15
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/CHANGELOG.md +35 -0
- package/dist/index.d.ts +233 -180
- package/dist/index.js +112 -21
- package/dist/web/assets/index-BfgPXZy4.css +7 -0
- package/dist/web/assets/index-BmnBcE97.js +1 -0
- package/dist/web/assets/index-DV7QXb5W.js +1 -0
- package/dist/web/assets/index-rfe-HAu1.js +445 -0
- package/dist/web/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2 +0 -0
- package/dist/web/icon.css +25 -0
- package/dist/web/index.html +20 -19
- package/package.json +3 -3
- package/dist/web/assets/index-CzI4cWVg.js +0 -1
- package/dist/web/assets/index-DWR0WNwJ.js +0 -458
- package/dist/web/assets/index-Dhun9ZvA.css +0 -7
- package/dist/web/assets/index-tlrEvQNU.js +0 -1
package/dist/index.js
CHANGED
|
@@ -14,9 +14,9 @@ var __export = (target, all) => {
|
|
|
14
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
// ../../node_modules/.pnpm/tsup@8.3.6_tsx@4.19.
|
|
17
|
+
// ../../node_modules/.pnpm/tsup@8.3.6_tsx@4.19.3_typescript@5.7.3/node_modules/tsup/assets/esm_shims.js
|
|
18
18
|
var init_esm_shims = __esm({
|
|
19
|
-
"../../node_modules/.pnpm/tsup@8.3.6_tsx@4.19.
|
|
19
|
+
"../../node_modules/.pnpm/tsup@8.3.6_tsx@4.19.3_typescript@5.7.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
20
20
|
"use strict";
|
|
21
21
|
}
|
|
22
22
|
});
|
|
@@ -268,7 +268,7 @@ var init_logger2 = __esm({
|
|
|
268
268
|
});
|
|
269
269
|
|
|
270
270
|
// src/env/index.ts
|
|
271
|
-
var isWin, isDev, isTsx, setProcessEnv, setVersion, setRuntime;
|
|
271
|
+
var isWin, isDev, isTsx, isTs, setProcessEnv, setVersion, setRuntime;
|
|
272
272
|
var init_env = __esm({
|
|
273
273
|
"src/env/index.ts"() {
|
|
274
274
|
"use strict";
|
|
@@ -276,6 +276,7 @@ var init_env = __esm({
|
|
|
276
276
|
isWin = () => process.platform === "win32";
|
|
277
277
|
isDev = () => process.env.NODE_ENV === "development";
|
|
278
278
|
isTsx = () => process.env.RUNTIME === "tsx";
|
|
279
|
+
isTs = () => isTsx();
|
|
279
280
|
setProcessEnv = (key, value) => {
|
|
280
281
|
process.env[key] = value + "";
|
|
281
282
|
return value;
|
|
@@ -5753,7 +5754,7 @@ var init_base = __esm({
|
|
|
5753
5754
|
communication: "other",
|
|
5754
5755
|
address: "",
|
|
5755
5756
|
secret: null,
|
|
5756
|
-
connectTime:
|
|
5757
|
+
connectTime: Date.now()
|
|
5757
5758
|
};
|
|
5758
5759
|
}
|
|
5759
5760
|
get selfId() {
|
|
@@ -10022,7 +10023,7 @@ import fs21 from "node:fs";
|
|
|
10022
10023
|
import path15 from "node:path";
|
|
10023
10024
|
import util3 from "node:util";
|
|
10024
10025
|
import { pathToFileURL } from "node:url";
|
|
10025
|
-
var getWebConfigPathFromPkg, getNpmPluginConfigPath, getLocalPluginConfigPath, getConfigPath, loadConfig, getConfig, saveConfig, isConfigExist;
|
|
10026
|
+
var getWebConfigPathFromPkg, getNpmPluginConfigPath, getLocalPluginConfigPath, getConfigPath, loadConfig, getWebConfig, getConfig, saveConfig, isConfigExist;
|
|
10026
10027
|
var init_config3 = __esm({
|
|
10027
10028
|
"src/server/api/plugins/config.ts"() {
|
|
10028
10029
|
"use strict";
|
|
@@ -10078,26 +10079,35 @@ var init_config3 = __esm({
|
|
|
10078
10079
|
const result = await import(`${pathToFileURL(configPath2).toString()}${isDev() ? "?t=" + Date.now() : ""}`);
|
|
10079
10080
|
return result.default;
|
|
10080
10081
|
};
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
createServerErrorResponse(res, "\u4E0D\u652F\u6301\u7684\u63D2\u4EF6\u7C7B\u578B");
|
|
10085
|
-
return;
|
|
10082
|
+
getWebConfig = async (type, id, fnc2) => {
|
|
10083
|
+
if (!["git", "npm"].includes(type)) {
|
|
10084
|
+
return null;
|
|
10086
10085
|
}
|
|
10087
|
-
const webConfig = getConfigPath(
|
|
10086
|
+
const webConfig = getConfigPath({ type, name: id });
|
|
10088
10087
|
if (!webConfig) {
|
|
10089
|
-
|
|
10090
|
-
return;
|
|
10088
|
+
return null;
|
|
10091
10089
|
}
|
|
10092
10090
|
const baseName = path15.basename(webConfig, path15.extname(webConfig));
|
|
10093
10091
|
if (baseName !== "web.config") {
|
|
10092
|
+
return null;
|
|
10093
|
+
}
|
|
10094
|
+
return await loadConfig(webConfig);
|
|
10095
|
+
};
|
|
10096
|
+
getConfig = async (req, res) => {
|
|
10097
|
+
const options = req.body;
|
|
10098
|
+
if (!options.type || !options.name) {
|
|
10099
|
+
createServerErrorResponse(res, "\u53C2\u6570\u9519\u8BEF");
|
|
10100
|
+
return;
|
|
10101
|
+
}
|
|
10102
|
+
const config2 = await getWebConfig(options.type, options.name, () => {
|
|
10094
10103
|
logger.error(`[plugin] \u63D2\u4EF6${options.name}\u7684web\u914D\u7F6E\u6587\u4EF6\u540D\u79F0\u4E0D\u6B63\u786E: \u9700\u8981\u4EE5 web.config \u547D\u540D`);
|
|
10095
10104
|
createSuccessResponse(res, null);
|
|
10096
|
-
|
|
10105
|
+
});
|
|
10106
|
+
if (!config2) {
|
|
10107
|
+
return createServerErrorResponse(res, "\u53C2\u6570\u9519\u8BEF");
|
|
10097
10108
|
}
|
|
10098
10109
|
const list2 = [];
|
|
10099
|
-
|
|
10100
|
-
let result = components2();
|
|
10110
|
+
let result = config2.components();
|
|
10101
10111
|
result = util3.types.isPromise(result) ? await result : result;
|
|
10102
10112
|
result.forEach((item) => {
|
|
10103
10113
|
if (typeof (item == null ? void 0 : item.toJSON) === "function") {
|
|
@@ -10108,12 +10118,16 @@ var init_config3 = __esm({
|
|
|
10108
10118
|
}
|
|
10109
10119
|
}
|
|
10110
10120
|
});
|
|
10111
|
-
|
|
10121
|
+
const data = {
|
|
10122
|
+
options: list2,
|
|
10123
|
+
info: config2.info
|
|
10124
|
+
};
|
|
10125
|
+
createSuccessResponse(res, data);
|
|
10112
10126
|
};
|
|
10113
10127
|
saveConfig = async (req, res) => {
|
|
10114
10128
|
const options = req.body;
|
|
10115
10129
|
const configPath2 = getConfigPath(options);
|
|
10116
|
-
if (!configPath2) return;
|
|
10130
|
+
if (!configPath2) return createServerErrorResponse(res, "\u53C2\u6570\u9519\u8BEF");
|
|
10117
10131
|
const { save: save2 } = await loadConfig(configPath2);
|
|
10118
10132
|
const result = save2(options.config);
|
|
10119
10133
|
const response = util3.types.isPromise(result) ? await result : result;
|
|
@@ -10173,7 +10187,7 @@ var init_cache2 = __esm({
|
|
|
10173
10187
|
};
|
|
10174
10188
|
setPluginListCache = async (plugins) => {
|
|
10175
10189
|
try {
|
|
10176
|
-
await redis2.
|
|
10190
|
+
await redis2.set(CACHE_KEY, JSON.stringify(plugins), { EX: CACHE_EXPIRE });
|
|
10177
10191
|
} catch (error) {
|
|
10178
10192
|
logger.error("\u8BBE\u7F6E\u63D2\u4EF6\u5217\u8868\u7F13\u5B58\u5931\u8D25:", error);
|
|
10179
10193
|
}
|
|
@@ -10459,6 +10473,62 @@ var init_install = __esm({
|
|
|
10459
10473
|
}
|
|
10460
10474
|
});
|
|
10461
10475
|
|
|
10476
|
+
// src/server/api/plugins/local.ts
|
|
10477
|
+
var getLocalList;
|
|
10478
|
+
var init_local = __esm({
|
|
10479
|
+
"src/server/api/plugins/local.ts"() {
|
|
10480
|
+
"use strict";
|
|
10481
|
+
init_esm_shims();
|
|
10482
|
+
init_env();
|
|
10483
|
+
init_config3();
|
|
10484
|
+
init_list();
|
|
10485
|
+
init_router();
|
|
10486
|
+
init_response();
|
|
10487
|
+
getLocalList = async (req, res) => {
|
|
10488
|
+
const { isForce } = req.body;
|
|
10489
|
+
const [npm, git] = await Promise.all([
|
|
10490
|
+
getPlugins("npm", true, isForce ?? false),
|
|
10491
|
+
getPlugins("git", true, isForce ?? false)
|
|
10492
|
+
]);
|
|
10493
|
+
const list2 = [...npm, ...git];
|
|
10494
|
+
const result = [];
|
|
10495
|
+
await Promise.allSettled(list2.map(async (val) => {
|
|
10496
|
+
var _a, _b;
|
|
10497
|
+
const pkg2 = val.pkgData;
|
|
10498
|
+
if (isTs() && ((_a = pkg2.karin) == null ? void 0 : _a["ts-web"])) {
|
|
10499
|
+
const config2 = await getWebConfig(val.type, val.name);
|
|
10500
|
+
if (config2 && config2.info) {
|
|
10501
|
+
result.push({
|
|
10502
|
+
...config2.info,
|
|
10503
|
+
id: val.name,
|
|
10504
|
+
version: config2.info.version ?? pkg2.version,
|
|
10505
|
+
description: config2.info.description ?? pkg2.description,
|
|
10506
|
+
hasConfig: true,
|
|
10507
|
+
type: val.type
|
|
10508
|
+
});
|
|
10509
|
+
}
|
|
10510
|
+
return;
|
|
10511
|
+
}
|
|
10512
|
+
if ((_b = pkg2.karin) == null ? void 0 : _b.web) {
|
|
10513
|
+
const config2 = await getWebConfig(val.type, val.name);
|
|
10514
|
+
if (config2 && config2.info) {
|
|
10515
|
+
result.push({
|
|
10516
|
+
...config2.info,
|
|
10517
|
+
id: val.name,
|
|
10518
|
+
version: config2.info.version ?? pkg2.version,
|
|
10519
|
+
description: config2.info.description ?? pkg2.description,
|
|
10520
|
+
hasConfig: true,
|
|
10521
|
+
type: val.type
|
|
10522
|
+
});
|
|
10523
|
+
}
|
|
10524
|
+
}
|
|
10525
|
+
}));
|
|
10526
|
+
createSuccessResponse(res, result);
|
|
10527
|
+
};
|
|
10528
|
+
router.post("/plugin/local", getLocalList);
|
|
10529
|
+
}
|
|
10530
|
+
});
|
|
10531
|
+
|
|
10462
10532
|
// src/server/api/plugins/test-url.ts
|
|
10463
10533
|
import axios6 from "axios";
|
|
10464
10534
|
var github, testUrl, githubMirror, speedTest, testGithub;
|
|
@@ -11098,6 +11168,7 @@ var init_plugins = __esm({
|
|
|
11098
11168
|
init_config3();
|
|
11099
11169
|
init_admin2();
|
|
11100
11170
|
init_install();
|
|
11171
|
+
init_local();
|
|
11101
11172
|
init_test_url();
|
|
11102
11173
|
init_list();
|
|
11103
11174
|
init_router();
|
|
@@ -16709,7 +16780,8 @@ var init_accordion = __esm({
|
|
|
16709
16780
|
...config2,
|
|
16710
16781
|
key,
|
|
16711
16782
|
componentType: "accordion-pro",
|
|
16712
|
-
data: config2.data || []
|
|
16783
|
+
data: config2.data || [],
|
|
16784
|
+
children: config2.children
|
|
16713
16785
|
});
|
|
16714
16786
|
createAccordionItem = (key, config2 = {}) => ({
|
|
16715
16787
|
key,
|
|
@@ -16781,7 +16853,7 @@ var init_accordion = __esm({
|
|
|
16781
16853
|
});
|
|
16782
16854
|
|
|
16783
16855
|
// src/components/input.ts
|
|
16784
|
-
var createInput, input;
|
|
16856
|
+
var createInput, createInputGroup, input;
|
|
16785
16857
|
var init_input = __esm({
|
|
16786
16858
|
"src/components/input.ts"() {
|
|
16787
16859
|
"use strict";
|
|
@@ -16802,6 +16874,18 @@ var init_input = __esm({
|
|
|
16802
16874
|
}
|
|
16803
16875
|
return data;
|
|
16804
16876
|
};
|
|
16877
|
+
createInputGroup = (key, options) => {
|
|
16878
|
+
return {
|
|
16879
|
+
...options,
|
|
16880
|
+
key,
|
|
16881
|
+
componentType: "input-group",
|
|
16882
|
+
template: createInput("input-group-template", options.template),
|
|
16883
|
+
data: Array.isArray(options == null ? void 0 : options.data) ? options.data : [],
|
|
16884
|
+
itemsPerRow: options.itemsPerRow ?? 3,
|
|
16885
|
+
maxRows: options.maxRows ?? 3,
|
|
16886
|
+
maxInputs: options.maxInputs ?? 100
|
|
16887
|
+
};
|
|
16888
|
+
};
|
|
16805
16889
|
input = {
|
|
16806
16890
|
/**
|
|
16807
16891
|
* 创建基础输入框
|
|
@@ -16809,6 +16893,12 @@ var init_input = __esm({
|
|
|
16809
16893
|
* @param options 输入框配置
|
|
16810
16894
|
*/
|
|
16811
16895
|
create: (key, options) => createInput(key, options),
|
|
16896
|
+
/**
|
|
16897
|
+
* 创建输入框组
|
|
16898
|
+
* @param key 唯一标识符
|
|
16899
|
+
* @param options 输入框组配置
|
|
16900
|
+
*/
|
|
16901
|
+
group: (key, options) => createInputGroup(key, options),
|
|
16812
16902
|
/**
|
|
16813
16903
|
* 字符串输入框
|
|
16814
16904
|
* @param key 唯一标识符
|
|
@@ -17940,6 +18030,7 @@ var init_index = __esm({
|
|
|
17940
18030
|
init_db2();
|
|
17941
18031
|
init_render2();
|
|
17942
18032
|
init_onebot();
|
|
18033
|
+
init_debug2();
|
|
17943
18034
|
init_root();
|
|
17944
18035
|
init_service();
|
|
17945
18036
|
init_karin();
|