asset upload: nix list and delete commands (#3847)
these need to go ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [ ] `sdk` — Changes the tldraw SDK - [x] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [x] `bugfix` — Bug fix - [ ] `feature` — New feature - [ ] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know
This commit is contained in:
parent
a457a39081
commit
760e8724db
1 changed files with 0 additions and 19 deletions
|
@ -43,18 +43,6 @@ const router = Router()
|
||||||
|
|
||||||
router
|
router
|
||||||
.all('*', preflight)
|
.all('*', preflight)
|
||||||
.get('/uploads/list', async (request, env: Env) => {
|
|
||||||
// we need to protect this behind auth
|
|
||||||
const url = new URL(request.url)
|
|
||||||
const options: R2ListOptions = {
|
|
||||||
prefix: url.searchParams.get('prefix') ?? undefined,
|
|
||||||
delimiter: url.searchParams.get('delimiter') ?? undefined,
|
|
||||||
cursor: url.searchParams.get('cursor') ?? undefined,
|
|
||||||
}
|
|
||||||
|
|
||||||
const listing = await env.UPLOADS.list(options)
|
|
||||||
return Response.json(listing)
|
|
||||||
})
|
|
||||||
.get('/uploads/:objectName', async (request: Request, env: Env, ctx: ExecutionContext) => {
|
.get('/uploads/:objectName', async (request: Request, env: Env, ctx: ExecutionContext) => {
|
||||||
const url = new URL(request.url)
|
const url = new URL(request.url)
|
||||||
|
|
||||||
|
@ -155,13 +143,6 @@ router
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.delete('/uploads/:objectName', async (request: Request, env: Env) => {
|
|
||||||
// Not sure if this is necessary, might be dangerous to expose
|
|
||||||
// TODO: infer types from path
|
|
||||||
// @ts-expect-error
|
|
||||||
await env.UPLOADS.delete(request.params.objectName)
|
|
||||||
return new Response()
|
|
||||||
})
|
|
||||||
.get('*', () => new Response('Not found', { status: 404 }))
|
.get('*', () => new Response('Not found', { status: 404 }))
|
||||||
|
|
||||||
const Worker = {
|
const Worker = {
|
||||||
|
|
Loading…
Reference in a new issue