node-karin 1.8.12 → 1.9.0
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 +25 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +100 -77
- 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-loading.tsx-CJaYj8cR.js.br +0 -0
- package/dist/web/assets/js/page-login.tsx-CseiAC-5.js.br +0 -0
- package/dist/web/assets/js/{utils-BuR6hXd1.js → utils-C1_eVtU6.js} +1 -1
- package/dist/web/assets/js/vendor-heroui-BYc15sbq.js.br +0 -0
- package/dist/web/assets/js/vendor-others-B6NXaB-r.js.br +0 -0
- package/dist/web/assets/js/vendor-react-Hg1DVPZt.js.br +0 -0
- package/dist/web/assets/js/vendor-visual-mzxhMYK3.js.br +0 -0
- package/dist/web/index.html +10 -10
- package/package.json +1 -1
- package/dist/web/assets/css/index-2KMNnJRA.css.br +0 -0
- package/dist/web/assets/js/components-xTgkEKOh.js.br +0 -0
- package/dist/web/assets/js/entry-DDp2aDp1.js.br +0 -0
- package/dist/web/assets/js/hooks-BVOSuufY.js.br +0 -0
- package/dist/web/assets/js/page-404.tsx-CQfJwMNP.js +0 -1
- package/dist/web/assets/js/page-dashboard-Cg6WjwPD.js.br +0 -0
- package/dist/web/assets/js/page-loading.tsx-DU5QaX5f.js.br +0 -0
- package/dist/web/assets/js/page-login.tsx-C_MXRUuZ.js.br +0 -0
- package/dist/web/assets/js/vendor-heroui-Blyb7kuN.js.br +0 -0
- package/dist/web/assets/js/vendor-others-CpZ3FDDG.js.br +0 -0
- package/dist/web/assets/js/vendor-react-Z2UfPrqC.js.br +0 -0
- package/dist/web/assets/js/vendor-visual-DQREh7WM.js.br +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [1.9.0](https://github.com/KarinJS/Karin/compare/core-v1.8.13...core-v1.9.0) (2025-05-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ✨ Features
|
|
7
|
+
|
|
8
|
+
* 增加Docker安装方式以及Docker构建工作流 ([#424](https://github.com/KarinJS/Karin/issues/424)) ([f58417d](https://github.com/KarinJS/Karin/commit/f58417d4593f74b710a5072f5aacdcc8c3d07fab))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### 🎡 Continuous Integration
|
|
12
|
+
|
|
13
|
+
* 优化ci ([#428](https://github.com/KarinJS/Karin/issues/428)) ([75fe5cb](https://github.com/KarinJS/Karin/commit/75fe5cb5a33b59e0089a39e540602202eb2c675b))
|
|
14
|
+
|
|
15
|
+
## [1.8.13](https://github.com/KarinJS/Karin/compare/core-v1.8.12...core-v1.8.13) (2025-05-09)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### 🐛 Bug Fixes
|
|
19
|
+
|
|
20
|
+
* clearCache ([#418](https://github.com/KarinJS/Karin/issues/418)) ([652b8fd](https://github.com/KarinJS/Karin/commit/652b8fdd65bf461fbbe85c3ba7b4dfc948cce915))
|
|
21
|
+
* restart ([#415](https://github.com/KarinJS/Karin/issues/415)) ([790ccdd](https://github.com/KarinJS/Karin/commit/790ccddf3c09ef1c91e5b344d3ff9afa7d116e8e))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### 🎡 Continuous Integration
|
|
25
|
+
|
|
26
|
+
* ban publish-minimal-repro ([#417](https://github.com/KarinJS/Karin/issues/417)) ([6ddcf80](https://github.com/KarinJS/Karin/commit/6ddcf803c99bac68662dbd95902f02bc8b6078cd))
|
|
27
|
+
|
|
3
28
|
## [1.8.12](https://github.com/KarinJS/Karin/compare/core-v1.8.11...core-v1.8.12) (2025-05-08)
|
|
4
29
|
|
|
5
30
|
|
package/dist/index.d.ts
CHANGED
|
@@ -12115,8 +12115,11 @@ declare const createCount: () => Record<string, {
|
|
|
12115
12115
|
declare const getCacheCfg: <T>(cache: Record<string, T>, count: ReturnType<typeof createCount>, keys: string[]) => T;
|
|
12116
12116
|
/**
|
|
12117
12117
|
* 定时清理缓存
|
|
12118
|
+
* @param data 数据
|
|
12119
|
+
* @param count 计数器
|
|
12120
|
+
* @param cache 缓存
|
|
12118
12121
|
*/
|
|
12119
|
-
declare const clearCache: <T>(count: ReturnType<typeof createCount>,
|
|
12122
|
+
declare const clearCache: <T extends GroupsObjectValue | PrivatesObjectValue>(count: ReturnType<typeof createCount>, staticCache: Record<string, T>, dynamicCache: Record<string, T>) => void;
|
|
12120
12123
|
|
|
12121
12124
|
/**
|
|
12122
12125
|
* @description 默认配置
|
|
@@ -12270,7 +12273,9 @@ declare const writeEnv: (data: {
|
|
|
12270
12273
|
* @description 获取群聊、频道配置
|
|
12271
12274
|
* @returns 群聊、频道配置
|
|
12272
12275
|
*/
|
|
12273
|
-
declare const groups: () =>
|
|
12276
|
+
declare const groups: () => {
|
|
12277
|
+
get: () => Record<string, GroupsObjectValue>;
|
|
12278
|
+
};
|
|
12274
12279
|
/**
|
|
12275
12280
|
* @public 公开Api
|
|
12276
12281
|
* @description 获取指定群聊配置
|
package/dist/index.mjs
CHANGED
|
@@ -1371,7 +1371,7 @@ 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 pluginPath = path5.join(
|
|
1374
|
+
const pluginPath = path5.join(karinPathBase, name);
|
|
1375
1375
|
if (!fs6.existsSync(pluginPath)) await fs6.promises.mkdir(pluginPath, { recursive: true });
|
|
1376
1376
|
await Promise.all(files.map((file) => {
|
|
1377
1377
|
const filePath = path5.join(pluginPath, file);
|
|
@@ -1629,19 +1629,22 @@ var init_path = __esm({
|
|
|
1629
1629
|
const files = fs6.readdirSync(filePath, { withFileTypes: true });
|
|
1630
1630
|
const list2 = [];
|
|
1631
1631
|
if (!Array.isArray(ext)) ext = [ext];
|
|
1632
|
-
|
|
1633
|
-
if (
|
|
1634
|
-
|
|
1632
|
+
const allFiles = (dir2, entry) => {
|
|
1633
|
+
if (entry.isDirectory()) {
|
|
1634
|
+
const subFiles = filesByExt(path5.join(dir2, entry.name), ext, returnType);
|
|
1635
|
+
list2.push(...subFiles);
|
|
1636
|
+
} else if (ext.includes(path5.extname(entry.name))) {
|
|
1635
1637
|
if (returnType === "name") {
|
|
1636
|
-
list2.push(
|
|
1638
|
+
list2.push(entry.name);
|
|
1637
1639
|
} else if (returnType === "rel") {
|
|
1638
|
-
const file = path5.resolve(
|
|
1640
|
+
const file = path5.resolve(dir2, entry.name);
|
|
1639
1641
|
list2.push(path5.relative(process.cwd(), file));
|
|
1640
1642
|
} else if (returnType === "abs") {
|
|
1641
|
-
list2.push(formatPath(path5.resolve(
|
|
1643
|
+
list2.push(formatPath(path5.resolve(dir2, entry.name)));
|
|
1642
1644
|
}
|
|
1643
1645
|
}
|
|
1644
|
-
}
|
|
1646
|
+
};
|
|
1647
|
+
files.forEach((entry) => allFiles(filePath, entry));
|
|
1645
1648
|
return list2;
|
|
1646
1649
|
};
|
|
1647
1650
|
splitPath = (filePath) => {
|
|
@@ -3225,34 +3228,41 @@ var init_tools = __esm({
|
|
|
3225
3228
|
createCount = () => {
|
|
3226
3229
|
return {};
|
|
3227
3230
|
};
|
|
3228
|
-
getCacheCfg = (
|
|
3231
|
+
getCacheCfg = (cache10, count3, keys) => {
|
|
3229
3232
|
const key = keys[0];
|
|
3230
|
-
if (
|
|
3233
|
+
if (cache10[key]) {
|
|
3231
3234
|
initCount(count3, key);
|
|
3232
|
-
return
|
|
3235
|
+
return cache10[key];
|
|
3233
3236
|
}
|
|
3234
|
-
keys.
|
|
3235
|
-
|
|
3236
|
-
if (
|
|
3237
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3238
|
+
const v = keys[i];
|
|
3239
|
+
if (!cache10[v]) {
|
|
3240
|
+
continue;
|
|
3241
|
+
}
|
|
3242
|
+
if (i === 0 && v === key) {
|
|
3237
3243
|
initCount(count3, v);
|
|
3238
|
-
return
|
|
3244
|
+
return cache10[v];
|
|
3239
3245
|
}
|
|
3240
3246
|
if (v === key) {
|
|
3241
3247
|
initCount(count3, v);
|
|
3242
|
-
return
|
|
3248
|
+
return cache10[v];
|
|
3243
3249
|
}
|
|
3244
|
-
|
|
3250
|
+
cache10[key] = cache10[v];
|
|
3245
3251
|
initCount(count3, key);
|
|
3246
|
-
return
|
|
3247
|
-
}
|
|
3248
|
-
return
|
|
3252
|
+
return cache10[key];
|
|
3253
|
+
}
|
|
3254
|
+
return cache10.default;
|
|
3249
3255
|
};
|
|
3250
|
-
clearCache = (count3,
|
|
3256
|
+
clearCache = (count3, staticCache3, dynamicCache3) => {
|
|
3251
3257
|
setInterval(() => {
|
|
3252
3258
|
Object.keys(count3).forEach((key) => {
|
|
3253
3259
|
if (count3[key].count - count3[key].start < 10) {
|
|
3260
|
+
if (staticCache3[key]) {
|
|
3261
|
+
delete count3[key];
|
|
3262
|
+
return;
|
|
3263
|
+
}
|
|
3254
3264
|
delete count3[key];
|
|
3255
|
-
delete
|
|
3265
|
+
delete dynamicCache3[key];
|
|
3256
3266
|
} else {
|
|
3257
3267
|
count3[key].start = count3[key].count;
|
|
3258
3268
|
}
|
|
@@ -10197,12 +10207,12 @@ var init_list = __esm({
|
|
|
10197
10207
|
list2.map(async (v) => {
|
|
10198
10208
|
const [type, name] = v.split(":");
|
|
10199
10209
|
if (type === "app") {
|
|
10200
|
-
const file = path5.join(
|
|
10210
|
+
const file = path5.join(karinPathPlugins, name);
|
|
10201
10211
|
await getAppInfo(info, file, name, ext, isForce);
|
|
10202
10212
|
return;
|
|
10203
10213
|
}
|
|
10204
10214
|
if (type === "git" || type === "root") {
|
|
10205
|
-
const file = type === "root" ? process.cwd() : path5.join(
|
|
10215
|
+
const file = type === "root" ? process.cwd() : path5.join(karinPathPlugins, name);
|
|
10206
10216
|
await getGitInfo(info, file, name, ext, isForce, env3);
|
|
10207
10217
|
return;
|
|
10208
10218
|
}
|
|
@@ -10225,7 +10235,7 @@ var init_list = __esm({
|
|
|
10225
10235
|
files.map(async (v) => {
|
|
10226
10236
|
if (!v.isDirectory()) return;
|
|
10227
10237
|
if (!v.name.startsWith("karin-plugin-")) return;
|
|
10228
|
-
if (fs6.existsSync(`${
|
|
10238
|
+
if (fs6.existsSync(`${karinPathPlugins}/${v.name}/package.json`)) return;
|
|
10229
10239
|
list2.push(`app:${v.name}`);
|
|
10230
10240
|
})
|
|
10231
10241
|
);
|
|
@@ -10235,8 +10245,8 @@ var init_list = __esm({
|
|
|
10235
10245
|
files.map(async (v) => {
|
|
10236
10246
|
if (!v.isDirectory()) return;
|
|
10237
10247
|
if (!v.name.startsWith("karin-plugin-")) return;
|
|
10238
|
-
if (!fs6.existsSync(path5.join(
|
|
10239
|
-
const pkg2 = await requireFile(path5.join(
|
|
10248
|
+
if (!fs6.existsSync(path5.join(karinPathPlugins, v.name, "package.json"))) return;
|
|
10249
|
+
const pkg2 = await requireFile(path5.join(karinPathPlugins, v.name, "package.json"));
|
|
10240
10250
|
if (pkg2?.karin?.engines?.karin && !satisfies(pkg2.karin.engines.karin, process.env.KARIN_VERSION)) {
|
|
10241
10251
|
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`;
|
|
10242
10252
|
isInit && setTimeout(() => logger.error(msg), 1e3);
|
|
@@ -10274,6 +10284,7 @@ var init_list = __esm({
|
|
|
10274
10284
|
"sqlite3"
|
|
10275
10285
|
];
|
|
10276
10286
|
collectNpmPlugins = async (list2) => {
|
|
10287
|
+
logger.debug("[collectNpmPlugins] \u5F00\u59CB\u6536\u96C6NPM\u63D2\u4EF6");
|
|
10277
10288
|
const pkg2 = await requireFile("./package.json", { force: true });
|
|
10278
10289
|
const dependencies = [
|
|
10279
10290
|
...Object.keys(pkg2.dependencies || {}),
|
|
@@ -10314,7 +10325,7 @@ var init_list = __esm({
|
|
|
10314
10325
|
initCache();
|
|
10315
10326
|
if (!["npm", "all", "git", "app"].includes(type)) return [];
|
|
10316
10327
|
const list2 = [];
|
|
10317
|
-
const files = type === "npm" ? [] : fs6.existsSync(
|
|
10328
|
+
const files = type === "npm" ? [] : fs6.existsSync(karinPathPlugins) ? await fs6.promises.readdir(karinPathPlugins, { withFileTypes: true }) : [];
|
|
10318
10329
|
switch (type) {
|
|
10319
10330
|
case "app":
|
|
10320
10331
|
await collectAppPlugins(files, list2);
|
|
@@ -11173,7 +11184,11 @@ var init_restart = __esm({
|
|
|
11173
11184
|
const db2 = await createDB2();
|
|
11174
11185
|
await db2.set(key, options);
|
|
11175
11186
|
if (isFront && process.send) {
|
|
11176
|
-
process.send(
|
|
11187
|
+
process.send(JSON.stringify({
|
|
11188
|
+
type: "restart",
|
|
11189
|
+
port: process.env.HTTP_PORT,
|
|
11190
|
+
token: process.env.HTTP_AUTH_KEY
|
|
11191
|
+
}));
|
|
11177
11192
|
return { status: "success", data: "\u5DF2\u53D1\u9001\u91CD\u542F\u4FE1\u53F7" };
|
|
11178
11193
|
}
|
|
11179
11194
|
if (process.env.PM2_RESTART === "true") process.exit();
|
|
@@ -13837,7 +13852,7 @@ function requireRange() {
|
|
|
13837
13852
|
parseRange(range22) {
|
|
13838
13853
|
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
13839
13854
|
const memoKey = memoOpts + ":" + range22;
|
|
13840
|
-
const cached =
|
|
13855
|
+
const cached = cache10.get(memoKey);
|
|
13841
13856
|
if (cached) {
|
|
13842
13857
|
return cached;
|
|
13843
13858
|
}
|
|
@@ -13871,7 +13886,7 @@ function requireRange() {
|
|
|
13871
13886
|
rangeMap.delete("");
|
|
13872
13887
|
}
|
|
13873
13888
|
const result = [...rangeMap.values()];
|
|
13874
|
-
|
|
13889
|
+
cache10.set(memoKey, result);
|
|
13875
13890
|
return result;
|
|
13876
13891
|
}
|
|
13877
13892
|
intersects(range22, options) {
|
|
@@ -13910,7 +13925,7 @@ function requireRange() {
|
|
|
13910
13925
|
}
|
|
13911
13926
|
range2 = Range;
|
|
13912
13927
|
const LRU = requireLrucache();
|
|
13913
|
-
const
|
|
13928
|
+
const cache10 = new LRU();
|
|
13914
13929
|
const parseOptions = requireParseOptions();
|
|
13915
13930
|
const Comparator = requireComparator();
|
|
13916
13931
|
const debug3 = requireDebug();
|
|
@@ -16665,7 +16680,7 @@ var init_config2 = __esm({
|
|
|
16665
16680
|
config_default = initConfig;
|
|
16666
16681
|
}
|
|
16667
16682
|
});
|
|
16668
|
-
var count,
|
|
16683
|
+
var count, staticCache, dynamicCache, getCfg, isOld, migrate, format2, initGroups, groups, getGroupCfg, getGuildCfg, getGroupsFileData, groups_default;
|
|
16669
16684
|
var init_groups4 = __esm({
|
|
16670
16685
|
"src/utils/config/file/groups.ts"() {
|
|
16671
16686
|
init_watch();
|
|
@@ -16675,7 +16690,7 @@ var init_groups4 = __esm({
|
|
|
16675
16690
|
init_default();
|
|
16676
16691
|
init_tools();
|
|
16677
16692
|
count = createCount();
|
|
16678
|
-
getCfg = (keys) => getCacheCfg(
|
|
16693
|
+
getCfg = (keys) => getCacheCfg(dynamicCache, count, keys);
|
|
16679
16694
|
isOld = (obj) => {
|
|
16680
16695
|
if (Array.isArray(obj)) return false;
|
|
16681
16696
|
return Object.keys(obj).every((key) => typeof obj[key] === "object");
|
|
@@ -16702,16 +16717,22 @@ var init_groups4 = __esm({
|
|
|
16702
16717
|
const name = "groups.json";
|
|
16703
16718
|
const file = `${dir2}/${name}`;
|
|
16704
16719
|
const data = requireFileSync(file, { type: "json" });
|
|
16705
|
-
|
|
16720
|
+
staticCache = isOld(data) ? migrate(file, data) : format2(data);
|
|
16721
|
+
dynamicCache = format2(data);
|
|
16706
16722
|
watch(file, async (old, data2) => {
|
|
16707
|
-
|
|
16708
|
-
|
|
16723
|
+
staticCache = isOld(data2) ? migrate(file, data2) : format2(data2);
|
|
16724
|
+
dynamicCache = staticCache;
|
|
16725
|
+
const options = { file: name, old, data: dynamicCache };
|
|
16709
16726
|
listeners.emit(FILE_CHANGE, options);
|
|
16710
16727
|
listeners.emit(`${FILE_CHANGE}:${name}`, options);
|
|
16711
16728
|
}, { type: "json" });
|
|
16712
|
-
clearCache(count,
|
|
16729
|
+
clearCache(count, staticCache, dynamicCache);
|
|
16730
|
+
};
|
|
16731
|
+
groups = () => {
|
|
16732
|
+
return {
|
|
16733
|
+
get: () => dynamicCache
|
|
16734
|
+
};
|
|
16713
16735
|
};
|
|
16714
|
-
groups = () => cache8;
|
|
16715
16736
|
getGroupCfg = (groupId, selfId) => {
|
|
16716
16737
|
const keys = [
|
|
16717
16738
|
`Bot:${selfId}:${groupId}`,
|
|
@@ -16741,7 +16762,7 @@ var init_groups4 = __esm({
|
|
|
16741
16762
|
groups_default = initGroups;
|
|
16742
16763
|
}
|
|
16743
16764
|
});
|
|
16744
|
-
var count2,
|
|
16765
|
+
var count2, staticCache2, dynamicCache2, getCfg2, isOld2, migrate2, format3, initPrivates, privates, getFriendCfg, getDirectCfg, getPrivatesFileData, privates_default;
|
|
16745
16766
|
var init_privates = __esm({
|
|
16746
16767
|
"src/utils/config/file/privates.ts"() {
|
|
16747
16768
|
init_watch();
|
|
@@ -16751,7 +16772,7 @@ var init_privates = __esm({
|
|
|
16751
16772
|
init_default();
|
|
16752
16773
|
init_tools();
|
|
16753
16774
|
count2 = createCount();
|
|
16754
|
-
getCfg2 = (keys) => getCacheCfg(
|
|
16775
|
+
getCfg2 = (keys) => getCacheCfg(dynamicCache2, count2, keys);
|
|
16755
16776
|
isOld2 = (obj) => {
|
|
16756
16777
|
if (Array.isArray(obj)) return false;
|
|
16757
16778
|
return Object.keys(obj).every((key) => typeof obj[key] === "object");
|
|
@@ -16778,16 +16799,18 @@ var init_privates = __esm({
|
|
|
16778
16799
|
const name = "privates.json";
|
|
16779
16800
|
const file = `${dir2}/${name}`;
|
|
16780
16801
|
const data = requireFileSync(file, { type: "json" });
|
|
16781
|
-
|
|
16802
|
+
staticCache2 = isOld2(data) ? migrate2(file, data) : format3(data);
|
|
16803
|
+
dynamicCache2 = format3(data);
|
|
16782
16804
|
watch(file, async (old, data2) => {
|
|
16783
|
-
|
|
16784
|
-
|
|
16805
|
+
staticCache2 = isOld2(data2) ? migrate2(file, data2) : format3(data2);
|
|
16806
|
+
dynamicCache2 = staticCache2;
|
|
16807
|
+
const options = { file: name, old, data: dynamicCache2 };
|
|
16785
16808
|
listeners.emit(FILE_CHANGE, options);
|
|
16786
16809
|
listeners.emit(`${FILE_CHANGE}:${name}`, options);
|
|
16787
16810
|
}, { type: "json" });
|
|
16788
|
-
clearCache(count2,
|
|
16811
|
+
clearCache(count2, staticCache2, dynamicCache2);
|
|
16789
16812
|
};
|
|
16790
|
-
privates = () =>
|
|
16813
|
+
privates = () => dynamicCache2;
|
|
16791
16814
|
getFriendCfg = (userId, selfId) => {
|
|
16792
16815
|
const keys = [`Bot:${selfId}:${userId}`, `Bot:${selfId}`, userId, "default"];
|
|
16793
16816
|
return getCfg2(keys);
|
|
@@ -17008,39 +17031,39 @@ var init_template = __esm({
|
|
|
17008
17031
|
});
|
|
17009
17032
|
|
|
17010
17033
|
// src/adapter/render/admin/cache.ts
|
|
17011
|
-
var index4,
|
|
17034
|
+
var index4, cache8, registerRender, unregisterRender, getRender, callRender, getRenderCount, getRenderList, renderHtml, renderMultiHtml, RenderCache, render, Renderer;
|
|
17012
17035
|
var init_cache3 = __esm({
|
|
17013
17036
|
"src/adapter/render/admin/cache.ts"() {
|
|
17014
17037
|
index4 = 0;
|
|
17015
|
-
|
|
17038
|
+
cache8 = [];
|
|
17016
17039
|
registerRender = (id, render4) => {
|
|
17017
17040
|
const i = ++index4;
|
|
17018
|
-
|
|
17041
|
+
cache8.push({ index: i, id, render: render4 });
|
|
17019
17042
|
logger.mark(`[render:${index4}] ${logger.green("\u6CE8\u518C\u6210\u529F")}: ${id}`);
|
|
17020
17043
|
return i;
|
|
17021
17044
|
};
|
|
17022
17045
|
unregisterRender = (index6) => {
|
|
17023
|
-
const app4 =
|
|
17046
|
+
const app4 = cache8.find((app5) => app5.index === index6);
|
|
17024
17047
|
if (!app4) {
|
|
17025
17048
|
logger.error(`[render] \u5378\u8F7D\u5931\u8D25: \u4E0D\u5B58\u5728\u7D22\u5F15 ${index6}`);
|
|
17026
17049
|
return false;
|
|
17027
17050
|
}
|
|
17028
|
-
|
|
17051
|
+
cache8.splice(cache8.findIndex((app5) => app5.index === index6), 1);
|
|
17029
17052
|
logger.mark(`[render] ${logger.yellow("\u5378\u8F7D\u6210\u529F")}: ${app4.id}`);
|
|
17030
17053
|
return true;
|
|
17031
17054
|
};
|
|
17032
17055
|
getRender = (id) => {
|
|
17033
|
-
if (
|
|
17056
|
+
if (cache8.length === 0) throw new Error("[\u8C03\u7528\u6E32\u67D3\u5668\u5931\u8D25] \u6E32\u67D3\u5668\u5217\u8868\u4E3A\u7A7A");
|
|
17034
17057
|
if (!id) {
|
|
17035
|
-
const app5 =
|
|
17058
|
+
const app5 = cache8[Math.floor(Math.random() * cache8.length)];
|
|
17036
17059
|
return app5;
|
|
17037
17060
|
}
|
|
17038
17061
|
if (typeof id === "number") {
|
|
17039
|
-
const app5 =
|
|
17062
|
+
const app5 = cache8.find((app6) => app6.index === id);
|
|
17040
17063
|
if (!app5) throw new Error(`[\u8C03\u7528\u6E32\u67D3\u5668\u5931\u8D25] \u672A\u627E\u5230\u6E32\u67D3\u5668\uFF1A${id}`);
|
|
17041
17064
|
return app5;
|
|
17042
17065
|
}
|
|
17043
|
-
const app4 =
|
|
17066
|
+
const app4 = cache8.find((app5) => app5.id === id);
|
|
17044
17067
|
if (!app4) throw new Error(`[\u8C03\u7528\u6E32\u67D3\u5668\u5931\u8D25] \u672A\u627E\u5230\u6E32\u67D3\u5668\uFF1A${id}`);
|
|
17045
17068
|
return app4;
|
|
17046
17069
|
};
|
|
@@ -17049,9 +17072,9 @@ var init_cache3 = __esm({
|
|
|
17049
17072
|
const result = await res.render(Object.assign(options, { encoding: "base64" }));
|
|
17050
17073
|
return result;
|
|
17051
17074
|
};
|
|
17052
|
-
getRenderCount = () =>
|
|
17075
|
+
getRenderCount = () => cache8.length;
|
|
17053
17076
|
getRenderList = () => {
|
|
17054
|
-
const list2 =
|
|
17077
|
+
const list2 = cache8.map((app4) => app4);
|
|
17055
17078
|
return list2;
|
|
17056
17079
|
};
|
|
17057
17080
|
renderHtml = (data) => {
|
|
@@ -17264,9 +17287,9 @@ var init_client2 = __esm({
|
|
|
17264
17287
|
});
|
|
17265
17288
|
};
|
|
17266
17289
|
disconnectSnapkaClient = (url) => {
|
|
17267
|
-
const
|
|
17268
|
-
if (!
|
|
17269
|
-
|
|
17290
|
+
const cache10 = snapkaMap.get(url);
|
|
17291
|
+
if (!cache10) return;
|
|
17292
|
+
cache10.close();
|
|
17270
17293
|
snapkaMap.delete(url);
|
|
17271
17294
|
};
|
|
17272
17295
|
addSnapkaClient = (clientOptions) => {
|
|
@@ -17447,7 +17470,7 @@ var init_snapka = __esm({
|
|
|
17447
17470
|
});
|
|
17448
17471
|
|
|
17449
17472
|
// src/utils/config/file/render.ts
|
|
17450
|
-
var
|
|
17473
|
+
var cache9, format4, initRender, render2, getRenderCfg, render_default;
|
|
17451
17474
|
var init_render = __esm({
|
|
17452
17475
|
"src/utils/config/file/render.ts"() {
|
|
17453
17476
|
init_watch();
|
|
@@ -17473,9 +17496,9 @@ var init_render = __esm({
|
|
|
17473
17496
|
const name = "render.json";
|
|
17474
17497
|
const file = `${dir2}/${name}`;
|
|
17475
17498
|
const data = requireFileSync(file, { type: "json" });
|
|
17476
|
-
|
|
17499
|
+
cache9 = format4(data);
|
|
17477
17500
|
watch(file, async (old, data2) => {
|
|
17478
|
-
|
|
17501
|
+
cache9 = format4(data2);
|
|
17479
17502
|
const wsClient = diffArray(
|
|
17480
17503
|
Array.isArray(old?.ws_client) ? old?.ws_client : [],
|
|
17481
17504
|
Array.isArray(data2?.ws_client) ? data2?.ws_client : []
|
|
@@ -17494,13 +17517,13 @@ var init_render = __esm({
|
|
|
17494
17517
|
);
|
|
17495
17518
|
httpServer.removed.forEach((v) => disconnectSnapkaHttp2(v.url));
|
|
17496
17519
|
httpServer.added.forEach((v) => createSnapkaHttp2(v));
|
|
17497
|
-
const options = { file: name, old, data:
|
|
17520
|
+
const options = { file: name, old, data: cache9 };
|
|
17498
17521
|
listeners.emit(FILE_CHANGE, options);
|
|
17499
17522
|
listeners.emit(`${FILE_CHANGE}:${name}`, options);
|
|
17500
17523
|
}, { type: "json" });
|
|
17501
17524
|
};
|
|
17502
|
-
render2 = () =>
|
|
17503
|
-
getRenderCfg = () =>
|
|
17525
|
+
render2 = () => cache9;
|
|
17526
|
+
getRenderCfg = () => cache9;
|
|
17504
17527
|
render_default = initRender;
|
|
17505
17528
|
}
|
|
17506
17529
|
});
|
|
@@ -22600,9 +22623,9 @@ var init_list2 = __esm({
|
|
|
22600
22623
|
init_redis();
|
|
22601
22624
|
getDependenciesListRouter = async (req, res) => {
|
|
22602
22625
|
try {
|
|
22603
|
-
const
|
|
22604
|
-
if (
|
|
22605
|
-
return createSuccessResponse(res,
|
|
22626
|
+
const cache10 = await getCache(req, res);
|
|
22627
|
+
if (cache10) {
|
|
22628
|
+
return createSuccessResponse(res, cache10);
|
|
22606
22629
|
}
|
|
22607
22630
|
const { stdout, error } = await exec("pnpm list --depth=0 --json");
|
|
22608
22631
|
if (error) {
|
|
@@ -22711,9 +22734,9 @@ var init_list2 = __esm({
|
|
|
22711
22734
|
return null;
|
|
22712
22735
|
}
|
|
22713
22736
|
const { redis: redis3 } = await Promise.resolve().then(() => (init_redis3(), redis_exports));
|
|
22714
|
-
const
|
|
22715
|
-
if (
|
|
22716
|
-
const data = JSON.parse(
|
|
22737
|
+
const cache10 = await redis3.get(REDIS_DEPENDENCIES_LIST_CACHE_KEY);
|
|
22738
|
+
if (cache10) {
|
|
22739
|
+
const data = JSON.parse(cache10);
|
|
22717
22740
|
if (!Array.isArray(data)) {
|
|
22718
22741
|
await redis3.del(REDIS_DEPENDENCIES_LIST_CACHE_KEY);
|
|
22719
22742
|
return null;
|
|
@@ -23286,9 +23309,9 @@ var init_market2 = __esm({
|
|
|
23286
23309
|
const list2 = [];
|
|
23287
23310
|
const isForce = Boolean(req.body.refresh ?? false);
|
|
23288
23311
|
if (!isForce) {
|
|
23289
|
-
const
|
|
23290
|
-
if (
|
|
23291
|
-
return createSuccessResponse(res, JSON.parse(
|
|
23312
|
+
const cache10 = await getCache2();
|
|
23313
|
+
if (cache10) {
|
|
23314
|
+
return createSuccessResponse(res, JSON.parse(cache10));
|
|
23292
23315
|
}
|
|
23293
23316
|
}
|
|
23294
23317
|
const [
|
|
@@ -23307,8 +23330,8 @@ var init_market2 = __esm({
|
|
|
23307
23330
|
};
|
|
23308
23331
|
getCache2 = async () => {
|
|
23309
23332
|
const { redis: redis3 } = await Promise.resolve().then(() => (init_redis3(), redis_exports));
|
|
23310
|
-
const
|
|
23311
|
-
return
|
|
23333
|
+
const cache10 = await redis3.get(REDIS_PLUGIN_MARKET_LIST_CACHE_KEY);
|
|
23334
|
+
return cache10;
|
|
23312
23335
|
};
|
|
23313
23336
|
setCache2 = async (data) => {
|
|
23314
23337
|
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
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{V as p}from"./vendor-react-
|
|
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
|
|
Binary file
|
|
Binary file
|
|
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
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-others-
|
|
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
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-react-
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-heroui-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/hooks-
|
|
24
|
-
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-visual-
|
|
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-
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-react-Hg1DVPZt.js">
|
|
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
|
+
<link rel="modulepreload" crossorigin href="/web/assets/js/vendor-visual-mzxhMYK3.js">
|
|
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-Z2UfPrqC.js";import{P as r}from"./components-xTgkEKOh.js";import"./vendor-others-CpZ3FDDG.js";import"./vendor-editor-B8hjWfkw.js";import"./vendor-ui-utils-5rYIvRjL.js";import"./vendor-heroui-Blyb7kuN.js";import"./page-dashboard-Cg6WjwPD.js";import"./hooks-BVOSuufY.js";import"./utils-BuR6hXd1.js";import"./vendor-visual-DQREh7WM.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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|