Files
grepo-remote/templates/options.html
2026-04-26 22:39:52 +03:00

351 lines
14 KiB
HTML
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="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;
}
.toggle-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toggle-label {
display: flex; align-items: center; gap: 6px;
font-size: 0.8rem; color: #8b949e; cursor: pointer;
background: #0d1117; border: 1px solid #30363d;
padding: 4px 10px; border-radius: 20px;
transition: border-color 0.2s, color 0.2s;
}
.toggle-label:has(input:checked) { border-color: #3fb950; color: #3fb950; }
.toggle-label input[type=checkbox] { display: none; }
.btn-apply {
background: #21262d; color: #8b949e;
border: 1px solid #30363d; border-radius: 6px;
padding: 4px 10px; font-size: 0.78rem; font-family: inherit;
cursor: pointer; transition: background 0.2s, color 0.2s;
}
.btn-apply:hover { background: #30363d; color: #e6edf3; }
.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>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="warn-box" style="margin-bottom: 20px; color: {% if category == 'error' %}#f85149{% else %}#3fb950{% endif %}; border-color: {% if category == 'error' %}rgba(248,81,73,0.3){% else %}rgba(63,185,80,0.3){% endif %}; background: {% if category == 'error' %}rgba(248,81,73,0.1){% else %}rgba(63,185,80,0.1){% endif %};">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
{% if clan %}
{% if clan.owner_id == current_user.id %}
<!-- ===================== 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>
<!-- ===================== Website Admins Section ===================== -->
<div class="card">
<div class="card-title">👨‍💻 Website Admins</div>
<p style="color:#8b949e; font-size:0.875rem; margin-bottom:14px;">
Προσθέστε το username άλλων παικτών που έχουν ήδη εγγραφεί στο site για να τους δώσετε πρόσβαση στο dashboard σας.
</p>
<form method="POST" action="/auth/clan/add-admin" class="inline-form" style="margin-bottom: 20px;">
<input type="text" name="admin_username" placeholder="π.χ. player123" required>
<button type="submit" class="btn-primary">Προσθήκη Admin</button>
</form>
{% if admins %}
<table class="members-table">
<thead>
<tr>
<th>Admin Username</th>
<th>Ημερομηνία Προσθήκης</th>
<th></th>
</tr>
</thead>
<tbody>
{% for a in admins %}
<tr>
<td><div class="player-name">{{ a.username }}</div></td>
<td style="color:#8b949e; font-size:0.8rem;">{{ a.created_at[:10] }}</td>
<td style="text-align:right;">
<form method="POST" action="/auth/clan/remove-admin/{{ a.id }}" onsubmit="return confirm('Αφαίρεση του admin {{ a.username }}?');">
<button type="submit" class="btn-danger">Αφαίρεση</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="empty-state" style="padding: 16px 0;">
Δεν έχετε προσθέσει κανέναν website admin ακόμη.
</div>
{% endif %}
</div>
{% endif %}
<!-- ===================== 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>
<th></th>
</tr>
</thead>
<tbody>
{% for m in members %}
<tr>
<td>
<div class="player-name">{{ m.player_name }}</div>
<div class="player-id">ID: {{ m.player_id }}</div>
</td>
<td>
{% if m.is_online %}
<span class="status-online">● Online</span>
{% else %}
<span class="status-offline">● Offline</span>
{% endif %}
</td>
<td>
{% if clan.owner_id == current_user.id %}
<form method="POST" action="/auth/clan/update-features/{{ m.player_id }}" style="display:inline;">
<div class="toggle-group">
<label class="toggle-label">
<input type="checkbox" name="farm" onchange="this.form.submit()" {{ 'checked' if m.feat_farm }}> 🌾 Farm
</label>
<label class="toggle-label">
<input type="checkbox" name="admin" onchange="this.form.submit()" {{ 'checked' if m.feat_admin }}> 🏛 Admin
</label>
</div>
</form>
{% else %}
<div class="toggle-group" style="opacity: 0.8;">
<span class="toggle-label" style="cursor:default; border-color: {{ '#3fb950' if m.feat_farm else '#30363d' }}; color: {{ '#3fb950' if m.feat_farm else '#8b949e' }};">🌾 Farm</span>
<span class="toggle-label" style="cursor:default; border-color: {{ '#3fb950' if m.feat_admin else '#30363d' }}; color: {{ '#3fb950' if m.feat_admin else '#8b949e' }};">🏛 Admin</span>
</div>
{% endif %}
</td>
<td style="color:#8b949e; font-size:0.8rem;">{{ m.joined_at }}</td>
<td style="text-align:right;">
{% if clan.owner_id == current_user.id %}
<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>
{% endif %}
</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>