karin-plugin-kkk 2.4.0 → 2.6.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 +29 -0
- package/lib/apps/admin.js +3 -3
- package/lib/apps/help.js +3 -3
- package/lib/apps/push.js +3 -3
- package/lib/apps/tools.js +3 -3
- package/lib/apps/update.js +164 -0
- package/lib/core_chunk/{db-BQZ7FLWw.js → db-DRCMka-n.js} +2 -2
- package/lib/core_chunk/{main-PJBwqzbd.js → main-BKmHLtkB.js} +200 -91
- package/lib/core_chunk/template.d.ts +32 -1
- package/lib/core_chunk/template.js +217 -495
- package/lib/core_chunk/{vendor-ClxefV4m.js → vendor-IyMLJerg.js} +364 -661
- package/lib/index.js +5 -5
- package/lib/karin-plugin-kkk.css +12 -1951
- package/lib/web.config.js +1 -1
- package/lib/web_chunk/assets/Combination-BYJgTUmn.js +46 -0
- package/lib/web_chunk/assets/avatar-fN_uMjQi.js +9 -0
- package/lib/web_chunk/assets/{eye-C5LXx-QQ.js → eye-IdL0-Vjd.js} +1 -1
- package/lib/web_chunk/assets/index-B0TxVY3L.js +6 -0
- package/lib/web_chunk/assets/index-Cl88-C0Y.js +487 -0
- package/lib/web_chunk/assets/page-BC62T7Cu.js +11 -0
- package/lib/web_chunk/assets/page-BPxkbWoi.js +114 -0
- package/lib/web_chunk/assets/page-Cy-z1zyu.js +45 -0
- package/lib/web_chunk/assets/page-Fqg5A1P7.js +16 -0
- package/lib/web_chunk/assets/page-lC6xBZmL.js +31 -0
- package/lib/web_chunk/assets/request-Q2xU2i96.js +19 -0
- package/lib/web_chunk/assets/select-CGAmmZfu.js +16 -0
- package/lib/web_chunk/assets/separator-DvBw2ZBd.js +1 -0
- package/lib/web_chunk/index.html +1 -1
- package/lib/web_chunk/sw.js +1 -1
- package/package.json +1 -1
- package/lib/web_chunk/assets/Combination-D_5Ir4bk.js +0 -46
- package/lib/web_chunk/assets/avatar-B6bodyNx.js +0 -9
- package/lib/web_chunk/assets/index-C4TKq9eG.js +0 -487
- package/lib/web_chunk/assets/index-Hi9W4UQy.js +0 -6
- package/lib/web_chunk/assets/page-BWD5DRhn.js +0 -45
- package/lib/web_chunk/assets/page-BenUenxb.js +0 -31
- package/lib/web_chunk/assets/page-Blcu1-_e.js +0 -16
- package/lib/web_chunk/assets/page-CQQ9mzE-.js +0 -114
- package/lib/web_chunk/assets/page-D8sJPU-r.js +0 -11
- package/lib/web_chunk/assets/request-BW_hZUK3.js +0 -19
- package/lib/web_chunk/assets/select-BUvKOwyZ.js +0 -16
- package/lib/web_chunk/assets/separator-DgC6OX8V.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# 变更日志
|
|
2
2
|
|
|
3
|
+
## [2.6.0](https://github.com/ikenxuan/karin-plugin-kkk/compare/v2.5.0...v2.6.0) (2025-10-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ✨ 新功能
|
|
7
|
+
|
|
8
|
+
* 重构更新日志组件并优化版本检测功能,添加'#kkk更新' ([7147598](https://github.com/ikenxuan/karin-plugin-kkk/commit/7147598c84c46d41aa4cf7b1a6fb1415105816ae))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### 🐛 错误修复
|
|
12
|
+
|
|
13
|
+
* 细优UI样式 ([8cad02d](https://github.com/ikenxuan/karin-plugin-kkk/commit/8cad02d69a9873520151694ee8ee4758961d63f9))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### ♻️ 代码重构
|
|
17
|
+
|
|
18
|
+
* **template:** 移除未使用的依赖并重构样式配置 ([4725c25](https://github.com/ikenxuan/karin-plugin-kkk/commit/4725c25cd5de7935fc542deacae35b82202c65ac))
|
|
19
|
+
|
|
20
|
+
## [2.5.0](https://github.com/ikenxuan/karin-plugin-kkk/compare/v2.4.0...v2.5.0) (2025-10-13)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### ✨ 新功能
|
|
24
|
+
|
|
25
|
+
* **douyin:** 添加评论回复功能及数据文件支持 ([12f2460](https://github.com/ikenxuan/karin-plugin-kkk/commit/12f24602bc7eb0bfe80cd4fd33ff35bcceac72bb))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### 🐛 错误修复
|
|
29
|
+
|
|
30
|
+
* 番剧匹配不到ID ([84dea7e](https://github.com/ikenxuan/karin-plugin-kkk/commit/84dea7eb49ab0ba55bffb3cf86873bccd58740fa))
|
|
31
|
+
|
|
3
32
|
## [2.4.0](https://github.com/ikenxuan/karin-plugin-kkk/compare/v2.3.0...v2.4.0) (2025-10-11)
|
|
4
33
|
|
|
5
34
|
|
package/lib/apps/admin.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import karin, { logger } from "node-karin";
|
|
3
3
|
import require$$1 from "path";
|
|
4
|
-
import "../core_chunk/db-
|
|
4
|
+
import "../core_chunk/db-DRCMka-n.js";
|
|
5
5
|
import "../root.js";
|
|
6
|
-
import "../core_chunk/vendor-
|
|
7
|
-
import { C as Config, m as Common, n as bilibiliLogin } from "../core_chunk/main-
|
|
6
|
+
import "../core_chunk/vendor-IyMLJerg.js";
|
|
7
|
+
import { C as Config, m as Common, n as bilibiliLogin } from "../core_chunk/main-BKmHLtkB.js";
|
|
8
8
|
import "node-karin/axios";
|
|
9
9
|
import "stream/promises";
|
|
10
10
|
import "node:path";
|
package/lib/apps/help.js
CHANGED
|
@@ -2,10 +2,10 @@ import fs from "node:fs";
|
|
|
2
2
|
import { markdown } from "@karinjs/md-html";
|
|
3
3
|
import karin, { logs, mkdirSync, render, segment } from "node-karin";
|
|
4
4
|
import { karinPathTemp } from "node-karin/root";
|
|
5
|
-
import "../core_chunk/db-
|
|
5
|
+
import "../core_chunk/db-DRCMka-n.js";
|
|
6
6
|
import { Root } from "../root.js";
|
|
7
|
-
import "../core_chunk/vendor-
|
|
8
|
-
import { R as Render, m as Common } from "../core_chunk/main-
|
|
7
|
+
import "../core_chunk/vendor-IyMLJerg.js";
|
|
8
|
+
import { R as Render, m as Common } from "../core_chunk/main-BKmHLtkB.js";
|
|
9
9
|
import "node-karin/axios";
|
|
10
10
|
import "stream/promises";
|
|
11
11
|
const help = karin.command(/^#?kkk帮助$/, async (e) => {
|
package/lib/apps/push.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as getDouyinData, g as getBilibiliData,
|
|
1
|
+
import { a as getDouyinData, g as getBilibiliData, a5 as amagi } from "../core_chunk/vendor-IyMLJerg.js";
|
|
2
2
|
import karin, { logger } from "node-karin";
|
|
3
|
-
import { douyinDBInstance, bilibiliDBInstance } from "../core_chunk/db-
|
|
3
|
+
import { douyinDBInstance, bilibiliDBInstance } from "../core_chunk/db-DRCMka-n.js";
|
|
4
4
|
import "../root.js";
|
|
5
5
|
import "node:fs";
|
|
6
|
-
import { C as Config, o as wrapWithErrorHandler, B as Bilibilipush, D as DouYinpush, p as getDouyinID, N as Networks, R as Render, m as Common } from "../core_chunk/main-
|
|
6
|
+
import { C as Config, o as wrapWithErrorHandler, B as Bilibilipush, D as DouYinpush, p as getDouyinID, N as Networks, R as Render, m as Common } from "../core_chunk/main-BKmHLtkB.js";
|
|
7
7
|
import "node-karin/axios";
|
|
8
8
|
const handleDouyinPush = wrapWithErrorHandler(async () => {
|
|
9
9
|
await new DouYinpush().action();
|
package/lib/apps/tools.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import karin, { logger } from "node-karin";
|
|
2
|
-
import "../core_chunk/db-
|
|
2
|
+
import "../core_chunk/db-DRCMka-n.js";
|
|
3
3
|
import "../root.js";
|
|
4
4
|
import "node:fs";
|
|
5
|
-
import "../core_chunk/vendor-
|
|
6
|
-
import { o as wrapWithErrorHandler, C as Config, p as getDouyinID, q as DouYin, r as getBilibiliID, t as Bilibili, u as getKuaishouID, x as fetchKuaishouData, K as Kuaishou, y as getXiaohongshuID, X as Xiaohongshu, m as Common } from "../core_chunk/main-
|
|
5
|
+
import "../core_chunk/vendor-IyMLJerg.js";
|
|
6
|
+
import { o as wrapWithErrorHandler, C as Config, p as getDouyinID, q as DouYin, r as getBilibiliID, t as Bilibili, u as getKuaishouID, x as fetchKuaishouData, K as Kuaishou, y as getXiaohongshuID, X as Xiaohongshu, m as Common } from "../core_chunk/main-BKmHLtkB.js";
|
|
7
7
|
import "node-karin/axios";
|
|
8
8
|
import "stream/promises";
|
|
9
9
|
import "node:path";
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import karin, { hooks, db, checkPkgUpdate, updatePkg, restart, segment, logger, config } from "node-karin";
|
|
2
|
+
import axios from "node-karin/axios";
|
|
3
|
+
import "../core_chunk/db-DRCMka-n.js";
|
|
4
|
+
import { Root } from "../root.js";
|
|
5
|
+
import "node:fs";
|
|
6
|
+
import "../core_chunk/vendor-IyMLJerg.js";
|
|
7
|
+
import { z as isSemverGreater, A as getChangelogImage } from "../core_chunk/main-BKmHLtkB.js";
|
|
8
|
+
import "stream/promises";
|
|
9
|
+
import "node:path";
|
|
10
|
+
import "../core_chunk/template.js";
|
|
11
|
+
const UPDATE_LOCK_KEY = "kkk:update:lock";
|
|
12
|
+
const UPDATE_MSGID_KEY = "kkk:update:msgId";
|
|
13
|
+
const Handler = async (e) => {
|
|
14
|
+
logger.trace(e);
|
|
15
|
+
const registryUrl = `https://registry.npmjs.org/${Root.pluginName}`;
|
|
16
|
+
let latestVersion = null;
|
|
17
|
+
try {
|
|
18
|
+
const res = await axios.get(registryUrl, { timeout: 1e4 });
|
|
19
|
+
latestVersion = res.data?.["dist-tags"]?.latest || res.data?.version || null;
|
|
20
|
+
} catch {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (!latestVersion) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
const lockKey = UPDATE_LOCK_KEY;
|
|
27
|
+
try {
|
|
28
|
+
const lockedVersion = await db.get(lockKey);
|
|
29
|
+
if (typeof lockedVersion === "string" && lockedVersion.length > 0) {
|
|
30
|
+
if (!isSemverGreater(lockedVersion, Root.pluginVersion)) {
|
|
31
|
+
await db.del(lockKey);
|
|
32
|
+
} else {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
if (!isSemverGreater(latestVersion, Root.pluginVersion)) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
await db.set(lockKey, latestVersion);
|
|
43
|
+
} catch {
|
|
44
|
+
}
|
|
45
|
+
const ChangeLogImg = await getChangelogImage(Root.pluginVersion, latestVersion);
|
|
46
|
+
const list = config.master();
|
|
47
|
+
let master = list[0];
|
|
48
|
+
if (master === "console") {
|
|
49
|
+
master = list[1];
|
|
50
|
+
}
|
|
51
|
+
const botList = karin.getAllBotList();
|
|
52
|
+
if (ChangeLogImg) {
|
|
53
|
+
const msgResult = await karin.sendMaster(
|
|
54
|
+
botList[0].bot.account.name === "console" ? botList[1].bot.account.selfId : botList[0].bot.account.selfId,
|
|
55
|
+
master,
|
|
56
|
+
[
|
|
57
|
+
segment.text("karin-plugin-kkk 有新的更新!"),
|
|
58
|
+
...ChangeLogImg
|
|
59
|
+
]
|
|
60
|
+
);
|
|
61
|
+
try {
|
|
62
|
+
await db.set(UPDATE_MSGID_KEY, msgResult.messageId);
|
|
63
|
+
await db.set(lockKey, latestVersion);
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
};
|
|
69
|
+
const kkkUpdate = hooks.message.friend(async (e, next) => {
|
|
70
|
+
if (e.msg.includes("更新")) {
|
|
71
|
+
const msgId = await db.get(UPDATE_MSGID_KEY);
|
|
72
|
+
if (e.replyId === msgId) {
|
|
73
|
+
const updateStatus = await checkPkgUpdate(Root.pluginName);
|
|
74
|
+
if (updateStatus.status === "yes") {
|
|
75
|
+
try {
|
|
76
|
+
const result = await updatePkg(Root.pluginName);
|
|
77
|
+
if (result.status === "ok") {
|
|
78
|
+
const msgResult = await e.reply(`${Root.pluginName} 更新成功!
|
|
79
|
+
${result.local} -> ${result.remote}
|
|
80
|
+
开始执行重启......`);
|
|
81
|
+
msgResult.messageId && await db.del(UPDATE_MSGID_KEY) && await db.del(UPDATE_LOCK_KEY);
|
|
82
|
+
const restartStartTime = Date.now();
|
|
83
|
+
const restartResult = await restart(e.selfId, e.contact, e.messageId);
|
|
84
|
+
if (restartResult.status === "success") {
|
|
85
|
+
await e.reply(`重启成功,耗时: ${(Date.now() - restartStartTime / 1e3).toFixed(2)}s`);
|
|
86
|
+
} else {
|
|
87
|
+
await e.reply(`重启失败: ${restartResult.data}`);
|
|
88
|
+
}
|
|
89
|
+
} else if (result.status === "failed") {
|
|
90
|
+
await e.reply(`${Root.pluginName} 更新失败: ${result.data}`);
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
await e.reply(`${Root.pluginName} 更新失败: ${error.message}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
next();
|
|
99
|
+
}, { priority: 100 });
|
|
100
|
+
const kkkUpdateCommand = karin.command(/^#?kkk更新$/, async (e) => {
|
|
101
|
+
const registryUrl = `https://registry.npmjs.org/${Root.pluginName}`;
|
|
102
|
+
let latestVersion = null;
|
|
103
|
+
try {
|
|
104
|
+
const res = await axios.get(registryUrl, { timeout: 1e4 });
|
|
105
|
+
latestVersion = res.data?.["dist-tags"]?.latest || res.data?.version || null;
|
|
106
|
+
} catch {
|
|
107
|
+
await e.reply("获取远程版本失败,请稍后再试。");
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!latestVersion) {
|
|
111
|
+
await e.reply("未获取到最新版本信息。");
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!isSemverGreater(latestVersion, Root.pluginVersion)) {
|
|
115
|
+
await e.reply(`当前已是最新版本:${Root.pluginVersion}`, { reply: true });
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const ChangeLogImg = await getChangelogImage(Root.pluginVersion, latestVersion);
|
|
119
|
+
if (ChangeLogImg) {
|
|
120
|
+
await e.reply([segment.text(`${Root.pluginName} 的更新日志:`), ...ChangeLogImg], { reply: true });
|
|
121
|
+
} else {
|
|
122
|
+
await e.reply("获取更新日志失败,更新进程继续......", { reply: true });
|
|
123
|
+
}
|
|
124
|
+
const updateStatus = await checkPkgUpdate(Root.pluginName);
|
|
125
|
+
if (updateStatus.status === "yes") {
|
|
126
|
+
try {
|
|
127
|
+
const result = await updatePkg(Root.pluginName);
|
|
128
|
+
if (result.status === "ok") {
|
|
129
|
+
const msgResult = await e.reply(`${Root.pluginName} 更新成功!
|
|
130
|
+
${result.local} -> ${result.remote}
|
|
131
|
+
开始执行重启......`);
|
|
132
|
+
msgResult.messageId && await db.del(UPDATE_MSGID_KEY) && await db.del(UPDATE_LOCK_KEY);
|
|
133
|
+
const restartStartTime = Date.now();
|
|
134
|
+
const restartResult = await restart(e.selfId, e.contact, e.messageId);
|
|
135
|
+
if (restartResult.status === "success") {
|
|
136
|
+
await e.reply(`重启成功,耗时: ${((Date.now() - restartStartTime) / 1e3).toFixed(2)}s`);
|
|
137
|
+
} else {
|
|
138
|
+
await e.reply(`重启失败: ${restartResult.data}`);
|
|
139
|
+
}
|
|
140
|
+
} else if (result.status === "failed") {
|
|
141
|
+
await e.reply(`${Root.pluginName} 更新失败: ${result.data}`);
|
|
142
|
+
}
|
|
143
|
+
} catch (error) {
|
|
144
|
+
await e.reply(`${Root.pluginName} 更新失败: ${error.message}`);
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
await e.reply("未检测到可更新版本。");
|
|
148
|
+
}
|
|
149
|
+
}, { name: "kkk-更新" });
|
|
150
|
+
const updateTest = karin.command("test", async (e) => {
|
|
151
|
+
return Handler(e);
|
|
152
|
+
}, {
|
|
153
|
+
name: "kkk-更新检测"
|
|
154
|
+
});
|
|
155
|
+
const update = karin.task("kkk-更新检测", "*/10 * * * *", Handler, {
|
|
156
|
+
name: "kkk-更新检测",
|
|
157
|
+
log: false
|
|
158
|
+
});
|
|
159
|
+
export {
|
|
160
|
+
kkkUpdate,
|
|
161
|
+
kkkUpdateCommand,
|
|
162
|
+
update,
|
|
163
|
+
updateTest
|
|
164
|
+
};
|
|
@@ -4,8 +4,8 @@ import { logger } from "node-karin";
|
|
|
4
4
|
import { karinPathBase } from "node-karin/root";
|
|
5
5
|
import sqlite3 from "node-karin/sqlite3";
|
|
6
6
|
import { Root } from "../root.js";
|
|
7
|
-
import { D as DynamicType } from "./vendor-
|
|
8
|
-
import { C as Config } from "./main-
|
|
7
|
+
import { D as DynamicType } from "./vendor-IyMLJerg.js";
|
|
8
|
+
import { C as Config } from "./main-BKmHLtkB.js";
|
|
9
9
|
import "node-karin/axios";
|
|
10
10
|
import "stream/promises";
|
|
11
11
|
import "./template.js";
|