karin-plugin-kkk 2.41.2 → 2.42.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +46 -19
  2. package/config/default_config/config.json +5 -0
  3. package/lib/apps/__ready.js +1 -0
  4. package/lib/apps/admin.js +1 -0
  5. package/lib/apps/help.js +1 -0
  6. package/lib/apps/push.js +1 -0
  7. package/lib/apps/qrlogin.js +1 -0
  8. package/lib/apps/statistics.js +1 -0
  9. package/lib/apps/testPush.js +1 -0
  10. package/lib/apps/tools.js +1 -0
  11. package/lib/apps/update.js +1 -0
  12. package/lib/build-metadata.json +5 -5
  13. package/lib/core_chunk/amagi.d.mts +242 -1249
  14. package/lib/core_chunk/amagi.js +3 -2
  15. package/lib/core_chunk/amagiClient.js +2 -1
  16. package/lib/core_chunk/api.js +3 -0
  17. package/lib/core_chunk/db.js +2 -1
  18. package/lib/core_chunk/lexer-DQCqS3nf.js +3 -0
  19. package/lib/core_chunk/main.js +19593 -21137
  20. package/lib/core_chunk/richtext.d.mts +267 -1
  21. package/lib/core_chunk/richtext.js +2 -1
  22. package/lib/core_chunk/rolldown-runtime.js +1 -0
  23. package/lib/core_chunk/setup.js +1 -0
  24. package/lib/core_chunk/template.d.mts +6 -2440
  25. package/lib/core_chunk/template.js +3 -2
  26. package/lib/core_chunk/vendor.js +45366 -31184
  27. package/lib/index.js +1 -0
  28. package/lib/ktr-assets.json +1 -0
  29. package/lib/root.js +2 -1
  30. package/lib/{karin-plugin-kkk.css → style.css} +332 -1127
  31. package/lib/template-registry.js +3 -0
  32. package/lib/web/assets/CronEditor-CoI7gVfa.js +1 -0
  33. package/lib/web/assets/{DesktopLayout-D87sxpYp.js → DesktopLayout-CRQdcmvy.js} +1 -1
  34. package/lib/web/assets/MobileLayout-ClOVwJEp.js +1 -0
  35. package/lib/web/assets/ThemeSwitch-DxWaxUmy.js +1 -0
  36. package/lib/web/assets/index-CScw9ngf.js +47 -0
  37. package/lib/web/assets/{index-BjheeBw6.css → index-D39hMurO.css} +1 -1
  38. package/lib/web/assets/{separator-B4jt1kVO.js → separator-B6VKhTtv.js} +1 -1
  39. package/lib/web/index.html +2 -2
  40. package/lib/web.config.js +2 -1
  41. package/package.json +3 -7
  42. package/lib/core_chunk/index-CZWy-8Jl.d.mts +0 -268
  43. package/lib/web/assets/CronEditor-xoZMMEWs.js +0 -1
  44. package/lib/web/assets/MobileLayout-HwaDlCUG.js +0 -1
  45. package/lib/web/assets/ThemeSwitch-CJXARLzz.js +0 -1
  46. package/lib/web/assets/index-84SfgXJi.js +0 -47
  47. package/resources/font/bilifont/bilifont.1.woff2 +0 -0
  48. package/resources/font/bilifont/bilifont.2.woff2 +0 -0
  49. package/resources/font/bilifont/font.css +0 -17
  50. package/resources/font/fansmedal-num/fansmedal-num.1.woff2 +0 -0
  51. package/resources/font/fansmedal-num/font.css +0 -9
  52. package/resources/font/mono/JetBrainsMono-Bold.woff2 +0 -0
  53. package/resources/font/mono/JetBrainsMono-BoldItalic.woff2 +0 -0
  54. package/resources/font/mono/JetBrainsMono-ExtraBold.woff2 +0 -0
  55. package/resources/font/mono/JetBrainsMono-ExtraBoldItalic.woff2 +0 -0
  56. package/resources/font/mono/JetBrainsMono-ExtraLight.woff2 +0 -0
  57. package/resources/font/mono/JetBrainsMono-ExtraLightItalic.woff2 +0 -0
  58. package/resources/font/mono/JetBrainsMono-Italic.woff2 +0 -0
  59. package/resources/font/mono/JetBrainsMono-Light.woff2 +0 -0
  60. package/resources/font/mono/JetBrainsMono-LightItalic.woff2 +0 -0
  61. package/resources/font/mono/JetBrainsMono-Medium.woff2 +0 -0
  62. package/resources/font/mono/JetBrainsMono-MediumItalic.woff2 +0 -0
  63. package/resources/font/mono/JetBrainsMono-Regular.woff2 +0 -0
  64. package/resources/font/mono/JetBrainsMono-SemiBold.woff2 +0 -0
  65. package/resources/font/mono/JetBrainsMono-SemiBoldItalic.woff2 +0 -0
  66. package/resources/font/mono/JetBrainsMono-Thin.woff2 +0 -0
  67. package/resources/font/mono/JetBrainsMono-ThinItalic.woff2 +0 -0
  68. package/resources/font/mono/font.css +0 -137
@@ -1,4 +1,259 @@
1
- import { A as RichTextVoteNode, C as RichTextParagraphNode, D as RichTextTextNode, E as RichTextSearchKeywordStyleConfig, O as RichTextTopicNode, S as RichTextNodeStyleConfig, T as RichTextSearchKeywordNode, _ as RichTextListItemNode, a as RichTextCodeBlockNode, b as RichTextMentionNode, c as RichTextEmojiNode, d as RichTextHorizontalRuleNode, f as RichTextImageNode, g as RichTextLinkCardNode, h as RichTextLineBreakNode, i as RichTextBlockquoteNode, j as RichTextWebLinkNode, k as RichTextViewPictureNode, l as RichTextHashtagNode, m as RichTextInlineStyle, n as RichTextAtNode, o as RichTextDocument, p as RichTextInlineNode, r as RichTextBlockNode, s as RichTextEmojiDefinition, t as renderRichTextToReact, u as RichTextHeadingNode, v as RichTextListNode, w as RichTextRenderOptions, x as RichTextNode, y as RichTextLotteryNode } from "./index-CZWy-8Jl.mjs";
1
+ import { ReactNode } from "react";
2
+ //#region ../richtext/src/types.d.ts
3
+ /**
4
+ * 富文本节点联合类型。
5
+ *
6
+ * 后端只需要生产这些纯 JSON 节点,前端可以再按 React、HTML、Canvas 等不同目标渲染。
7
+ */
8
+ type RichTextNode = RichTextInlineNode | RichTextBlockNode;
9
+ /** 行内节点。 */
10
+ type RichTextInlineNode = RichTextTextNode | RichTextEmojiNode | RichTextMentionNode | RichTextSearchKeywordNode | RichTextLineBreakNode | RichTextTopicNode | RichTextAtNode | RichTextLotteryNode | RichTextWebLinkNode | RichTextVoteNode | RichTextViewPictureNode | RichTextHashtagNode;
11
+ /** 块级节点。 */
12
+ type RichTextBlockNode = RichTextHeadingNode | RichTextParagraphNode | RichTextImageNode | RichTextBlockquoteNode | RichTextListNode | RichTextListItemNode | RichTextCodeBlockNode | RichTextLinkCardNode | RichTextHorizontalRuleNode;
13
+ /**
14
+ * 富文本文档。
15
+ *
16
+ * `version` 用来给后续节点协议升级留空间;`platform` 用来标记来源平台,方便后续按平台做兼容。
17
+ */
18
+ interface RichTextDocument {
19
+ version: 1;
20
+ platform?: string;
21
+ nodes: RichTextNode[];
22
+ }
23
+ /** 行内文本样式。 */
24
+ interface RichTextInlineStyle {
25
+ /** 粗体 */
26
+ bold?: boolean;
27
+ /** 斜体 */
28
+ italic?: boolean;
29
+ /** 删除线 */
30
+ strike?: boolean;
31
+ /** 文字颜色(CSS color 值) */
32
+ color?: string;
33
+ /** 超链接地址 */
34
+ link?: string;
35
+ /** 字体大小(CSS font-size 值) */
36
+ fontSize?: string;
37
+ }
38
+ /** 普通文本节点。文本永远作为文本渲染,不会当成 HTML 执行。 */
39
+ interface RichTextTextNode {
40
+ type: 'text';
41
+ /** 文本内容 */
42
+ text: string;
43
+ /** 可选的行内样式 */
44
+ style?: RichTextInlineStyle;
45
+ }
46
+ /** 行内表情节点。用于评论文本中夹杂的平台表情图片。 */
47
+ interface RichTextEmojiNode {
48
+ type: 'emoji';
49
+ /** 表情包名称 */
50
+ name: string;
51
+ /** 表情包链接 */
52
+ src: string;
53
+ /** 缩放倍率。默认 1,某些平台的大表情可以传 3。 */
54
+ scale?: number;
55
+ }
56
+ /** @ 用户节点。`userId` 可选,因为有些平台只给历史昵称,不给稳定 ID。 */
57
+ interface RichTextMentionNode {
58
+ type: 'mention';
59
+ /** @ 用户的文本 */
60
+ text: string;
61
+ /** UID */
62
+ userId?: string;
63
+ }
64
+ /**
65
+ * 搜索词高亮节点。
66
+ *
67
+ * 某些平台会把"评论里的高亮搜索词"独立放在元数据里,而不是单独拼进 HTML。
68
+ * 这里把它提升成独立节点,方便 template 渲染成高亮文本和上标搜索图标。
69
+ */
70
+ interface RichTextSearchKeywordNode {
71
+ type: 'searchKeyword';
72
+ /** 搜索词 */
73
+ text: string;
74
+ /** 搜索ID */
75
+ queryId?: string;
76
+ }
77
+ /** 换行节点。前端渲染成 `<br />`,避免后端直接拼 HTML。 */
78
+ interface RichTextLineBreakNode {
79
+ type: 'lineBreak';
80
+ }
81
+ /** 话题节点。B站动态中以 #话题名称# 形式呈现,带彩色文字。 */
82
+ interface RichTextTopicNode {
83
+ type: 'topic';
84
+ /** 话题名称(不含#号) */
85
+ text: string;
86
+ }
87
+ /** @用户节点。用于动态描述中的@提及。 */
88
+ interface RichTextAtNode {
89
+ type: 'at';
90
+ /** @用户的显示文本 */
91
+ text: string;
92
+ /** 用户ID(可选) */
93
+ userId?: string;
94
+ }
95
+ /** 抽奖节点。带SVG图标,显示抽奖信息。 */
96
+ interface RichTextLotteryNode {
97
+ type: 'lottery';
98
+ /** 显示文本 */
99
+ text: string;
100
+ }
101
+ /** 网页链接节点。带SVG图标,显示链接的标题。 */
102
+ interface RichTextWebLinkNode {
103
+ type: 'webLink';
104
+ /** 显示文本(如网页标题) */
105
+ text: string;
106
+ /** 跳转链接 */
107
+ jumpUrl: string;
108
+ }
109
+ /** 投票节点。带SVG图标,显示投票标题。 */
110
+ interface RichTextVoteNode {
111
+ type: 'vote';
112
+ /** 投票标题 */
113
+ text: string;
114
+ }
115
+ /** 查看图片节点。带SVG图标,提示用户点击查看图片。 */
116
+ interface RichTextViewPictureNode {
117
+ type: 'viewPicture';
118
+ /** 显示文本 */
119
+ text: string;
120
+ }
121
+ /**
122
+ * Hashtag 话题节点。
123
+ *
124
+ * 纯文本高亮,不带任何图标。用于抖音等平台的 #话题# 标签展示。
125
+ * 与 topic 节点的区别:topic 带有 B站风格的 # 图标,hashtag 只做纯文字高亮。
126
+ */
127
+ interface RichTextHashtagNode {
128
+ type: 'hashtag';
129
+ /** 话题文本(包含 # 号) */
130
+ text: string;
131
+ }
132
+ /** 标题节点。 */
133
+ interface RichTextHeadingNode {
134
+ type: 'heading';
135
+ /** 标题级别 1-6 */
136
+ level: 1 | 2 | 3 | 4 | 5 | 6;
137
+ /** 子节点 */
138
+ nodes: RichTextNode[];
139
+ }
140
+ /** 段落节点。 */
141
+ interface RichTextParagraphNode {
142
+ type: 'paragraph';
143
+ /** 子节点 */
144
+ nodes: RichTextNode[];
145
+ }
146
+ /** 图片节点。 */
147
+ interface RichTextImageNode {
148
+ type: 'image';
149
+ /** 图片地址 */
150
+ src: string;
151
+ /** 替代文本 */
152
+ alt?: string;
153
+ /** 图片下方注释/说明文字 */
154
+ caption?: string;
155
+ }
156
+ /** 水平分隔线节点。 */
157
+ interface RichTextHorizontalRuleNode {
158
+ type: 'horizontalRule';
159
+ }
160
+ /** 引用块节点。 */
161
+ interface RichTextBlockquoteNode {
162
+ type: 'blockquote';
163
+ /** 子节点 */
164
+ nodes: RichTextNode[];
165
+ }
166
+ /** 列表节点。 */
167
+ interface RichTextListNode {
168
+ type: 'list';
169
+ /** 是否为有序列表 */
170
+ ordered: boolean;
171
+ /** 列表项 */
172
+ items: RichTextListItemNode[];
173
+ }
174
+ /** 列表项节点。 */
175
+ interface RichTextListItemNode {
176
+ type: 'listItem';
177
+ /** 子节点 */
178
+ nodes: RichTextNode[];
179
+ }
180
+ /** 代码块节点。 */
181
+ interface RichTextCodeBlockNode {
182
+ type: 'codeBlock';
183
+ /** 代码语言 */
184
+ language?: string;
185
+ /** 代码内容 */
186
+ content: string;
187
+ }
188
+ /** 链接卡片节点。 */
189
+ interface RichTextLinkCardNode {
190
+ type: 'linkCard';
191
+ /** 卡片标题/显示文本 */
192
+ title: string;
193
+ /** 跳转链接 */
194
+ url: string;
195
+ /** 卡片类型标识 */
196
+ cardType?: string;
197
+ /** 额外元数据 */
198
+ meta?: Record<string, any>;
199
+ }
200
+ /** 平台表情定义,通常由 core 从平台表情接口转换得到。 */
201
+ interface RichTextEmojiDefinition {
202
+ name: string;
203
+ url: string;
204
+ /** 缩放倍率。默认 1。 */
205
+ scale?: number;
206
+ }
207
+ /**
208
+ * 单个富文本节点的样式配置。
209
+ *
210
+ * 平台模板传入它们想要的 className,渲染器直接应用。
211
+ * 只允许 className,不允许 style 对象——视觉样式全部由 Tailwind 接管。
212
+ */
213
+ interface RichTextNodeStyleConfig {
214
+ /** Tailwind className,控制该节点的视觉样式 */
215
+ className?: string;
216
+ }
217
+ /**
218
+ * 搜索关键词节点需要额外的图标 className(普通节点不需要)。
219
+ */
220
+ interface RichTextSearchKeywordStyleConfig extends RichTextNodeStyleConfig {
221
+ /** 搜索图标的额外 className */
222
+ iconClassName?: string;
223
+ }
224
+ /**
225
+ * HTML 渲染器配置。React 渲染器复用这些 className 约定。
226
+ *
227
+ * 传入的 className 会覆盖渲染器内部对这些节点的默认样式。
228
+ * 视觉样式全部由 Tailwind className 表达,渲染器只负责结构。
229
+ */
230
+ interface RichTextRenderOptions {
231
+ /** @提及节点 */
232
+ mention?: RichTextNodeStyleConfig;
233
+ /** 搜索关键词节点(高亮词) */
234
+ searchKeyword?: RichTextSearchKeywordStyleConfig;
235
+ /** 话题节点 */
236
+ topic?: RichTextNodeStyleConfig;
237
+ /** @用户节点 */
238
+ at?: RichTextNodeStyleConfig;
239
+ /** 抽奖节点 */
240
+ lottery?: RichTextNodeStyleConfig;
241
+ /** 网页链接节点 */
242
+ webLink?: RichTextNodeStyleConfig;
243
+ /** 投票节点 */
244
+ vote?: RichTextNodeStyleConfig;
245
+ /** 查看图片节点 */
246
+ viewPicture?: RichTextNodeStyleConfig;
247
+ /** 代码块节点 */
248
+ codeBlock?: RichTextNodeStyleConfig;
249
+ /** 链接卡片节点 */
250
+ linkCard?: RichTextNodeStyleConfig;
251
+ /** hashtag 话题节点 */
252
+ hashtag?: RichTextNodeStyleConfig;
253
+ /** 图标缩放比例,默认 1。用于在不同字体大小下保持图标比例一致。 */
254
+ iconScale?: number;
255
+ }
256
+ //#endregion
2
257
  //#region ../richtext/src/parse/index.d.ts
3
258
  /** 创建普通文本节点。 */
4
259
  declare const createTextNode: (text: string, style?: RichTextInlineStyle) => RichTextTextNode;
@@ -73,4 +328,15 @@ declare const createRichTextDocument: (nodes: RichTextNode[], options?: {
73
328
  platform?: string;
74
329
  }) => RichTextDocument;
75
330
  //#endregion
331
+ //#region ../richtext/src/react/index.d.ts
332
+ /**
333
+ * 将富文本文档渲染成 React 节点。
334
+ *
335
+ * 这是 React 模板的首选渲染方式:
336
+ * - 不经过 HTML 字符串;
337
+ * - 不需要 `dangerouslySetInnerHTML`;
338
+ * - 更适合 SSR,因为传输边界仍然是纯 JSON。
339
+ */
340
+ declare const renderRichTextToReact: (document: RichTextDocument, options?: RichTextRenderOptions) => ReactNode;
341
+ //#endregion
76
342
  export { RichTextAtNode, RichTextBlockNode, RichTextBlockquoteNode, RichTextCodeBlockNode, RichTextDocument, RichTextEmojiDefinition, RichTextEmojiNode, RichTextHashtagNode, RichTextHeadingNode, RichTextHorizontalRuleNode, RichTextImageNode, RichTextInlineNode, RichTextInlineStyle, RichTextLineBreakNode, RichTextLinkCardNode, RichTextListItemNode, RichTextListNode, RichTextLotteryNode, RichTextMentionNode, RichTextNode, RichTextNodeStyleConfig, RichTextParagraphNode, RichTextRenderOptions, RichTextSearchKeywordNode, RichTextSearchKeywordStyleConfig, RichTextTextNode, RichTextTopicNode, RichTextViewPictureNode, RichTextVoteNode, RichTextWebLinkNode, createAtNode, createBlockquoteNode, createCodeBlockNode, createEmojiNode, createHashtagNode, createHeadingNode, createHorizontalRuleNode, createImageNode, createLineBreakNode, createLinkCardNode, createListItemNode, createListNode, createLotteryNode, createMentionNode, createParagraphNode, createRichTextDocument, createSearchKeywordNode, createTextNode, createTopicNode, createViewPictureNode, createVoteNode, createWebLinkNode, extractRichTextPlainText, normalizeRichTextNodes, renderRichTextToReact };
@@ -1,2 +1,3 @@
1
- import { $ as createImageNode, G as renderRichTextToReact, J as createCodeBlockNode, K as createAtNode, Q as createHorizontalRuleNode, X as createHashtagNode, Y as createEmojiNode, Z as createHeadingNode, at as createMentionNode, ct as createSearchKeywordNode, dt as createViewPictureNode, et as createLineBreakNode, ft as createVoteNode, ht as normalizeRichTextNodes, it as createLotteryNode, lt as createTextNode, mt as extractRichTextPlainText, nt as createListItemNode, ot as createParagraphNode, pt as createWebLinkNode, q as createBlockquoteNode, rt as createListNode, st as createRichTextDocument, tt as createLinkCardNode, ut as createTopicNode } from "./main.js";
1
+ globalThis.__KTR_BUNDLED__ = true;
2
+ import { $ as createVoteNode, B as createImageNode, F as createCodeBlockNode, G as createLotteryNode, H as createLinkCardNode, I as createEmojiNode, J as createRichTextDocument, K as createMentionNode, L as createHashtagNode, M as renderRichTextToReact, N as createAtNode, P as createBlockquoteNode, Q as createViewPictureNode, R as createHeadingNode, U as createListItemNode, V as createLineBreakNode, W as createListNode, X as createTextNode, Y as createSearchKeywordNode, Z as createTopicNode, et as createWebLinkNode, nt as normalizeRichTextNodes, q as createParagraphNode, tt as extractRichTextPlainText, z as createHorizontalRuleNode } from "./main.js";
2
3
  export { createAtNode, createBlockquoteNode, createCodeBlockNode, createEmojiNode, createHashtagNode, createHeadingNode, createHorizontalRuleNode, createImageNode, createLineBreakNode, createLinkCardNode, createListItemNode, createListNode, createLotteryNode, createMentionNode, createParagraphNode, createRichTextDocument, createSearchKeywordNode, createTextNode, createTopicNode, createViewPictureNode, createVoteNode, createWebLinkNode, extractRichTextPlainText, normalizeRichTextNodes, renderRichTextToReact };
@@ -1,3 +1,4 @@
1
+ globalThis.__KTR_BUNDLED__ = true;
1
2
  import { createRequire } from "node:module";
2
3
  //#region \0rolldown/runtime.js
3
4
  var __create = Object.create;
@@ -1,2 +1,3 @@
1
+ globalThis.__KTR_BUNDLED__ = true;
1
2
  import "./main.js";
2
3
  export {};