Testing embedded R2
This commit is contained in:
parent
d9e701eaa8
commit
8f6fd37578
@ -11,6 +11,3 @@
|
|||||||
/rss /rss.xml
|
/rss /rss.xml
|
||||||
/feed /rss.xml
|
/feed /rss.xml
|
||||||
/feed.xml /rss.xml
|
/feed.xml /rss.xml
|
||||||
|
|
||||||
# Minecraft modpack downloads
|
|
||||||
/download/minecraft-modpack/* minecraft-modpack.storage.ewpratten.com/:splat
|
|
||||||
|
19
static/functions/download/minecraft-modpack/[[version]].js
Normal file
19
static/functions/download/minecraft-modpack/[[version]].js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
export async function onRequest(context) {
|
||||||
|
// Figure out what version was requested
|
||||||
|
const url = new URL(context.request.url);
|
||||||
|
const version = url.pathname.split("/").pop();
|
||||||
|
|
||||||
|
// Request the file from R2
|
||||||
|
let object = await context.env.MC_MODPACK_BUCKET.get(`Evan's Pack-${version}.mrpack`);
|
||||||
|
if (object === null) {
|
||||||
|
return new Response("Not Found", { status: 404 });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the file
|
||||||
|
return new Response(object, {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/octet-stream",
|
||||||
|
"Content-Disposition": `attachment; filename="Evan's Pack-${version}.mrpack"`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
@ -13,3 +13,7 @@ compatibility_date = "2023-05-22"
|
|||||||
[env.production.vars]
|
[env.production.vars]
|
||||||
GOAT_COUNTER_SITE_CODE = "ewpratten"
|
GOAT_COUNTER_SITE_CODE = "ewpratten"
|
||||||
ZOLA_VERSION = "0.15.3"
|
ZOLA_VERSION = "0.15.3"
|
||||||
|
|
||||||
|
[[r2_buckets]]
|
||||||
|
binding = "MC_MODPACK_BUCKET"
|
||||||
|
bucket_name = "minecraft-modpack-builds"
|
Loading…
x
Reference in New Issue
Block a user