Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Merge develop into main #192

Merged
merged 12 commits into from
Nov 5, 2024
Merged
27 changes: 27 additions & 0 deletions functions/api/mirrorlists/[mirrorlist].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export async function onRequest(context)
{
if (!context.params.mirrorlist.includes(".json"))
{
return new Response(JSON.stringify({ error: "Bad request: Expected .json format" }), {
status: 400,
headers: { "Content-Type": "application/json" },
});
}

const version = context.params.mirrorlist.replace('.json', '');

const downloadPathVersion = version.replace('.mono', '');

const mirrorlist = {
mirrors: [
{
name: "Official GitHub Releases mirror",
url: `https://github.com/Redot-Engine/redot-engine/releases/download/redot-${ downloadPathVersion }/Redot_v${ version }_export_templates.tpz`
}
]
};

return new Response(JSON.stringify(mirrorlist), {
headers: { "Content-Type": "application/json" },
});
}