Actually do what coconut was asking me to

This commit is contained in:
2024-03-26 03:55:49 -04:00
parent 65b33e4c94
commit 6b85d517ca
2 changed files with 23 additions and 13 deletions

View File

@ -29,15 +29,6 @@ export async function onRequestPost(context: RequestContext) {
if (coconutData) {
const responsePromises = [];
const contentTypes: { [k: string]: string } = {
gif: "image/gif",
m4v: "video/x-m4v",
mkv: "video/x-matroska",
mov: "video/mp4",
mp4: "video/mp4",
webm: "video/webm",
wmv: "video/x-ms-wmv",
};
for (const attachment of coconutData.attachments) {
const token = crypto.randomUUID();
@ -57,7 +48,7 @@ export async function onRequestPost(context: RequestContext) {
secret_access_key: context.env.R2_SECRET_KEY,
},
endpoint: `https://${context.env.R2_ZONE}.r2.cloudflarestorage.com`,
key: `/t/${attachment}.${contentTypes[objectMeta.httpMetadata?.contentType as string]}`,
key: `/t/${attachment}`,
region: "us-east-1",
service: "s3other",
},
@ -71,7 +62,7 @@ export async function onRequestPost(context: RequestContext) {
},
outputs: {
mp4: {
path: `/${attachment}`,
path: `/${attachment}.mp4`,
},
},
storage: {