aboutsummaryrefslogtreecommitdiff
path: root/views/dashboard.ejs
blob: e63c458a4eda14cc5b6d1f9b16f052dd2ca878fd (plain) (blame)
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/css/style.css">
    <title>bnbSO Dashboard</title>
</head>
<body>
    <div class="background"></div>
    <div class="container">
        <h1>Welcome, <%= username %>!</h1>
        <h2><%= serverName %> Username: <%= fso_username %></h2>
        <h2 id="simtime"></h2>
        <a href="/password" class="button">Change Password</a>
        <a href="https://fso-builds.riperiperi.workers.dev" class="button">Download <%= serverName %> Client</a>
        <a href="/logout" class="button logout">Logout</a>
    </div>
    <script>
        function updateTSOClock() {
            const currentTime = new Date(),
                utcMinutes = currentTime.getUTCMinutes(),
                utcSeconds = currentTime.getUTCSeconds();
            let timePeriod = 'AM', totalSeconds = 0;
            if (currentTime.getUTCHours() % 2 === 1) {
                totalSeconds = 3600;
                timePeriod = 'PM';
            }
            totalSeconds += utcMinutes * 60 + utcSeconds;
            let hour = Math.floor(totalSeconds / 300);
            if (hour > 12) {
                hour -= 12;
            }
            if (hour === 0) {
                hour = 12;
            }
            let minute = Math.floor(totalSeconds % 300 / 5);
            if (minute < 10) {
                minute = '0' + minute;
            }
            const simTimeElement = document.querySelector('#simtime');
            if (simTimeElement) {
                simTimeElement.textContent = `${hour}:${minute} ${timePeriod}`;
            }
        }

        setInterval(updateTSOClock, 1000);
        updateTSOClock();
    </script>
</body>
</html>