Major update 2 / login

This commit is contained in:
2026-04-26 16:33:04 +03:00
parent 5bff9a287d
commit e8fd35105f
15 changed files with 999 additions and 96 deletions

260
templates/options.html Normal file
View File

@@ -0,0 +1,260 @@
<!DOCTYPE html>
<html lang="el">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Grepolis Remote — Ρυθμίσεις Clan</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: #0d1117; color: #e6edf3; min-height: 100vh; }
/* --- Top nav --- */
.topbar {
background: #161b22;
border-bottom: 1px solid #30363d;
padding: 14px 32px;
display: flex;
align-items: center;
justify-content: space-between;
}
.topbar-logo { font-size: 1.1rem; font-weight: 700; color: #c8a44a; text-decoration: none; }
.topbar-nav { display: flex; gap: 16px; align-items: center; }
.topbar-nav a {
color: #8b949e; font-size: 0.875rem; text-decoration: none;
padding: 6px 12px; border-radius: 6px; transition: background 0.2s, color 0.2s;
}
.topbar-nav a:hover { background: #21262d; color: #e6edf3; }
.topbar-nav a.active { color: #c8a44a; }
.topbar-nav .btn-logout {
background: rgba(248,81,73,0.1); color: #f85149;
border: 1px solid rgba(248,81,73,0.3); padding: 6px 14px; border-radius: 6px;
cursor: pointer; font-size: 0.875rem; font-family: inherit; text-decoration: none;
transition: background 0.2s;
}
.topbar-nav .btn-logout:hover { background: rgba(248,81,73,0.2); }
/* --- Page layout --- */
.page { max-width: 760px; margin: 40px auto; padding: 0 20px; }
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.page-subtitle { color: #8b949e; font-size: 0.9rem; margin-bottom: 32px; }
/* --- Cards --- */
.card {
background: #161b22;
border: 1px solid #30363d;
border-radius: 10px;
padding: 24px 28px;
margin-bottom: 24px;
}
.card-title {
font-size: 1rem; font-weight: 600;
margin-bottom: 18px; padding-bottom: 12px;
border-bottom: 1px solid #30363d;
display: flex; align-items: center; gap: 8px;
}
/* --- Key display --- */
.key-box {
background: #0d1117;
border: 1px solid #30363d;
border-radius: 6px;
padding: 14px 18px;
display: flex; align-items: center; justify-content: space-between;
gap: 12px; margin-bottom: 14px;
}
.key-value {
font-family: 'Courier New', monospace;
font-size: 1.4rem;
font-weight: 700;
color: #c8a44a;
letter-spacing: 3px;
}
.btn-copy {
background: #21262d; color: #e6edf3;
border: 1px solid #30363d; border-radius: 6px;
padding: 6px 14px; font-size: 0.8rem; cursor: pointer;
font-family: inherit; transition: background 0.2s; white-space: nowrap;
}
.btn-copy:hover { background: #30363d; }
/* --- Create clan form --- */
.inline-form { display: flex; gap: 10px; }
.inline-form input[type="text"] {
flex: 1; padding: 9px 14px;
background: #0d1117; border: 1px solid #30363d; border-radius: 6px;
color: #e6edf3; font-size: 0.9rem; font-family: inherit;
}
.inline-form input:focus { outline: none; border-color: #c8a44a; }
/* --- Buttons --- */
.btn-primary {
background: #c8a44a; color: #0d1117;
border: none; border-radius: 6px; padding: 9px 18px;
font-weight: 700; font-size: 0.875rem; font-family: inherit;
cursor: pointer; transition: background 0.2s, transform 0.1s; white-space: nowrap;
}
.btn-primary:hover { background: #e0b85a; transform: translateY(-1px); }
.btn-danger {
background: rgba(248,81,73,0.1); color: #f85149;
border: 1px solid rgba(248,81,73,0.3); border-radius: 6px;
padding: 5px 12px; font-size: 0.8rem; font-family: inherit;
cursor: pointer; transition: background 0.2s;
}
.btn-danger:hover { background: rgba(248,81,73,0.2); }
.btn-warning {
background: rgba(210,153,34,0.1); color: #d99512;
border: 1px solid rgba(210,153,34,0.3); border-radius: 6px;
padding: 7px 14px; font-size: 0.8rem; font-family: inherit;
cursor: pointer; transition: background 0.2s; margin-top: 6px;
}
.btn-warning:hover { background: rgba(210,153,34,0.2); }
/* --- Members table --- */
.members-table { width: 100%; border-collapse: collapse; }
.members-table th {
text-align: left; font-size: 0.75rem; color: #8b949e;
text-transform: uppercase; letter-spacing: 0.5px;
padding: 0 0 10px 0; border-bottom: 1px solid #30363d;
}
.members-table td {
padding: 12px 0; border-bottom: 1px solid #21262d;
font-size: 0.875rem; vertical-align: middle;
}
.members-table tr:last-child td { border-bottom: none; }
.player-name { font-weight: 600; }
.player-id { color: #8b949e; font-size: 0.78rem; font-family: monospace; }
.status-online { color: #3fb950; font-size: 0.78rem; font-weight: 600; }
.status-offline { color: #8b949e; font-size: 0.78rem; }
.empty-state {
text-align: center; padding: 32px 0;
color: #8b949e; font-size: 0.9rem;
}
.warn-box {
background: rgba(210,153,34,0.1);
border: 1px solid rgba(210,153,34,0.3);
border-radius: 6px; padding: 12px 16px;
color: #d99512; font-size: 0.85rem; margin-top: 10px;
}
</style>
</head>
<body>
<div class="topbar">
<a class="topbar-logo" href="/">⚔️ Grepolis Remote</a>
<div class="topbar-nav">
<a href="/">Clients</a>
<a href="/auth/options" class="active">Ρυθμίσεις</a>
<a href="/auth/logout" class="btn-logout">Αποσύνδεση</a>
</div>
</div>
<div class="page">
<div class="page-title">Ρυθμίσεις Clan</div>
<div class="page-subtitle">Διαχείριση της ομάδας σας και του κλειδιού πρόσβασης</div>
{% if clan %}
<!-- ===================== Clan Key Section ===================== -->
<div class="card">
<div class="card-title">🔑 Clan Key</div>
<p style="color:#8b949e; font-size:0.875rem; margin-bottom:14px;">
Μοιραστείτε αυτό το κλειδί με τους παίκτες σας. Πρέπει να το προσθέσουν στο Loader script τους για να συνδεθούν στην ομάδα σας.
</p>
<div class="key-box">
<span class="key-value" id="clanKeyDisplay">{{ clan.clan_key }}</span>
<button class="btn-copy" onclick="copyKey()">📋 Αντιγραφή</button>
</div>
<div class="warn-box">
⚠️ Εάν αναγεννήσετε το κλειδί, οι παίκτες σας θα πρέπει να ενημερώσουν το script τους με το νέο κλειδί.
</div>
<form method="POST" action="/auth/clan/regenerate-key"
onsubmit="return confirm('Σίγουρα; Οι παίκτες σου θα πρέπει να ανανεώσουν το κλειδί τους.');">
<button type="submit" class="btn-warning">🔄 Αναγέννηση Κλειδιού</button>
</form>
</div>
<!-- ===================== Members Section ===================== -->
<div class="card">
<div class="card-title">👥 Μέλη Clan — {{ clan.name }}</div>
{% if members %}
<table class="members-table">
<thead>
<tr>
<th>Παίκτης</th>
<th>Κατάσταση</th>
<th>Προστέθηκε</th>
<th></th>
</tr>
</thead>
<tbody>
{% for m in members %}
{% set last_seen = m.updated_at %}
{% if last_seen %}
{% set diff = (now - last_seen) | int %}
{% endif %}
<tr>
<td>
<div class="player-name">{{ m.player_name or 'Άγνωστος' }}</div>
<div class="player-id">ID: {{ m.player_id }}</div>
</td>
<td>
{% if m.updated_at and (now_ts - m.updated_at|string|int) < 150 %}
<span class="status-online">● Online</span>
{% else %}
<span class="status-offline">● Offline</span>
{% endif %}
</td>
<td style="color:#8b949e; font-size:0.8rem;">{{ m.joined_at[:10] }}</td>
<td style="text-align:right;">
<form method="POST" action="/auth/clan/remove-member/{{ m.player_id }}"
onsubmit="return confirm('Αφαίρεση παίκτη {{ m.player_name }}?');">
<button type="submit" class="btn-danger">Αφαίρεση</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="empty-state">
Δεν υπάρχουν μέλη ακόμη.<br>
<span style="font-size:0.8rem; margin-top:6px; display:block;">
Μοιραστείτε το Clan Key με τους παίκτες σας για να συνδεθούν.
</span>
</div>
{% endif %}
</div>
{% else %}
<!-- ===================== Create Clan Section ===================== -->
<div class="card">
<div class="card-title">🏰 Δημιουργία Clan</div>
<p style="color:#8b949e; font-size:0.875rem; margin-bottom:18px;">
Δεν έχετε δημιουργήσει clan ακόμη. Δώστε ένα όνομα για να ξεκινήσετε.
</p>
<form method="POST" action="/auth/clan/create" class="inline-form">
<input type="text" name="clan_name" placeholder="π.χ. Alpha Squad" required>
<button type="submit" class="btn-primary">Δημιουργία →</button>
</form>
</div>
{% endif %}
</div>
<script>
function copyKey() {
const key = document.getElementById('clanKeyDisplay').textContent;
navigator.clipboard.writeText(key).then(() => {
const btn = document.querySelector('.btn-copy');
btn.textContent = '✅ Αντιγράφηκε!';
setTimeout(() => btn.textContent = '📋 Αντιγραφή', 2000);
});
}
</script>
</body>
</html>