From 50d2992168223b32eeb90a6c9afc545136747b50 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Wed, 24 Sep 2025 12:44:27 +0200 Subject: Add /imgs/ endpoint and fix type errors --- src/functions/scheduled.ts | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'src/functions') diff --git a/src/functions/scheduled.ts b/src/functions/scheduled.ts index 5aa3fa0..ae43469 100644 --- a/src/functions/scheduled.ts +++ b/src/functions/scheduled.ts @@ -8,9 +8,6 @@ interface Env { IMGS_BUCKET: R2Bucket; } -interface ImageData { - [key: string]: string[]; -} class GeshemUpdate { private bucket: R2Bucket; @@ -118,29 +115,10 @@ class GeshemUpdate { return `imgs/${d}/${t}/${res}.png`; } - private async generateJson(): Promise { - const latestKeys = await this.getLatestBucketKeys(); - const keys = latestKeys - .filter(key => key.endsWith('280.png')) - .sort() - .slice(-10); - - const index: ImageData = { '280': keys }; - - await this.bucket.put('imgs.json', JSON.stringify(index), { - httpMetadata: { - contentType: 'application/json', - cacheControl: 'public, max-age=60' - } - }); - } async run(): Promise { try { const updated = await this.fetchMissingImages(); - if (updated) { - await this.generateJson(); - } return `Updated: ${updated}`; } catch (error) { console.error('Error in GeshemUpdate.run():', error); -- cgit v1.3.1