just use fetch and a buffer

This commit is contained in:
MeowcaTheoRange 2024-06-11 00:58:12 -05:00
parent c98063dbd4
commit af37f779ef

View file

@ -9,9 +9,22 @@ app.use("/assets", express.static('assets'));
app.use("/", express.static('pages')); app.use("/", express.static('pages'));
app.use("/files", createProxyMiddleware({ app.get('/files/*', async (req, res) => {
target: config.files_url console.log(req.params);
})); // Get events
let eventsReq = await fetch(new URL(req.params[0], config.files_url));
let events;
if (eventsReq.ok)
events = await eventsReq.arrayBuffer();
else
return res.status(eventsReq.status).send(await eventsReq.text());
console.log(events);
res.type(eventsReq.headers.get("Content-Type"));
return res.send(Buffer.from(events));
})
app.get('/data/:lang/events/:floor', async (req, res) => { app.get('/data/:lang/events/:floor', async (req, res) => {
// Get events // Get events