From de8fc6a4e24b6583fd812f8a6b92430fa795308a Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:51:05 -0400 Subject: [PATCH] Make changes for video processing check --- components/ReportCard.tsx | 220 ++++++++++++++------------------ functions/api/reports/submit.ts | 9 -- index.d.ts | 1 - 3 files changed, 95 insertions(+), 135 deletions(-) diff --git a/components/ReportCard.tsx b/components/ReportCard.tsx index 58e3afc..ed19af3 100644 --- a/components/ReportCard.tsx +++ b/components/ReportCard.tsx @@ -21,9 +21,6 @@ export default function (props: ReportCardProps) { const [loading, setLoading] = useState(false); const toast = useToast(); const targetMap: { [k: number]: string } = {}; - const [attachmentsReady, setAttachmentReady] = useState( - !props.attachments_loading, - ); const actionMap: { [k: number]: number } = {}; for (let i = 0; i < props.target_ids.length; i++) @@ -31,18 +28,6 @@ export default function (props: ReportCardProps) { value: props.target_usernames[i], }); - async function recheckAttachment() { - const attachmentCheck = await fetch("/api/uploads/status", { - body: JSON.stringify(props.attachments), - headers: { - "content-type": "application/json", - }, - method: "POST", - }); - - setAttachmentReady(attachmentCheck.ok); - } - async function submitActions() { setLoading(true); const submitReq = await fetch(`/api/reports/${props.id}/action`, { @@ -82,124 +67,109 @@ export default function (props: ReportCardProps) { ID(s): {props.target_ids.toString()} - {attachmentsReady ? ( -
-
- ) : ( - Attachments processing... - )} + + + + +
{props.description}
- {props.attachments_loading ? ( - - ) : ( - - {(function () { - const radioGroups = []; - for (let i = 0; i < props.target_ids.length; i++) { - radioGroups.push( - { - actionMap[props.target_ids[i]] = parseInt(val); - }} - > - - {props.target_usernames[i]} - - Ignore - - - Hide from Leaderboards - - - Ban - - - , - ); - } + + {(function () { + const radioGroups = []; + for (let i = 0; i < props.target_ids.length; i++) { + radioGroups.push( + { + actionMap[props.target_ids[i]] = parseInt(val); + }} + > + + {props.target_usernames[i]} + + Ignore + + + Hide from Leaderboards + + + Ban + + + , + ); + } - return radioGroups; - })()} - - - - - )} + return radioGroups; + })()} + + + + ); diff --git a/functions/api/reports/submit.ts b/functions/api/reports/submit.ts index 64701c5..eed12b3 100644 --- a/functions/api/reports/submit.ts +++ b/functions/api/reports/submit.ts @@ -189,15 +189,6 @@ export async function onRequestPost(context: RequestContext) { uploadUrls.push(urlResult.value); let url = new URL(urlResult.value).searchParams.get("name") as string; - const extension = (url.split(".").at(-1) as string).toLowerCase(); - - if (["mkv", "wmv"].includes(extension)) { - url = url.replace(`.${extension}`, ".mp4"); - - await context.env.DATA.put(`videoprocessing_${url}`, "1", { - expirationTtl: 600, - }); - } attachments.push(url); } diff --git a/index.d.ts b/index.d.ts index b3eb57a..40846a8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -63,7 +63,6 @@ declare global { interface ReportCardProps { attachments: string[]; - attachments_loading?: boolean; created_at: number; description?: string; id: string;