karin-plugin-kkk 1.6.9 → 1.6.10
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 +9 -0
- package/lib/apps/admin.js +3 -3
- package/lib/apps/help.js +8 -97
- package/lib/apps/push.js +3 -3
- package/lib/apps/tools.js +3 -3
- package/lib/chunk/{db-BwUYgCsJ.js → db-CF5YPBQZ.js} +2 -2
- package/lib/chunk/{main-NN4to0wU.js → main-7ixE4nsO.js} +9 -10
- package/lib/chunk/{vendor-FI9gb_Rv.js → vendor-FBHuBUPi.js} +1484 -1490
- package/lib/index.js +4 -4
- package/lib/web.config.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# 变更日志
|
|
2
2
|
|
|
3
|
+
## [1.6.10](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.6.9...v1.6.10) (2025-06-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **douyin:** 修复评论中表情替换和空格处理问题 ([d49a2e1](https://github.com/ikenxuan/karin-plugin-kkk/commit/d49a2e1b4dd5e7c28cbe15429c53f1d1951a3447))
|
|
9
|
+
* 分割更新日志 ([11ddf95](https://github.com/ikenxuan/karin-plugin-kkk/commit/11ddf952338b459b9a0751c72aaad294f10559dc))
|
|
10
|
+
* 移除内置更新 ([11ddf95](https://github.com/ikenxuan/karin-plugin-kkk/commit/11ddf952338b459b9a0751c72aaad294f10559dc))
|
|
11
|
+
|
|
3
12
|
## [1.6.9](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.6.8...v1.6.9) (2025-06-11)
|
|
4
13
|
|
|
5
14
|
|
package/lib/apps/admin.js
CHANGED
|
@@ -2,10 +2,10 @@ import fs from "node:fs";
|
|
|
2
2
|
import karin, { logger } from "node-karin";
|
|
3
3
|
import require$$1 from "path";
|
|
4
4
|
import "sequelize";
|
|
5
|
-
import "../chunk/db-
|
|
5
|
+
import "../chunk/db-CF5YPBQZ.js";
|
|
6
6
|
import "../root.js";
|
|
7
|
-
import "../chunk/vendor-
|
|
8
|
-
import { C as Config, a as Common, b as bilibiliLogin, d as douyinLogin } from "../chunk/main-
|
|
7
|
+
import "../chunk/vendor-FBHuBUPi.js";
|
|
8
|
+
import { C as Config, a as Common, b as bilibiliLogin, d as douyinLogin } from "../chunk/main-7ixE4nsO.js";
|
|
9
9
|
import "node-karin/axios";
|
|
10
10
|
import "stream/promises";
|
|
11
11
|
import "node:path";
|
package/lib/apps/help.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { execSync } from "node:child_process";
|
|
2
1
|
import fs from "node:fs";
|
|
3
|
-
import { m as markdown } from "../chunk/vendor-
|
|
4
|
-
import karin, { mkdirSync, render, segment
|
|
2
|
+
import { m as markdown } from "../chunk/vendor-FBHuBUPi.js";
|
|
3
|
+
import karin, { logs, mkdirSync, render, segment } from "node-karin";
|
|
5
4
|
import { karinPathTemp } from "node-karin/root";
|
|
6
5
|
import "sequelize";
|
|
7
|
-
import "../chunk/db-
|
|
6
|
+
import "../chunk/db-CF5YPBQZ.js";
|
|
8
7
|
import { Root } from "../root.js";
|
|
9
|
-
import { R as Render,
|
|
8
|
+
import { R as Render, a as Common } from "../chunk/main-7ixE4nsO.js";
|
|
10
9
|
import "node-karin/axios";
|
|
11
10
|
import "stream/promises";
|
|
12
11
|
const help = karin.command(/^#?kkk帮助$/, async (e) => {
|
|
@@ -14,10 +13,10 @@ const help = karin.command(/^#?kkk帮助$/, async (e) => {
|
|
|
14
13
|
await e.reply(img);
|
|
15
14
|
return true;
|
|
16
15
|
}, { name: "kkk-帮助" });
|
|
17
|
-
const version = karin.command(/^#?kkk
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const html = markdown(
|
|
16
|
+
const version = karin.command(/^#?kkk(版本|更新日志)$/, async (e) => {
|
|
17
|
+
const changelogContent = fs.readFileSync(Root.pluginPath + "/CHANGELOG.md", "utf8");
|
|
18
|
+
const forwardLogs = logs(Root.pluginVersion, changelogContent, 8, false);
|
|
19
|
+
const html = markdown(forwardLogs, {
|
|
21
20
|
gitcss: Common.useDarkTheme() ? "github-markdown-dark.css" : "github-markdown-light.css"
|
|
22
21
|
});
|
|
23
22
|
mkdirSync(`${karinPathTemp}/html/${Root.pluginName}/version`);
|
|
@@ -27,95 +26,7 @@ const version = karin.command(/^#?kkk版本$/, async (e) => {
|
|
|
27
26
|
await e.reply(segment.image("base64://" + img));
|
|
28
27
|
return true;
|
|
29
28
|
}, { name: "kkk-版本" });
|
|
30
|
-
const changelogs = karin.command(/^#?kkk更新日志$/, async (e) => {
|
|
31
|
-
const commits = getLatestCommitsSync();
|
|
32
|
-
let htmlString = "";
|
|
33
|
-
for (const commit of commits) {
|
|
34
|
-
htmlString += `
|
|
35
|
-
<div align="center" style="padding: 3em; border: ${setColor(commit.message)}; border-radius: 0 50px 25px 100px;">
|
|
36
|
-
<p align="left" style="font-size: 1.5em; font-weight: 700;">${commit.message}</p>
|
|
37
|
-
<p align="right" style="font-size: 1.15em">COMMITTER: ${commit.committer}</p>
|
|
38
|
-
<p align="right" style="font-size: 1em">SHA: ${commit.sha}</p>
|
|
39
|
-
</div><br>
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
42
|
-
const html = markdown(htmlString, {
|
|
43
|
-
gitcss: Common.useDarkTheme() ? "github-markdown-dark.css" : "github-markdown-light.css"
|
|
44
|
-
});
|
|
45
|
-
mkdirSync(`${karinPathTemp}/html/${Root.pluginName}/version`);
|
|
46
|
-
const htmlPath = `${karinPathTemp}/html/${Root.pluginName}/version/changelogs.html`;
|
|
47
|
-
fs.writeFileSync(htmlPath, html);
|
|
48
|
-
const img = await render.renderHtml(htmlPath);
|
|
49
|
-
await e.reply(segment.image("base64://" + img));
|
|
50
|
-
return true;
|
|
51
|
-
}, { name: "kkk-更新日志" });
|
|
52
|
-
const update = karin.command(/^#?kkk更新(预览版)?$/, async (e) => {
|
|
53
|
-
let status = "failed";
|
|
54
|
-
let data = "";
|
|
55
|
-
if (isPackaged) {
|
|
56
|
-
if (e.msg.includes("预览版")) {
|
|
57
|
-
const resolve = await updatePkg(Root.pluginName, "beta");
|
|
58
|
-
status = resolve.status;
|
|
59
|
-
data = resolve.data;
|
|
60
|
-
} else {
|
|
61
|
-
const resolve = await updatePkg(Root.pluginName);
|
|
62
|
-
status = resolve.status;
|
|
63
|
-
data = resolve.data;
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
let cmd = "git pull";
|
|
67
|
-
if (e.msg.includes("强制")) {
|
|
68
|
-
cmd = "git reset --hard && git pull --allow-unrelated-histories";
|
|
69
|
-
}
|
|
70
|
-
const resolve = await updateGitPlugin(Root.pluginPath, cmd);
|
|
71
|
-
status = resolve.status;
|
|
72
|
-
data = resolve.data;
|
|
73
|
-
}
|
|
74
|
-
logger.debug(data);
|
|
75
|
-
await e.bot.sendForwardMsg(e.contact, common.makeForward([segment.text(`更新 ${Root.pluginName}...
|
|
76
|
-
${JSON.stringify(data)}`)], e.sender.userId, e.sender.nick));
|
|
77
|
-
if (status === "ok") {
|
|
78
|
-
try {
|
|
79
|
-
await e.reply(`
|
|
80
|
-
更新完成,开始重启 本次运行时间:${common.uptime()}`, { at: true });
|
|
81
|
-
await restart(e.selfId, e.contact, e.messageId);
|
|
82
|
-
return true;
|
|
83
|
-
} catch (error) {
|
|
84
|
-
await e.reply(`${Root.pluginName}重启失败,请手动重启以应用更新!`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return true;
|
|
88
|
-
}, { name: "kkk-更新", perm: "master" });
|
|
89
|
-
const getLatestCommitsSync = () => {
|
|
90
|
-
const command = 'git log -150 --pretty=format:"%h %an %s"';
|
|
91
|
-
const output = execSync(command, { cwd: Root.pluginPath }).toString();
|
|
92
|
-
const commits = output.trim().split("\n");
|
|
93
|
-
return commits.map((commit) => {
|
|
94
|
-
const [sha, ...rest] = commit.split(" ");
|
|
95
|
-
const spaceIndex = rest.findIndex((word) => word.includes(":"));
|
|
96
|
-
const committerAndMessage = rest.slice(0, spaceIndex);
|
|
97
|
-
const committer = committerAndMessage.join(" ");
|
|
98
|
-
const message = rest.slice(spaceIndex).join(" ").replace(/^:/, "").trim();
|
|
99
|
-
return { sha, committer, message };
|
|
100
|
-
}).slice(0, 50);
|
|
101
|
-
};
|
|
102
|
-
const setColor = (message) => {
|
|
103
|
-
switch (true) {
|
|
104
|
-
case message.includes("feat"):
|
|
105
|
-
return "10px solid #a9ffb9";
|
|
106
|
-
case message.includes("fix"):
|
|
107
|
-
return "10px solid #ffe96e;";
|
|
108
|
-
case message.includes("perf"):
|
|
109
|
-
return "10px solid #928eff";
|
|
110
|
-
case message.includes("refactor"):
|
|
111
|
-
return "10px solid #ff3b3b";
|
|
112
|
-
default:
|
|
113
|
-
return "2px solid";
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
29
|
export {
|
|
117
|
-
changelogs,
|
|
118
30
|
help,
|
|
119
|
-
update,
|
|
120
31
|
version
|
|
121
32
|
};
|
package/lib/apps/push.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { d as getDouyinData, g as getBilibiliData } from "../chunk/vendor-
|
|
1
|
+
import { d as getDouyinData, g as getBilibiliData } from "../chunk/vendor-FBHuBUPi.js";
|
|
2
2
|
import karin from "node-karin";
|
|
3
3
|
import "sequelize";
|
|
4
|
-
import "../chunk/db-
|
|
4
|
+
import "../chunk/db-CF5YPBQZ.js";
|
|
5
5
|
import "../root.js";
|
|
6
6
|
import "node:fs";
|
|
7
|
-
import { C as Config, c as DouYinpush, B as Bilibilipush } from "../chunk/main-
|
|
7
|
+
import { C as Config, c as DouYinpush, B as Bilibilipush } from "../chunk/main-7ixE4nsO.js";
|
|
8
8
|
import "node-karin/axios";
|
|
9
9
|
import "stream/promises";
|
|
10
10
|
import "node:path";
|
package/lib/apps/tools.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import karin, { logger } from "node-karin";
|
|
2
2
|
import "sequelize";
|
|
3
|
-
import "../chunk/db-
|
|
3
|
+
import "../chunk/db-CF5YPBQZ.js";
|
|
4
4
|
import "../root.js";
|
|
5
5
|
import "node:fs";
|
|
6
|
-
import "../chunk/vendor-
|
|
7
|
-
import { e as getDouyinID, f as DouYin, C as Config, h as getBilibiliID, i as Bilibili, j as getKuaishouID, k as fetchKuaishouData, K as Kuaishou, a as Common } from "../chunk/main-
|
|
6
|
+
import "../chunk/vendor-FBHuBUPi.js";
|
|
7
|
+
import { e as getDouyinID, f as DouYin, C as Config, h as getBilibiliID, i as Bilibili, j as getKuaishouID, k as fetchKuaishouData, K as Kuaishou, a as Common } from "../chunk/main-7ixE4nsO.js";
|
|
8
8
|
import "node-karin/axios";
|
|
9
9
|
import "stream/promises";
|
|
10
10
|
import "node:path";
|
|
@@ -4,8 +4,8 @@ import { logger } from "node-karin";
|
|
|
4
4
|
import { karinPathBase } from "node-karin/root";
|
|
5
5
|
import { Root } from "../root.js";
|
|
6
6
|
import "node:fs";
|
|
7
|
-
import "./vendor-
|
|
8
|
-
import { C as Config, D as DynamicType } from "./main-
|
|
7
|
+
import "./vendor-FBHuBUPi.js";
|
|
8
|
+
import { C as Config, D as DynamicType } from "./main-7ixE4nsO.js";
|
|
9
9
|
import "node-karin/axios";
|
|
10
10
|
import "stream/promises";
|
|
11
11
|
const sequelize$1 = new Sequelize({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Root } from "../root.js";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
-
import { C as Client, b as bilibiliErrorCodeMap, g as getBilibiliData, a as bilibiliApiUrls, w as wbi_sign, c as browserExports, i as index, d as getDouyinData, h as heicConvertExports, m as markdown } from "./vendor-
|
|
3
|
+
import { C as Client, b as bilibiliErrorCodeMap, g as getBilibiliData, a as bilibiliApiUrls, w as wbi_sign, c as browserExports, i as index, d as getDouyinData, h as heicConvertExports, m as markdown } from "./vendor-FBHuBUPi.js";
|
|
4
4
|
import karin, { logger, config, segment, createNotFoundResponse, copyConfigSync, filesByExt, watch, requireFileSync, ffmpeg, ffprobe, render, common, defineConfig, components, karinPathRoot, mkdirSync, handler } from "node-karin";
|
|
5
5
|
import axios, { AxiosError } from "node-karin/axios";
|
|
6
6
|
import { pipeline } from "stream/promises";
|
|
7
7
|
import path, { join } from "node:path";
|
|
8
8
|
import "sequelize";
|
|
9
|
-
import { douyinDB, bilibiliDB, cleanOldDynamicCache } from "./db-
|
|
9
|
+
import { douyinDB, bilibiliDB, cleanOldDynamicCache } from "./db-CF5YPBQZ.js";
|
|
10
10
|
import _ from "node-karin/lodash";
|
|
11
11
|
import { execSync, spawn } from "node:child_process";
|
|
12
12
|
import { chromium } from "playwright";
|
|
@@ -819,7 +819,7 @@ class Cfg {
|
|
|
819
819
|
async syncConfigToDatabase() {
|
|
820
820
|
try {
|
|
821
821
|
const pushCfg = this.getYaml("config", "pushlist");
|
|
822
|
-
const { bilibiliDB: bilibiliDB2, douyinDB: douyinDB2 } = await import("./db-
|
|
822
|
+
const { bilibiliDB: bilibiliDB2, douyinDB: douyinDB2 } = await import("./db-CF5YPBQZ.js");
|
|
823
823
|
if (pushCfg.bilibili) {
|
|
824
824
|
await bilibiliDB2.syncConfigSubscriptions(pushCfg.bilibili);
|
|
825
825
|
}
|
|
@@ -4184,11 +4184,7 @@ async function douyinComments(data, emojidata) {
|
|
|
4184
4184
|
for (const item1 of CommentData.jsonArray) {
|
|
4185
4185
|
for (const item2 of emojidata) {
|
|
4186
4186
|
if (item1.text.includes(item2.name)) {
|
|
4187
|
-
|
|
4188
|
-
item1.text = item1.text.replace(/\[[^\]]*\]/g, `<img src="${item2.url}"/>`).replace(/\\/g, "");
|
|
4189
|
-
} else {
|
|
4190
|
-
item1.text = `<img src="${item2.url}"/>`;
|
|
4191
|
-
}
|
|
4187
|
+
item1.text = item1.text.replaceAll(item2.name, `<img src="${item2.url}"/>`);
|
|
4192
4188
|
item1.text += " ";
|
|
4193
4189
|
}
|
|
4194
4190
|
}
|
|
@@ -4258,6 +4254,9 @@ function br$1(data) {
|
|
|
4258
4254
|
for (const i of data) {
|
|
4259
4255
|
let text = i.text;
|
|
4260
4256
|
text = text.replace(/\n/g, "<br>");
|
|
4257
|
+
text = text.replace(/ {2,}/g, (match) => {
|
|
4258
|
+
return " ".repeat(match.length);
|
|
4259
|
+
});
|
|
4261
4260
|
i.text = text;
|
|
4262
4261
|
}
|
|
4263
4262
|
return data;
|
|
@@ -4475,8 +4474,8 @@ ${g_video_url}`));
|
|
|
4475
4474
|
video_data.push(res);
|
|
4476
4475
|
}
|
|
4477
4476
|
if (Config.douyin.comment && Config.douyin.comment) {
|
|
4478
|
-
const EmojiData = await this.amagi.getDouyinData("Emoji数据");
|
|
4479
|
-
const list =
|
|
4477
|
+
const EmojiData = await this.amagi.getDouyinData("Emoji数据", { typeMode: "strict" });
|
|
4478
|
+
const list = Emoji(EmojiData);
|
|
4480
4479
|
const commentsArray = await douyinComments(CommentsData, list);
|
|
4481
4480
|
if (!commentsArray.jsonArray.length) {
|
|
4482
4481
|
await this.e.reply("这个作品没有评论 ~");
|