app
components
data
functions
api
admin-apps
appeals
auth
data-transfers
events-team
game-appeals
game-bans
gme
inactivity
infractions
me
mod-queue
reports
uploads
[[id]].ts
_middleware.ts
[[path]].ts
coconut.ts
events.ts
webview-captcha.ts
_middleware.ts
common.ts
email.ts
gcloud.ts
permissions.ts
roblox-open-cloud.ts
upload.ts
public
.gitignore
.node-version
.prettierignore
OFL.txt
README.md
emotion-server.js
index.css
index.d.ts
package-lock.json
package.json
remix.config.js
server.ts
theme.ts
tsconfig.json
23 lines
570 B
TypeScript
23 lines
570 B
TypeScript
import { AwsClient } from "aws4fetch";
|
|
|
|
export async function onRequestGet(context: RequestContext) {
|
|
const attachment = (context.params.id as string[]).join("/");
|
|
const aws = new AwsClient({
|
|
accessKeyId: context.env.R2_ACCESS_KEY,
|
|
secretAccessKey: context.env.R2_SECRET_KEY,
|
|
});
|
|
|
|
return Response.redirect(
|
|
(
|
|
await aws.sign(
|
|
`https://car-crushers.${context.env.R2_ZONE}.r2.cloudflarestorage.com/${attachment}?X-Amz-Expires=1800`,
|
|
{
|
|
aws: {
|
|
signQuery: true,
|
|
},
|
|
},
|
|
)
|
|
).url,
|
|
);
|
|
}
|