diff options
| author | Yuval Adam <_@yuv.al> | 2025-09-24 12:44:27 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2025-09-24 12:44:27 +0200 |
| commit | 50d2992168223b32eeb90a6c9afc545136747b50 (patch) | |
| tree | 16aa098f4b6dcad08123113fa8747613573d45dc /src/functions | |
| parent | 1076752caa8f2f3804c0d79c7db937e88ecdf205 (diff) | |
Add /imgs/ endpoint and fix type errors
Diffstat (limited to 'src/functions')
| -rw-r--r-- | src/functions/scheduled.ts | 22 |
1 files changed, 0 insertions, 22 deletions
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<void> { - 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<string> { try { const updated = await this.fetchMissingImages(); - if (updated) { - await this.generateJson(); - } return `Updated: ${updated}`; } catch (error) { console.error('Error in GeshemUpdate.run():', error); |
