more accessibility

This commit is contained in:
nocci 2025-05-02 14:49:43 +02:00
parent 6649cd6e23
commit 3313fb0a89
1 changed files with 217 additions and 143 deletions

234
setup.sh
View File

@ -1032,15 +1032,24 @@ cat <<HTML_END > templates/base.html
<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">
<title>{{ _('Game Key Manager') }}</title>
<!-- PWA Manifest -->
<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>
<!-- Critical CSS (Above-the-Fold) kann hier inline ergänzt werden -->
<!-- Eigene Styles -->
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
{# LCP-Optimierung: Preload für das erste Cover-Bild, falls vorhanden #}
{% 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>
<body>
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container">
@ -1049,7 +1058,7 @@ cat <<HTML_END > templates/base.html
<span>Game Key Manager</span>
</a>
<div class="d-flex align-items-center gap-3">
<form class="d-flex" action="{{ url_for('index') }}" method="GET">
<form class="d-flex" action="{{ url_for('index') }}" method="GET" role="search" aria-label="{{ _('Search games') }}">
<label for="searchInput" class="visually-hidden">{{ _('Search') }}</label>
<input class="form-control me-2"
type="search"
@ -1057,7 +1066,7 @@ cat <<HTML_END > templates/base.html
id="searchInput"
placeholder="{{ _('Search') }}"
value="{{ search_query }}">
<button class="btn btn-outline-success" type="submit">🔍</button>
<button class="btn btn-outline-success" type="submit" aria-label="{{ _('Search') }}">🔍</button>
</form>
<div class="form-check form-switch">
<input class="form-check-input"
@ -1115,16 +1124,17 @@ cat <<HTML_END > templates/base.html
}
// Dark Mode Switch
document.addEventListener('DOMContentLoaded', function() {
const toggle = document.getElementById('darkModeSwitch')
const html = document.documentElement
const toggle = document.getElementById('darkModeSwitch');
const html = document.documentElement;
if (toggle) {
toggle.addEventListener('change', function() {
const theme = this.checked ? 'dark' : 'light'
const theme = this.checked ? 'dark' : 'light';
fetch('/set-theme/' + theme)
.then(() => html.setAttribute('data-bs-theme', theme))
.then(() => html.setAttribute('data-bs-theme', theme));
});
}
});
</script>
{% include "footer.html" %}
</body>
@ -1170,13 +1180,15 @@ cat <<HTML_END > templates/index.html
class="game-cover"
{% if loop.first %}fetchpriority="high"{% endif %}
width="368"
height="172">
height="172"
loading="lazy">
{% elif game.url and 'gog.com' in game.url %}
<img src="{{ url_for('static', filename='gog_logo.webp') }}"
alt="GOG Logo"
class="game-cover"
width="368"
height="172">
height="172"
loading="lazy">
{% endif %}
</td>
<td>{{ game.name }}</td>
@ -1257,87 +1269,134 @@ HTML_END
cat <<HTML_END > templates/login.html
{% extends "base.html" %}
{% block content %}
<div class="row justify-content-center mt-5">
<div class="col-md-6">
<div class="card shadow-sm">
<div class="card-body text-center">
<img src="{{ url_for('static', filename='logo.webp') }}" alt="Logo" width="266" height="206" class="mb-4" style="object-fit:contain;">
<h2 class="card-title mb-4">{{ _('Login') }}</h2>
<form method="POST">
<div class="row justify-content-center">
<div class="col-md-6 col-lg-4">
<h1 class="mb-4">{{ _('Login') }}</h1>
<form method="POST" aria-label="{{ _('Login form') }}" autocomplete="on">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="mb-3">
<label class="form-label">{{ _('Username') }}</label>
<input type="text" name="username" class="form-control" required>
<label for="username" class="form-label">{{ _('Username') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="text"
id="username"
name="username"
class="form-control"
required
autocomplete="username"
aria-required="true"
autofocus>
</div>
<div class="mb-3">
<label class="form-label">{{ _('Password') }}</label>
<input type="password" name="password" class="form-control" required>
<label for="password" class="form-label">{{ _('Password') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="password"
id="password"
name="password"
class="form-control"
required
autocomplete="current-password"
aria-required="true">
</div>
{% if error %}
<div class="alert alert-danger" role="alert">
{{ error }}
</div>
{% endif %}
<button type="submit" class="btn btn-primary w-100">{{ _('Login') }}</button>
</form>
<div class="mt-3 text-center">
<a href="{{ url_for('register') }}">{{ _('No account yet? Register') }}</a>
</div>
</div>
<a href="{{ url_for('register') }}">{{ _('No account? Register here!') }}</a>
</div>
</div>
</div>
{% endblock %}
HTML_END
# Register Template
cat <<HTML_END > templates/register.html
{% extends "base.html" %}
{% block content %}
<div class="row justify-content-center mt-5">
<div class="col-md-6">
<div class="card shadow-sm">
<div class="card-body">
<h2 class="card-title mb-4">{{ _('Register') }}</h2>
<form method="POST">
<div class="row justify-content-center">
<div class="col-md-6 col-lg-4">
<h1 class="mb-4">{{ _('Register') }}</h1>
<form method="POST" aria-label="{{ _('Registration form') }}" autocomplete="on">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="mb-3">
<label class="form-label">{{ _('Username') }}</label>
<input type="text" name="username" class="form-control" required>
<label for="reg-username" class="form-label">{{ _('Username') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="text"
id="reg-username"
name="username"
class="form-control"
required
autocomplete="username"
aria-required="true">
</div>
<div class="mb-3">
<label class="form-label">{{ _('Password') }}</label>
<input type="password" name="password" class="form-control" required>
<label for="reg-password" class="form-label">{{ _('Password') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="password"
id="reg-password"
name="password"
class="form-control"
required
autocomplete="new-password"
aria-required="true">
</div>
<div class="mb-3">
<label for="reg-password2" class="form-label">{{ _('Confirm Password') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="password"
id="reg-password2"
name="password2"
class="form-control"
required
autocomplete="new-password"
aria-required="true">
</div>
{% if error %}
<div class="alert alert-danger" role="alert">
{{ error }}
</div>
{% endif %}
<button type="submit" class="btn btn-primary w-100">{{ _('Register') }}</button>
</form>
</div>
<div class="mt-3 text-center">
<a href="{{ url_for('login') }}">{{ _('Already have an account? Login!') }}</a>
</div>
</div>
</div>
{% endblock %}
HTML_END
# Change Password Template
cat <<HTML_END > templates/change_password.html
{% extends "base.html" %}
{% block content %}
<div class="card p-4 shadow-sm">
<div class="row justify-content-center">
<div class="col-md-6 col-lg-5">
<div class="card p-4 shadow-sm">
<h2 class="mb-4">{{ _('Change Password') }}</h2>
<form method="POST">
<form method="POST" aria-label="{{ _('Change password form') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="mb-3">
<label class="form-label">{{ _('Current Password') }}</label>
<input type="password" name="current_password" class="form-control" required>
<label for="current_password" class="form-label">{{ _('Current Password') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="password" id="current_password" name="current_password" class="form-control" required autocomplete="current-password" aria-required="true">
</div>
<div class="mb-3">
<label class="form-label">{{ _('New Password') }}</label>
<input type="password" name="new_password" class="form-control" required>
<label for="new_password" class="form-label">{{ _('New Password') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="password" id="new_password" name="new_password" class="form-control" required autocomplete="new-password" aria-required="true">
</div>
<div class="mb-3">
<label class="form-label">{{ _('Confirm New Password') }}</label>
<input type="password" name="confirm_password" class="form-control" required>
<label for="confirm_password" class="form-label">{{ _('Confirm New Password') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="password" id="confirm_password" name="confirm_password" class="form-control" required autocomplete="new-password" aria-required="true">
</div>
<button type="submit" class="btn btn-primary">{{ _('Change Password') }}</button>
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary ms-2">{{ _('Cancel') }}</a>
</form>
</div>
</div>
</div>
{% endblock %}
HTML_END
@ -1347,50 +1406,51 @@ cat <<HTML_END > templates/edit_game.html
{% block content %}
<div class="card p-4 shadow-sm">
<h2 class="mb-4">{{ _('Edit Game') }}</h2>
<form method="POST">
<form method="POST" aria-label="{{ _('Edit Game') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="row g-3">
<div class="col-md-6">
<label class="form-label">{{ _('Name') }} *</label>
<input type="text" name="name" class="form-control" value="{{ game.name }}" required>
<label for="game_name" class="form-label">{{ _('Name') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="text" id="game_name" name="name" class="form-control" value="{{ game.name }}" required aria-required="true">
</div>
<div class="col-md-6">
<label class="form-label">{{ _('Game Key') }} *</label>
<input type="text" name="steam_key" class="form-control" value="{{ game.steam_key }}" required>
<label for="game_key" class="form-label">{{ _('Game Key') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="text" id="game_key" name="steam_key" class="form-control" value="{{ game.steam_key }}" required aria-required="true">
</div>
<div class="col-md-6">
<label class="form-label">{{ _('Steam AppID (optional)') }}</label>
<input type="text" name="steam_appid" class="form-control" value="{{ game.steam_appid or '' }}">
<label for="game_appid" class="form-label">{{ _('Steam AppID (optional)') }}</label>
<input type="text" id="game_appid" name="steam_appid" class="form-control" value="{{ game.steam_appid or '' }}">
</div>
<div class="col-md-4">
<label class="form-label">{{ _('Status') }} *</label>
<select name="status" class="form-select" required>
<label for="game_status" class="form-label">{{ _('Status') }} <span aria-hidden="true" class="text-danger">*</span></label>
<select id="game_status" name="status" class="form-select" required aria-required="true">
<option value="nicht eingelöst" {% if game.status == 'nicht eingelöst' %}selected{% endif %}>{{ _('Not redeemed') }}</option>
<option value="verschenkt" {% if game.status == 'verschenkt' %}selected{% endif %}>{{ _('Gifted') }}</option>
<option value="eingelöst" {% if game.status == 'eingelöst' %}selected{% endif %}>{{ _('Redeemed') }}</option>
</select>
</div>
<div class="col-md-4">
<label class="form-label">{{ _('Redeem by') }}</label>
<input type="date" name="redeem_date" class="form-control" value="{{ redeem_date }}">
<label for="game_redeem_date" class="form-label">{{ _('Redeem by') }}</label>
<input type="date" id="game_redeem_date" name="redeem_date" class="form-control" value="{{ redeem_date }}">
</div>
<div class="col-md-4">
<label class="form-label">{{ _('Recipient') }}</label>
<input type="text" name="recipient" class="form-control" value="{{ game.recipient }}">
<label for="game_recipient" class="form-label">{{ _('Recipient') }}</label>
<input type="text" id="game_recipient" name="recipient" class="form-control" value="{{ game.recipient }}">
</div>
<div class="col-12">
<label class="form-label">{{ _('Shop URL') }}</label>
<input type="url" name="url" class="form-control" value="{{ game.url }}">
<label for="game_url" class="form-label">{{ _('Shop URL') }}</label>
<input type="url" id="game_url" name="url" class="form-control" value="{{ game.url }}">
</div>
<div class="col-12">
<label class="form-label">{{ _('Notes') }}</label>
<textarea name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
<label for="game_notes" class="form-label">{{ _('Notes') }}</label>
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
</div>
<div class="col-12">
{% if redeem_url and active_redeem %}
<div class="mb-3">
<label class="form-label">{{ _('Active Redeem Link') }}</label>
<label for="active_redeem_link" class="form-label">{{ _('Active Redeem Link') }}</label>
<input type="text"
id="active_redeem_link"
class="form-control"
value="{{ redeem_url }}"
readonly
@ -1403,7 +1463,7 @@ cat <<HTML_END > templates/edit_game.html
</div>
<div class="col-12">
<button type="submit" class="btn btn-primary">{{ _('Save') }}</button>
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary">{{ _('Cancel') }}</a>
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary ms-2">{{ _('Cancel') }}</a>
</div>
</div>
</form>
@ -1416,40 +1476,44 @@ cat <<HTML_END > templates/add_game.html
{% block content %}
<div class="card p-4 shadow-sm">
<h2 class="mb-4">{{ _('Add New Game') }}</h2>
<form method="POST">
<form method="POST" aria-label="{{ _('Add New Game') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="row g-3">
<div class="col-md-6">
<label class="form-label">{{ _('Name') }} *</label>
<input type="text" name="name" class="form-control" required>
<label for="game_name" class="form-label">{{ _('Name') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="text" id="game_name" name="name" class="form-control" required aria-required="true">
</div>
<div class="col-md-6">
<label class="form-label">{{ _('Game Key') }} *</label>
<input type="text" name="steam_key" class="form-control" required>
<label for="game_key" class="form-label">{{ _('Game Key') }} <span aria-hidden="true" class="text-danger">*</span></label>
<input type="text" id="game_key" name="steam_key" class="form-control" required aria-required="true">
</div>
<div class="col-md-4">
<label class="form-label">{{ _('Status') }} *</label>
<select name="status" class="form-select" required>
<label for="game_status" class="form-label">{{ _('Status') }} <span aria-hidden="true" class="text-danger">*</span></label>
<select id="game_status" name="status" class="form-select" required aria-required="true">
<option value="nicht eingelöst">{{ _('Not redeemed') }}</option>
<option value="verschenkt">{{ _('Gifted') }}</option>
<option value="eingelöst">{{ _('Redeemed') }}</option>
</select>
</div>
<div class="col-md-4">
<label class="form-label">{{ _('Redeem by') }}</label>
<input type="date" name="redeem_date" class="form-control">
<label for="game_redeem_date" class="form-label">{{ _('Redeem by') }}</label>
<input type="date" id="game_redeem_date" name="redeem_date" class="form-control">
</div>
<div class="col-md-4">
<label class="form-label">{{ _('Recipient') }}</label>
<input type="text" name="recipient" class="form-control">
<label for="game_recipient" class="form-label">{{ _('Recipient') }}</label>
<input type="text" id="game_recipient" name="recipient" class="form-control">
</div>
<div class="col-md-6">
<label for="game_appid" class="form-label">{{ _('Steam AppID (optional)') }}</label>
<input type="text" id="game_appid" name="steam_appid" class="form-control">
</div>
<div class="col-md-6">
<label for="game_url" class="form-label">{{ _('Shop URL') }}</label>
<input type="url" id="game_url" name="url" class="form-control">
</div>
<div class="col-12">
<label class="form-label">{{ _('Shop URL') }}</label>
<input type="url" name="url" class="form-control">
</div>
<div class="col-12">
<label class="form-label">{{ _('Notes') }}</label>
<textarea name="notes" class="form-control" rows="3"></textarea>
<label for="game_notes" class="form-label">{{ _('Notes') }}</label>
<textarea id="game_notes" name="notes" class="form-control" rows="3"></textarea>
</div>
<div class="col-12">
<button type="submit" class="btn btn-success">{{ _('Save') }}</button>
@ -1663,6 +1727,16 @@ body {
padding: 4px 8px;
}
.badge.bg-warning {
background-color: #ffcc00 !important;
color: #222 !important;
}
.badge.bg-success {
background-color: #198754 !important;
color: #fff !important;
}
.game-cover {
width: 368px;
height: 172px;