From 89cf52a10dfe7cfeb02c3f7f4b6842892eb04300 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 3 Nov 2021 19:12:27 +0100 Subject: Reverse proxy support --- htdocs/public/archive/index.ejs | 58 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 htdocs/public/archive/index.ejs (limited to 'htdocs/public/archive') diff --git a/htdocs/public/archive/index.ejs b/htdocs/public/archive/index.ejs new file mode 100644 index 0000000..b8bd4df --- /dev/null +++ b/htdocs/public/archive/index.ejs @@ -0,0 +1,58 @@ +<% global.title = "Archives"; %> +<%- include(`${private}/header.ejs`) %> + +← Go back home + +
+ +

Archives

+ + + + +
+ <% + const monthNames = ["January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" + ]; + archives = []; + for (let archive of fs.readdirSync(serverRoot + "/archives")) { + data = {}; + if (archive.endsWith(".json")) { + json = JSON.parse(fs.readFileSync(serverRoot + "/archives/" + archive).toString()) + + data.id = archive.substr(0, archive.length - 5); + data.name = json.title; + data.description = json.description.en; + data.date = (json.date.substr(3) + json.date.substr(0, 2)) - 1 + 1; + + if (json.unreleased) { + date = new Date(json.date.substr(3) + "-" + json.date.substr(0, 2) + "-01"); + data.info = "Never released · " + monthNames[date.getMonth()] + " " + date.getFullYear(); + } else { + data.info = "Officially released · " + monthNames[date.getMonth()] + " " + date.getFullYear(); + } + + archives.push(data); + } + } + archives = archives.sort((a, b) => a.date - b.date).reverse() + %> + <% for (let archive of archives) { %> +
+ "> +

<%- archive.name %>

+

<%- archive.description %>

+

+ Download +

+

<%- archive.info %>

+
+ <% } %> +
+ +<%- include(`${private}/footer.ejs`) %> \ No newline at end of file -- cgit