karin-plugin-kkk 1.1.2 → 1.1.4-pr46.d747316
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/Version.js +13 -0
- package/lib/module/utils/Common.js +1 -1
- package/lib/module/utils/Config.d.ts +9 -9
- package/lib/module/utils/Config.js +13 -15
- package/lib/module/utils/index.d.ts +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/web.config.d.ts +13 -2
- package/lib/web.config.js +89 -69
- package/package.json +1 -1
- package/resources/template/extend/html/default.html +0 -2
- package/config/PluginConfigView.yaml +0 -271
- package/lib/module/utils/Version.js +0 -20
- /package/lib/{module/utils/Version.d.ts → Version.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.3](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.1.2...v1.1.3) (2025-02-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* add type ([65c9710](https://github.com/ikenxuan/karin-plugin-kkk/commit/65c9710f6691a4a105c1a3e5b356e95429785647))
|
|
9
|
+
* avatar ([f4bd7a6](https://github.com/ikenxuan/karin-plugin-kkk/commit/f4bd7a61afe9a0146bf2fd8f1d27aa96cfcf7a5e))
|
|
10
|
+
* web.config.ts ([e939cd5](https://github.com/ikenxuan/karin-plugin-kkk/commit/e939cd5efb0d581ebd8510ff4ae5f18acb2c9c3e))
|
|
11
|
+
|
|
3
12
|
## [1.1.2](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.1.1...v1.1.2) (2025-02-25)
|
|
4
13
|
|
|
5
14
|
|
package/lib/Version.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { karinDir } from 'node-karin/root';
|
|
5
|
+
const pluginPath = path.join(fileURLToPath(import.meta.url), '../..');
|
|
6
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(pluginPath, 'package.json'), 'utf-8'));
|
|
7
|
+
export const Version = {
|
|
8
|
+
pluginName: pkg.name,
|
|
9
|
+
pluginVersion: pkg.version,
|
|
10
|
+
pluginPath,
|
|
11
|
+
karinVersion: process.env.KARIN_VERSION,
|
|
12
|
+
karinPath: karinDir
|
|
13
|
+
};
|
|
@@ -772,17 +772,17 @@ declare class Cfg {
|
|
|
772
772
|
*/
|
|
773
773
|
Modify(name: keyof ConfigType, key: string, value: any, type?: ConfigDirType): void;
|
|
774
774
|
/**
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
775
|
+
* 修改整个配置文件,保留注释
|
|
776
|
+
* @param name 文件名
|
|
777
|
+
* @param config 完整的配置对象
|
|
778
|
+
* @param type 配置文件类型,默认为用户配置文件 `config`
|
|
779
|
+
*/
|
|
780
780
|
ModifyPro<T extends keyof ConfigType>(name: T, config: ConfigType[T], type?: ConfigDirType): boolean;
|
|
781
781
|
/**
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
782
|
+
* 深度合并YAML节点(保留目标注释)
|
|
783
|
+
* @param target 目标节点(保留注释的原始节点)
|
|
784
|
+
* @param source 源节点(提供新值的节点)
|
|
785
|
+
*/
|
|
786
786
|
private deepMergeYaml;
|
|
787
787
|
/**
|
|
788
788
|
* 在YAML映射中设置嵌套值
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { basePath, copyConfigSync, filesByExt, logger, requireFileSync, watch } from 'node-karin';
|
|
4
4
|
import YAML from 'node-karin/yaml';
|
|
5
|
-
import { Version } from '
|
|
5
|
+
import { Version } from '../../Version.js';
|
|
6
6
|
class Cfg {
|
|
7
7
|
/** 用户配置文件路径 */
|
|
8
8
|
dirCfgPath;
|
|
@@ -102,11 +102,11 @@ class Cfg {
|
|
|
102
102
|
fs.writeFileSync(path, yamlData.toString({ lineWidth: -1 }), 'utf8');
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
* 修改整个配置文件,保留注释
|
|
106
|
+
* @param name 文件名
|
|
107
|
+
* @param config 完整的配置对象
|
|
108
|
+
* @param type 配置文件类型,默认为用户配置文件 `config`
|
|
109
|
+
*/
|
|
110
110
|
ModifyPro(name, config, type = 'config') {
|
|
111
111
|
const filePath = type === 'config'
|
|
112
112
|
? `${this.dirCfgPath}/${name}.yaml`
|
|
@@ -129,31 +129,29 @@ class Cfg {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
* 深度合并YAML节点(保留目标注释)
|
|
133
|
+
* @param target 目标节点(保留注释的原始节点)
|
|
134
|
+
* @param source 源节点(提供新值的节点)
|
|
135
|
+
*/
|
|
136
136
|
deepMergeYaml(target, source) {
|
|
137
137
|
if (YAML.isMap(target) && YAML.isMap(source)) {
|
|
138
|
-
// 遍历源节点的所有键
|
|
139
138
|
for (const pair of source.items) {
|
|
140
139
|
const key = pair.key;
|
|
141
140
|
const sourceVal = pair.value;
|
|
142
141
|
const targetVal = target.get(key);
|
|
143
142
|
if (targetVal === undefined) {
|
|
144
|
-
// 新增键:直接添加
|
|
145
143
|
target.set(key, sourceVal);
|
|
146
144
|
}
|
|
147
145
|
else if (YAML.isMap(targetVal) && YAML.isMap(sourceVal)) {
|
|
148
|
-
// 递归合并嵌套Map
|
|
149
146
|
this.deepMergeYaml(targetVal, sourceVal);
|
|
150
147
|
}
|
|
151
148
|
else if (YAML.isSeq(targetVal) && YAML.isSeq(sourceVal)) {
|
|
152
|
-
//
|
|
149
|
+
// 替换序列内容并保持源序列格式
|
|
153
150
|
targetVal.items = sourceVal.items;
|
|
151
|
+
// 同步序列的显示格式
|
|
152
|
+
targetVal.flow = sourceVal.flow;
|
|
154
153
|
}
|
|
155
154
|
else {
|
|
156
|
-
// 覆盖标量值但保留原键的注释
|
|
157
155
|
target.set(key, sourceVal);
|
|
158
156
|
}
|
|
159
157
|
}
|
package/lib/web.config.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { LocalApiResponse } from 'node-karin';
|
|
2
2
|
import { ConfigType } from './types/index.js';
|
|
3
|
+
/** 基础配置的类型 */
|
|
4
|
+
type BaseConfigType = {
|
|
5
|
+
[key in keyof Omit<ConfigType, 'pushlist'>]: ConfigType[key];
|
|
6
|
+
};
|
|
7
|
+
/** 推送列表配置的类型,要单独处理 */
|
|
8
|
+
type PushConfigType = {
|
|
9
|
+
'pushlist:douyin': ConfigType['pushlist']['douyin'];
|
|
10
|
+
'pushlist:bilibili': ConfigType['pushlist']['bilibili'];
|
|
11
|
+
};
|
|
12
|
+
/** 前端传回来新配置的类型 */
|
|
13
|
+
type newConfigType = BaseConfigType & PushConfigType;
|
|
3
14
|
declare const _default: {
|
|
4
15
|
info: LocalApiResponse;
|
|
5
16
|
/** 动态渲染的组件 */
|
|
6
17
|
components: () => (import("node-karin").DividerProps | import("node-karin").AccordionProps | import("node-karin").AccordionProProps)[];
|
|
7
18
|
/** 前端点击保存之后调用的方法 */
|
|
8
|
-
save: (config:
|
|
9
|
-
|
|
19
|
+
save: (config: newConfigType) => {
|
|
20
|
+
mergeCfg: ConfigType;
|
|
10
21
|
formatCfg: ConfigType;
|
|
11
22
|
success: boolean;
|
|
12
23
|
message: string;
|
package/lib/web.config.js
CHANGED
|
@@ -9,7 +9,14 @@ export default {
|
|
|
9
9
|
icon: {
|
|
10
10
|
name: 'tag',
|
|
11
11
|
color: '#EAC452'
|
|
12
|
-
}
|
|
12
|
+
},
|
|
13
|
+
author: [
|
|
14
|
+
{
|
|
15
|
+
name: 'ikenxuan',
|
|
16
|
+
home: 'https://github.com/ikenxuan',
|
|
17
|
+
avatar: 'https://avatars.githubusercontent.com/u/112480306'
|
|
18
|
+
}
|
|
19
|
+
]
|
|
13
20
|
},
|
|
14
21
|
/** 动态渲染的组件 */
|
|
15
22
|
components: () => [
|
|
@@ -17,9 +24,9 @@ export default {
|
|
|
17
24
|
description: 'Cookies 相关',
|
|
18
25
|
descPosition: 20
|
|
19
26
|
}),
|
|
20
|
-
components.accordion.create('
|
|
27
|
+
components.accordion.create('cookies', {
|
|
21
28
|
children: [
|
|
22
|
-
components.accordion.createItem('cookies', {
|
|
29
|
+
components.accordion.createItem('cfg:cookies', {
|
|
23
30
|
title: 'Cookies 相关',
|
|
24
31
|
className: 'ml-4 mr-4',
|
|
25
32
|
subtitle: '建议配置,否则大部分功能无法使用',
|
|
@@ -59,9 +66,9 @@ export default {
|
|
|
59
66
|
description: '插件应用相关',
|
|
60
67
|
descPosition: 20
|
|
61
68
|
}),
|
|
62
|
-
components.accordion.create('
|
|
69
|
+
components.accordion.create('app', {
|
|
63
70
|
children: [
|
|
64
|
-
components.accordion.createItem('app', {
|
|
71
|
+
components.accordion.createItem('cfg:app', {
|
|
65
72
|
title: '插件应用相关',
|
|
66
73
|
className: 'ml-4 mr-4',
|
|
67
74
|
subtitle: '此处用于管理插件的基本设置',
|
|
@@ -148,9 +155,9 @@ export default {
|
|
|
148
155
|
description: '抖音相关',
|
|
149
156
|
descPosition: 20
|
|
150
157
|
}),
|
|
151
|
-
components.accordion.create('
|
|
158
|
+
components.accordion.create('douyin', {
|
|
152
159
|
children: [
|
|
153
|
-
components.accordion.createItem('douyin', {
|
|
160
|
+
components.accordion.createItem('cfg:douyin', {
|
|
154
161
|
title: '抖音相关',
|
|
155
162
|
className: 'ml-4 mr-4',
|
|
156
163
|
subtitle: '此处为抖音相关的用户偏好设置',
|
|
@@ -184,84 +191,84 @@ export default {
|
|
|
184
191
|
description: '抖音推送相关',
|
|
185
192
|
descPosition: 20
|
|
186
193
|
}),
|
|
187
|
-
components.switch.create('push
|
|
194
|
+
components.switch.create('push:switch', {
|
|
188
195
|
startText: '推送开关',
|
|
189
196
|
description: '推送开关,开启后需重启;使用「#设置抖音推送 + 抖音号」配置推送列表',
|
|
190
197
|
defaultSelected: all.douyin.push.switch
|
|
191
198
|
}),
|
|
192
|
-
components.input.group('push
|
|
199
|
+
components.input.group('push:banWords', {
|
|
193
200
|
label: '作品中有以下指定关键词时,不推送',
|
|
194
201
|
maxRows: 2,
|
|
195
202
|
itemsPerRow: 4,
|
|
196
203
|
data: all.douyin.push.banWords,
|
|
197
|
-
template: components.input.string('push
|
|
204
|
+
template: components.input.string('push:banWords', {
|
|
198
205
|
placeholder: '',
|
|
199
206
|
label: '',
|
|
200
207
|
color: 'success'
|
|
201
208
|
})
|
|
202
209
|
}),
|
|
203
|
-
components.input.group('push
|
|
210
|
+
components.input.group('push:banTags', {
|
|
204
211
|
label: '作品中有指定标签时,不推送',
|
|
205
212
|
maxRows: 2,
|
|
206
213
|
itemsPerRow: 4,
|
|
207
214
|
data: all.douyin.push.banWords,
|
|
208
|
-
template: components.input.string('push
|
|
215
|
+
template: components.input.string('push:banTags', {
|
|
209
216
|
placeholder: '',
|
|
210
217
|
label: '',
|
|
211
218
|
color: 'success'
|
|
212
219
|
})
|
|
213
220
|
}),
|
|
214
|
-
components.radio.group('push
|
|
221
|
+
components.radio.group('push:permission', {
|
|
215
222
|
label: '谁可以设置推送',
|
|
216
223
|
orientation: 'horizontal',
|
|
217
224
|
defaultValue: all.douyin.push.permission,
|
|
218
225
|
radio: [
|
|
219
|
-
components.radio.create('push
|
|
226
|
+
components.radio.create('push:permission:radio-1', {
|
|
220
227
|
label: '所有人',
|
|
221
228
|
value: 'all'
|
|
222
229
|
}),
|
|
223
|
-
components.radio.create('push
|
|
230
|
+
components.radio.create('push:permission:radio-2', {
|
|
224
231
|
label: '管理员',
|
|
225
232
|
value: 'admin'
|
|
226
233
|
}),
|
|
227
|
-
components.radio.create('push
|
|
234
|
+
components.radio.create('push:permission:radio-3', {
|
|
228
235
|
label: '主人',
|
|
229
236
|
value: 'master'
|
|
230
237
|
}),
|
|
231
|
-
components.radio.create('push
|
|
238
|
+
components.radio.create('push:permission:radio-4', {
|
|
232
239
|
label: '群主',
|
|
233
240
|
value: 'group.owner'
|
|
234
241
|
}),
|
|
235
|
-
components.radio.create('push
|
|
242
|
+
components.radio.create('push:permission:radio-5', {
|
|
236
243
|
label: '群管理员',
|
|
237
244
|
value: 'group.admin'
|
|
238
245
|
})
|
|
239
246
|
]
|
|
240
247
|
}),
|
|
241
|
-
components.input.string('push
|
|
248
|
+
components.input.string('push:cron', {
|
|
242
249
|
label: '定时任务表达式',
|
|
243
250
|
defaultValue: all.douyin.push.cron
|
|
244
251
|
}),
|
|
245
|
-
components.switch.create('push
|
|
252
|
+
components.switch.create('push:parsedynamic', {
|
|
246
253
|
startText: '作品解析',
|
|
247
254
|
description: '触发推送时是否一同解析该作品',
|
|
248
255
|
defaultSelected: all.douyin.push.parsedynamic
|
|
249
256
|
}),
|
|
250
|
-
components.switch.create('push
|
|
257
|
+
components.switch.create('push:log', {
|
|
251
258
|
startText: '推送日志',
|
|
252
259
|
description: '是否打印推送日志(修改后需重启)',
|
|
253
260
|
defaultSelected: all.douyin.push.log
|
|
254
261
|
}),
|
|
255
|
-
components.radio.group('push
|
|
262
|
+
components.radio.group('push:shareType', {
|
|
256
263
|
label: '分享链接二维码的类型',
|
|
257
264
|
orientation: 'horizontal',
|
|
258
265
|
defaultValue: all.douyin.push.shareType,
|
|
259
266
|
radio: [
|
|
260
|
-
components.radio.create('push
|
|
267
|
+
components.radio.create('push:shareType.radio-1', {
|
|
261
268
|
label: '网页链接',
|
|
262
269
|
value: 'web'
|
|
263
270
|
}),
|
|
264
|
-
components.radio.create('push
|
|
271
|
+
components.radio.create('push:shareType.radio-2', {
|
|
265
272
|
label: '下载链接',
|
|
266
273
|
value: 'download'
|
|
267
274
|
})
|
|
@@ -275,9 +282,9 @@ export default {
|
|
|
275
282
|
description: 'B站相关',
|
|
276
283
|
descPosition: 20
|
|
277
284
|
}),
|
|
278
|
-
components.accordion.create('
|
|
285
|
+
components.accordion.create('bilibili', {
|
|
279
286
|
children: [
|
|
280
|
-
components.accordion.createItem('bilibili', {
|
|
287
|
+
components.accordion.createItem('cfg:bilibili', {
|
|
281
288
|
title: 'B站相关',
|
|
282
289
|
className: 'ml-4 mr-4',
|
|
283
290
|
subtitle: '此处为B站相关的用户偏好设置',
|
|
@@ -316,70 +323,70 @@ export default {
|
|
|
316
323
|
description: 'B站推送相关',
|
|
317
324
|
descPosition: 20
|
|
318
325
|
}),
|
|
319
|
-
components.switch.create('push
|
|
326
|
+
components.switch.create('push:switch', {
|
|
320
327
|
startText: '推送开关',
|
|
321
328
|
description: '推送开关,开启后需重启;使用「#设置B站推送 + UID」配置推送列表',
|
|
322
329
|
defaultSelected: all.bilibili.push.switch
|
|
323
330
|
}),
|
|
324
|
-
components.input.group('push
|
|
331
|
+
components.input.group('push:banWords', {
|
|
325
332
|
label: '动态中有以下指定关键词时,不推送',
|
|
326
333
|
maxRows: 2,
|
|
327
334
|
itemsPerRow: 4,
|
|
328
335
|
data: all.bilibili.push.banWords,
|
|
329
|
-
template: components.input.string('push
|
|
336
|
+
template: components.input.string('push:banWords', {
|
|
330
337
|
placeholder: '',
|
|
331
338
|
label: '',
|
|
332
339
|
color: 'success'
|
|
333
340
|
})
|
|
334
341
|
}),
|
|
335
|
-
components.input.group('push
|
|
342
|
+
components.input.group('push:banTags', {
|
|
336
343
|
label: '动态中有指定标签时,不推送',
|
|
337
344
|
maxRows: 2,
|
|
338
345
|
itemsPerRow: 4,
|
|
339
346
|
data: all.bilibili.push.banWords,
|
|
340
|
-
template: components.input.string('push
|
|
347
|
+
template: components.input.string('push:banTags', {
|
|
341
348
|
placeholder: '',
|
|
342
349
|
label: '',
|
|
343
350
|
color: 'success'
|
|
344
351
|
})
|
|
345
352
|
}),
|
|
346
|
-
components.radio.group('push
|
|
353
|
+
components.radio.group('push:permission', {
|
|
347
354
|
label: '谁可以设置推送',
|
|
348
355
|
orientation: 'horizontal',
|
|
349
356
|
defaultValue: all.bilibili.push.permission,
|
|
350
357
|
radio: [
|
|
351
|
-
components.radio.create('push
|
|
358
|
+
components.radio.create('push:permission:radio-1', {
|
|
352
359
|
label: '所有人',
|
|
353
360
|
value: 'all'
|
|
354
361
|
}),
|
|
355
|
-
components.radio.create('push
|
|
362
|
+
components.radio.create('push:permission:radio-2', {
|
|
356
363
|
label: '管理员',
|
|
357
364
|
value: 'admin'
|
|
358
365
|
}),
|
|
359
|
-
components.radio.create('push
|
|
366
|
+
components.radio.create('push:permission:radio-3', {
|
|
360
367
|
label: '主人',
|
|
361
368
|
value: 'master'
|
|
362
369
|
}),
|
|
363
|
-
components.radio.create('push
|
|
370
|
+
components.radio.create('push:permission:radio-4', {
|
|
364
371
|
label: '群主',
|
|
365
372
|
value: 'group.owner'
|
|
366
373
|
}),
|
|
367
|
-
components.radio.create('push
|
|
374
|
+
components.radio.create('push:permission:radio-5', {
|
|
368
375
|
label: '群管理员',
|
|
369
376
|
value: 'group.admin'
|
|
370
377
|
})
|
|
371
378
|
]
|
|
372
379
|
}),
|
|
373
|
-
components.input.string('push
|
|
380
|
+
components.input.string('push:cron', {
|
|
374
381
|
label: '定时任务表达式',
|
|
375
382
|
defaultValue: all.bilibili.push.cron
|
|
376
383
|
}),
|
|
377
|
-
components.switch.create('push
|
|
384
|
+
components.switch.create('push:parsedynamic', {
|
|
378
385
|
startText: '作品解析',
|
|
379
386
|
description: '触发推送时是否一同解析该作品',
|
|
380
387
|
defaultSelected: all.bilibili.push.parsedynamic
|
|
381
388
|
}),
|
|
382
|
-
components.switch.create('push
|
|
389
|
+
components.switch.create('push:log', {
|
|
383
390
|
startText: '推送日志',
|
|
384
391
|
description: '是否打印推送日志(修改后需重启)',
|
|
385
392
|
defaultSelected: all.bilibili.push.log
|
|
@@ -392,9 +399,9 @@ export default {
|
|
|
392
399
|
description: '快手相关',
|
|
393
400
|
descPosition: 20
|
|
394
401
|
}),
|
|
395
|
-
components.accordion.create('
|
|
402
|
+
components.accordion.create('kuaishou', {
|
|
396
403
|
children: [
|
|
397
|
-
components.accordion.createItem('kuaishou', {
|
|
404
|
+
components.accordion.createItem('cfg:kuaishou', {
|
|
398
405
|
title: '快手相关',
|
|
399
406
|
className: 'ml-4 mr-4',
|
|
400
407
|
subtitle: '此处为快手相关的用户偏好设置',
|
|
@@ -427,9 +434,9 @@ export default {
|
|
|
427
434
|
description: '上传相关',
|
|
428
435
|
descPosition: 20
|
|
429
436
|
}),
|
|
430
|
-
components.accordion.create('
|
|
437
|
+
components.accordion.create('upload', {
|
|
431
438
|
children: [
|
|
432
|
-
components.accordion.createItem('upload', {
|
|
439
|
+
components.accordion.createItem('cfg:upload', {
|
|
433
440
|
title: '上传相关',
|
|
434
441
|
className: 'ml-4 mr-4',
|
|
435
442
|
subtitle: '此处为上传相关的用户偏好设置',
|
|
@@ -490,7 +497,7 @@ export default {
|
|
|
490
497
|
description: '抖音推送列表相关',
|
|
491
498
|
descPosition: 20
|
|
492
499
|
}),
|
|
493
|
-
components.accordionPro.create('
|
|
500
|
+
components.accordionPro.create('pushlist:douyin', all.pushlist.douyin.map((item) => {
|
|
494
501
|
return {
|
|
495
502
|
...item,
|
|
496
503
|
title: item.remark,
|
|
@@ -510,7 +517,7 @@ export default {
|
|
|
510
517
|
label: '推送群号和机器人账号',
|
|
511
518
|
maxRows: 2,
|
|
512
519
|
data: [],
|
|
513
|
-
template: components.input.string('accordion-item-douyin
|
|
520
|
+
template: components.input.string('accordion-item-douyin:push:douyin:group_id', {
|
|
514
521
|
placeholder: '',
|
|
515
522
|
label: '',
|
|
516
523
|
color: 'success'
|
|
@@ -535,7 +542,7 @@ export default {
|
|
|
535
542
|
description: 'B站推送列表相关',
|
|
536
543
|
descPosition: 20
|
|
537
544
|
}),
|
|
538
|
-
components.accordionPro.create('
|
|
545
|
+
components.accordionPro.create('pushlist:bilibili', all.pushlist.bilibili.map((item) => {
|
|
539
546
|
return {
|
|
540
547
|
...item,
|
|
541
548
|
title: item.remark,
|
|
@@ -556,7 +563,7 @@ export default {
|
|
|
556
563
|
label: '推送群号和机器人账号',
|
|
557
564
|
maxRows: 2,
|
|
558
565
|
data: [],
|
|
559
|
-
template: components.input.string('accordion-item-bilibili
|
|
566
|
+
template: components.input.string('accordion-item-bilibili:push:bilibili:group_id', {
|
|
560
567
|
placeholder: '',
|
|
561
568
|
label: '',
|
|
562
569
|
color: 'success'
|
|
@@ -577,17 +584,17 @@ export default {
|
|
|
577
584
|
const formatCfg = processFrontendData(config);
|
|
578
585
|
const oldAllCfg = Config.All();
|
|
579
586
|
/** 合并旧新配置 */
|
|
580
|
-
const
|
|
587
|
+
const mergeCfg = _.mergeWith({}, oldAllCfg, formatCfg, customizer);
|
|
581
588
|
let success = false;
|
|
582
589
|
let isChange = false;
|
|
583
|
-
Object.keys(
|
|
584
|
-
isChange = deepEqual(
|
|
590
|
+
Object.keys(mergeCfg).forEach((key) => {
|
|
591
|
+
isChange = deepEqual(mergeCfg[key], oldAllCfg[key]);
|
|
585
592
|
if (isChange) {
|
|
586
|
-
success = Config.ModifyPro(key,
|
|
593
|
+
success = Config.ModifyPro(key, mergeCfg[key]);
|
|
587
594
|
}
|
|
588
595
|
});
|
|
589
596
|
return {
|
|
590
|
-
|
|
597
|
+
mergeCfg,
|
|
591
598
|
formatCfg,
|
|
592
599
|
success,
|
|
593
600
|
message: success ? '保存成功 Ciallo~(∠・ω< )⌒☆' : '配置无变化,无需保存'
|
|
@@ -683,8 +690,13 @@ const deepEqual = (a, b) => {
|
|
|
683
690
|
* @returns
|
|
684
691
|
*/
|
|
685
692
|
function convertToNumber(value) {
|
|
686
|
-
|
|
687
|
-
|
|
693
|
+
// 检查字符串是否为有效的数字
|
|
694
|
+
if (/^\d+$/.test(value)) {
|
|
695
|
+
const num = parseInt(value, 10);
|
|
696
|
+
return num;
|
|
697
|
+
}
|
|
698
|
+
else
|
|
699
|
+
return value;
|
|
688
700
|
}
|
|
689
701
|
/**
|
|
690
702
|
* 获取数组中的第一个对象,如果数组为空则返回空对象
|
|
@@ -701,34 +713,42 @@ function getFirstObject(arr) {
|
|
|
701
713
|
*/
|
|
702
714
|
function processFrontendData(data) {
|
|
703
715
|
const result = {};
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
716
|
+
const configKeys = Object.keys(data).filter((key) => {
|
|
717
|
+
return !key.includes('pushlist') && key in data;
|
|
718
|
+
});
|
|
707
719
|
for (const key of configKeys) {
|
|
708
|
-
const
|
|
720
|
+
const value = data[key];
|
|
721
|
+
const firstObj = Array.isArray(value) ? getFirstObject(value) : {};
|
|
722
|
+
// 使用类型断言,确保 result[key] 的类型正确
|
|
709
723
|
result[key] = {};
|
|
710
724
|
for (const prop in firstObj) {
|
|
711
725
|
let value = firstObj[prop];
|
|
712
|
-
//
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
const [parent, child] = prop.split('
|
|
717
|
-
if (!result[key][
|
|
726
|
+
if (typeof value === 'string') { // 确保仅对字符串类型进行转换
|
|
727
|
+
value = convertToNumber(value);
|
|
728
|
+
}
|
|
729
|
+
if (prop.includes(':')) {
|
|
730
|
+
const [parent, child] = prop.split(':');
|
|
731
|
+
if (!result[key] || typeof result[key] !== 'object') {
|
|
732
|
+
result[key] = {};
|
|
733
|
+
}
|
|
734
|
+
if (!result[key][parent] || typeof result[key][parent] !== 'object') {
|
|
718
735
|
result[key][parent] = {};
|
|
719
736
|
}
|
|
720
737
|
result[key][parent][child] = value;
|
|
721
738
|
}
|
|
722
739
|
else {
|
|
723
|
-
// 处理普通属性
|
|
724
740
|
result[key][prop] = value;
|
|
725
741
|
}
|
|
726
742
|
}
|
|
727
743
|
}
|
|
728
|
-
// 处理 pushlist 配置项
|
|
729
744
|
result.pushlist = {
|
|
730
|
-
douyin: data['
|
|
731
|
-
bilibili: data['
|
|
745
|
+
douyin: data['pushlist:douyin'] || [],
|
|
746
|
+
bilibili: data['pushlist:bilibili'].map(item => {
|
|
747
|
+
return {
|
|
748
|
+
...item,
|
|
749
|
+
host_mid: Number(item.host_mid)
|
|
750
|
+
};
|
|
751
|
+
}) || []
|
|
732
752
|
};
|
|
733
753
|
return result;
|
|
734
754
|
}
|
package/package.json
CHANGED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
-
|
|
2
|
-
# 配置文件描述
|
|
3
|
-
name: Cookies相关
|
|
4
|
-
# 配置文件名
|
|
5
|
-
file: cookies.yaml
|
|
6
|
-
# 视图信息
|
|
7
|
-
view:
|
|
8
|
-
-
|
|
9
|
-
# 配置项
|
|
10
|
-
key: 抖音ck
|
|
11
|
-
# 配置描述
|
|
12
|
-
comment: 抖音ck,用于请求官方API数据
|
|
13
|
-
# 配置路径
|
|
14
|
-
path: 'douyin'
|
|
15
|
-
# 配置类型
|
|
16
|
-
type: 'text'
|
|
17
|
-
-
|
|
18
|
-
key: B站ck
|
|
19
|
-
comment: B站ck,用于请求官方API数据
|
|
20
|
-
path: 'bilibili'
|
|
21
|
-
type: 'text'
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
# 配置文件描述
|
|
25
|
-
name: 应用设置
|
|
26
|
-
# 配置文件名
|
|
27
|
-
file: app.yaml
|
|
28
|
-
# 视图信息
|
|
29
|
-
view:
|
|
30
|
-
-
|
|
31
|
-
# 配置项
|
|
32
|
-
key: 总开关
|
|
33
|
-
# 配置描述
|
|
34
|
-
comment: 视频解析工具总开关,修改后重启生效,关闭后可使用 kkk/kkk解析/解析 + 视频分享链接代替
|
|
35
|
-
# 配置路径
|
|
36
|
-
path: 'videotool'
|
|
37
|
-
# 配置类型
|
|
38
|
-
type: 'boolean'
|
|
39
|
-
-
|
|
40
|
-
key: 默认解析
|
|
41
|
-
comment: 识别最高优先级,修改后重启生效
|
|
42
|
-
path: 'defaulttool'
|
|
43
|
-
type: 'boolean'
|
|
44
|
-
-
|
|
45
|
-
key: 发送合并转发消息
|
|
46
|
-
comment: 可能多用于抖音解析
|
|
47
|
-
path: 'sendforwardmsg'
|
|
48
|
-
type: 'boolean'
|
|
49
|
-
-
|
|
50
|
-
key: 视频文件上传限制
|
|
51
|
-
comment: 开启后会根据解析的视频文件大小判断是否需要上传(B站番剧无影响)
|
|
52
|
-
path: 'usefilelimit'
|
|
53
|
-
type: 'boolean'
|
|
54
|
-
-
|
|
55
|
-
key: 缓存删除
|
|
56
|
-
comment: 非必要不修改!
|
|
57
|
-
path: 'rmmp4'
|
|
58
|
-
type: 'boolean'
|
|
59
|
-
-
|
|
60
|
-
key: API服务
|
|
61
|
-
comment: '将所有api接口放出,作为一个本地的视频解析API服务,默认端口4567'
|
|
62
|
-
path: 'APIServer'
|
|
63
|
-
type: 'boolean'
|
|
64
|
-
-
|
|
65
|
-
key: API服务端口
|
|
66
|
-
comment: 'API服务端口'
|
|
67
|
-
path: 'APIServerPort'
|
|
68
|
-
type: 'number'
|
|
69
|
-
-
|
|
70
|
-
key: API服务日志
|
|
71
|
-
comment: '打开或关闭运行日志'
|
|
72
|
-
path: 'APIServerLog'
|
|
73
|
-
type: 'boolean'
|
|
74
|
-
-
|
|
75
|
-
key: 自定义优先级
|
|
76
|
-
comment: 「默认解析」关闭后才会生效。修改后重启生效
|
|
77
|
-
path: 'priority'
|
|
78
|
-
type: 'number'
|
|
79
|
-
-
|
|
80
|
-
key: 视频文件大小限制
|
|
81
|
-
comment: '视频文件大于该数值则不会上传 单位: MB,「视频文件上传限制」开启后才会生效(B站番剧无影响)'
|
|
82
|
-
path: 'filelimit'
|
|
83
|
-
type: 'number'
|
|
84
|
-
-
|
|
85
|
-
key: 渲染精度
|
|
86
|
-
comment: 可选值50~200,建议100。设置高精度会提高图片的精细度,过高可能会影响渲染与发送速度
|
|
87
|
-
path: 'renderScale'
|
|
88
|
-
type: 'number'
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
# 配置文件描述
|
|
92
|
-
name: 抖音相关
|
|
93
|
-
# 配置文件名
|
|
94
|
-
file: douyin.yaml
|
|
95
|
-
# 视图信息
|
|
96
|
-
view:
|
|
97
|
-
-
|
|
98
|
-
# 配置项
|
|
99
|
-
key: 抖音解析开关
|
|
100
|
-
# 配置描述
|
|
101
|
-
comment: 单独开关,受「总开关」影响
|
|
102
|
-
# 配置路径
|
|
103
|
-
path: 'douyintool'
|
|
104
|
-
# 配置类型
|
|
105
|
-
type: 'boolean'
|
|
106
|
-
-
|
|
107
|
-
key: 抖音解析提示
|
|
108
|
-
comment: 发送提示信息:“检测到抖音链接,开始解析”
|
|
109
|
-
path: 'douyintip'
|
|
110
|
-
type: 'boolean'
|
|
111
|
-
-
|
|
112
|
-
key: 抖音评论解析
|
|
113
|
-
path: 'comments'
|
|
114
|
-
type: 'boolean'
|
|
115
|
-
-
|
|
116
|
-
key: 抖音评论数量
|
|
117
|
-
comment: 范围1~50条
|
|
118
|
-
path: 'numcomments'
|
|
119
|
-
type: 'number'
|
|
120
|
-
-
|
|
121
|
-
key: 发送抖音作品评论图
|
|
122
|
-
path: 'commentsimg'
|
|
123
|
-
type: 'boolean'
|
|
124
|
-
-
|
|
125
|
-
key: 抖音推送
|
|
126
|
-
comment: 开启后需重启;使用[#设置抖音推送+抖音号]配置推送列表
|
|
127
|
-
path: 'douyinpush'
|
|
128
|
-
type: 'boolean'
|
|
129
|
-
-
|
|
130
|
-
key: 抖音推送日志
|
|
131
|
-
comment: 打开或关闭定时任务日志
|
|
132
|
-
path: 'douyinpushlog'
|
|
133
|
-
type: 'boolean'
|
|
134
|
-
-
|
|
135
|
-
key: 抖音推送设置权限
|
|
136
|
-
comment: '0: (all)所有人;1: (admin)群主和管理员;2: (owner)群主;3: (master)主人'
|
|
137
|
-
path: 'douyinpushGroup'
|
|
138
|
-
type: 'select'
|
|
139
|
-
# 是否可以多选
|
|
140
|
-
multiple: false
|
|
141
|
-
# 选项
|
|
142
|
-
item:
|
|
143
|
-
-
|
|
144
|
-
name: 所有人都可以添加
|
|
145
|
-
value: all
|
|
146
|
-
-
|
|
147
|
-
name: 只有群管理员可以添加
|
|
148
|
-
value: admin
|
|
149
|
-
-
|
|
150
|
-
name: 只有群主可以添加
|
|
151
|
-
value: owner
|
|
152
|
-
-
|
|
153
|
-
name: 只有主人可以添加
|
|
154
|
-
value: master
|
|
155
|
-
-
|
|
156
|
-
key: 抖音推送表达式
|
|
157
|
-
path: 'douyinpushcron'
|
|
158
|
-
type: 'boolean'
|
|
159
|
-
-
|
|
160
|
-
key: 图集BGM是否使用高清语音发送
|
|
161
|
-
comment: 高清语音「ios/PC」系统均无法播放,自行衡量开关(仅icqq)
|
|
162
|
-
path: 'sendHDrecord'
|
|
163
|
-
type: 'boolean'
|
|
164
|
-
-
|
|
165
|
-
key: 抖音推送是否一同发送作品视频
|
|
166
|
-
comment: 和推送图一同将新作品内容发送出去(图集暂未支持)
|
|
167
|
-
path: 'senddynamicwork'
|
|
168
|
-
type: 'boolean'
|
|
169
|
-
|
|
170
|
-
-
|
|
171
|
-
# 配置文件描述
|
|
172
|
-
name: bilibili相关
|
|
173
|
-
# 配置文件名
|
|
174
|
-
file: bilibili.yaml
|
|
175
|
-
# 视图信息
|
|
176
|
-
view:
|
|
177
|
-
-
|
|
178
|
-
# 配置项
|
|
179
|
-
key: B站解析开关
|
|
180
|
-
# 配置描述
|
|
181
|
-
comment: 单独开关,受「总开关」影响
|
|
182
|
-
# 配置路径
|
|
183
|
-
path: 'bilibilitool'
|
|
184
|
-
# 配置类型
|
|
185
|
-
type: 'boolean'
|
|
186
|
-
-
|
|
187
|
-
key: B站解析提示
|
|
188
|
-
comment: 发送提示信息:“检测到B站链接,开始解析”
|
|
189
|
-
path: 'bilibilitip'
|
|
190
|
-
type: 'boolean'
|
|
191
|
-
-
|
|
192
|
-
key: B站评论图
|
|
193
|
-
comment: 发送哔哩哔哩作品评论图
|
|
194
|
-
path: 'bilibilicommentsimg'
|
|
195
|
-
type: 'boolean'
|
|
196
|
-
-
|
|
197
|
-
key: B站评论数量
|
|
198
|
-
comment: 范围1~20条
|
|
199
|
-
path: 'bilibilinumcomments'
|
|
200
|
-
type: 'number'
|
|
201
|
-
-
|
|
202
|
-
key: B站推送
|
|
203
|
-
comment: 开启后需重启;使用[#设置B站推送+UID]配置推送列表
|
|
204
|
-
path: 'bilibilipush'
|
|
205
|
-
type: 'boolean'
|
|
206
|
-
-
|
|
207
|
-
key: B站推送日志
|
|
208
|
-
comment: 打开或关闭定时任务日志
|
|
209
|
-
path: 'bilibilipushlog'
|
|
210
|
-
type: 'boolean'
|
|
211
|
-
-
|
|
212
|
-
key: B站推送设置权限
|
|
213
|
-
comment: '0: (all)所有人;1: (admin)群主和管理员;2: (owner)群主;3: (master)主人'
|
|
214
|
-
path: 'bilibilipushGroup'
|
|
215
|
-
type: 'select'
|
|
216
|
-
# 是否可以多选
|
|
217
|
-
multiple: false
|
|
218
|
-
# 选项
|
|
219
|
-
item:
|
|
220
|
-
-
|
|
221
|
-
name: 所有人都可以添加
|
|
222
|
-
value: all
|
|
223
|
-
-
|
|
224
|
-
name: 只有群管理员可以添加
|
|
225
|
-
value: admin
|
|
226
|
-
-
|
|
227
|
-
name: 只有群主可以添加
|
|
228
|
-
value: owner
|
|
229
|
-
-
|
|
230
|
-
name: 只有主人可以添加
|
|
231
|
-
value: master
|
|
232
|
-
-
|
|
233
|
-
key: B站推送表达式
|
|
234
|
-
path: 'bilibilipushcron'
|
|
235
|
-
type: 'boolean'
|
|
236
|
-
-
|
|
237
|
-
key: B站动态视频发送
|
|
238
|
-
comment: 该UP的最新动态可能是视频,可选是否与推送图片一同发送
|
|
239
|
-
path: 'senddynamicvideo'
|
|
240
|
-
type: 'boolean'
|
|
241
|
-
-
|
|
242
|
-
key: B站动态视频发送
|
|
243
|
-
comment: 解析视频是否优先保内容,打开为优先保证上传将使用最低分辨率,关闭为优先保清晰度将使用最高分辨率
|
|
244
|
-
path: 'videopriority'
|
|
245
|
-
type: 'boolean'
|
|
246
|
-
-
|
|
247
|
-
# 配置文件描述
|
|
248
|
-
name: 快手相关
|
|
249
|
-
# 配置文件名
|
|
250
|
-
file: kuaishou.yaml
|
|
251
|
-
# 视图信息
|
|
252
|
-
view:
|
|
253
|
-
-
|
|
254
|
-
# 配置项
|
|
255
|
-
key: 快手解析开关
|
|
256
|
-
# 配置描述
|
|
257
|
-
comment: 单独开关,受「总开关」影响
|
|
258
|
-
# 配置路径
|
|
259
|
-
path: 'kuaishoutool'
|
|
260
|
-
# 配置类型
|
|
261
|
-
type: 'boolean'
|
|
262
|
-
-
|
|
263
|
-
key: 快手解析提示
|
|
264
|
-
comment: 发送提示信息:“检测到快手链接,开始解析”
|
|
265
|
-
path: 'kuaishoutip'
|
|
266
|
-
type: 'boolean'
|
|
267
|
-
-
|
|
268
|
-
key: 快手评论数量
|
|
269
|
-
comment: 范围1~30条
|
|
270
|
-
path: 'kuaishounumcomments'
|
|
271
|
-
type: 'number'
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { basename, dirname, join } from 'node:path';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { config, getPkgVersion, getPluginInfo } from 'node-karin';
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = dirname(__filename);
|
|
6
|
-
const pluginPath = join(__dirname, '..', '..', '..').replace(/\\/g, '/');
|
|
7
|
-
const pluginName = basename(pluginPath);
|
|
8
|
-
const Ver = {
|
|
9
|
-
/** 插件名字 */
|
|
10
|
-
pluginName,
|
|
11
|
-
/** 插件版本号 */
|
|
12
|
-
pluginVersion: getPluginInfo('karin-plugin-kkk')?.pkg?.version || await getPkgVersion(pluginName),
|
|
13
|
-
/** 插件路径 */
|
|
14
|
-
pluginPath: join(__dirname, '..', '..', '..').replace(/\\/g, '/'),
|
|
15
|
-
/** Karin版本 */
|
|
16
|
-
karinVersion: config.pkg().version,
|
|
17
|
-
/** Karin程序/客户端路径 */
|
|
18
|
-
karinPath: (process.cwd()).replace(/\\/g, '/')
|
|
19
|
-
};
|
|
20
|
-
export const Version = Ver;
|
|
File without changes
|