132 lines
		
	
	
	
		
			6.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			132 lines
		
	
	
	
		
			6.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html lang="{{ session.get('lang', 'en') }}" data-bs-theme="{{ theme }}">
 | |
| <head>
 | |
|     <meta charset="UTF-8">
 | |
|     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | |
|     <meta name="csrf-token" content="{{ csrf_token() }}">
 | |
|     <meta name="description" content="Manage your Steam and GOG keys efficiently. Track redemption dates, share games, and export lists.">
 | |
|     <meta name="theme-color" content="#212529">
 | |
|     <link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}">
 | |
|     <title>{{ _('Game Key Manager') }}</title>
 | |
|     <!-- Preload Bootstrap CSS for better LCP -->
 | |
|     <link rel="preload" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
 | |
|     <noscript><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"></noscript>
 | |
|     <!-- My Styles -->
 | |
|     <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
 | |
|     {% if games and games[0].steam_appid %}
 | |
|     <link rel="preload"
 | |
|           as="image"
 | |
|           href="https://cdn.cloudflare.steamstatic.com/steam/apps/{{ games[0].steam_appid }}/header.jpg"
 | |
|           imagesrcset="https://cdn.cloudflare.steamstatic.com/steam/apps/{{ games[0].steam_appid }}/header.jpg 368w"
 | |
|           fetchpriority="high"
 | |
|           type="image/jpeg">
 | |
|     {% endif %}
 | |
| </head>
 | |
| <script>
 | |
| (function() {
 | |
|   try {
 | |
|     var theme = localStorage.getItem('theme');
 | |
|     if (!theme) {
 | |
|       // Systempräferenz als Fallback
 | |
|       theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
 | |
|     }
 | |
|     document.documentElement.setAttribute('data-bs-theme', theme);
 | |
|   } catch(e) {}
 | |
| })();
 | |
| </script>
 | |
| <body>
 | |
| <nav class="navbar navbar-expand-lg bg-body-tertiary">
 | |
|   <div class="container">
 | |
|     <a class="navbar-brand d-flex align-items-center gap-2" href="/">
 | |
|       <img src="{{ url_for('static', filename='logo_small.webp') }}" alt="Logo" width="36" height="28" style="object-fit:contain; border-radius:8px;">
 | |
|       <span>Game Key Manager</span>
 | |
|     </a>
 | |
|     <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNavbar" aria-controls="mainNavbar" aria-expanded="false" aria-label="Toggle navigation">
 | |
|       <span class="navbar-toggler-icon"></span>
 | |
|     </button>
 | |
|     <div class="collapse navbar-collapse flex-grow-1" id="mainNavbar">
 | |
|       <form class="d-flex ms-auto my-2 my-lg-0" action="{{ url_for('index') }}" method="GET" role="search" aria-label="{{ _('Search games') }}">
 | |
|         <input class="form-control me-2" type="search" name="q" id="searchInput" placeholder="{{ _('Search') }}" value="{{ search_query }}">
 | |
|         <button class="btn btn-outline-success" type="submit" aria-label="{{ _('Search') }}">🔍</button>
 | |
|       </form>
 | |
|       <ul class="navbar-nav ms-lg-3 mb-2 mb-lg-0">
 | |
|         <li class="nav-item dropdown">
 | |
|           <a class="nav-link dropdown-toggle" href="#" id="langDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
 | |
|             {% if session.get('lang', 'en') == 'de' %} Deutsch {% elif session.get('lang', 'en') == 'en' %} English {% else %} Sprache {% endif %}
 | |
|           </a>
 | |
|           <ul class="dropdown-menu" aria-labelledby="langDropdown">
 | |
|             <li><a class="dropdown-item {% if session.get('lang', 'en') == 'de' %}active{% endif %}" href="{{ url_for('set_lang', lang='de') }}">Deutsch</a></li>
 | |
|             <li><a class="dropdown-item {% if session.get('lang', 'en') == 'en' %}active{% endif %}" href="{{ url_for('set_lang', lang='en') }}">English</a></li>
 | |
|           </ul>
 | |
|         </li>
 | |
|         {% if current_user.is_authenticated %}
 | |
|           {% if current_user.is_admin %}
 | |
|           <li class="nav-item"><a class="nav-link" href="{{ url_for('admin_users') }}">⚙️ {{ _('Admin') }}</a></li>
 | |
|           <li class="nav-item"><a class="nav-link" href="{{ url_for('admin_audit_logs') }}">📜 {{ _('Audit Logs') }}</a></li>
 | |
|           {% endif %}
 | |
|           <li class="nav-item"><a class="nav-link" href="{{ url_for('change_password') }}">🔒 {{ _('Password') }}</a></li>
 | |
|           <li class="nav-item"><a class="nav-link" href="{{ url_for('logout') }}">🚪 {{ _('Logout') }}</a></li>
 | |
|         {% endif %}
 | |
|       </ul>
 | |
|     </div>
 | |
|   </div>
 | |
| </nav>
 | |
|     <div class="container mt-4">
 | |
|         {% with messages = get_flashed_messages(with_categories=true) %}
 | |
|             {% if messages %}
 | |
|                 <div class="flash-container">
 | |
|                   {% for category, message in messages %}
 | |
|                     <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
 | |
|                       {{ message|safe }}
 | |
|                     <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
 | |
|                     </div>
 | |
|                   {% endfor %}
 | |
|                 </div>
 | |
|             {% endif %}
 | |
|         {% endwith %}
 | |
|         {% block content %}{% endblock %}
 | |
|     </div>
 | |
|     <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
 | |
|     <script>
 | |
|     // Service Worker Registration for PWA
 | |
|     if ('serviceWorker' in navigator) {
 | |
|       window.addEventListener('load', () => {
 | |
|         navigator.serviceWorker.register('{{ url_for("static", filename="serviceworker.js") }}', {scope: '/'})
 | |
|           .then(registration => {
 | |
|             console.log('ServiceWorker registered:', registration.scope);
 | |
|           })
 | |
|           .catch(error => {
 | |
|             console.log('ServiceWorker registration failed:', error);
 | |
|           });
 | |
|       });
 | |
|     }
 | |
|     // Dark Mode Switch
 | |
|     document.addEventListener('DOMContentLoaded', function() {
 | |
|         const toggle = document.getElementById('darkModeSwitch');
 | |
|         const html = document.documentElement;
 | |
|         if (toggle) {
 | |
|             toggle.checked = (html.getAttribute('data-bs-theme') === 'dark')
 | |
|             toggle.addEventListener('change', function() {
 | |
|                 const theme = this.checked ? 'dark' : 'light';
 | |
|                 document.cookie = "theme=" + theme + ";path=/;max-age=31536000";
 | |
|                 html.setAttribute('data-bs-theme', theme);
 | |
|                 fetch('/set-theme/' + theme);
 | |
|             });
 | |
|         }
 | |
|         // Set theme on page load
 | |
|         function getThemeCookie() {
 | |
|           const cookies = document.cookie.split(';');
 | |
|             for (let cookie of cookies) {
 | |
|               const [name, value] = cookie.trim().split('=');
 | |
|               if (name === 'theme') return value;
 | |
|             }
 | |
|             return null;
 | |
|         }
 | |
|         const savedTheme = getThemeCookie() || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
 | |
|         document.documentElement.setAttribute('data-bs-theme', savedTheme);
 | |
|     });
 | |
| 
 | |
|     </script>
 | |
| {% include "footer.html" %}
 | |
| </body>
 | |
| </html>
 |