node-karin 1.8.13 → 1.9.1
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 +19 -0
- package/README.md +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +94 -81
- package/dist/web/assets/css/index-CZ_28tSH.css.br +0 -0
- package/dist/web/assets/js/components-AQsFMN7-.js.br +0 -0
- package/dist/web/assets/js/entry-UpjOQl3S.js.br +0 -0
- package/dist/web/assets/js/hooks-C1liScQm.js.br +0 -0
- package/dist/web/assets/js/page-404.tsx-vg2MOg_F.js +1 -0
- package/dist/web/assets/js/page-dashboard-BMR0KJUA.js.br +0 -0
- package/dist/web/assets/js/page-login.tsx-CseiAC-5.js.br +0 -0
- package/dist/web/assets/js/{utils-DqFE1yN-.js → utils-C1_eVtU6.js} +1 -1
- package/dist/web/assets/js/vendor-heroui-BYc15sbq.js.br +0 -0
- package/dist/web/index.html +7 -7
- package/package.json +1 -1
- package/dist/web/assets/css/index-2KMNnJRA.css.br +0 -0
- package/dist/web/assets/js/components-9RKTV4LX.js.br +0 -0
- package/dist/web/assets/js/entry-CzDSdA4M.js.br +0 -0
- package/dist/web/assets/js/hooks-D65eaS4p.js.br +0 -0
- package/dist/web/assets/js/page-404.tsx-BNti6Z2J.js +0 -1
- package/dist/web/assets/js/page-dashboard-BewrlGFW.js.br +0 -0
- package/dist/web/assets/js/page-login.tsx-DkO-XzeU.js.br +0 -0
- package/dist/web/assets/js/vendor-heroui-WfpTlnyv.js.br +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [1.9.1](https://github.com/KarinJS/Karin/compare/core-v1.9.0...core-v1.9.1) (2025-05-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ♻️ Code Refactoring
|
|
7
|
+
|
|
8
|
+
* **core:** 优化插件目录创建逻辑 ([#429](https://github.com/KarinJS/Karin/issues/429)) ([3828411](https://github.com/KarinJS/Karin/commit/382841192b4fe3f91a2797d2118d654a42308d1b))
|
|
9
|
+
|
|
10
|
+
## [1.9.0](https://github.com/KarinJS/Karin/compare/core-v1.8.13...core-v1.9.0) (2025-05-10)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ✨ Features
|
|
14
|
+
|
|
15
|
+
* 增加Docker安装方式以及Docker构建工作流 ([#424](https://github.com/KarinJS/Karin/issues/424)) ([f58417d](https://github.com/KarinJS/Karin/commit/f58417d4593f74b710a5072f5aacdcc8c3d07fab))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### 🎡 Continuous Integration
|
|
19
|
+
|
|
20
|
+
* 优化ci ([#428](https://github.com/KarinJS/Karin/issues/428)) ([75fe5cb](https://github.com/KarinJS/Karin/commit/75fe5cb5a33b59e0089a39e540602202eb2c675b))
|
|
21
|
+
|
|
3
22
|
## [1.8.13](https://github.com/KarinJS/Karin/compare/core-v1.8.12...core-v1.8.13) (2025-05-09)
|
|
4
23
|
|
|
5
24
|
|
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -10103,7 +10103,7 @@ declare const downloadFile: <T extends boolean = false>(fileUrl: string, savePat
|
|
|
10103
10103
|
* @param savePath 保存路径
|
|
10104
10104
|
* @param param axios参数
|
|
10105
10105
|
*/
|
|
10106
|
-
declare const downFile: (fileUrl: string, savePath: string, param?: AxiosRequestConfig) => Promise<boolean
|
|
10106
|
+
declare const downFile: (fileUrl: string, savePath: string, param?: AxiosRequestConfig) => Promise<DownloadFileResult<boolean>>;
|
|
10107
10107
|
/**
|
|
10108
10108
|
* 标准化文件路径 统一使用/分隔符
|
|
10109
10109
|
* @param file - 路径
|
|
@@ -12119,7 +12119,7 @@ declare const getCacheCfg: <T>(cache: Record<string, T>, count: ReturnType<typeo
|
|
|
12119
12119
|
* @param count 计数器
|
|
12120
12120
|
* @param cache 缓存
|
|
12121
12121
|
*/
|
|
12122
|
-
declare const clearCache: <T extends GroupsObjectValue | PrivatesObjectValue>(
|
|
12122
|
+
declare const clearCache: <T extends GroupsObjectValue | PrivatesObjectValue>(count: ReturnType<typeof createCount>, staticCache: Record<string, T>, dynamicCache: Record<string, T>) => void;
|
|
12123
12123
|
|
|
12124
12124
|
/**
|
|
12125
12125
|
* @description 默认配置
|
package/dist/index.mjs
CHANGED
|
@@ -1371,8 +1371,12 @@ var init_file2 = __esm({
|
|
|
1371
1371
|
createPluginDir = async (name, files) => {
|
|
1372
1372
|
if (!Array.isArray(files)) files = ["config", "data", "resources"];
|
|
1373
1373
|
if (files.length === 0) return;
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1374
|
+
const isOrgPkg = name.startsWith("@") && name.includes("/");
|
|
1375
|
+
let pluginPath = isOrgPkg ? path5.join(karinPathBase, name.replace("/", "-")) : path5.join(karinPathBase, name);
|
|
1376
|
+
if (isOrgPkg && !fs6.existsSync(pluginPath)) {
|
|
1377
|
+
const [orgName, pkgName] = name.split("/");
|
|
1378
|
+
pluginPath = path5.join(karinPathBase, orgName, pkgName);
|
|
1379
|
+
}
|
|
1376
1380
|
await Promise.all(files.map((file) => {
|
|
1377
1381
|
const filePath = path5.join(pluginPath, file);
|
|
1378
1382
|
if (!fs6.existsSync(filePath)) return fs6.promises.mkdir(filePath, { recursive: true });
|
|
@@ -1629,19 +1633,22 @@ var init_path = __esm({
|
|
|
1629
1633
|
const files = fs6.readdirSync(filePath, { withFileTypes: true });
|
|
1630
1634
|
const list2 = [];
|
|
1631
1635
|
if (!Array.isArray(ext)) ext = [ext];
|
|
1632
|
-
|
|
1633
|
-
if (
|
|
1634
|
-
|
|
1636
|
+
const allFiles = (dir2, entry) => {
|
|
1637
|
+
if (entry.isDirectory()) {
|
|
1638
|
+
const subFiles = filesByExt(path5.join(dir2, entry.name), ext, returnType);
|
|
1639
|
+
list2.push(...subFiles);
|
|
1640
|
+
} else if (ext.includes(path5.extname(entry.name))) {
|
|
1635
1641
|
if (returnType === "name") {
|
|
1636
|
-
list2.push(
|
|
1642
|
+
list2.push(entry.name);
|
|
1637
1643
|
} else if (returnType === "rel") {
|
|
1638
|
-
const file = path5.resolve(
|
|
1644
|
+
const file = path5.resolve(dir2, entry.name);
|
|
1639
1645
|
list2.push(path5.relative(process.cwd(), file));
|
|
1640
1646
|
} else if (returnType === "abs") {
|
|
1641
|
-
list2.push(formatPath(path5.resolve(
|
|
1647
|
+
list2.push(formatPath(path5.resolve(dir2, entry.name)));
|
|
1642
1648
|
}
|
|
1643
1649
|
}
|
|
1644
|
-
}
|
|
1650
|
+
};
|
|
1651
|
+
files.forEach((entry) => allFiles(filePath, entry));
|
|
1645
1652
|
return list2;
|
|
1646
1653
|
};
|
|
1647
1654
|
splitPath = (filePath) => {
|
|
@@ -3225,38 +3232,41 @@ var init_tools = __esm({
|
|
|
3225
3232
|
createCount = () => {
|
|
3226
3233
|
return {};
|
|
3227
3234
|
};
|
|
3228
|
-
getCacheCfg = (
|
|
3235
|
+
getCacheCfg = (cache10, count3, keys) => {
|
|
3229
3236
|
const key = keys[0];
|
|
3230
|
-
if (
|
|
3237
|
+
if (cache10[key]) {
|
|
3231
3238
|
initCount(count3, key);
|
|
3232
|
-
return
|
|
3239
|
+
return cache10[key];
|
|
3233
3240
|
}
|
|
3234
|
-
keys.
|
|
3235
|
-
|
|
3236
|
-
if (
|
|
3241
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3242
|
+
const v = keys[i];
|
|
3243
|
+
if (!cache10[v]) {
|
|
3244
|
+
continue;
|
|
3245
|
+
}
|
|
3246
|
+
if (i === 0 && v === key) {
|
|
3237
3247
|
initCount(count3, v);
|
|
3238
|
-
return
|
|
3248
|
+
return cache10[v];
|
|
3239
3249
|
}
|
|
3240
3250
|
if (v === key) {
|
|
3241
3251
|
initCount(count3, v);
|
|
3242
|
-
return
|
|
3252
|
+
return cache10[v];
|
|
3243
3253
|
}
|
|
3244
|
-
|
|
3254
|
+
cache10[key] = cache10[v];
|
|
3245
3255
|
initCount(count3, key);
|
|
3246
|
-
return
|
|
3247
|
-
}
|
|
3248
|
-
return
|
|
3256
|
+
return cache10[key];
|
|
3257
|
+
}
|
|
3258
|
+
return cache10.default;
|
|
3249
3259
|
};
|
|
3250
|
-
clearCache = (
|
|
3260
|
+
clearCache = (count3, staticCache3, dynamicCache3) => {
|
|
3251
3261
|
setInterval(() => {
|
|
3252
3262
|
Object.keys(count3).forEach((key) => {
|
|
3253
3263
|
if (count3[key].count - count3[key].start < 10) {
|
|
3254
|
-
if (
|
|
3264
|
+
if (staticCache3[key]) {
|
|
3255
3265
|
delete count3[key];
|
|
3256
3266
|
return;
|
|
3257
3267
|
}
|
|
3258
3268
|
delete count3[key];
|
|
3259
|
-
delete
|
|
3269
|
+
delete dynamicCache3[key];
|
|
3260
3270
|
} else {
|
|
3261
3271
|
count3[key].start = count3[key].count;
|
|
3262
3272
|
}
|
|
@@ -10201,12 +10211,12 @@ var init_list = __esm({
|
|
|
10201
10211
|
list2.map(async (v) => {
|
|
10202
10212
|
const [type, name] = v.split(":");
|
|
10203
10213
|
if (type === "app") {
|
|
10204
|
-
const file = path5.join(
|
|
10214
|
+
const file = path5.join(karinPathPlugins, name);
|
|
10205
10215
|
await getAppInfo(info, file, name, ext, isForce);
|
|
10206
10216
|
return;
|
|
10207
10217
|
}
|
|
10208
10218
|
if (type === "git" || type === "root") {
|
|
10209
|
-
const file = type === "root" ? process.cwd() : path5.join(
|
|
10219
|
+
const file = type === "root" ? process.cwd() : path5.join(karinPathPlugins, name);
|
|
10210
10220
|
await getGitInfo(info, file, name, ext, isForce, env3);
|
|
10211
10221
|
return;
|
|
10212
10222
|
}
|
|
@@ -10229,7 +10239,7 @@ var init_list = __esm({
|
|
|
10229
10239
|
files.map(async (v) => {
|
|
10230
10240
|
if (!v.isDirectory()) return;
|
|
10231
10241
|
if (!v.name.startsWith("karin-plugin-")) return;
|
|
10232
|
-
if (fs6.existsSync(`${
|
|
10242
|
+
if (fs6.existsSync(`${karinPathPlugins}/${v.name}/package.json`)) return;
|
|
10233
10243
|
list2.push(`app:${v.name}`);
|
|
10234
10244
|
})
|
|
10235
10245
|
);
|
|
@@ -10239,8 +10249,8 @@ var init_list = __esm({
|
|
|
10239
10249
|
files.map(async (v) => {
|
|
10240
10250
|
if (!v.isDirectory()) return;
|
|
10241
10251
|
if (!v.name.startsWith("karin-plugin-")) return;
|
|
10242
|
-
if (!fs6.existsSync(path5.join(
|
|
10243
|
-
const pkg2 = await requireFile(path5.join(
|
|
10252
|
+
if (!fs6.existsSync(path5.join(karinPathPlugins, v.name, "package.json"))) return;
|
|
10253
|
+
const pkg2 = await requireFile(path5.join(karinPathPlugins, v.name, "package.json"));
|
|
10244
10254
|
if (pkg2?.karin?.engines?.karin && !satisfies(pkg2.karin.engines.karin, process.env.KARIN_VERSION)) {
|
|
10245
10255
|
const msg = `[getPlugins][git] ${v.name} \u8981\u6C42 node-karin \u7248\u672C\u4E3A ${pkg2.karin.engines.karin}\uFF0C\u5F53\u524D\u4E0D\u7B26\u5408\u8981\u6C42\uFF0C\u8DF3\u8FC7\u52A0\u8F7D\u63D2\u4EF6`;
|
|
10246
10256
|
isInit && setTimeout(() => logger.error(msg), 1e3);
|
|
@@ -10278,6 +10288,7 @@ var init_list = __esm({
|
|
|
10278
10288
|
"sqlite3"
|
|
10279
10289
|
];
|
|
10280
10290
|
collectNpmPlugins = async (list2) => {
|
|
10291
|
+
logger.debug("[collectNpmPlugins] \u5F00\u59CB\u6536\u96C6NPM\u63D2\u4EF6");
|
|
10281
10292
|
const pkg2 = await requireFile("./package.json", { force: true });
|
|
10282
10293
|
const dependencies = [
|
|
10283
10294
|
...Object.keys(pkg2.dependencies || {}),
|
|
@@ -10318,7 +10329,7 @@ var init_list = __esm({
|
|
|
10318
10329
|
initCache();
|
|
10319
10330
|
if (!["npm", "all", "git", "app"].includes(type)) return [];
|
|
10320
10331
|
const list2 = [];
|
|
10321
|
-
const files = type === "npm" ? [] : fs6.existsSync(
|
|
10332
|
+
const files = type === "npm" ? [] : fs6.existsSync(karinPathPlugins) ? await fs6.promises.readdir(karinPathPlugins, { withFileTypes: true }) : [];
|
|
10322
10333
|
switch (type) {
|
|
10323
10334
|
case "app":
|
|
10324
10335
|
await collectAppPlugins(files, list2);
|
|
@@ -13845,7 +13856,7 @@ function requireRange() {
|
|
|
13845
13856
|
parseRange(range22) {
|
|
13846
13857
|
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
13847
13858
|
const memoKey = memoOpts + ":" + range22;
|
|
13848
|
-
const cached =
|
|
13859
|
+
const cached = cache10.get(memoKey);
|
|
13849
13860
|
if (cached) {
|
|
13850
13861
|
return cached;
|
|
13851
13862
|
}
|
|
@@ -13879,7 +13890,7 @@ function requireRange() {
|
|
|
13879
13890
|
rangeMap.delete("");
|
|
13880
13891
|
}
|
|
13881
13892
|
const result = [...rangeMap.values()];
|
|
13882
|
-
|
|
13893
|
+
cache10.set(memoKey, result);
|
|
13883
13894
|
return result;
|
|
13884
13895
|
}
|
|
13885
13896
|
intersects(range22, options) {
|
|
@@ -13918,7 +13929,7 @@ function requireRange() {
|
|
|
13918
13929
|
}
|
|
13919
13930
|
range2 = Range;
|
|
13920
13931
|
const LRU = requireLrucache();
|
|
13921
|
-
const
|
|
13932
|
+
const cache10 = new LRU();
|
|
13922
13933
|
const parseOptions = requireParseOptions();
|
|
13923
13934
|
const Comparator = requireComparator();
|
|
13924
13935
|
const debug3 = requireDebug();
|
|
@@ -16673,7 +16684,7 @@ var init_config2 = __esm({
|
|
|
16673
16684
|
config_default = initConfig;
|
|
16674
16685
|
}
|
|
16675
16686
|
});
|
|
16676
|
-
var count,
|
|
16687
|
+
var count, staticCache, dynamicCache, getCfg, isOld, migrate, format2, initGroups, groups, getGroupCfg, getGuildCfg, getGroupsFileData, groups_default;
|
|
16677
16688
|
var init_groups4 = __esm({
|
|
16678
16689
|
"src/utils/config/file/groups.ts"() {
|
|
16679
16690
|
init_watch();
|
|
@@ -16683,7 +16694,7 @@ var init_groups4 = __esm({
|
|
|
16683
16694
|
init_default();
|
|
16684
16695
|
init_tools();
|
|
16685
16696
|
count = createCount();
|
|
16686
|
-
getCfg = (keys) => getCacheCfg(
|
|
16697
|
+
getCfg = (keys) => getCacheCfg(dynamicCache, count, keys);
|
|
16687
16698
|
isOld = (obj) => {
|
|
16688
16699
|
if (Array.isArray(obj)) return false;
|
|
16689
16700
|
return Object.keys(obj).every((key) => typeof obj[key] === "object");
|
|
@@ -16710,19 +16721,20 @@ var init_groups4 = __esm({
|
|
|
16710
16721
|
const name = "groups.json";
|
|
16711
16722
|
const file = `${dir2}/${name}`;
|
|
16712
16723
|
const data = requireFileSync(file, { type: "json" });
|
|
16713
|
-
|
|
16714
|
-
|
|
16724
|
+
staticCache = isOld(data) ? migrate(file, data) : format2(data);
|
|
16725
|
+
dynamicCache = format2(data);
|
|
16715
16726
|
watch(file, async (old, data2) => {
|
|
16716
|
-
|
|
16717
|
-
|
|
16727
|
+
staticCache = isOld(data2) ? migrate(file, data2) : format2(data2);
|
|
16728
|
+
dynamicCache = staticCache;
|
|
16729
|
+
const options = { file: name, old, data: dynamicCache };
|
|
16718
16730
|
listeners.emit(FILE_CHANGE, options);
|
|
16719
16731
|
listeners.emit(`${FILE_CHANGE}:${name}`, options);
|
|
16720
16732
|
}, { type: "json" });
|
|
16721
|
-
clearCache(
|
|
16733
|
+
clearCache(count, staticCache, dynamicCache);
|
|
16722
16734
|
};
|
|
16723
16735
|
groups = () => {
|
|
16724
16736
|
return {
|
|
16725
|
-
get: () =>
|
|
16737
|
+
get: () => dynamicCache
|
|
16726
16738
|
};
|
|
16727
16739
|
};
|
|
16728
16740
|
getGroupCfg = (groupId, selfId) => {
|
|
@@ -16754,7 +16766,7 @@ var init_groups4 = __esm({
|
|
|
16754
16766
|
groups_default = initGroups;
|
|
16755
16767
|
}
|
|
16756
16768
|
});
|
|
16757
|
-
var count2,
|
|
16769
|
+
var count2, staticCache2, dynamicCache2, getCfg2, isOld2, migrate2, format3, initPrivates, privates, getFriendCfg, getDirectCfg, getPrivatesFileData, privates_default;
|
|
16758
16770
|
var init_privates = __esm({
|
|
16759
16771
|
"src/utils/config/file/privates.ts"() {
|
|
16760
16772
|
init_watch();
|
|
@@ -16764,7 +16776,7 @@ var init_privates = __esm({
|
|
|
16764
16776
|
init_default();
|
|
16765
16777
|
init_tools();
|
|
16766
16778
|
count2 = createCount();
|
|
16767
|
-
getCfg2 = (keys) => getCacheCfg(
|
|
16779
|
+
getCfg2 = (keys) => getCacheCfg(dynamicCache2, count2, keys);
|
|
16768
16780
|
isOld2 = (obj) => {
|
|
16769
16781
|
if (Array.isArray(obj)) return false;
|
|
16770
16782
|
return Object.keys(obj).every((key) => typeof obj[key] === "object");
|
|
@@ -16791,17 +16803,18 @@ var init_privates = __esm({
|
|
|
16791
16803
|
const name = "privates.json";
|
|
16792
16804
|
const file = `${dir2}/${name}`;
|
|
16793
16805
|
const data = requireFileSync(file, { type: "json" });
|
|
16794
|
-
|
|
16795
|
-
|
|
16806
|
+
staticCache2 = isOld2(data) ? migrate2(file, data) : format3(data);
|
|
16807
|
+
dynamicCache2 = format3(data);
|
|
16796
16808
|
watch(file, async (old, data2) => {
|
|
16797
|
-
|
|
16798
|
-
|
|
16809
|
+
staticCache2 = isOld2(data2) ? migrate2(file, data2) : format3(data2);
|
|
16810
|
+
dynamicCache2 = staticCache2;
|
|
16811
|
+
const options = { file: name, old, data: dynamicCache2 };
|
|
16799
16812
|
listeners.emit(FILE_CHANGE, options);
|
|
16800
16813
|
listeners.emit(`${FILE_CHANGE}:${name}`, options);
|
|
16801
16814
|
}, { type: "json" });
|
|
16802
|
-
clearCache(
|
|
16815
|
+
clearCache(count2, staticCache2, dynamicCache2);
|
|
16803
16816
|
};
|
|
16804
|
-
privates = () =>
|
|
16817
|
+
privates = () => dynamicCache2;
|
|
16805
16818
|
getFriendCfg = (userId, selfId) => {
|
|
16806
16819
|
const keys = [`Bot:${selfId}:${userId}`, `Bot:${selfId}`, userId, "default"];
|
|
16807
16820
|
return getCfg2(keys);
|
|
@@ -17022,39 +17035,39 @@ var init_template = __esm({
|
|
|
17022
17035
|
});
|
|
17023
17036
|
|
|
17024
17037
|
// src/adapter/render/admin/cache.ts
|
|
17025
|
-
var index4,
|
|
17038
|
+
var index4, cache8, registerRender, unregisterRender, getRender, callRender, getRenderCount, getRenderList, renderHtml, renderMultiHtml, RenderCache, render, Renderer;
|
|
17026
17039
|
var init_cache3 = __esm({
|
|
17027
17040
|
"src/adapter/render/admin/cache.ts"() {
|
|
17028
17041
|
index4 = 0;
|
|
17029
|
-
|
|
17042
|
+
cache8 = [];
|
|
17030
17043
|
registerRender = (id, render4) => {
|
|
17031
17044
|
const i = ++index4;
|
|
17032
|
-
|
|
17045
|
+
cache8.push({ index: i, id, render: render4 });
|
|
17033
17046
|
logger.mark(`[render:${index4}] ${logger.green("\u6CE8\u518C\u6210\u529F")}: ${id}`);
|
|
17034
17047
|
return i;
|
|
17035
17048
|
};
|
|
17036
17049
|
unregisterRender = (index6) => {
|
|
17037
|
-
const app4 =
|
|
17050
|
+
const app4 = cache8.find((app5) => app5.index === index6);
|
|
17038
17051
|
if (!app4) {
|
|
17039
17052
|
logger.error(`[render] \u5378\u8F7D\u5931\u8D25: \u4E0D\u5B58\u5728\u7D22\u5F15 ${index6}`);
|
|
17040
17053
|
return false;
|
|
17041
17054
|
}
|
|
17042
|
-
|
|
17055
|
+
cache8.splice(cache8.findIndex((app5) => app5.index === index6), 1);
|
|
17043
17056
|
logger.mark(`[render] ${logger.yellow("\u5378\u8F7D\u6210\u529F")}: ${app4.id}`);
|
|
17044
17057
|
return true;
|
|
17045
17058
|
};
|
|
17046
17059
|
getRender = (id) => {
|
|
17047
|
-
if (
|
|
17060
|
+
if (cache8.length === 0) throw new Error("[\u8C03\u7528\u6E32\u67D3\u5668\u5931\u8D25] \u6E32\u67D3\u5668\u5217\u8868\u4E3A\u7A7A");
|
|
17048
17061
|
if (!id) {
|
|
17049
|
-
const app5 =
|
|
17062
|
+
const app5 = cache8[Math.floor(Math.random() * cache8.length)];
|
|
17050
17063
|
return app5;
|
|
17051
17064
|
}
|
|
17052
17065
|
if (typeof id === "number") {
|
|
17053
|
-
const app5 =
|
|
17066
|
+
const app5 = cache8.find((app6) => app6.index === id);
|
|
17054
17067
|
if (!app5) throw new Error(`[\u8C03\u7528\u6E32\u67D3\u5668\u5931\u8D25] \u672A\u627E\u5230\u6E32\u67D3\u5668\uFF1A${id}`);
|
|
17055
17068
|
return app5;
|
|
17056
17069
|
}
|
|
17057
|
-
const app4 =
|
|
17070
|
+
const app4 = cache8.find((app5) => app5.id === id);
|
|
17058
17071
|
if (!app4) throw new Error(`[\u8C03\u7528\u6E32\u67D3\u5668\u5931\u8D25] \u672A\u627E\u5230\u6E32\u67D3\u5668\uFF1A${id}`);
|
|
17059
17072
|
return app4;
|
|
17060
17073
|
};
|
|
@@ -17063,9 +17076,9 @@ var init_cache3 = __esm({
|
|
|
17063
17076
|
const result = await res.render(Object.assign(options, { encoding: "base64" }));
|
|
17064
17077
|
return result;
|
|
17065
17078
|
};
|
|
17066
|
-
getRenderCount = () =>
|
|
17079
|
+
getRenderCount = () => cache8.length;
|
|
17067
17080
|
getRenderList = () => {
|
|
17068
|
-
const list2 =
|
|
17081
|
+
const list2 = cache8.map((app4) => app4);
|
|
17069
17082
|
return list2;
|
|
17070
17083
|
};
|
|
17071
17084
|
renderHtml = (data) => {
|
|
@@ -17278,9 +17291,9 @@ var init_client2 = __esm({
|
|
|
17278
17291
|
});
|
|
17279
17292
|
};
|
|
17280
17293
|
disconnectSnapkaClient = (url) => {
|
|
17281
|
-
const
|
|
17282
|
-
if (!
|
|
17283
|
-
|
|
17294
|
+
const cache10 = snapkaMap.get(url);
|
|
17295
|
+
if (!cache10) return;
|
|
17296
|
+
cache10.close();
|
|
17284
17297
|
snapkaMap.delete(url);
|
|
17285
17298
|
};
|
|
17286
17299
|
addSnapkaClient = (clientOptions) => {
|
|
@@ -17461,7 +17474,7 @@ var init_snapka = __esm({
|
|
|
17461
17474
|
});
|
|
17462
17475
|
|
|
17463
17476
|
// src/utils/config/file/render.ts
|
|
17464
|
-
var
|
|
17477
|
+
var cache9, format4, initRender, render2, getRenderCfg, render_default;
|
|
17465
17478
|
var init_render = __esm({
|
|
17466
17479
|
"src/utils/config/file/render.ts"() {
|
|
17467
17480
|
init_watch();
|
|
@@ -17487,9 +17500,9 @@ var init_render = __esm({
|
|
|
17487
17500
|
const name = "render.json";
|
|
17488
17501
|
const file = `${dir2}/${name}`;
|
|
17489
17502
|
const data = requireFileSync(file, { type: "json" });
|
|
17490
|
-
|
|
17503
|
+
cache9 = format4(data);
|
|
17491
17504
|
watch(file, async (old, data2) => {
|
|
17492
|
-
|
|
17505
|
+
cache9 = format4(data2);
|
|
17493
17506
|
const wsClient = diffArray(
|
|
17494
17507
|
Array.isArray(old?.ws_client) ? old?.ws_client : [],
|
|
17495
17508
|
Array.isArray(data2?.ws_client) ? data2?.ws_client : []
|
|
@@ -17508,13 +17521,13 @@ var init_render = __esm({
|
|
|
17508
17521
|
);
|
|
17509
17522
|
httpServer.removed.forEach((v) => disconnectSnapkaHttp2(v.url));
|
|
17510
17523
|
httpServer.added.forEach((v) => createSnapkaHttp2(v));
|
|
17511
|
-
const options = { file: name, old, data:
|
|
17524
|
+
const options = { file: name, old, data: cache9 };
|
|
17512
17525
|
listeners.emit(FILE_CHANGE, options);
|
|
17513
17526
|
listeners.emit(`${FILE_CHANGE}:${name}`, options);
|
|
17514
17527
|
}, { type: "json" });
|
|
17515
17528
|
};
|
|
17516
|
-
render2 = () =>
|
|
17517
|
-
getRenderCfg = () =>
|
|
17529
|
+
render2 = () => cache9;
|
|
17530
|
+
getRenderCfg = () => cache9;
|
|
17518
17531
|
render_default = initRender;
|
|
17519
17532
|
}
|
|
17520
17533
|
});
|
|
@@ -19209,7 +19222,7 @@ var init_load = __esm({
|
|
|
19209
19222
|
} else if (Array.isArray(pkg2.pkgData.karin?.files)) {
|
|
19210
19223
|
files.push(...pkg2.pkgData.karin.files);
|
|
19211
19224
|
}
|
|
19212
|
-
await createPluginDir(pkg2.name
|
|
19225
|
+
await createPluginDir(pkg2.name, files);
|
|
19213
19226
|
debug("debug: createPluginDir", pkg2.name, files);
|
|
19214
19227
|
pkg2.apps.forEach((app4) => {
|
|
19215
19228
|
const promise = async () => {
|
|
@@ -22614,9 +22627,9 @@ var init_list2 = __esm({
|
|
|
22614
22627
|
init_redis();
|
|
22615
22628
|
getDependenciesListRouter = async (req, res) => {
|
|
22616
22629
|
try {
|
|
22617
|
-
const
|
|
22618
|
-
if (
|
|
22619
|
-
return createSuccessResponse(res,
|
|
22630
|
+
const cache10 = await getCache(req, res);
|
|
22631
|
+
if (cache10) {
|
|
22632
|
+
return createSuccessResponse(res, cache10);
|
|
22620
22633
|
}
|
|
22621
22634
|
const { stdout, error } = await exec("pnpm list --depth=0 --json");
|
|
22622
22635
|
if (error) {
|
|
@@ -22725,9 +22738,9 @@ var init_list2 = __esm({
|
|
|
22725
22738
|
return null;
|
|
22726
22739
|
}
|
|
22727
22740
|
const { redis: redis3 } = await Promise.resolve().then(() => (init_redis3(), redis_exports));
|
|
22728
|
-
const
|
|
22729
|
-
if (
|
|
22730
|
-
const data = JSON.parse(
|
|
22741
|
+
const cache10 = await redis3.get(REDIS_DEPENDENCIES_LIST_CACHE_KEY);
|
|
22742
|
+
if (cache10) {
|
|
22743
|
+
const data = JSON.parse(cache10);
|
|
22731
22744
|
if (!Array.isArray(data)) {
|
|
22732
22745
|
await redis3.del(REDIS_DEPENDENCIES_LIST_CACHE_KEY);
|
|
22733
22746
|
return null;
|
|
@@ -23300,9 +23313,9 @@ var init_market2 = __esm({
|
|
|
23300
23313
|
const list2 = [];
|
|
23301
23314
|
const isForce = Boolean(req.body.refresh ?? false);
|
|
23302
23315
|
if (!isForce) {
|
|
23303
|
-
const
|
|
23304
|
-
if (
|
|
23305
|
-
return createSuccessResponse(res, JSON.parse(
|
|
23316
|
+
const cache10 = await getCache2();
|
|
23317
|
+
if (cache10) {
|
|
23318
|
+
return createSuccessResponse(res, JSON.parse(cache10));
|
|
23306
23319
|
}
|
|
23307
23320
|
}
|
|
23308
23321
|
const [
|
|
@@ -23321,8 +23334,8 @@ var init_market2 = __esm({
|
|
|
23321
23334
|
};
|
|
23322
23335
|
getCache2 = async () => {
|
|
23323
23336
|
const { redis: redis3 } = await Promise.resolve().then(() => (init_redis3(), redis_exports));
|
|
23324
|
-
const
|
|
23325
|
-
return
|
|
23337
|
+
const cache10 = await redis3.get(REDIS_PLUGIN_MARKET_LIST_CACHE_KEY);
|
|
23338
|
+
return cache10;
|
|
23326
23339
|
};
|
|
23327
23340
|
setCache2 = async (data) => {
|
|
23328
23341
|
const { redis: redis3 } = await Promise.resolve().then(() => (init_redis3(), redis_exports));
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./vendor-react-Hg1DVPZt.js";import{P as r}from"./components-AQsFMN7-.js";import"./vendor-others-B6NXaB-r.js";import"./vendor-editor-B8hjWfkw.js";import"./vendor-ui-utils-5rYIvRjL.js";import"./vendor-heroui-BYc15sbq.js";import"./page-dashboard-BMR0KJUA.js";import"./hooks-C1liScQm.js";import"./utils-C1_eVtU6.js";import"./vendor-visual-mzxhMYK3.js";const x=()=>t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx(r,{})});export{x as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{V as p}from"./vendor-react-Hg1DVPZt.js";import{a5 as g}from"./components-
|
|
1
|
+
import{V as p}from"./vendor-react-Hg1DVPZt.js";import{a5 as g}from"./components-AQsFMN7-.js";const k=async(t,n,e,r)=>{const{setIsLogModalOpen:i,setTaskId:c,setTaskLogs:o,setTaskName:f}=n;f("更新插件");const a=["开始创建更新任务...",`options: ${JSON.stringify(t)}`];o(a);try{const s=await g(t);if(s.success&&s.taskId)c(s.taskId),o([...a,`
|
|
2
2
|
任务创建成功!`,`任务ID: ${s.taskId}`,"正在连接任务执行日志..."]),i(!0),typeof e=="function"&&e(),typeof r=="function"&&r();else throw new Error(s.message||"未知错误")}catch(s){console.error("更新失败:",s),p.error(`更新失败: ${s.message}`)}};export{k as c};
|
|
Binary file
|
package/dist/web/index.html
CHANGED
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
content="viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
|
|
15
15
|
name="viewport" />
|
|
16
16
|
<link href="/web/assets/ico/favicon-BoqZd694.ico" rel="icon" />
|
|
17
|
-
<script type="module" crossorigin src="/web/assets/js/entry-
|
|
17
|
+
<script type="module" crossorigin src="/web/assets/js/entry-UpjOQl3S.js"></script>
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-editor-B8hjWfkw.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-others-B6NXaB-r.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-ui-utils-5rYIvRjL.js">
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-react-Hg1DVPZt.js">
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-heroui-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/hooks-
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-heroui-BYc15sbq.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/web/assets/js/hooks-C1liScQm.js">
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-visual-mzxhMYK3.js">
|
|
25
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/components-
|
|
26
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/utils-
|
|
27
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/page-dashboard-
|
|
25
|
+
<link rel="modulepreload" crossorigin href="/web/assets/js/components-AQsFMN7-.js">
|
|
26
|
+
<link rel="modulepreload" crossorigin href="/web/assets/js/utils-C1_eVtU6.js">
|
|
27
|
+
<link rel="modulepreload" crossorigin href="/web/assets/js/page-dashboard-BMR0KJUA.js">
|
|
28
28
|
<link rel="stylesheet" crossorigin href="/web/assets/css/vendor-editor-CFbL2ovg.css">
|
|
29
29
|
<link rel="stylesheet" crossorigin href="/web/assets/css/vendor-others-ZgkIHsf0.css">
|
|
30
30
|
<link rel="stylesheet" crossorigin href="/web/assets/css/components-ep7vm38G.css">
|
|
31
|
-
<link rel="stylesheet" crossorigin href="/web/assets/css/index-
|
|
31
|
+
<link rel="stylesheet" crossorigin href="/web/assets/css/index-CZ_28tSH.css">
|
|
32
32
|
</head>
|
|
33
33
|
|
|
34
34
|
<body>
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./vendor-react-Hg1DVPZt.js";import{P as r}from"./components-9RKTV4LX.js";import"./vendor-others-B6NXaB-r.js";import"./vendor-editor-B8hjWfkw.js";import"./vendor-ui-utils-5rYIvRjL.js";import"./vendor-heroui-WfpTlnyv.js";import"./page-dashboard-BewrlGFW.js";import"./hooks-D65eaS4p.js";import"./utils-DqFE1yN-.js";import"./vendor-visual-mzxhMYK3.js";const x=()=>t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx(r,{})});export{x as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|