Make changes for video processing check
This commit is contained in:
parent
4e0729e91e
commit
de8fc6a4e2
@ -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,14 +67,11 @@ export default function (props: ReportCardProps) {
|
||||
<Text fontSize="xs">ID(s): {props.target_ids.toString()}</Text>
|
||||
</CardHeader>
|
||||
<CardBody>
|
||||
{attachmentsReady ? (
|
||||
<div style={{ position: "relative" }}>
|
||||
<video
|
||||
autoPlay={true}
|
||||
controls={true}
|
||||
src={`/api/uploads/${props.attachments[attachmentIdx]}`}
|
||||
width="100%"
|
||||
/>
|
||||
<video autoPlay={true} controls={true} width="100%">
|
||||
<source src={`/api/uploads/${props.attachments[attachmentIdx]}`} />
|
||||
<source src="/files/processing.webm" />
|
||||
</video>
|
||||
<HStack
|
||||
pos="absolute"
|
||||
top="50%"
|
||||
@ -144,21 +126,10 @@ export default function (props: ReportCardProps) {
|
||||
</Button>
|
||||
</HStack>
|
||||
</div>
|
||||
) : (
|
||||
<Text>Attachments processing...</Text>
|
||||
)}
|
||||
<br />
|
||||
<Text my="16px">{props.description}</Text>
|
||||
</CardBody>
|
||||
<CardFooter>
|
||||
{props.attachments_loading ? (
|
||||
<Button
|
||||
colorScheme="blue"
|
||||
onClick={async () => await recheckAttachment()}
|
||||
>
|
||||
Reload Attachment
|
||||
</Button>
|
||||
) : (
|
||||
<Stack direction="column">
|
||||
{(function () {
|
||||
const radioGroups = [];
|
||||
@ -199,7 +170,6 @@ export default function (props: ReportCardProps) {
|
||||
</Button>
|
||||
</Box>
|
||||
</Stack>
|
||||
)}
|
||||
</CardFooter>
|
||||
</Card>
|
||||
);
|
||||
|
@ -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);
|
||||
}
|
||||
|
1
index.d.ts
vendored
1
index.d.ts
vendored
@ -63,7 +63,6 @@ declare global {
|
||||
|
||||
interface ReportCardProps {
|
||||
attachments: string[];
|
||||
attachments_loading?: boolean;
|
||||
created_at: number;
|
||||
description?: string;
|
||||
id: string;
|
||||
|
Loading…
x
Reference in New Issue
Block a user