Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add mod submission function
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 7c0fec5 commit a1c3e68
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion app/routes/report.tsx
Expand Up @@ -42,6 +42,22 @@ export default function () {
const toast = useToast();
const [uploading, setUploading] = useState(false);
const [turnstileToken, setTurnstileToken] = useState("");
const fileTypes: { [k: string]: string } = {
gif: "image/gif",
heic: "image/heic",
heif: "image/heif",
jfif: "image/jpeg",
jpeg: "image/jpeg",
jpg: "image/jpg",
m4v: "video/x-m4v",
mkv: "video/x-matroska",
mov: "video/quicktime",
mp4: "video/mp4",
png: "image/png",
webp: "image/webp",
webm: "video/webm",
wmv: "video/x-ms-wmv",
};

useEffect(() => {
if (sessionStorage.getItem("REPORT_SUCCESS")) {
Expand Down Expand Up @@ -164,7 +180,9 @@ export default function () {
// @ts-expect-error
duplex: supportsRequestStreams ? "half" : undefined,
headers: {
"content-type": file.type,
"content-type":
file.type ||
fileTypes[file.name.split(".")[file.name.split(".").length - 1]],
},
method: "PUT",
}).catch(console.error);
Expand Down

0 comments on commit a1c3e68

Please sign in to comment.