Create upload status check endpoint
This commit is contained in:
parent
95d0686eaa
commit
eb1a246da8
@ -1,14 +1,4 @@
|
||||
export async function onRequestGet(context: RequestContext) {
|
||||
const { current_user: currentUser } = context.data;
|
||||
|
||||
if (!(currentUser?.permissions & (1 << 5)))
|
||||
return new Response('{"error":"Forbidden"}', {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
status: 403,
|
||||
});
|
||||
|
||||
const attachment = context.params.id as string;
|
||||
const unsignedURL = `https://mediaproxy.carcrushers.cc/${attachment}?Expires=${(
|
||||
Math.round(Date.now() / 1000) + 1800
|
||||
@ -33,3 +23,13 @@ export async function onRequestGet(context: RequestContext) {
|
||||
.replaceAll("=", "")}`
|
||||
);
|
||||
}
|
||||
|
||||
export async function onRequestHead(context: RequestContext) {
|
||||
const attachment = context.params.id as string;
|
||||
|
||||
return new Response(null, {
|
||||
status: (await context.env.DATA.get(`videoprocessing_${attachment}`))
|
||||
? 409
|
||||
: 204,
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user