joshh
08/31/2022, 2:54 AMIsaac McFadyen | YYZ01
08/31/2022, 2:54 AMjoshh
08/31/2022, 2:54 AMIsaac McFadyen | YYZ01
08/31/2022, 2:54 AMcreator
via the header but maybe I just didn't notice it wasn't working for me?Isaac McFadyen | YYZ01
08/31/2022, 2:54 AMjoshh
08/31/2022, 2:55 AMIsaac McFadyen | YYZ01
08/31/2022, 2:55 AMjoshh
08/31/2022, 2:55 AMIsaac McFadyen | YYZ01
08/31/2022, 2:55 AMts
const uploadLink = await fetch(`https://api.cloudflare.com/client/v4/accounts/${env.CFAccountID}/stream?direct_user=true`,
{
method: "POST",
headers: {
authorization: env.CFAPIToken,
"upload-length": size.toString(),
"tus-resumable": "1.0.0",
"upload-metadata": `allowedOrigins ZGFzaGNoYXQuYXBwCg==,creator ${btoa(
userID
)}`,
"Content-Type": "application/json",
},
}
);
joshh
08/31/2022, 2:56 AMIsaac McFadyen | YYZ01
08/31/2022, 2:56 AMIsaac McFadyen | YYZ01
08/31/2022, 2:56 AMjoshh
08/31/2022, 2:56 AMjoshh
08/31/2022, 2:56 AMIsaac McFadyen | YYZ01
08/31/2022, 2:57 AMIsaac McFadyen | YYZ01
08/31/2022, 2:57 AMcreator
is actually being successfully applied on mine.joshh
08/31/2022, 2:58 AMjoshh
08/31/2022, 2:58 AMIsaac McFadyen | YYZ01
08/31/2022, 2:59 AMjoshh
08/31/2022, 2:59 AMjoshh
08/31/2022, 3:00 AMjoshh
08/31/2022, 3:00 AMjoshh
08/31/2022, 3:00 AMYou can apply the same constraints as Direct Creator Upload via basic upload when using tus. To do so, you must pass the expiry and maxDurationSeconds as part of the Upload-Metadata request header as part of the first request (made by the Worker in the example above.) The Upload-Metadata values are ignored from subsequent requests that do the actual file upload.
joshh
08/31/2022, 3:00 AMIsaac McFadyen | YYZ01
08/31/2022, 3:00 AMIsaac McFadyen | YYZ01
08/31/2022, 3:00 AMjoshh
08/31/2022, 3:00 AMIsaac McFadyen | YYZ01
08/31/2022, 3:00 AMIsaac McFadyen | YYZ01
08/31/2022, 3:00 AM