karin-plugin-kkk 1.6.9 → 1.6.11
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 +16 -0
- package/lib/apps/admin.js +4 -3
- package/lib/apps/help.js +9 -97
- package/lib/apps/push.js +4 -3
- package/lib/apps/tools.js +3 -3
- package/lib/chunk/{db-BwUYgCsJ.js → db-D3WhtbU7.js} +2 -2
- package/lib/chunk/{main-NN4to0wU.js → main-ACpbO-o9.js} +10 -10
- package/lib/chunk/vendor-BXFp06D9.js +54253 -0
- package/lib/index.js +4 -4
- package/lib/web.config.js +1 -1
- package/package.json +2 -1
- package/lib/chunk/vendor-FI9gb_Rv.js +0 -123911
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# 变更日志
|
|
2
2
|
|
|
3
|
+
## [1.6.11](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.6.10...v1.6.11) (2025-06-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* 不打包 '@karinjs/md-html' ([2392a0c](https://github.com/ikenxuan/karin-plugin-kkk/commit/2392a0cec5807ca035924cc6a3fdd7993676f6aa))
|
|
9
|
+
|
|
10
|
+
## [1.6.10](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.6.9...v1.6.10) (2025-06-15)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **douyin:** 修复评论中表情替换和空格处理问题 ([d49a2e1](https://github.com/ikenxuan/karin-plugin-kkk/commit/d49a2e1b4dd5e7c28cbe15429c53f1d1951a3447))
|
|
16
|
+
* 分割更新日志 ([11ddf95](https://github.com/ikenxuan/karin-plugin-kkk/commit/11ddf952338b459b9a0751c72aaad294f10559dc))
|
|
17
|
+
* 移除内置更新 ([11ddf95](https://github.com/ikenxuan/karin-plugin-kkk/commit/11ddf952338b459b9a0751c72aaad294f10559dc))
|
|
18
|
+
|
|
3
19
|
## [1.6.9](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.6.8...v1.6.9) (2025-06-11)
|
|
4
20
|
|
|
5
21
|
|
package/lib/apps/admin.js
CHANGED
|
@@ -2,13 +2,14 @@ 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-D3WhtbU7.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-BXFp06D9.js";
|
|
8
|
+
import { C as Config, a as Common, b as bilibiliLogin, d as douyinLogin } from "../chunk/main-ACpbO-o9.js";
|
|
9
9
|
import "node-karin/axios";
|
|
10
10
|
import "stream/promises";
|
|
11
11
|
import "node:path";
|
|
12
|
+
import "@karinjs/md-html";
|
|
12
13
|
const task = Config.app.rmmp4 && karin.task("[kkk-视频缓存自动删除]", "0 0 4 * * *", async () => {
|
|
13
14
|
try {
|
|
14
15
|
await removeAllFiles(Common.tempDri.video);
|
package/lib/apps/help.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { execSync } from "node:child_process";
|
|
2
1
|
import fs from "node:fs";
|
|
3
|
-
import {
|
|
4
|
-
import karin, { mkdirSync, render, segment
|
|
2
|
+
import { markdown } from "@karinjs/md-html";
|
|
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-D3WhtbU7.js";
|
|
8
7
|
import { Root } from "../root.js";
|
|
9
|
-
import
|
|
8
|
+
import "../chunk/vendor-BXFp06D9.js";
|
|
9
|
+
import { R as Render, a as Common } from "../chunk/main-ACpbO-o9.js";
|
|
10
10
|
import "node-karin/axios";
|
|
11
11
|
import "stream/promises";
|
|
12
12
|
const help = karin.command(/^#?kkk帮助$/, async (e) => {
|
|
@@ -14,10 +14,10 @@ const help = karin.command(/^#?kkk帮助$/, async (e) => {
|
|
|
14
14
|
await e.reply(img);
|
|
15
15
|
return true;
|
|
16
16
|
}, { name: "kkk-帮助" });
|
|
17
|
-
const version = karin.command(/^#?kkk
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const html = markdown(
|
|
17
|
+
const version = karin.command(/^#?kkk(版本|更新日志)$/, async (e) => {
|
|
18
|
+
const changelogContent = fs.readFileSync(Root.pluginPath + "/CHANGELOG.md", "utf8");
|
|
19
|
+
const forwardLogs = logs(Root.pluginVersion, changelogContent, 8, false);
|
|
20
|
+
const html = markdown(forwardLogs, {
|
|
21
21
|
gitcss: Common.useDarkTheme() ? "github-markdown-dark.css" : "github-markdown-light.css"
|
|
22
22
|
});
|
|
23
23
|
mkdirSync(`${karinPathTemp}/html/${Root.pluginName}/version`);
|
|
@@ -27,95 +27,7 @@ const version = karin.command(/^#?kkk版本$/, async (e) => {
|
|
|
27
27
|
await e.reply(segment.image("base64://" + img));
|
|
28
28
|
return true;
|
|
29
29
|
}, { 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
30
|
export {
|
|
117
|
-
changelogs,
|
|
118
31
|
help,
|
|
119
|
-
update,
|
|
120
32
|
version
|
|
121
33
|
};
|
package/lib/apps/push.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { d as getDouyinData, g as getBilibiliData } from "../chunk/vendor-
|
|
1
|
+
import { d as getDouyinData, g as getBilibiliData } from "../chunk/vendor-BXFp06D9.js";
|
|
2
2
|
import karin from "node-karin";
|
|
3
3
|
import "sequelize";
|
|
4
|
-
import "../chunk/db-
|
|
4
|
+
import "../chunk/db-D3WhtbU7.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-ACpbO-o9.js";
|
|
8
8
|
import "node-karin/axios";
|
|
9
9
|
import "stream/promises";
|
|
10
10
|
import "node:path";
|
|
11
|
+
import "@karinjs/md-html";
|
|
11
12
|
import "node:child_process";
|
|
12
13
|
import "playwright";
|
|
13
14
|
const douyinPush = Config.douyin.push.switch && karin.task("抖音推送", Config.douyin.push.cron, async () => {
|
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-D3WhtbU7.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-BXFp06D9.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-ACpbO-o9.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-BXFp06D9.js";
|
|
8
|
+
import { C as Config, D as DynamicType } from "./main-ACpbO-o9.js";
|
|
9
9
|
import "node-karin/axios";
|
|
10
10
|
import "stream/promises";
|
|
11
11
|
const sequelize$1 = new Sequelize({
|
|
@@ -1,15 +1,16 @@
|
|
|
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
|
|
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 } from "./vendor-BXFp06D9.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-D3WhtbU7.js";
|
|
10
10
|
import _ from "node-karin/lodash";
|
|
11
11
|
import { execSync, spawn } from "node:child_process";
|
|
12
12
|
import { chromium } from "playwright";
|
|
13
|
+
import { markdown } from "@karinjs/md-html";
|
|
13
14
|
import { karinPathTemp, karinPathBase } from "node-karin/root";
|
|
14
15
|
import YAML from "node-karin/yaml";
|
|
15
16
|
class Base {
|
|
@@ -819,7 +820,7 @@ class Cfg {
|
|
|
819
820
|
async syncConfigToDatabase() {
|
|
820
821
|
try {
|
|
821
822
|
const pushCfg = this.getYaml("config", "pushlist");
|
|
822
|
-
const { bilibiliDB: bilibiliDB2, douyinDB: douyinDB2 } = await import("./db-
|
|
823
|
+
const { bilibiliDB: bilibiliDB2, douyinDB: douyinDB2 } = await import("./db-D3WhtbU7.js");
|
|
823
824
|
if (pushCfg.bilibili) {
|
|
824
825
|
await bilibiliDB2.syncConfigSubscriptions(pushCfg.bilibili);
|
|
825
826
|
}
|
|
@@ -4184,11 +4185,7 @@ async function douyinComments(data, emojidata) {
|
|
|
4184
4185
|
for (const item1 of CommentData.jsonArray) {
|
|
4185
4186
|
for (const item2 of emojidata) {
|
|
4186
4187
|
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
|
-
}
|
|
4188
|
+
item1.text = item1.text.replaceAll(item2.name, `<img src="${item2.url}"/>`);
|
|
4192
4189
|
item1.text += " ";
|
|
4193
4190
|
}
|
|
4194
4191
|
}
|
|
@@ -4258,6 +4255,9 @@ function br$1(data) {
|
|
|
4258
4255
|
for (const i of data) {
|
|
4259
4256
|
let text = i.text;
|
|
4260
4257
|
text = text.replace(/\n/g, "<br>");
|
|
4258
|
+
text = text.replace(/ {2,}/g, (match) => {
|
|
4259
|
+
return " ".repeat(match.length);
|
|
4260
|
+
});
|
|
4261
4261
|
i.text = text;
|
|
4262
4262
|
}
|
|
4263
4263
|
return data;
|
|
@@ -4475,8 +4475,8 @@ ${g_video_url}`));
|
|
|
4475
4475
|
video_data.push(res);
|
|
4476
4476
|
}
|
|
4477
4477
|
if (Config.douyin.comment && Config.douyin.comment) {
|
|
4478
|
-
const EmojiData = await this.amagi.getDouyinData("Emoji数据");
|
|
4479
|
-
const list =
|
|
4478
|
+
const EmojiData = await this.amagi.getDouyinData("Emoji数据", { typeMode: "strict" });
|
|
4479
|
+
const list = Emoji(EmojiData);
|
|
4480
4480
|
const commentsArray = await douyinComments(CommentsData, list);
|
|
4481
4481
|
if (!commentsArray.jsonArray.length) {
|
|
4482
4482
|
await this.e.reply("这个作品没有评论 ~");
|