koishi-plugin-memesluna 0.4.5 → 0.4.6

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
@@ -213,17 +213,6 @@ var MemesLunaService = class extends import_koishi.Service {
213
213
  indexes: ["hash"]
214
214
  }
215
215
  );
216
- this.ctx.database.extend(
217
- "memesluna_collection_stats",
218
- {
219
- collection: "string",
220
- api_call_count: "integer",
221
- updated_at: "timestamp"
222
- },
223
- {
224
- primary: "collection"
225
- }
226
- );
227
216
  this.ctx.database.extend(
228
217
  "memesluna_staged_images",
229
218
  {
@@ -1107,7 +1096,6 @@ var MemesLunaService = class extends import_koishi.Service {
1107
1096
  }
1108
1097
  const createdAt = dates.length ? new Date(Math.min(...dates.map((date) => date.getTime()), statCreatedAt?.getTime() || Infinity)) : statCreatedAt;
1109
1098
  const updatedAt = dates.length ? new Date(Math.max(...dates.map((date) => date.getTime()), statUpdatedAt?.getTime() || 0)) : statUpdatedAt;
1110
- const apiCallCount = await this.getCollectionApiCallCount(collectionName);
1111
1099
  return {
1112
1100
  name: collectionName,
1113
1101
  description,
@@ -1117,36 +1105,9 @@ var MemesLunaService = class extends import_koishi.Service {
1117
1105
  hasContent: localImages.length > 0 || links.length > 0,
1118
1106
  createdAt,
1119
1107
  updatedAt,
1120
- apiCallCount,
1121
1108
  cover: localImages[0]
1122
1109
  };
1123
1110
  }
1124
- async getCollectionApiCallCount(collectionName) {
1125
- if (!this.isValidCollectionName(collectionName)) {
1126
- return 0;
1127
- }
1128
- const rows = await this.ctx.database.get("memesluna_collection_stats", { collection: collectionName });
1129
- return rows[0]?.api_call_count || 0;
1130
- }
1131
- async incrementCollectionApiCallCount(collectionName) {
1132
- if (!this.isValidCollectionName(collectionName)) {
1133
- return;
1134
- }
1135
- const rows = await this.ctx.database.get("memesluna_collection_stats", { collection: collectionName });
1136
- const now = /* @__PURE__ */ new Date();
1137
- if (rows.length) {
1138
- await this.ctx.database.set("memesluna_collection_stats", { collection: collectionName }, {
1139
- api_call_count: (rows[0].api_call_count || 0) + 1,
1140
- updated_at: now
1141
- });
1142
- return;
1143
- }
1144
- await this.ctx.database.create("memesluna_collection_stats", {
1145
- collection: collectionName,
1146
- api_call_count: 1,
1147
- updated_at: now
1148
- });
1149
- }
1150
1111
  async getRandomResource(collectionName) {
1151
1112
  if (!this.isValidCollectionName(collectionName)) {
1152
1113
  return null;
@@ -1366,7 +1327,6 @@ async function applyDynamicForward(ctx, config, service, routeName, _query, requ
1366
1327
  if (!resource) {
1367
1328
  return { notFound: true };
1368
1329
  }
1369
- await service.incrementCollectionApiCallCount(routeName);
1370
1330
  if (resource.type === "external") {
1371
1331
  return { redirectTo: resource.value };
1372
1332
  }
package/lib/service.d.ts CHANGED
@@ -28,7 +28,6 @@ export interface CollectionInfo {
28
28
  hasContent: boolean;
29
29
  createdAt?: Date;
30
30
  updatedAt?: Date;
31
- apiCallCount: number;
32
31
  cover?: string;
33
32
  }
34
33
  export interface CollectionResource {
@@ -133,8 +132,6 @@ export declare class MemesLunaService extends Service {
133
132
  deleteImageFromCollection(collectionName: string, filename: string): Promise<boolean>;
134
133
  moveImageToCollection(sourceCollection: string, targetCollection: string, filename: string): Promise<string | null>;
135
134
  getCollectionInfo(collectionName: string): Promise<CollectionInfo | null>;
136
- getCollectionApiCallCount(collectionName: string): Promise<number>;
137
- incrementCollectionApiCallCount(collectionName: string): Promise<void>;
138
135
  getRandomResource(collectionName: string): Promise<CollectionResource | null>;
139
136
  private mapEndpoint;
140
137
  getEndpoints(): Promise<ApiEndpoint[]>;
@@ -177,11 +174,6 @@ declare module 'koishi' {
177
174
  perceptual_hash: string;
178
175
  created_at: Date;
179
176
  };
180
- memesluna_collection_stats: {
181
- collection: string;
182
- api_call_count: number;
183
- updated_at: Date;
184
- };
185
177
  memesluna_staged_images: {
186
178
  id: string;
187
179
  filename: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-memesluna",
3
3
  "description": "Image Forward service for Koishi with ChatLuna integration",
4
- "version": "0.4.5",
4
+ "version": "0.4.6",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "types": "lib/index.d.ts",