summaryrefslogtreecommitdiff
path: root/htdocs/public/archive/index.ejs
blob: b8bd4dfbad092ef18cd3ee3983f9ff6f7b48f52e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<% global.title = "Archives"; %>
<%- include(`${private}/header.ejs`) %>

<a href="/">← Go back home</a>

<hr class="rnbwsquare-separator rnbwsquare-outer">

<h1>Archives</h1>
<!--<p>This is the page where all my active projects are, it is regularly updated from the projects I created on <a-->
<!--            href="https://source.minteck.org" target="_blank">source.minteck.org</a>. For projects I don't maintain-->
<!--    anymore, refer to the <a href="/archive">Archives</a> page.</p>-->

<div class="grid-3 projects">
    <%
    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 = "<span style='color:gold;'>Never released</span> · " + 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) { %>
        <div class="project">
            <img class="project-icon"
                 src="<%- fs.existsSync(serverRoot + "/htdocs/public/assets/archive/" + archive.id + ".png") ? "/assets/archive/" + archive.id + ".png" : "/assets/icons/project.svg" %>">
            <h2 class="project-name"><%- archive.name %></h2>
            <p class="project-description"><%- archive.description %></p>
            <p class="project-buttons">
                <a
                        href="https://archive.cdn.minteck.org/<%- archive.id %>.zip"
                        target="_blank"
                        class="big-button big-button-bg3">Download</a>
            </p>
            <p style="text-align: center;"><small><%- archive.info %></small></p>
        </div>
    <% } %>
</div>

<%- include(`${private}/footer.ejs`) %>