karin-plugin-kkk 1.1.0 → 1.1.2

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.2](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.1.1...v1.1.2) (2025-02-25)
4
+
5
+
6
+ ### Performance Improvements
7
+
8
+ * **app:** 添加移除渲染图片底部水印功能 ([f37f83a](https://github.com/ikenxuan/karin-plugin-kkk/commit/f37f83af93d18dc2e763a0c710639bc59deab0a0))
9
+ * 抖音推送图可选二维码是网页链接还是下载链接 ([7bb6139](https://github.com/ikenxuan/karin-plugin-kkk/commit/7bb6139de1eecc9082b52969690f9349fae65b40))
10
+
11
+ ## [1.1.1](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.1.0...v1.1.1) (2025-02-24)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * fix [#41](https://github.com/ikenxuan/karin-plugin-kkk/issues/41) ([6335eea](https://github.com/ikenxuan/karin-plugin-kkk/commit/6335eeabaa59ca188473be191251f16c30ee4970))
17
+ * save web config ([c594c0c](https://github.com/ikenxuan/karin-plugin-kkk/commit/c594c0c800abd8dff97c7af1d3f4dd175d068792))
18
+ * 选择性记录 ([89f9e1b](https://github.com/ikenxuan/karin-plugin-kkk/commit/89f9e1b791eb257f40965fdaccf132ba210e5758))
19
+
20
+
21
+ ### Performance Improvements
22
+
23
+ * web config ([24c9dd0](https://github.com/ikenxuan/karin-plugin-kkk/commit/24c9dd0d1e0591633565d4c05c26bc385aba2c0b))
24
+
3
25
  ## [1.1.0](https://github.com/ikenxuan/karin-plugin-kkk/compare/v1.0.9...v1.1.0) (2025-02-22)
4
26
 
5
27
 
@@ -23,4 +23,7 @@ APIServerPort: 4567
23
23
  APIServerMount: true
24
24
 
25
25
  # 渲染评论图和推送图的主题色,0为自动(06:00-18:00为浅色,18:00-06:00为深色),1为浅色,2为深色
26
- Theme: 0
26
+ Theme: 0
27
+
28
+ # 渲染的图片是否移除底部水印
29
+ RemoveWatermark: false
@@ -32,4 +32,6 @@ push:
32
32
  # 推送时是否一同解析该作品
33
33
  parsedynamic: false
34
34
  # 是否打印日志
35
- log: true
35
+ log: true
36
+ # 分享链接二维码的类型,web为跳转到抖音网页,download为视频下载直链
37
+ shareType: 'web'
package/lib/index.js CHANGED
@@ -14,7 +14,7 @@ server.use(cors());
14
14
  server.use('/', createProxyMiddleware(proxyOptions));
15
15
  server.listen(3780);
16
16
  if (Config.app.APIServer && Config.app.APIServerMount) {
17
- app.use(logMiddleware);
17
+ app.use(logMiddleware(['/api/bilibili', '/api/douyin', '/api/kuaishou']));
18
18
  app.use('/api/bilibili', registerBilibiliRoutes(Config.cookies.bilibili));
19
19
  app.use('/api/douyin', registerDouyinRoutes(Config.cookies.douyin));
20
20
  app.use('/api/kuaishou', registerKuaishouRoutes(Config.cookies.kuaishou));
@@ -160,8 +160,8 @@ export class Base {
160
160
  function generateProgressBar(progressPercentage) {
161
161
  const filledLength = Math.floor((progressPercentage / 100) * barLength);
162
162
  let progress = '';
163
- progress += '#'.repeat(filledLength);
164
- progress += '-'.repeat(Math.max(0, barLength - filledLength - 1));
163
+ progress += '\u2588'.repeat(filledLength);
164
+ progress += '\u2591'.repeat(Math.max(0, barLength - filledLength - 1));
165
165
  return `[${progress}]`;
166
166
  }
167
167
  // 计算当前下载进度百分比
@@ -183,7 +183,7 @@ export class Base {
183
183
  const downloadedSizeMB = (downloadedBytes / 1048576).toFixed(1);
184
184
  const totalSizeMB = (totalBytes / 1048576).toFixed(1);
185
185
  // 打印下载进度、速度和剩余时间
186
- console.log(`🚀 Downloading 🚀 ${opt.title} ${generateProgressBar(progressPercentage)} ${coloredPercentage} ${downloadedSizeMB}/${totalSizeMB} MB | ${formattedSpeed} 剩余: ${formattedRemainingTime}\r`);
186
+ console.log(`⬇️ ${opt.title} ${generateProgressBar(progressPercentage)} ${coloredPercentage} ${downloadedSizeMB}/${totalSizeMB} MB | ${formattedSpeed} 剩余: ${formattedRemainingTime}\r`);
187
187
  }, 3);
188
188
  return { filepath, totalBytes };
189
189
  }
@@ -39,6 +39,7 @@ declare class Cfg {
39
39
  APIServerPort: number;
40
40
  APIServerMount: boolean;
41
41
  Theme: number;
42
+ RemoveWatermark: boolean;
42
43
  bilibili: string;
43
44
  douyin: string;
44
45
  kuaishou: string;
@@ -75,6 +76,7 @@ declare class Cfg {
75
76
  cron: string;
76
77
  parsedynamic: boolean;
77
78
  log: boolean;
79
+ shareType: "web" | "download";
78
80
  };
79
81
  bilibili: string;
80
82
  douyin: string;
@@ -122,6 +124,7 @@ declare class Cfg {
122
124
  APIServerPort: number;
123
125
  APIServerMount: boolean;
124
126
  Theme: number;
127
+ RemoveWatermark: boolean;
125
128
  sendbase64: boolean;
126
129
  usefilelimit: boolean;
127
130
  filelimit: number;
@@ -168,6 +171,7 @@ declare class Cfg {
168
171
  cron: string;
169
172
  parsedynamic: boolean;
170
173
  log: boolean;
174
+ shareType: "web" | "download";
171
175
  };
172
176
  sendbase64: boolean;
173
177
  usefilelimit: boolean;
@@ -215,6 +219,7 @@ declare class Cfg {
215
219
  APIServerPort: number;
216
220
  APIServerMount: boolean;
217
221
  Theme: number;
222
+ RemoveWatermark: boolean;
218
223
  } | {
219
224
  sendbase64: boolean;
220
225
  usefilelimit: boolean;
@@ -232,6 +237,7 @@ declare class Cfg {
232
237
  APIServerPort: number;
233
238
  APIServerMount: boolean;
234
239
  Theme: number;
240
+ RemoveWatermark: boolean;
235
241
  } | {
236
242
  defaulttool: boolean;
237
243
  priority: number;
@@ -241,6 +247,7 @@ declare class Cfg {
241
247
  APIServerPort: number;
242
248
  APIServerMount: boolean;
243
249
  Theme: number;
250
+ RemoveWatermark: boolean;
244
251
  } | {
245
252
  switch: boolean;
246
253
  tip: boolean;
@@ -265,6 +272,7 @@ declare class Cfg {
265
272
  APIServerPort: number;
266
273
  APIServerMount: boolean;
267
274
  Theme: number;
275
+ RemoveWatermark: boolean;
268
276
  } | {
269
277
  switch: boolean;
270
278
  tip: boolean;
@@ -279,6 +287,7 @@ declare class Cfg {
279
287
  cron: string;
280
288
  parsedynamic: boolean;
281
289
  log: boolean;
290
+ shareType: "web" | "download";
282
291
  };
283
292
  defaulttool: boolean;
284
293
  priority: number;
@@ -288,6 +297,7 @@ declare class Cfg {
288
297
  APIServerPort: number;
289
298
  APIServerMount: boolean;
290
299
  Theme: number;
300
+ RemoveWatermark: boolean;
291
301
  } | {
292
302
  switch: boolean;
293
303
  tip: boolean;
@@ -301,6 +311,7 @@ declare class Cfg {
301
311
  APIServerPort: number;
302
312
  APIServerMount: boolean;
303
313
  Theme: number;
314
+ RemoveWatermark: boolean;
304
315
  } | {
305
316
  douyin: import("../../types/config/pushlist.js").douyinPushItem[];
306
317
  bilibili: import("../../types/config/pushlist.js").bilibiliPushItem[];
@@ -312,6 +323,7 @@ declare class Cfg {
312
323
  APIServerPort: number;
313
324
  APIServerMount: boolean;
314
325
  Theme: number;
326
+ RemoveWatermark: boolean;
315
327
  } | {
316
328
  bilibili: string;
317
329
  douyin: string;
@@ -364,6 +376,7 @@ declare class Cfg {
364
376
  APIServerPort: number;
365
377
  APIServerMount: boolean;
366
378
  Theme: number;
379
+ RemoveWatermark: boolean;
367
380
  switch: boolean;
368
381
  tip: boolean;
369
382
  comment: boolean;
@@ -409,6 +422,7 @@ declare class Cfg {
409
422
  cron: string;
410
423
  parsedynamic: boolean;
411
424
  log: boolean;
425
+ shareType: "web" | "download";
412
426
  };
413
427
  videopriority: boolean;
414
428
  } | {
@@ -462,6 +476,7 @@ declare class Cfg {
462
476
  cron: string;
463
477
  parsedynamic: boolean;
464
478
  log: boolean;
479
+ shareType: "web" | "download";
465
480
  };
466
481
  } | {
467
482
  sendbase64: boolean;
@@ -485,6 +500,7 @@ declare class Cfg {
485
500
  cron: string;
486
501
  parsedynamic: boolean;
487
502
  log: boolean;
503
+ shareType: "web" | "download";
488
504
  };
489
505
  } | {
490
506
  defaulttool: boolean;
@@ -495,6 +511,7 @@ declare class Cfg {
495
511
  APIServerPort: number;
496
512
  APIServerMount: boolean;
497
513
  Theme: number;
514
+ RemoveWatermark: boolean;
498
515
  switch: boolean;
499
516
  tip: boolean;
500
517
  comment: boolean;
@@ -508,6 +525,7 @@ declare class Cfg {
508
525
  cron: string;
509
526
  parsedynamic: boolean;
510
527
  log: boolean;
528
+ shareType: "web" | "download";
511
529
  };
512
530
  } | {
513
531
  switch: boolean;
@@ -539,6 +557,7 @@ declare class Cfg {
539
557
  cron: string;
540
558
  parsedynamic: boolean;
541
559
  log: boolean;
560
+ shareType: "web" | "download";
542
561
  };
543
562
  } | {
544
563
  switch: boolean;
@@ -554,6 +573,7 @@ declare class Cfg {
554
573
  cron: string;
555
574
  parsedynamic: boolean;
556
575
  log: boolean;
576
+ shareType: "web" | "download";
557
577
  };
558
578
  } | {
559
579
  douyin: import("../../types/config/pushlist.js").douyinPushItem[];
@@ -571,6 +591,7 @@ declare class Cfg {
571
591
  cron: string;
572
592
  parsedynamic: boolean;
573
593
  log: boolean;
594
+ shareType: "web" | "download";
574
595
  };
575
596
  } | {
576
597
  bilibili: string;
@@ -603,6 +624,7 @@ declare class Cfg {
603
624
  APIServerPort: number;
604
625
  APIServerMount: boolean;
605
626
  Theme: number;
627
+ RemoveWatermark: boolean;
606
628
  switch: boolean;
607
629
  tip: boolean;
608
630
  comment: boolean;
@@ -637,6 +659,7 @@ declare class Cfg {
637
659
  cron: string;
638
660
  parsedynamic: boolean;
639
661
  log: boolean;
662
+ shareType: "web" | "download";
640
663
  };
641
664
  } | {
642
665
  [x: string]: any;
@@ -677,6 +700,7 @@ declare class Cfg {
677
700
  APIServerPort: number;
678
701
  APIServerMount: boolean;
679
702
  Theme: number;
703
+ RemoveWatermark: boolean;
680
704
  douyin: import("../../types/config/pushlist.js").douyinPushItem[];
681
705
  bilibili: import("../../types/config/pushlist.js").bilibiliPushItem[];
682
706
  } | {
@@ -711,6 +735,7 @@ declare class Cfg {
711
735
  cron: string;
712
736
  parsedynamic: boolean;
713
737
  log: boolean;
738
+ shareType: "web" | "download";
714
739
  };
715
740
  douyin: import("../../types/config/pushlist.js").douyinPushItem[];
716
741
  bilibili: import("../../types/config/pushlist.js").bilibiliPushItem[];
@@ -49,7 +49,7 @@ export async function Render(path, params) {
49
49
  scale: scale(params?.scale || 1)
50
50
  },
51
51
  pluResPath: `${Version.pluginPath}/resources/`,
52
- copyright: `<span class="name">kkk</span><span class="version">${Version.pluginVersion} ${releaseType()}</span> Powered By <span class="name">Karin</span>`,
52
+ copyright: Config.app.RemoveWatermark ? '' : `<span class="name">kkk</span><span class="version">${Version.pluginVersion} ${releaseType()}</span> Powered By <span class="name">Karin</span>`,
53
53
  useDarkTheme: Common.useDarkTheme()
54
54
  },
55
55
  screensEval: '#container'
@@ -1,3 +1,4 @@
1
+ import { BiliBangumiVideoInfo, BiliBangumiVideoPlayurlIsLogin, BiliBangumiVideoPlayurlNoLogin, BiliBiliVideoPlayurlNoLogin, BiliOneWork, BiliVideoPlayurlIsLogin } from '@ikenxuan/amagi';
1
2
  import { Message } from 'node-karin';
2
3
  import { Base } from '../../module/utils/index.js';
3
4
  import { BilibiliId } from '../../platform/bilibili/index.js';
@@ -23,7 +24,10 @@ export declare class Bilibili extends Base {
23
24
  get botadapter(): string;
24
25
  constructor(e: Message, data: any);
25
26
  RESOURCES(iddata: BilibiliId): Promise<boolean | undefined>;
26
- getvideo({ infoData, playUrlData }: any): Promise<void>;
27
+ getvideo({ infoData, playUrlData }: {
28
+ infoData?: BiliBangumiVideoInfo | BiliOneWork;
29
+ playUrlData: BiliVideoPlayurlIsLogin | BiliBiliVideoPlayurlNoLogin | BiliBangumiVideoPlayurlIsLogin | BiliBangumiVideoPlayurlNoLogin;
30
+ }): Promise<void>;
27
31
  getvideosize(videourl: any, audiourl: any, bvid: any): Promise<string>;
28
32
  /**
29
33
  * 检出应该下载的视频流
@@ -176,18 +176,14 @@ export class Bilibili extends Base {
176
176
  playUrlData.result.dash.video = correctList.videoList;
177
177
  playUrlData.result.cept_description = correctList.accept_description;
178
178
  await this.getvideo({
179
- videoInfo,
180
- playUrlData,
181
- video_url: playUrlData.result.dash.video[0].base_url,
182
- audio_url: playUrlData.result.dash.audio[0].base_url
179
+ infoData: videoInfo,
180
+ playUrlData
183
181
  });
184
182
  }
185
183
  else {
186
184
  await this.getvideo({
187
- videoInfo,
188
- playUrlData,
189
- video_url: playUrlData.result.dash.video[0].base_url,
190
- audio_url: playUrlData.result.dash.audio[0].base_url
185
+ infoData: videoInfo,
186
+ playUrlData
191
187
  });
192
188
  }
193
189
  break;
@@ -452,19 +448,19 @@ export class Bilibili extends Base {
452
448
  }
453
449
  switch (this.islogin) {
454
450
  case true: {
455
- const bmp4 = await this.DownLoadFile(this.Type === 'one_video' ? playUrlData.data?.dash?.video[0].base_url : playUrlData.video_url, {
456
- title: `Bil_V_${this.Type === 'one_video' ? infoData.data.bvid : infoData.result.season_id}.mp4`,
451
+ const bmp4 = await this.DownLoadFile(this.Type === 'one_video' ? playUrlData.data?.dash?.video[0].base_url : playUrlData.result.dash.video[0].base_url, {
452
+ title: `Bil_V_${this.Type === 'one_video' ? infoData && infoData.data.bvid : infoData && infoData.result.season_id}.mp4`,
457
453
  headers: this.headers
458
454
  });
459
- const bmp3 = await this.DownLoadFile(this.Type === 'one_video' ? playUrlData.data?.dash?.audio[0].base_url : playUrlData.audio_url, {
460
- title: `Bil_A_${this.Type === 'one_video' ? infoData.data.bvid : infoData.result.season_id}.mp3`,
455
+ const bmp3 = await this.DownLoadFile(this.Type === 'one_video' ? playUrlData.data?.dash?.audio[0].base_url : playUrlData.result.dash.audio[0].base_url, {
456
+ title: `Bil_A_${this.Type === 'one_video' ? infoData && infoData.data.bvid : infoData && infoData.result.season_id}.mp3`,
461
457
  headers: this.headers
462
458
  });
463
459
  if (bmp4.filepath && bmp3.filepath) {
464
460
  await mergeFile('二合一(视频 + 音频)', {
465
461
  path: bmp4.filepath,
466
462
  path2: bmp3.filepath,
467
- resultPath: Common.tempDri.video + `Bil_Result_${this.Type === 'one_video' ? infoData.data.bvid : infoData.result.season_id}.mp4`,
463
+ resultPath: Common.tempDri.video + `Bil_Result_${this.Type === 'one_video' ? infoData && infoData.data.bvid : infoData && infoData.result.season_id}.mp4`,
468
464
  callback: async (success, resultPath) => {
469
465
  if (success) {
470
466
  const filePath = Common.tempDri.video + `${Config.app.rmmp4 ? 'tmp_' + Date.now() : this.downloadfilename}.mp4`;
@@ -16,7 +16,7 @@ export function bilibiliComments(commentsData) {
16
16
  const vipstatus = commentsData.data.replies[i].member.vip.status;
17
17
  const like = commentsData.data.replies[i].like;
18
18
  const replylength = commentsData.data.replies[i].rcount;
19
- const location = commentsData.data.replies[i].reply_control.location;
19
+ const location = commentsData.data.replies[i].reply_control.location.replace('IP属地:', '');
20
20
  const img_src = commentsData.data.replies[i].content &&
21
21
  commentsData.data.replies[i].content.pictures &&
22
22
  commentsData.data.replies[i].content.pictures.length > 0
@@ -67,6 +67,12 @@ export class DouYinpush extends Base {
67
67
  });
68
68
  }
69
69
  else {
70
+ const realUrl = Config.douyin.push.shareType === 'web' && await new Networks({
71
+ url: Detail_Data.share_url,
72
+ headers: {
73
+ 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)'
74
+ }
75
+ }).getLongLink();
70
76
  img = await Render('douyin/dynamic', {
71
77
  image_url: iddata.is_mp4 ? Detail_Data.video.animated_cover?.url_list[0] || Detail_Data.video.cover.url_list[0] : Detail_Data.images[0].url_list[0],
72
78
  desc: this.desc(Detail_Data, Detail_Data.desc),
@@ -76,10 +82,7 @@ export class DouYinpush extends Base {
76
82
  shouchang: this.count(Detail_Data.statistics.collect_count),
77
83
  create_time: Common.convertTimestampToDateTime(data[awemeId].create_time),
78
84
  avater_url: 'https://p3-pc.douyinpic.com/aweme/1080x1080/' + Detail_Data.user_info.user.avatar_larger.uri,
79
- // share_url: iddata.is_mp4
80
- // ? `https://aweme.snssdk.com/aweme/v1/play/?video_id=${Detail_Data.video.play_addr.uri}&ratio=1080p&line=0`
81
- // : Detail_Data.share_url,
82
- share_url: Detail_Data.share_url,
85
+ share_url: Config.douyin.push.shareType === 'web' ? realUrl : `https://aweme.snssdk.com/aweme/v1/play/?video_id=${Detail_Data.video.play_addr.uri}&ratio=1080p&line=0`,
83
86
  username: Detail_Data.author.nickname,
84
87
  抖音号: Detail_Data.user_info.user.unique_id === '' ? Detail_Data.user_info.user.unique_id : Detail_Data.user_info.user.unique_id,
85
88
  粉丝: this.count(Detail_Data.user_info.user.follower_count),
@@ -16,4 +16,6 @@ export interface appConfig {
16
16
  APIServerMount: boolean;
17
17
  /** 渲染图片的主题色,0为自动,1为浅色,2为深色 */
18
18
  Theme: number;
19
+ /** 渲染的图片是否移除底部水印 */
20
+ RemoveWatermark: boolean;
19
21
  }
@@ -26,5 +26,7 @@ export interface douyinConfig {
26
26
  parsedynamic: boolean;
27
27
  /** 是否打印日志 */
28
28
  log: boolean;
29
+ /** 分享链接二维码的类型,web为跳转到抖音网页,download为视频下载直链 */
30
+ shareType: 'web' | 'download';
29
31
  };
30
32
  }
@@ -1,9 +1,13 @@
1
+ import { LocalApiResponse } from 'node-karin';
2
+ import { ConfigType } from './types/index.js';
1
3
  declare const _default: {
2
- info: {};
4
+ info: LocalApiResponse;
3
5
  /** 动态渲染的组件 */
4
6
  components: () => (import("node-karin").DividerProps | import("node-karin").AccordionProps | import("node-karin").AccordionProProps)[];
5
7
  /** 前端点击保存之后调用的方法 */
6
8
  save: (config: any) => {
9
+ fullData: ConfigType;
10
+ formatCfg: ConfigType;
7
11
  success: boolean;
8
12
  message: string;
9
13
  };
package/lib/web.config.js CHANGED
@@ -3,7 +3,14 @@ import _ from 'node-karin/lodash';
3
3
  import { Config } from './module/index.js';
4
4
  const all = Config.All();
5
5
  export default {
6
- info: {},
6
+ info: {
7
+ name: 'karin-plugin-kkk',
8
+ description: 'Karin 的「抖音」「B站」「快手」视频解析/动态推送插件',
9
+ icon: {
10
+ name: 'tag',
11
+ color: '#EAC452'
12
+ }
13
+ },
7
14
  /** 动态渲染的组件 */
8
15
  components: () => [
9
16
  components.divider.create('divider-1', {
@@ -17,29 +24,32 @@ export default {
17
24
  className: 'ml-4 mr-4',
18
25
  subtitle: '建议配置,否则大部分功能无法使用',
19
26
  children: [
20
- components.input.string('cfg.cookies.douyin', {
27
+ components.input.string('douyin', {
21
28
  label: '抖音',
22
29
  type: 'text',
23
30
  description: '请输入你的抖音Cookies,不输入则无法使用抖音相关功能噢',
24
31
  defaultValue: all.cookies.douyin,
25
32
  placeholder: '',
26
- rules: undefined
33
+ rules: undefined,
34
+ isRequired: false
27
35
  }),
28
- components.input.string('cfg.cookies.bilibili', {
36
+ components.input.string('bilibili', {
29
37
  label: 'B站',
30
38
  type: 'text',
31
39
  description: '请输入你的B站Cookies,不输入则无法使用B站相关功能噢',
32
40
  defaultValue: all.cookies.bilibili,
33
41
  placeholder: '',
34
- rules: undefined
42
+ rules: undefined,
43
+ isRequired: false
35
44
  }),
36
- components.input.string('cfg.cookies.kuaishou', {
45
+ components.input.string('kuaishou', {
37
46
  label: '快手',
38
47
  type: 'text',
39
48
  description: '请输入你的快手Cookies,不输入则无法使用快手相关功能噢',
40
49
  defaultValue: all.cookies.kuaishou,
41
50
  placeholder: '',
42
- rules: undefined
51
+ rules: undefined,
52
+ isRequired: false
43
53
  })
44
54
  ]
45
55
  })
@@ -56,24 +66,24 @@ export default {
56
66
  className: 'ml-4 mr-4',
57
67
  subtitle: '此处用于管理插件的基本设置',
58
68
  children: [
59
- components.switch.create('cfg.app.rmmp4', {
69
+ components.switch.create('rmmp4', {
60
70
  startText: '缓存删除',
61
71
  description: '缓存自动删除,非必要不修改!',
62
72
  defaultSelected: all.app.rmmp4
63
73
  }),
64
- components.switch.create('cfg.app.defaulttool', {
74
+ components.switch.create('defaulttool', {
65
75
  startText: '默认解析',
66
76
  description: '即识别最高优先级,修改后重启生效',
67
77
  defaultSelected: all.app.defaulttool
68
78
  }),
69
- components.input.number('cfg.app.priority', {
79
+ components.input.number('priority', {
70
80
  label: '自定义优先级',
71
81
  description: '自定义优先级,「默认解析」关闭后才会生效。修改后重启生效',
72
82
  defaultValue: all.app.priority.toString(),
73
83
  isDisabled: all.app.defaulttool,
74
84
  rules: undefined
75
85
  }),
76
- components.input.number('cfg.app.renderScale', {
86
+ components.input.number('renderScale', {
77
87
  label: '渲染精度',
78
88
  description: '可选值50~200,建议100。设置高精度会提高图片的精细度,过高可能会影响渲染与发送速度',
79
89
  defaultValue: all.app.renderScale.toString(),
@@ -84,17 +94,17 @@ export default {
84
94
  }
85
95
  ]
86
96
  }),
87
- components.switch.create('cfg.app.APIServer', {
97
+ components.switch.create('APIServer', {
88
98
  startText: 'API服务',
89
99
  description: '本地部署一个视频解析API服务,接口范围为本插件用到的所有',
90
100
  defaultSelected: all.app.APIServer
91
101
  }),
92
- components.switch.create('cfg.app.APIServerMount', {
102
+ components.switch.create('APIServerMount', {
93
103
  startText: '挂载到 Karin',
94
104
  description: 'API 服务是否挂载到 Karin 上,开启后监听端口为 Karin 的 http 端口,修改后需重启',
95
105
  defaultSelected: all.app.APIServerMount
96
106
  }),
97
- components.input.number('cfg.app.APIServerPort', {
107
+ components.input.number('APIServerPort', {
98
108
  label: 'API服务端口',
99
109
  defaultValue: all.app.APIServerPort.toString(),
100
110
  isDisabled: all.app.APIServerMount,
@@ -106,24 +116,29 @@ export default {
106
116
  }
107
117
  ]
108
118
  }),
109
- components.radio.group('cfg.app.Theme', {
119
+ components.radio.group('Theme', {
110
120
  label: '渲染图片的主题色',
111
121
  orientation: 'horizontal',
112
122
  defaultValue: all.app.Theme.toString(),
113
123
  radio: [
114
- components.radio.create('cfg.app.Theme-1', {
124
+ components.radio.create('Theme-1', {
115
125
  label: '自动',
116
126
  value: '0'
117
127
  }),
118
- components.radio.create('cfg.app.Theme-2', {
128
+ components.radio.create('Theme-2', {
119
129
  label: '浅色',
120
130
  value: '1'
121
131
  }),
122
- components.radio.create('cfg.app.Theme-3', {
132
+ components.radio.create('Theme-3', {
123
133
  label: '深色',
124
134
  value: '2'
125
135
  })
126
136
  ]
137
+ }),
138
+ components.switch.create('RemoveWatermark', {
139
+ startText: '移除水印',
140
+ description: '渲染的图片是否移除底部水印',
141
+ defaultSelected: all.app.RemoveWatermark
127
142
  })
128
143
  ]
129
144
  })
@@ -140,27 +155,27 @@ export default {
140
155
  className: 'ml-4 mr-4',
141
156
  subtitle: '此处为抖音相关的用户偏好设置',
142
157
  children: [
143
- components.switch.create('cfg.douyin.switch', {
158
+ components.switch.create('switch', {
144
159
  startText: '解析开关',
145
160
  description: '抖音解析开关,此开关为单独开关',
146
161
  defaultSelected: all.douyin.switch
147
162
  }),
148
- components.switch.create('cfg.douyin.tip', {
163
+ components.switch.create('tip', {
149
164
  startText: '解析提示',
150
165
  description: '抖音解析提示,发送提示信息:“检测到抖音链接,开始解析”',
151
166
  defaultSelected: all.douyin.tip
152
167
  }),
153
- components.switch.create('cfg.douyin.comment', {
168
+ components.switch.create('comment', {
154
169
  startText: '评论解析',
155
170
  description: '抖音评论解析,开启后可发送抖音作品评论图',
156
171
  defaultSelected: all.douyin.comment
157
172
  }),
158
- components.input.number('cfg.douyin.numcomment', {
173
+ components.input.number('numcomment', {
159
174
  label: '评论解析数量',
160
175
  defaultValue: all.douyin.numcomment.toString(),
161
176
  rules: [{ min: 1 }]
162
177
  }),
163
- components.switch.create('cfg.douyin.autoResolution', {
178
+ components.switch.create('autoResolution', {
164
179
  startText: '自动分辨率',
165
180
  description: '根据「视频拦截阈值」自动选择合适的分辨率,关闭后默认选择最大分辨率进行下载',
166
181
  defaultSelected: all.douyin.autoResolution
@@ -169,73 +184,88 @@ export default {
169
184
  description: '抖音推送相关',
170
185
  descPosition: 20
171
186
  }),
172
- components.switch.create('cfg.douyin.push.switch', {
187
+ components.switch.create('push.switch', {
173
188
  startText: '推送开关',
174
189
  description: '推送开关,开启后需重启;使用「#设置抖音推送 + 抖音号」配置推送列表',
175
190
  defaultSelected: all.douyin.push.switch
176
191
  }),
177
- components.input.group('cfg.douyin.push.banWords', {
192
+ components.input.group('push.banWords', {
178
193
  label: '作品中有以下指定关键词时,不推送',
179
194
  maxRows: 2,
180
195
  itemsPerRow: 4,
181
196
  data: all.douyin.push.banWords,
182
- template: components.input.string('cfg.douyin.push.banWords', {
197
+ template: components.input.string('push.banWords', {
183
198
  placeholder: '',
184
199
  label: '',
185
200
  color: 'success'
186
201
  })
187
202
  }),
188
- components.input.group('cfg.douyin.push.banTags', {
203
+ components.input.group('push.banTags', {
189
204
  label: '作品中有指定标签时,不推送',
190
205
  maxRows: 2,
191
206
  itemsPerRow: 4,
192
207
  data: all.douyin.push.banWords,
193
- template: components.input.string('cfg.douyin.push.banTags', {
208
+ template: components.input.string('push.banTags', {
194
209
  placeholder: '',
195
210
  label: '',
196
211
  color: 'success'
197
212
  })
198
213
  }),
199
- components.radio.group('cfg.douyin.push.permission', {
214
+ components.radio.group('push.permission', {
200
215
  label: '谁可以设置推送',
201
216
  orientation: 'horizontal',
202
217
  defaultValue: all.douyin.push.permission,
203
218
  radio: [
204
- components.radio.create('cfg.douyin.push.permission.radio-1', {
219
+ components.radio.create('push.permission.radio-1', {
205
220
  label: '所有人',
206
221
  value: 'all'
207
222
  }),
208
- components.radio.create('cfg.douyin.push.permission.radio-2', {
223
+ components.radio.create('push.permission.radio-2', {
209
224
  label: '管理员',
210
225
  value: 'admin'
211
226
  }),
212
- components.radio.create('cfg.douyin.push.permission.radio-3', {
227
+ components.radio.create('push.permission.radio-3', {
213
228
  label: '主人',
214
229
  value: 'master'
215
230
  }),
216
- components.radio.create('cfg.douyin.push.permission.radio-4', {
231
+ components.radio.create('push.permission.radio-4', {
217
232
  label: '群主',
218
233
  value: 'group.owner'
219
234
  }),
220
- components.radio.create('cfg.douyin.push.permission.radio-5', {
235
+ components.radio.create('push.permission.radio-5', {
221
236
  label: '群管理员',
222
237
  value: 'group.admin'
223
238
  })
224
239
  ]
225
240
  }),
226
- components.input.string('cfg.douyin.push.cron', {
241
+ components.input.string('push.cron', {
227
242
  label: '定时任务表达式',
228
243
  defaultValue: all.douyin.push.cron
229
244
  }),
230
- components.switch.create('cfg.douyin.push.parsedynamic', {
245
+ components.switch.create('push.parsedynamic', {
231
246
  startText: '作品解析',
232
247
  description: '触发推送时是否一同解析该作品',
233
248
  defaultSelected: all.douyin.push.parsedynamic
234
249
  }),
235
- components.switch.create('cfg.douyin.push.log', {
250
+ components.switch.create('push.log', {
236
251
  startText: '推送日志',
237
252
  description: '是否打印推送日志(修改后需重启)',
238
253
  defaultSelected: all.douyin.push.log
254
+ }),
255
+ components.radio.group('push.shareType', {
256
+ label: '分享链接二维码的类型',
257
+ orientation: 'horizontal',
258
+ defaultValue: all.douyin.push.shareType,
259
+ radio: [
260
+ components.radio.create('push.shareType.radio-1', {
261
+ label: '网页链接',
262
+ value: 'web'
263
+ }),
264
+ components.radio.create('push.shareType.radio-2', {
265
+ label: '下载链接',
266
+ value: 'download'
267
+ })
268
+ ]
239
269
  })
240
270
  ]
241
271
  })
@@ -252,32 +282,32 @@ export default {
252
282
  className: 'ml-4 mr-4',
253
283
  subtitle: '此处为B站相关的用户偏好设置',
254
284
  children: [
255
- components.switch.create('cfg.bilibili.switch', {
285
+ components.switch.create('switch', {
256
286
  startText: '解析开关',
257
287
  description: 'B站解析开关,此开关为单独开关',
258
288
  defaultSelected: all.bilibili.switch
259
289
  }),
260
- components.switch.create('cfg.bilibili.tip', {
290
+ components.switch.create('tip', {
261
291
  startText: '解析提示',
262
292
  description: 'B站解析提示,发送提示信息:“检测到B站链接,开始解析”',
263
293
  defaultSelected: all.bilibili.tip
264
294
  }),
265
- components.switch.create('cfg.bilibili.comment', {
295
+ components.switch.create('comment', {
266
296
  startText: '评论解析',
267
297
  description: 'B站评论解析,开启后可发送B站作品评论图',
268
298
  defaultSelected: all.bilibili.comment
269
299
  }),
270
- components.input.number('cfg.bilibili.numcomment', {
300
+ components.input.number('numcomment', {
271
301
  label: '评论解析数量',
272
302
  defaultValue: all.bilibili.numcomment.toString(),
273
303
  rules: [{ min: 1 }]
274
304
  }),
275
- components.switch.create('cfg.bilibili.videopriority', {
305
+ components.switch.create('videopriority', {
276
306
  startText: '优先保内容',
277
307
  description: '解析视频是否优先保内容,true为优先保证上传将使用最低分辨率,false为优先保清晰度将使用最高分辨率',
278
308
  defaultSelected: all.bilibili.videopriority
279
309
  }),
280
- components.switch.create('cfg.bilibili.autoResolution', {
310
+ components.switch.create('autoResolution', {
281
311
  startText: '自动分辨率',
282
312
  description: '根据「视频拦截阈值」自动选择合适的分辨率,关闭后默认选择最大分辨率进行下载',
283
313
  defaultSelected: all.bilibili.autoResolution
@@ -286,70 +316,70 @@ export default {
286
316
  description: 'B站推送相关',
287
317
  descPosition: 20
288
318
  }),
289
- components.switch.create('cfg.bilibili.push.switch', {
319
+ components.switch.create('push.switch', {
290
320
  startText: '推送开关',
291
321
  description: '推送开关,开启后需重启;使用「#设置B站推送 + UID」配置推送列表',
292
322
  defaultSelected: all.bilibili.push.switch
293
323
  }),
294
- components.input.group('cfg.bilibili.push.banWords', {
324
+ components.input.group('push.banWords', {
295
325
  label: '动态中有以下指定关键词时,不推送',
296
326
  maxRows: 2,
297
327
  itemsPerRow: 4,
298
328
  data: all.bilibili.push.banWords,
299
- template: components.input.string('cfg.bilibili.push.banWords', {
329
+ template: components.input.string('push.banWords', {
300
330
  placeholder: '',
301
331
  label: '',
302
332
  color: 'success'
303
333
  })
304
334
  }),
305
- components.input.group('cfg.bilibili.push.banTags', {
335
+ components.input.group('push.banTags', {
306
336
  label: '动态中有指定标签时,不推送',
307
337
  maxRows: 2,
308
338
  itemsPerRow: 4,
309
339
  data: all.bilibili.push.banWords,
310
- template: components.input.string('cfg.bilibili.push.banTags', {
340
+ template: components.input.string('push.banTags', {
311
341
  placeholder: '',
312
342
  label: '',
313
343
  color: 'success'
314
344
  })
315
345
  }),
316
- components.radio.group('cfg.bilibili.push.permission', {
346
+ components.radio.group('push.permission', {
317
347
  label: '谁可以设置推送',
318
348
  orientation: 'horizontal',
319
349
  defaultValue: all.bilibili.push.permission,
320
350
  radio: [
321
- components.radio.create('cfg.bilibili.push.permission.radio-1', {
351
+ components.radio.create('push.permission.radio-1', {
322
352
  label: '所有人',
323
353
  value: 'all'
324
354
  }),
325
- components.radio.create('cfg.bilibili.push.permission.radio-2', {
355
+ components.radio.create('push.permission.radio-2', {
326
356
  label: '管理员',
327
357
  value: 'admin'
328
358
  }),
329
- components.radio.create('cfg.bilibili.push.permission.radio-3', {
359
+ components.radio.create('push.permission.radio-3', {
330
360
  label: '主人',
331
361
  value: 'master'
332
362
  }),
333
- components.radio.create('cfg.bilibili.push.permission.radio-4', {
363
+ components.radio.create('push.permission.radio-4', {
334
364
  label: '群主',
335
365
  value: 'group.owner'
336
366
  }),
337
- components.radio.create('cfg.bilibili.push.permission.radio-5', {
367
+ components.radio.create('push.permission.radio-5', {
338
368
  label: '群管理员',
339
369
  value: 'group.admin'
340
370
  })
341
371
  ]
342
372
  }),
343
- components.input.string('cfg.bilibili.push.cron', {
373
+ components.input.string('push.cron', {
344
374
  label: '定时任务表达式',
345
375
  defaultValue: all.bilibili.push.cron
346
376
  }),
347
- components.switch.create('cfg.bilibili.push.parsedynamic', {
377
+ components.switch.create('push.parsedynamic', {
348
378
  startText: '作品解析',
349
379
  description: '触发推送时是否一同解析该作品',
350
380
  defaultSelected: all.bilibili.push.parsedynamic
351
381
  }),
352
- components.switch.create('cfg.bilibili.push.log', {
382
+ components.switch.create('push.log', {
353
383
  startText: '推送日志',
354
384
  description: '是否打印推送日志(修改后需重启)',
355
385
  defaultSelected: all.bilibili.push.log
@@ -369,22 +399,22 @@ export default {
369
399
  className: 'ml-4 mr-4',
370
400
  subtitle: '此处为快手相关的用户偏好设置',
371
401
  children: [
372
- components.switch.create('cfg.kuaishou.switch', {
402
+ components.switch.create('switch', {
373
403
  startText: '解析开关',
374
404
  description: '快手解析开关,此开关为单独开关',
375
405
  defaultSelected: all.kuaishou.switch
376
406
  }),
377
- components.switch.create('cfg.kuaishou.tip', {
407
+ components.switch.create('tip', {
378
408
  startText: '解析提示',
379
409
  description: '抖音解析提示,发送提示信息:“检测到快手链接,开始解析”',
380
410
  defaultSelected: all.kuaishou.tip
381
411
  }),
382
- components.switch.create('cfg.kuaishou.comment', {
412
+ components.switch.create('comment', {
383
413
  startText: '评论解析',
384
414
  description: '快手评论解析,开启后可发送抖音作品评论图',
385
415
  defaultSelected: all.kuaishou.comment
386
416
  }),
387
- components.input.number('cfg.kuaishou.numcomment', {
417
+ components.input.number('numcomment', {
388
418
  label: '评论解析数量',
389
419
  defaultValue: all.kuaishou.numcomment.toString(),
390
420
  rules: [{ min: 1 }]
@@ -404,48 +434,48 @@ export default {
404
434
  className: 'ml-4 mr-4',
405
435
  subtitle: '此处为上传相关的用户偏好设置',
406
436
  children: [
407
- components.switch.create('cfg.upload.sendbase64', {
437
+ components.switch.create('sendbase64', {
408
438
  startText: '转换Base64',
409
439
  description: '发送视频经本插件转换为base64格式后再发送,适合Karin与机器人不在同一网络环境下开启',
410
440
  defaultSelected: all.upload.swisendbase64tch
411
441
  }),
412
- components.switch.create('cfg.upload.usefilelimit', {
442
+ components.switch.create('usefilelimit', {
413
443
  startText: '视频上传拦截',
414
444
  description: '开启后会根据视频文件大小判断是否需要上传,需配置「视频拦截阈值」。',
415
445
  defaultSelected: all.upload.usefilelimit
416
446
  }),
417
- components.input.number('cfg.upload.filelimit', {
447
+ components.input.number('filelimit', {
418
448
  label: '视频拦截阈值',
419
449
  description: '视频文件大于该数值则直接结束任务,不会上传,单位: MB,「视频上传拦截」开启后才会生效。',
420
450
  defaultValue: all.upload.filelimit.toString(),
421
451
  rules: [{ min: 1 }],
422
452
  isDisabled: !all.upload.usefilelimit
423
453
  }),
424
- components.switch.create('cfg.upload.compress', {
454
+ components.switch.create('compress', {
425
455
  startText: '压缩视频',
426
456
  description: '开启后会将视频文件压缩后再上传,适合上传大文件,任务过程中会吃满CPU,对低配服务器不友好。需配置「压缩触发阈值」与「压缩后的值」',
427
457
  defaultSelected: all.upload.compress
428
458
  }),
429
- components.input.number('cfg.upload.compresstrigger', {
459
+ components.input.number('compresstrigger', {
430
460
  label: '压缩触发阈值',
431
461
  description: '触发视频压缩的阈值,单位:MB。当文件大小超过该值时,才会压缩视频,「压缩视频」开启后才会生效',
432
462
  defaultValue: all.upload.compresstrigger.toString(),
433
463
  rules: [{ min: 1 }],
434
464
  isDisabled: !all.upload.compress
435
465
  }),
436
- components.input.number('cfg.upload.compressvalue', {
466
+ components.input.number('compressvalue', {
437
467
  label: '压缩后的值',
438
468
  description: '单位:MB,若视频文件大小大于「压缩触发阈值」的值,则会进行压缩至该值(±5%),「压缩视频」开启后才会生效',
439
469
  defaultValue: all.upload.compressvalue.toString(),
440
470
  rules: [{ min: 1 }],
441
471
  isDisabled: !all.upload.compress
442
472
  }),
443
- components.switch.create('cfg.upload.usegroupfile', {
473
+ components.switch.create('usegroupfile', {
444
474
  startText: '群文件上传',
445
475
  description: '使用群文件上传,开启后会将视频文件上传到群文件中,需配置「群文件上传阈值」',
446
476
  defaultSelected: all.upload.usegroupfile
447
477
  }),
448
- components.input.number('cfg.upload.groupfilevalue', {
478
+ components.input.number('groupfilevalue', {
449
479
  label: '群文件上传阈值',
450
480
  description: '当文件大小超过该值时将使用群文件上传,单位:MB,「使用群文件上传」开启后才会生效',
451
481
  defaultValue: all.upload.groupfilevalue.toString(),
@@ -544,7 +574,7 @@ export default {
544
574
  ],
545
575
  /** 前端点击保存之后调用的方法 */
546
576
  save: (config) => {
547
- const formatCfg = processFrontendConfig(config);
577
+ const formatCfg = processFrontendData(config);
548
578
  const oldAllCfg = Config.All();
549
579
  /** 合并旧新配置 */
550
580
  const fullData = _.mergeWith({}, oldAllCfg, formatCfg, customizer);
@@ -557,6 +587,8 @@ export default {
557
587
  }
558
588
  });
559
589
  return {
590
+ fullData,
591
+ formatCfg,
560
592
  success,
561
593
  message: success ? '保存成功 Ciallo~(∠・ω< )⌒☆' : '配置无变化,无需保存'
562
594
  };
@@ -647,137 +679,56 @@ const deepEqual = (a, b) => {
647
679
  };
648
680
  /**
649
681
  * str 转 num
650
- * @param value 字符串或者数字
682
+ * @param value 字符串
651
683
  * @returns
652
684
  */
653
- const convertToNumber = (value) => {
654
- if (typeof value === 'string') {
655
- return parseInt(value, 10);
656
- }
657
- return value;
658
- };
685
+ function convertToNumber(value) {
686
+ const num = parseInt(value);
687
+ return isNaN(num) ? value : num;
688
+ }
659
689
  /**
660
- * 转换前端传回来的配置成定义的配置文件格式
661
- * @param frontendConfig 前端传回来的原始内容
662
- * @returns
690
+ * 获取数组中的第一个对象,如果数组为空则返回空对象
691
+ * @param arr 数组
692
+ * @returns 数组中的第一个对象或空对象
663
693
  */
664
- const processFrontendConfig = (frontendConfig) => {
665
- const processedConfig = {
666
- app: {},
667
- bilibili: {},
668
- douyin: {},
669
- cookies: {},
670
- pushlist: {},
671
- upload: {},
672
- kuaishou: {}
673
- };
674
- // 处理cookies配置
675
- if (frontendConfig['cfg.cookies'] && frontendConfig['cfg.cookies'].length > 0) {
676
- const cookiesData = frontendConfig['cfg.cookies'][0];
677
- processedConfig.cookies = {
678
- bilibili: cookiesData['cfg.cookies.bilibili'],
679
- douyin: cookiesData['cfg.cookies.douyin'],
680
- kuaishou: cookiesData['cfg.cookies.kuaishou']
681
- };
682
- }
683
- // 处理app配置
684
- if (frontendConfig['cfg.app'] && frontendConfig['cfg.app'].length > 0) {
685
- const appData = frontendConfig['cfg.app'][0];
686
- processedConfig.app = {
687
- defaulttool: appData['cfg.app.defaulttool'],
688
- priority: convertToNumber(appData['cfg.app.priority']),
689
- rmmp4: appData['cfg.app.rmmp4'],
690
- renderScale: convertToNumber(appData['cfg.app.renderScale']),
691
- APIServer: appData['cfg.app.APIServer'],
692
- APIServerPort: convertToNumber(appData['cfg.app.APIServerPort']),
693
- APIServerMount: appData['cfg.app.APIServerMount'],
694
- Theme: convertToNumber(appData['cfg.app.Theme'])
695
- };
696
- }
697
- // 处理douyin配置
698
- if (frontendConfig['cfg.douyin'] && frontendConfig['cfg.douyin'].length > 0) {
699
- const douyinData = frontendConfig['cfg.douyin'][0];
700
- processedConfig.douyin = {
701
- switch: douyinData['cfg.douyin.switch'],
702
- tip: douyinData['cfg.douyin.tip'],
703
- comment: douyinData['cfg.douyin.comment'],
704
- numcomment: convertToNumber(douyinData['cfg.douyin.numcomment']),
705
- autoResolution: douyinData['cfg.douyin.autoResolution'],
706
- push: {
707
- switch: douyinData['cfg.douyin.push.switch'],
708
- banWords: douyinData['cfg.douyin.push.banWords'],
709
- banTags: douyinData['cfg.douyin.push.banTags'],
710
- permission: douyinData['cfg.douyin.push.permission'],
711
- cron: douyinData['cfg.douyin.push.cron'],
712
- parsedynamic: douyinData['cfg.douyin.push.parsedynamic'],
713
- log: douyinData['cfg.douyin.push.log']
694
+ function getFirstObject(arr) {
695
+ return arr.length > 0 ? arr[0] : {};
696
+ }
697
+ /**
698
+ * 处理前端返回的数据,将其转换为 ConfigType 格式
699
+ * @param data 前端返回的数据
700
+ * @returns 处理后符合 ConfigType 格式的数据
701
+ */
702
+ function processFrontendData(data) {
703
+ const result = {};
704
+ // 处理普通配置项
705
+ // const configKeys = ['app', 'bilibili', 'douyin', 'cookies', 'kuaishou', 'upload']
706
+ const configKeys = Object.keys(data).filter(key => !key.includes('pushlist'));
707
+ for (const key of configKeys) {
708
+ const firstObj = getFirstObject(data[key] || []);
709
+ result[key] = {};
710
+ for (const prop in firstObj) {
711
+ let value = firstObj[prop];
712
+ // 尝试将值转换为数字
713
+ value = convertToNumber(value);
714
+ if (prop.includes('.')) {
715
+ // 处理嵌套属性
716
+ const [parent, child] = prop.split('.');
717
+ if (!result[key][parent]) {
718
+ result[key][parent] = {};
719
+ }
720
+ result[key][parent][child] = value;
714
721
  }
715
- };
716
- }
717
- // 处理bilibili配置
718
- if (frontendConfig['cfg.bilibili'] && frontendConfig['cfg.bilibili'].length > 0) {
719
- const bilibiliData = frontendConfig['cfg.bilibili'][0];
720
- processedConfig.bilibili = {
721
- switch: bilibiliData['cfg.bilibili.switch'],
722
- tip: bilibiliData['cfg.bilibili.tip'],
723
- comment: bilibiliData['cfg.bilibili.comment'],
724
- numcomment: convertToNumber(bilibiliData['cfg.bilibili.numcomment']),
725
- videopriority: bilibiliData['cfg.bilibili.videopriority'],
726
- autoResolution: bilibiliData['cfg.bilibili.autoResolution'],
727
- push: {
728
- switch: bilibiliData['cfg.bilibili.push.switch'],
729
- banWords: bilibiliData['cfg.bilibili.push.banWords'],
730
- banTags: bilibiliData['cfg.bilibili.push.banTags'],
731
- permission: bilibiliData['cfg.bilibili.push.permission'],
732
- cron: bilibiliData['cfg.bilibili.push.cron'],
733
- parsedynamic: bilibiliData['cfg.bilibili.push.parsedynamic'],
734
- log: bilibiliData['cfg.bilibili.push.log']
722
+ else {
723
+ // 处理普通属性
724
+ result[key][prop] = value;
735
725
  }
736
- };
737
- }
738
- // 处理kuaishou配置
739
- if (frontendConfig['cfg.kuaishou'] && frontendConfig['cfg.kuaishou'].length > 0) {
740
- const kuaishouData = frontendConfig['cfg.kuaishou'][0];
741
- processedConfig.kuaishou = {
742
- switch: kuaishouData['cfg.kuaishou.switch'],
743
- tip: kuaishouData['cfg.kuaishou.tip'],
744
- comment: kuaishouData['cfg.kuaishou.comment'],
745
- numcomment: convertToNumber(kuaishouData['cfg.kuaishou.numcomment'])
746
- };
747
- }
748
- // 处理upload配置
749
- if (frontendConfig['cfg.upload'] && frontendConfig['cfg.upload'].length > 0) {
750
- const uploadData = frontendConfig['cfg.upload'][0];
751
- processedConfig.upload = {
752
- sendbase64: uploadData['cfg.upload.sendbase64'],
753
- usefilelimit: uploadData['cfg.upload.usefilelimit'],
754
- filelimit: convertToNumber(uploadData['cfg.upload.filelimit']),
755
- compress: uploadData['cfg.upload.compress'],
756
- compresstrigger: convertToNumber(uploadData['cfg.upload.compresstrigger']),
757
- compressvalue: convertToNumber(uploadData['cfg.upload.compressvalue']),
758
- usegroupfile: uploadData['cfg.upload.usegroupfile'],
759
- groupfilevalue: convertToNumber(uploadData['cfg.upload.groupfilevalue'])
760
- };
726
+ }
761
727
  }
762
- // 处理pushlist配置
763
- processedConfig.pushlist = {
764
- douyin: [],
765
- bilibili: []
728
+ // 处理 pushlist 配置项
729
+ result.pushlist = {
730
+ douyin: data['cfg.pushlist.douyin'] || [],
731
+ bilibili: data['cfg.pushlist.bilibili'] || []
766
732
  };
767
- if (frontendConfig['cfg.pushlist.douyin'] && frontendConfig['cfg.pushlist.douyin'].length > 0) {
768
- processedConfig.pushlist.douyin = frontendConfig['cfg.pushlist.douyin'].map((item) => ({
769
- sec_uid: item.sec_uid,
770
- short_id: item.short_id,
771
- group_id: item.group_id,
772
- remark: item.remark
773
- }));
774
- }
775
- if (frontendConfig['cfg.pushlist.bilibili'] && frontendConfig['cfg.pushlist.bilibili'].length > 0) {
776
- processedConfig.pushlist.bilibili = frontendConfig['cfg.pushlist.bilibili'].map((item) => ({
777
- host_mid: convertToNumber(item.host_mid),
778
- group_id: item.group_id,
779
- remark: item.remark
780
- }));
781
- }
782
- return processedConfig;
783
- };
733
+ return result;
734
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-kkk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "a Karin video parsing tool",
5
5
  "keywords": [
6
6
  "karin-plugin",
@@ -32,17 +32,16 @@
32
32
  "build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
33
33
  "clean": "npm lib/cli/pr.js clean",
34
34
  "commit": "node lib/cli/commit.js",
35
- "dev": "tsx watch src/index.ts",
35
+ "dev": "tsx src/index.ts",
36
+ "watch": "tsx watch --include \"src/**/*.ts\" src/index.ts",
36
37
  "fix": "eslint src/**/*.ts --fix",
37
- "init": "karin init",
38
38
  "pr": "node lib/cli/pr.js",
39
39
  "pub": "npm publish --access public",
40
40
  "pub-beta": "npm publish --tag beta",
41
- "sort": "npx sort-package-json",
42
- "start": "karin start"
41
+ "sort": "npx sort-package-json"
43
42
  },
44
43
  "dependencies": {
45
- "@ikenxuan/amagi": "^4.4.7",
44
+ "@ikenxuan/amagi": "^4.4.8",
46
45
  "@karinjs/md-html": "^1.1.6",
47
46
  "cors": "^2.8.5",
48
47
  "heic-convert": "^2.1.0",
@@ -27,7 +27,9 @@
27
27
  <body {{@sys.scale}}>
28
28
  <div class="container" id="container">
29
29
  {{block 'main'}}{{/block}}
30
+ {{if copyright}}
30
31
  <div class="copyright">{{@copyright}}</div>
32
+ {{/if}}
31
33
  <script>
32
34
  // 获取当前时间并自动设置主题
33
35
  function setThemeBasedOnTime () {