I am an idiot
This commit is contained in:
@ -2,7 +2,7 @@ export async function onRequestGet(context: RequestContext) {
|
|||||||
const attachment = (context.params.id as string[]).join("/");
|
const attachment = (context.params.id as string[]).join("/");
|
||||||
const unsignedURL = `https://mediaproxy.carcrushers.cc/${attachment}?Expires=${(
|
const unsignedURL = `https://mediaproxy.carcrushers.cc/${attachment}?Expires=${(
|
||||||
Math.round(Date.now() / 1000) + 1800
|
Math.round(Date.now() / 1000) + 1800
|
||||||
).toString()}`;
|
).toString()}&KeyName=portal-media-linkgen`;
|
||||||
const signingKey = await crypto.subtle.importKey(
|
const signingKey = await crypto.subtle.importKey(
|
||||||
"raw",
|
"raw",
|
||||||
Uint8Array.from(atob(context.env.URL_SIGNING_KEY), (c) => c.charCodeAt(0)),
|
Uint8Array.from(atob(context.env.URL_SIGNING_KEY), (c) => c.charCodeAt(0)),
|
||||||
@ -18,7 +18,7 @@ export async function onRequestGet(context: RequestContext) {
|
|||||||
|
|
||||||
return Response.redirect(
|
return Response.redirect(
|
||||||
`${unsignedURL}&Signature=${btoa(
|
`${unsignedURL}&Signature=${btoa(
|
||||||
String.fromCodePoint(...new Uint8Array(signature)),
|
String.fromCharCode(...new Uint8Array(signature)),
|
||||||
)
|
)
|
||||||
.replaceAll("+", "-")
|
.replaceAll("+", "-")
|
||||||
.replaceAll("/", "_")
|
.replaceAll("/", "_")
|
||||||
|
Reference in New Issue
Block a user