@@ -2,7 +2,7 @@ import { Hono } from 'hono'
22import { cors } from 'hono/cors'
33import { allowedOrigin , encodeEndpoint } from '@kodadot/workers-utils'
44import { CACHE_TTL_BY_STATUS , type Env } from '../utils/constants'
5- import { getCFIFlexibleVariant , urlToCFI } from '../utils/cloudflare-images'
5+ import { deleteImageByPath , getCFIFlexibleVariant , urlToCFI } from '../utils/cloudflare-images'
66import { ResponseType } from '../utils/types'
77
88const app = new Hono < { Bindings : Env } > ( )
@@ -101,9 +101,14 @@ app.delete('/*', async (c) => {
101101 console . log ( { objectName } )
102102
103103 try {
104- await c . env . MY_BUCKET . delete ( objectName )
104+ const bucket = await c . env . MY_BUCKET . delete ( objectName )
105+ const image = await deleteImageByPath ( {
106+ token : c . env . IMAGE_API_TOKEN ,
107+ imageAccount : c . env . CF_IMAGE_ACCOUNT ,
108+ path,
109+ } )
105110
106- return c . json ( { status : 'ok' } )
111+ return c . json ( { status : 'ok' , bucket , image , path } )
107112 } catch ( error ) {
108113 return c . json ( { status : 'error' , error } , 500 )
109114 }
0 commit comments