dok/views/index.ejs
2026-04-10 16:58:46 +01:00

106 lines
2.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<title>Dynasty of Knights</title>
<link
rel="icon"
href="/images/favicon/dok_favicon_32px.ico"
type="image/x-icon"
/>
<link rel="stylesheet" href="/css/global.css" />
<link rel="stylesheet" href="/css/login.css" />
</head>
<body>
<div class="fog"></div>
<div class="launcher">
<form action="/login" method="POST">
<select name="server_id">
<% servers.forEach(server => { %>
<option value="<%= server.id %>">
<%= server.name %>
</option>
<% }) %>
<% extraServers.forEach(server => { %>
<option disabled>
<%= server.name %> (Offline)
</option>
<% }) %>
</select>
<input type="text" name="username" placeholder="Username" required />
<input type="password" name="password" placeholder="Password" required />
<button type="submit" class="login">
Login
</button>
</form>
<a class="register" href="/register">
Account registrieren
</a>
<div class="server-status">
<% servers.forEach(server => { %>
<div class="server-status-row">
<span class="server-name"><%= server.name %></span>
<span class="online">Online</span>
<span class="server-players" id="players-<%= server.id %>"> Spieler online</span>
</div>
<% }) %>
<% extraServers.forEach(server => { %>
<div class="server-status-row">
<span class="server-name"><%= server.name %></span>
<span class="offline">Offline</span>
</div>
<% }) %>
</div>
<script>
fetch('/api/server-stats')
.then(r => r.json())
.then(stats => {
Object.entries(stats).forEach(([serverId, count]) => {
const el = document.getElementById('players-' + serverId);
if (el) el.textContent = ' ' + count + ' Spieler online';
});
})
.catch(() => {});
</script>
</div>
<% if (typeof error !== 'undefined' && error) { %>
<div class="login-overlay" id="login-overlay"></div>
<div class="login-popup" id="login-popup">
<div class="login-popup-header">
⚔️ Hinweis
</div>
<div class="login-popup-body">
<%= error %>
</div>
<div class="login-popup-footer">
<button class="login-popup-btn" onclick="document.getElementById('login-popup').style.display='none';document.getElementById('login-overlay').style.display='none';">OK</button>
</div>
</div>
<script>
document.getElementById('login-overlay').style.display = 'block';
document.getElementById('login-popup').style.display = 'block';
</script>
<% } %>
</body>
</html>