koishi-plugin-best-cave 1.4.0 → 1.4.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.
package/lib/index.js CHANGED
@@ -712,11 +712,12 @@ var HashStorage = class _HashStorage {
712
712
  await this.processCaveTextHashes(cave);
713
713
  processedCount++;
714
714
  if (processedCount % 100 === 0 || processedCount === total) {
715
- logger3.info(`Processing caves: ${processedCount}/${total} (${Math.floor(processedCount / total * 100)}%)`);
715
+ logger3.info(`Progress: ${processedCount}/${total} caves (${Math.floor(processedCount / total * 100)}%)`);
716
716
  }
717
717
  }
718
718
  await this.saveHashes();
719
- logger3.info(`Processed ${processedCount} caves with ${this.imageHashes.size} images and ${this.textHashes.size} texts`);
719
+ const stats = this.getStorageStats();
720
+ logger3.info(`Cave Hashes Initialized: ${stats.text} text hashes, ${stats.image} image hashes`);
720
721
  }
721
722
  /**
722
723
  * 更新缺失的哈希值
@@ -728,23 +729,15 @@ var HashStorage = class _HashStorage {
728
729
  const missingTextCaves = caveData.filter((cave) => !this.textHashes.has(cave.cave_id));
729
730
  const total = missingImageCaves.length + missingTextCaves.length;
730
731
  if (total > 0) {
731
- let processedCount = 0;
732
732
  for (const cave of missingImageCaves) {
733
733
  await this.processCaveHashes(cave);
734
- processedCount++;
735
- if (processedCount % 100 === 0 || processedCount === total) {
736
- logger3.info(`Updating missing hashes: ${processedCount}/${total} (${Math.floor(processedCount / total * 100)}%)`);
737
- }
738
734
  }
739
735
  for (const cave of missingTextCaves) {
740
736
  await this.processCaveTextHashes(cave);
741
- processedCount++;
742
- if (processedCount % 100 === 0 || processedCount === total) {
743
- logger3.info(`Updating missing hashes: ${processedCount}/${total} (${Math.floor(processedCount / total * 100)}%)`);
744
- }
745
737
  }
746
738
  await this.saveHashes();
747
- logger3.info(`Updated ${missingImageCaves.length} missing images and ${missingTextCaves.length} missing texts`);
739
+ const stats = this.getStorageStats();
740
+ logger3.info(`Hash storage updated: ${stats.text} text hashes, ${stats.image} image hashes`);
748
741
  }
749
742
  }
750
743
  /**
@@ -815,6 +808,18 @@ var HashStorage = class _HashStorage {
815
808
  static hashText(text) {
816
809
  return import_crypto.default.createHash("md5").update(text).digest("hex");
817
810
  }
811
+ /**
812
+ * 获取存储统计数据
813
+ * @private
814
+ */
815
+ getStorageStats() {
816
+ const textCount = Array.from(this.textHashes.values()).reduce((sum, arr) => sum + arr.length, 0);
817
+ const imageCount = Array.from(this.imageHashes.values()).reduce((sum, arr) => sum + arr.length, 0);
818
+ return {
819
+ text: textCount,
820
+ image: imageCount
821
+ };
822
+ }
818
823
  };
819
824
 
820
825
  // src/index.ts
@@ -84,4 +84,9 @@ export declare class HashStorage {
84
84
  * @returns MD5哈希值
85
85
  */
86
86
  static hashText(text: string): string;
87
+ /**
88
+ * 获取存储统计数据
89
+ * @private
90
+ */
91
+ private getStorageStats;
87
92
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-best-cave",
3
3
  "description": "最好的 cave 插件,可开关的审核系统,可引用添加,支持图文混合内容,可查阅投稿列表,完美复刻你的 .cave 体验!",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "contributors": [
6
6
  "Yis_Rime <yis_rime@outlook.com>"
7
7
  ],