app
components
data
functions
api
admin-apps
appeals
auth
data-transfers
events-team
game-appeals
game-bans
gme
inactivity
infractions
me
mod-queue
reports
uploads
[[id]].ts
_middleware.ts
status.ts
[[path]].ts
webview-captcha.ts
_middleware.ts
common.ts
email.ts
gcloud.ts
permissions.ts
roblox-open-cloud.ts
public
.gitignore
.node-version
.prettierignore
OFL.txt
README.md
emotion-server.js
esbuild.config.js
index.css
index.d.ts
package-lock.json
package.json
remix.config.js
server.ts
theme.ts
tsconfig.json
28 lines
820 B
TypeScript
28 lines
820 B
TypeScript
import { jsonError } from "../../common.js";
|
|
|
|
export async function onRequestPost(context: RequestContext) {
|
|
const { body } = context.data;
|
|
|
|
if (
|
|
!Array.isArray(body) ||
|
|
body.find((attachment) => typeof attachment !== "string")
|
|
)
|
|
return jsonError("Request body must be an array of strings", 400);
|
|
|
|
if (body.length > 3) return jsonError("Too many video ids", 400);
|
|
|
|
const kvPromises = [];
|
|
|
|
for (const attachment of body)
|
|
kvPromises.push(context.env.DATA.get(`videoprocessing_${attachment}`));
|
|
|
|
const kvResults = await Promise.allSettled(kvPromises);
|
|
|
|
if (kvResults.find((result) => result.status === "rejected"))
|
|
return jsonError("Failed to check status of attachments", 500);
|
|
|
|
return new Response(null, {
|
|
status: kvResults.find((result) => result !== null) ? 409 : 204,
|
|
});
|
|
}
|