stream-fusion-better/stream_fusion/static/admin/base.html

386 lines
15 KiB
HTML

{% set csrf_token = csrf_token_gen() %}<!DOCTYPE html>
<html lang="fr" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}StreamFusion Admin{% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
<style>
:root {
--sidebar-width: 240px;
--topbar-height: 56px;
--sidebar-bg: #1a1d21;
--sidebar-hover: #2c3036;
--sidebar-active-color: #0d6efd;
--sidebar-active-bg: rgba(13, 110, 253, 0.15);
}
body {
transition: background-color 0.2s ease, color 0.2s ease;
min-height: 100vh;
}
/* ── Sidebar ── */
#sidebar {
position: fixed;
top: 0;
left: 0;
width: var(--sidebar-width);
height: 100vh;
background-color: var(--sidebar-bg);
display: flex;
flex-direction: column;
z-index: 1000;
border-right: 1px solid rgba(255,255,255,0.07);
overflow-y: auto;
}
.sidebar-brand {
display: flex;
align-items: center;
gap: 10px;
padding: 18px 20px;
font-size: 1.05rem;
font-weight: 600;
color: #fff;
text-decoration: none;
border-bottom: 1px solid rgba(255,255,255,0.07);
flex-shrink: 0;
}
.sidebar-brand .brand-icon {
font-size: 1.4rem;
color: var(--sidebar-active-color);
}
.sidebar-nav {
flex: 1;
padding: 12px 0;
}
.sidebar-section {
padding: 8px 20px 4px;
font-size: 0.68rem;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(255,255,255,0.35);
margin-top: 8px;
}
.sidebar-link {
display: flex;
align-items: center;
gap: 11px;
padding: 9px 20px;
color: rgba(255,255,255,0.65);
text-decoration: none;
font-size: 0.875rem;
transition: all 0.15s ease;
border-left: 3px solid transparent;
}
.sidebar-link:hover {
background-color: var(--sidebar-hover);
color: rgba(255,255,255,0.9);
}
.sidebar-link.active {
background-color: var(--sidebar-active-bg);
color: #fff;
border-left-color: var(--sidebar-active-color);
font-weight: 500;
}
.sidebar-link i {
font-size: 1rem;
width: 18px;
text-align: center;
flex-shrink: 0;
}
.sidebar-footer {
padding: 16px 20px;
border-top: 1px solid rgba(255,255,255,0.07);
flex-shrink: 0;
}
.sidebar-footer .logout-link {
display: flex;
align-items: center;
gap: 11px;
color: rgba(255,255,255,0.45);
text-decoration: none;
font-size: 0.875rem;
transition: color 0.15s;
}
.sidebar-footer .logout-link:hover {
color: #dc3545;
}
/* ── Topbar ── */
#topbar {
position: fixed;
top: 0;
left: var(--sidebar-width);
right: 0;
height: var(--topbar-height);
background-color: var(--bs-body-bg);
border-bottom: 1px solid var(--bs-border-color);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
z-index: 999;
}
.topbar-title {
font-size: 1rem;
font-weight: 600;
color: var(--bs-body-color);
margin: 0;
}
/* ── Main content ── */
#main-content {
margin-left: var(--sidebar-width);
margin-top: var(--topbar-height);
padding: 28px;
min-height: calc(100vh - var(--topbar-height));
}
/* ── Theme toggle ── */
.theme-toggle-btn {
background: none;
border: 1px solid var(--bs-border-color);
color: var(--bs-body-color);
padding: 5px 10px;
border-radius: 6px;
cursor: pointer;
font-size: 0.85rem;
display: flex;
align-items: center;
gap: 6px;
transition: all 0.15s;
}
.theme-toggle-btn:hover {
background: var(--bs-secondary-bg);
}
/* ── Stat cards ── */
.stat-card {
border: 1px solid var(--bs-border-color);
border-radius: 10px;
padding: 20px;
background: var(--bs-secondary-bg);
}
.stat-card .stat-value {
font-size: 2rem;
font-weight: 700;
line-height: 1;
}
.stat-card .stat-label {
font-size: 0.8rem;
color: var(--bs-secondary-color);
margin-top: 4px;
}
.stat-card .stat-icon {
font-size: 1.8rem;
opacity: 0.4;
}
/* ── Light mode sidebar overrides ── */
[data-bs-theme="light"] #sidebar {
background-color: #f0f2f5;
border-right-color: rgba(0,0,0,0.1);
}
[data-bs-theme="light"] .sidebar-brand { color: #212529; border-bottom-color: rgba(0,0,0,0.1); }
[data-bs-theme="light"] .sidebar-link { color: rgba(0,0,0,0.6); }
[data-bs-theme="light"] .sidebar-link:hover { background-color: #e2e6ea; color: rgba(0,0,0,0.85); }
[data-bs-theme="light"] .sidebar-link.active { color: #0d6efd; background-color: rgba(13,110,253,0.08); }
[data-bs-theme="light"] .sidebar-footer { border-top-color: rgba(0,0,0,0.1); }
[data-bs-theme="light"] .sidebar-footer .logout-link { color: rgba(0,0,0,0.4); }
[data-bs-theme="light"] .sidebar-section { color: rgba(0,0,0,0.35); }
</style>
{% block extra_head %}{% endblock %}
</head>
<body>
<!-- Sidebar -->
<nav id="sidebar">
<a class="sidebar-brand" href="{{ url_for('dashboard')(request) }}">
<i class="bi bi-lightning-fill brand-icon"></i>
<div>
<div>StreamFusion</div>
<div style="font-size:0.65rem;font-weight:400;opacity:0.5;margin-top:1px;">v{{ app_version }}</div>
</div>
</a>
<div class="sidebar-nav">
<div class="sidebar-section">Général</div>
<a class="sidebar-link {% if '/dashboard' in request.url.path %}active{% endif %}"
href="{{ url_for('dashboard')(request) }}">
<i class="bi bi-speedometer2"></i> Dashboard
</a>
<div class="sidebar-section">Accès</div>
<a class="sidebar-link {% if 'api-keys' in request.url.path or 'create-api-key' in request.url.path %}active{% endif %}"
href="{{ url_for('list_api_keys')(request) }}">
<i class="bi bi-key"></i> Clés API
</a>
<a class="sidebar-link {% if 'peer-keys' in request.url.path or 'create-peer-key' in request.url.path %}active{% endif %}"
href="{{ url_for('list_peer_keys')(request) }}">
<i class="bi bi-diagram-3"></i> Peer Keys
</a>
<div class="sidebar-section">Base de données</div>
<a class="sidebar-link {% if '/search/tmdb' in request.url.path %}active{% endif %}"
href="{{ url_for('search_tmdb_page')(request) }}">
<i class="bi bi-film"></i> Par TMDB ID
</a>
<a class="sidebar-link {% if '/search/hash' in request.url.path %}active{% endif %}"
href="{{ url_for('search_hash_page')(request) }}">
<i class="bi bi-hash"></i> Par hash
</a>
<a class="sidebar-link {% if '/search/groups' in request.url.path %}active{% endif %}"
href="{{ url_for('search_groups_page')(request) }}">
<i class="bi bi-collection"></i> Groupes torrents
</a>
<div class="sidebar-section">Matching TMDB</div>
<a class="sidebar-link {% if '/search/unmatched' in request.url.path %}active{% endif %}"
href="{{ url_for('search_unmatched_page')(request) }}">
<i class="bi bi-question-circle"></i> Non-matchés
</a>
<a class="sidebar-link {% if '/mismatches' in request.url.path %}active{% endif %}"
href="{{ url_for('list_mismatches')(request) }}">
<i class="bi bi-exclamation-triangle"></i> Mismatches
</a>
<a class="sidebar-link {% if '/mappings' in request.url.path %}active{% endif %}"
href="{{ url_for('list_mappings')(request) }}">
<i class="bi bi-arrow-left-right"></i> Mappings méta
</a>
<a class="sidebar-link {% if '/tmdb-matcher' in request.url.path %}active{% endif %}"
href="{{ url_for('tmdb_matcher_page')(request) }}">
<i class="bi bi-link-45deg"></i> TMDB Matcher
</a>
<div class="sidebar-section">Règles</div>
<a class="sidebar-link {% if '/matching/title-rules' in request.url.path %}active{% endif %}"
href="{{ url_for('matching_title_rules')(request) }}">
<i class="bi bi-type"></i> Règles titres
</a>
<a class="sidebar-link {% if '/matching/language-rules' in request.url.path %}active{% endif %}"
href="{{ url_for('matching_language_rules')(request) }}">
<i class="bi bi-translate"></i> Règles langue
</a>
<a class="sidebar-link {% if '/matching/test' in request.url.path %}active{% endif %}"
href="{{ url_for('matching_test_page')(request) }}">
<i class="bi bi-play-circle"></i> Test matching
</a>
<div class="sidebar-section">Système</div>
<a class="sidebar-link {% if '/scheduler' in request.url.path %}active{% endif %}"
href="{{ url_for('scheduler_page')(request) }}">
<i class="bi bi-clock-history"></i> Tâches planifiées
</a>
<a class="sidebar-link {% if '/maintenance' in request.url.path %}active{% endif %}"
href="{{ url_for('maintenance_page')(request) }}">
<i class="bi bi-tools"></i> Maintenance
</a>
<a class="sidebar-link {% if '/config' in request.url.path %}active{% endif %}"
href="{{ url_for('config_page')(request) }}">
<i class="bi bi-sliders"></i> Configuration
</a>
</div>
<div class="sidebar-footer">
<div style="margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.07);">
<div style="font-size:0.68rem;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:rgba(255,255,255,0.25);margin-bottom:6px;">Support</div>
<div class="d-flex flex-column gap-1">
<a href="https://github.com/LimeHubs/stream-fusion" target="_blank" rel="noopener"
style="display:flex;align-items:center;gap:8px;color:rgba(255,255,255,0.45);text-decoration:none;font-size:0.8rem;transition:color 0.15s;"
onmouseover="this.style.color='rgba(255,255,255,0.85)'" onmouseout="this.style.color='rgba(255,255,255,0.45)'">
<i class="bi bi-github" style="width:16px;text-align:center;"></i> Dépôt GitHub
</a>
<a href="https://github.com/LimeHubs/stream-fusion/issues/new/choose" target="_blank" rel="noopener"
style="display:flex;align-items:center;gap:8px;color:rgba(255,255,255,0.45);text-decoration:none;font-size:0.8rem;transition:color 0.15s;"
onmouseover="this.style.color='#dc3545'" onmouseout="this.style.color='rgba(255,255,255,0.45)'">
<i class="bi bi-bug" style="width:16px;text-align:center;"></i> Signaler un bug
</a>
<a href="https://github.com/LimeHubs/stream-fusion/discussions/new/choose" target="_blank" rel="noopener"
style="display:flex;align-items:center;gap:8px;color:rgba(255,255,255,0.45);text-decoration:none;font-size:0.8rem;transition:color 0.15s;"
onmouseover="this.style.color='rgba(255,255,255,0.85)'" onmouseout="this.style.color='rgba(255,255,255,0.45)'">
<i class="bi bi-chat-dots" style="width:16px;text-align:center;"></i> Discussions
</a>
</div>
</div>
<a class="logout-link" href="{{ url_for('logout')(request) }}">
<i class="bi bi-box-arrow-left"></i> Déconnexion
</a>
</div>
</nav>
<!-- Topbar -->
<header id="topbar">
<h6 class="topbar-title">{% block page_title %}Administration{% endblock %}</h6>
<div class="d-flex align-items-center gap-3">
<button class="theme-toggle-btn" id="themeToggle">
<i class="bi bi-moon-fill" id="themeIcon"></i>
<span id="themeLabel">Sombre</span>
</button>
</div>
</header>
<!-- Main content -->
<main id="main-content">
{% block content %}{% endblock %}
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
const themeToggle = document.getElementById('themeToggle');
const themeIcon = document.getElementById('themeIcon');
const themeLabel = document.getElementById('themeLabel');
const html = document.documentElement;
function applyTheme(theme) {
html.setAttribute('data-bs-theme', theme);
localStorage.setItem('sf-theme', theme);
if (theme === 'dark') {
themeIcon.className = 'bi bi-moon-fill';
themeLabel.textContent = 'Sombre';
} else {
themeIcon.className = 'bi bi-sun-fill';
themeLabel.textContent = 'Clair';
}
}
const savedTheme = localStorage.getItem('sf-theme') || 'dark';
applyTheme(savedTheme);
themeToggle.addEventListener('click', () => {
applyTheme(html.getAttribute('data-bs-theme') === 'dark' ? 'light' : 'dark');
});
</script>
<script>
// Server-generated CSRF token — automatically injected into all POST forms
window.__ADMIN_CSRF__ = "{{ csrf_token }}";
document.addEventListener('submit', function(e) {
var form = e.target;
if (form.method && form.method.toLowerCase() === 'post') {
if (!form.querySelector('input[name="csrf_token"]')) {
var input = document.createElement('input');
input.type = 'hidden';
input.name = 'csrf_token';
input.value = window.__ADMIN_CSRF__ || '';
form.appendChild(input);
}
}
});
</script>
{% block extra_scripts %}{% endblock %}
</body>
</html>