seems to be the last RC - this app is done - so am I
41
steam-gift-manager/.env
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Flask-Configuration
|
||||
SECRET_KEY="ef16ed848264df8391a7f9769f0ac13d5d4c1a711793bb6b"
|
||||
REDEEM_SECRET="02c6a04e663604a837141d79e75b0a93"
|
||||
WTF_CSRF_SECRET_KEY="5c6c0f730c337afb804ba21c6e1b3f93"
|
||||
|
||||
# Language Settings
|
||||
DEFAULT_LANGUAGE="en"
|
||||
SUPPORTED_LANGUAGES="de,en"
|
||||
|
||||
# Timezone
|
||||
TZ=Europe/Berlin
|
||||
|
||||
# Security
|
||||
FORCE_HTTPS=False
|
||||
SESSION_COOKIE_SECURE=auto
|
||||
CSRF_ENABLED="True"
|
||||
|
||||
# Account registration
|
||||
REGISTRATION_ENABLED="True"
|
||||
|
||||
# checking interval if keys have to be redeemed before a specific date
|
||||
CHECK_EXPIRING_KEYS_INTERVAL_HOURS=6
|
||||
|
||||
# Want to check prices? Here you are!
|
||||
ITAD_API_KEY="your-secret-key-here"
|
||||
ITAD_COUNTRY="DE"
|
||||
|
||||
# Apprise URLs (separate several with a comma or space)
|
||||
APPRISE_URLS=""
|
||||
|
||||
### example for multiple notifications
|
||||
#APPRISE_URLS="pover://USER_KEY@APP_TOKEN
|
||||
#gotify://gotify.example.com/TOKEN
|
||||
#matrixs://TOKEN@matrix.org/!ROOM_ID"
|
||||
|
||||
# Redis URL
|
||||
REDIS_URL=redis://redis:6379/0
|
||||
|
||||
# Enable Debug (e.g. for VS Code)
|
||||
FLASK_DEBUG=1
|
||||
DEBUGPY=0
|
|
@ -2,13 +2,25 @@ FROM python:3.10-slim
|
|||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends wget && mkdir -p /app/static && wget -O /app/static/logo.webp "https://drop.nocadmin.net/logo.webp" && wget -O /app/static/logo_small.webp "https://drop.nocadmin.net/logo_small.webp" && wget -O /app/static/forgejo.webp "https://drop.nocadmin.net/forgejo.webp" && wget -O /app/static/gog_logo.webp "https://drop.nocadmin.net/gog_logo.webp" && wget -O /app/static/logo_small_maskable.webp "https://drop.nocadmin.net/logo_small_maskable.webp" && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
wget \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir -p /app/data && chown -R 1000:1000 /app/data
|
||||
RUN apt-get update && apt-get install -y locales && \
|
||||
sed -i '/de_DE.UTF-8/s/^# //' /etc/locale.gen && \
|
||||
locale-gen
|
||||
ENV LC_ALL=de_DE.UTF-8 LANG=de_DE.UTF-8
|
||||
|
||||
ENV TZ=
|
||||
RUN ln -snf /usr/share/zoneinfo/ /etc/localtime && echo > /etc/timezone
|
||||
|
||||
RUN mkdir -p /app/data && \
|
||||
chown -R 1000:1000 /app/data
|
||||
|
||||
ENV TZ=${TZ}
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
COPY entrypoint.sh /app/entrypoint.sh
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
|
@ -18,10 +30,14 @@ COPY . .
|
|||
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
RUN groupadd -g $GID appuser && useradd -u $UID -g $GID -m appuser && chown -R appuser:appuser /app
|
||||
|
||||
RUN groupadd -g ${GID} appuser && \
|
||||
useradd -l -o -u ${UID} -g appuser -m appuser && \
|
||||
mkdir -p /app && \
|
||||
chown -R appuser:appuser /app
|
||||
|
||||
USER appuser
|
||||
|
||||
EXPOSE 5000
|
||||
EXPOSE 5000 5678
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
||||
CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]
|
||||
|
|
|
@ -1,15 +1,44 @@
|
|||
services:
|
||||
redis:
|
||||
image: redis:alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
steam-manager:
|
||||
build: .
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
- UID=0
|
||||
- GID=1000
|
||||
ports:
|
||||
- "5000:5000"
|
||||
- "5678:5678"
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- REGISTRATION_ENABLED=True
|
||||
- TZ=
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
volumes:
|
||||
- ../data:/app/data
|
||||
- ../data:/app/data
|
||||
- ./translations:/app/translations:rw
|
||||
- ../.env:/app/.env
|
||||
user: "0:"
|
||||
- ./static:/app/static:rw
|
||||
user: "0:1000"
|
||||
restart: unless-stopped
|
||||
command: ["/app/entrypoint.sh"]
|
||||
networks:
|
||||
- app-network
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
|
||||
|
||||
|
||||
|
|
16
steam-gift-manager/entrypoint.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Debug-Output
|
||||
echo "🔄 DEBUGPY-Value: ''"
|
||||
echo "🔄 FLASK_DEBUG-Value: ''"
|
||||
|
||||
# Debug-Modus activate if .env told you so
|
||||
if [[ "" == "1" || "" == "1" ]]; then
|
||||
echo "🔄 Starting in DEBUG mode (Port 5678)..."
|
||||
exec python -m debugpy --listen 0.0.0.0:5678 -m flask run --host=0.0.0.0 --port=5000
|
||||
else
|
||||
echo "🚀 Starting in PRODUCTION mode..."
|
||||
exec gunicorn -b 0.0.0.0:5000 app:app
|
||||
fi
|
||||
|
||||
|
|
@ -14,3 +14,7 @@ requests
|
|||
pillow
|
||||
gunicorn
|
||||
apprise
|
||||
debugpy
|
||||
pytz
|
||||
Flask-Session
|
||||
redis
|
||||
|
|
BIN
steam-gift-manager/static/apple-touch-icon.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
steam-gift-manager/static/favicon.ico
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
steam-gift-manager/static/forgejo.webp
Normal file
After Width: | Height: | Size: 740 B |
BIN
steam-gift-manager/static/gog_logo.webp
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
steam-gift-manager/static/logo.webp
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
steam-gift-manager/static/logo_small.webp
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
steam-gift-manager/static/logo_small_maskable.webp
Normal file
After Width: | Height: | Size: 2.5 KiB |
|
@ -13,22 +13,25 @@
|
|||
},
|
||||
"icons": [
|
||||
{
|
||||
"src": "/static/logo_small.webp",
|
||||
"src": "/static/web-app-manifest-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/webp",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/static/logo_small_maskable.webp",
|
||||
"src": "/static/web-app-manifest-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/webp",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "/static/logo.webp",
|
||||
"src": "/static/web-app-manifest-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/webp",
|
||||
"purpose": "any maskable"
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#3f3a3a",
|
||||
"display": "standalone"
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ const ASSETS = [
|
|||
'/',
|
||||
'/static/style.css',
|
||||
'/static/logo.webp',
|
||||
'/static/web-app-manifest-512x512.png',
|
||||
'/static/web-app-manifest-192x192.png',
|
||||
'/static/logo_small.webp',
|
||||
'/static/gog_logo.webp',
|
||||
'/static/forgejo.webp'
|
||||
|
|
|
@ -133,3 +133,38 @@ body {
|
|||
border: 0;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: 1.2em;
|
||||
font-weight: 400;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.navbar-nav .nav-link {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 991.98px) {
|
||||
.navbar-nav {
|
||||
flex-direction: column !important;
|
||||
align-items: flex-start !important;
|
||||
}
|
||||
}
|
||||
|
||||
.card-body img,
|
||||
.steam-description img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
margin: 8px auto;
|
||||
}
|
||||
|
||||
td.font-monospace {
|
||||
word-break: break-all;
|
||||
/* or */
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.alert-error { background-color: #f8d7da; border-color: #f5c6cb; color: #721c24; }
|
||||
.alert-success { background-color: #d4edda; border-color: #c3e6cb; color: #155724; }
|
||||
.alert-info { background: #d9edf7; color: #31708f; }
|
||||
|
||||
|
|
BIN
steam-gift-manager/static/web-app-manifest-192x192.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
steam-gift-manager/static/web-app-manifest-512x512.png
Normal file
After Width: | Height: | Size: 128 KiB |
25
steam-gift-manager/templates/403.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="d-flex flex-column align-items-center justify-content-center" style="min-height:60vh;">
|
||||
<div class="text-center">
|
||||
<img src="{{ url_for('static', filename='logo.webp') }}"
|
||||
alt="Forbidden"
|
||||
class="img-fluid rounded shadow mb-4"
|
||||
style="max-width: 160px;">
|
||||
<h1 class="display-3 fw-bold text-danger mb-3">403</h1>
|
||||
<h2 class="mb-4">{{ _('Access Forbidden') }}</h2>
|
||||
<p class="lead mb-4">
|
||||
<span class="d-block mb-2">{{ _('Sorry, you are not allowed to access this page.') }}</span>
|
||||
<span class="text-muted">({{ _('Registration is currently disabled.') }})</span>
|
||||
</p>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-lg btn-primary shadow">
|
||||
🏠 {{ _('Back to Home') }}
|
||||
</a>
|
||||
<div class="mt-4 text-muted">
|
||||
<small>
|
||||
<span>Sorry, you haven't unlocked this area yet. Grind some more XP or check your DLC entitlements.<br>Maybe try again after the next patch?</span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
25
steam-gift-manager/templates/404.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="d-flex flex-column align-items-center justify-content-center" style="min-height:60vh;">
|
||||
<div class="text-center">
|
||||
<img src="{{ url_for('static', filename='logo.webp') }}"
|
||||
alt="Forbidden"
|
||||
class="img-fluid rounded shadow mb-4"
|
||||
style="max-width: 160px;">
|
||||
<h1 class="display-3 fw-bold text-danger mb-3">404</h1>
|
||||
<h2 class="mb-4">{{ _('Access Forbidden') }}</h2>
|
||||
<p class="lead mb-4">
|
||||
<span class="d-block mb-2">{{ _('Sorry, you are not allowed to access this page.') }}</span>
|
||||
<span class="text-muted">({{ _('Registration is currently disabled.') }})</span>
|
||||
</p>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-lg btn-primary shadow">
|
||||
🏠 {{ _('Back to Home') }}
|
||||
</a>
|
||||
<div class="mt-4 text-muted">
|
||||
<small>
|
||||
<span>Sorry, you haven't unlocked this area yet. Grind some more XP or check your DLC entitlements.<br>Maybe try again after the next patch?</span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,51 +1,94 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="card p-4 shadow-sm">
|
||||
<h2 class="mb-4">{{ _('Add New Game') }}</h2>
|
||||
<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 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 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 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 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 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 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>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary">{{ _('Cancel') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<h2 class="mb-4">{{ _('Add Game') }}</h2>
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<div class="mb-3">
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ 'danger' if category == 'error' else category }}">
|
||||
{{ message|safe }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<form method="POST" aria-label="{{ _('Add Game') }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<div class="row g-3">
|
||||
<!-- Name -->
|
||||
<div class="col-md-6">
|
||||
<label for="game_name" class="form-label">{{ _('Name') }} <span class="text-danger">*</span></label>
|
||||
<input type="text" id="game_name" name="name" class="form-control" value="{{ request.form.name or '' }}" required>
|
||||
</div>
|
||||
|
||||
<!-- Steam Key -->
|
||||
<div class="col-md-6">
|
||||
<label for="game_key" class="form-label">{{ _('Game Key') }} <span class="text-danger">*</span></label>
|
||||
<input type="text" id="game_key" name="steam_key" class="form-control" value="{{ request.form.steam_key or '' }}" required>
|
||||
</div>
|
||||
|
||||
<!-- Platform Dropdown -->
|
||||
<div class="col-md-6">
|
||||
<label for="game_platform" class="form-label">{{ _('Platform') }} <span class="text-danger">*</span></label>
|
||||
<select id="game_platform" name="platform" class="form-select" required>
|
||||
{% for value, label in platforms %}
|
||||
<option value="{{ value }}" {% if request.form.platform == value %}selected{% endif %}>
|
||||
{{ _(label) }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Status Dropdown -->
|
||||
<div class="col-md-6">
|
||||
<label for="game_status" class="form-label">{{ _('Status') }} <span class="text-danger">*</span></label>
|
||||
<select id="game_status" name="status" class="form-select" required>
|
||||
{% for value, label in statuses %}
|
||||
<option value="{{ value }}" {% if request.form.status == value %}selected{% endif %}>
|
||||
{{ _(label) }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Steam AppID -->
|
||||
<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" value="{{ request.form.steam_appid or '' }}">
|
||||
</div>
|
||||
|
||||
<!-- Redeem Date -->
|
||||
<div class="col-md-6">
|
||||
<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="{{ request.form.redeem_date or '' }}">
|
||||
</div>
|
||||
|
||||
<!-- Recipient -->
|
||||
<div class="col-12">
|
||||
<label for="game_recipient" class="form-label">{{ _('Recipient') }}</label>
|
||||
<input type="text" id="game_recipient" name="recipient" class="form-control" value="{{ request.form.recipient or '' }}">
|
||||
</div>
|
||||
|
||||
<!-- Shop URL -->
|
||||
<div class="col-12">
|
||||
<label for="game_url" class="form-label">{{ _('Shop URL') }}</label>
|
||||
<input type="url" id="game_url" name="url" class="form-control" value="{{ request.form.url or '' }}">
|
||||
</div>
|
||||
|
||||
<!-- Notes -->
|
||||
<div class="col-12">
|
||||
<label for="game_notes" class="form-label">{{ _('Notes') }}</label>
|
||||
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ request.form.notes or '' }}</textarea>
|
||||
</div>
|
||||
|
||||
<!-- Buttons -->
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-primary">{{ _('Save') }}</button>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary ms-2">{{ _('Cancel') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
|
55
steam-gift-manager/templates/admin_audit_logs.html
Normal file
|
@ -0,0 +1,55 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<h2>{{ _('Audit Logs') }}</h2>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ _('Timestamp') }}</th>
|
||||
<th>{{ _('User') }}</th>
|
||||
<th>{{ _('Action') }}</th>
|
||||
<th>{{ _('Details') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for log in logs.items %}
|
||||
<tr>
|
||||
<td>{{ log.timestamp|strftime('%d.%m.%Y %H:%M') }}</td>
|
||||
<td>{{ log.user.username if log.user else 'System' }}</td>
|
||||
<td>{{ log.action }}</td>
|
||||
<td>{{ log.details|default('', true) }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% if logs.pages > 1 %}
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination">
|
||||
{% if logs.has_prev %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ url_for('admin_audit_logs', page=logs.prev_num) }}">{{ _('Previous') }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for page_num in logs.iter_pages() %}
|
||||
<li class="page-item {% if page_num == logs.page %}active{% endif %}">
|
||||
<a class="page-link" href="{{ url_for('admin_audit_logs', page=page_num) }}">{{ page_num }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{% if logs.has_next %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{ url_for('admin_audit_logs', page=logs.next_num) }}">{{ _('Next') }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
39
steam-gift-manager/templates/admin_users.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<h2>{{ _('User Management') }}</h2>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ _('Username') }}</th>
|
||||
<th>{{ _('Actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ user.username }}
|
||||
{% if user.is_admin %}<span class="badge bg-primary">Admin</span>{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if user.id != current_user.id %}
|
||||
<form method="POST" action="{{ url_for('admin_delete_user', user_id=user.id) }}" class="d-inline">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<button type="submit" class="btn btn-danger btn-sm">{{ _('Delete') }}</button>
|
||||
</form>
|
||||
|
||||
<form method="POST" action="{{ url_for('admin_reset_password', user_id=user.id) }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<button type="submit" class="btn btn-warning">{{ _('Reset Password') }}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -11,9 +11,8 @@
|
|||
<!-- 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>
|
||||
<!-- Eigene Styles -->
|
||||
<!-- My 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"
|
||||
|
@ -36,59 +35,53 @@
|
|||
})();
|
||||
</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="150" height="116" style="object-fit:contain; border-radius:8px;">
|
||||
<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" role="search" aria-label="{{ _('Search games') }}">
|
||||
<label for="searchInput" class="visually-hidden">{{ _('Search') }}</label>
|
||||
<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>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input"
|
||||
type="checkbox"
|
||||
id="darkModeSwitch" {% if theme == 'dark' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="darkModeSwitch">{{ _('Dark Mode') }}</label>
|
||||
</div>
|
||||
<div class="dropdown ms-3">
|
||||
<div hidden id="locale-debug" data-locale="{{ session.get('lang', 'en') }}"></div>
|
||||
<button class="btn btn-outline-secondary dropdown-toggle" type="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 %}
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<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>
|
||||
</div>
|
||||
{% if current_user.is_authenticated %}
|
||||
<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 %}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<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 %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }} alert-dismissible fade show">
|
||||
{{ message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
<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>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% block content %}{% endblock %}
|
||||
|
|
|
@ -1,35 +1,85 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="card p-4 shadow-sm">
|
||||
<h2 class="mb-4">{{ _('Edit Game') }}</h2>
|
||||
<form method="POST" aria-label="{{ _('Edit Game') }}">
|
||||
<h2 class="mb-4">{{ _('Spiel bearbeiten') }}</h2>
|
||||
|
||||
<!-- Flash-Nachrichten -->
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<div class="flash-messages mb-4">
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ 'danger' if category == 'error' else category }} alert-dismissible fade show">
|
||||
{{ message|safe }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<!-- Update Data Form (separate, outside main form, uses POST) -->
|
||||
<div class="mb-3 text-end">
|
||||
<form method="POST" action="{{ url_for('update_game_data', game_id=game.id) }}" id="updateDataForm">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<!-- Ändere die ID für Eindeutigkeit -->
|
||||
<input type="hidden" name="steam_appid" id="itad_steam_appid" value="{{ game.steam_appid }}">
|
||||
<button type="submit" class="btn btn-secondary">
|
||||
🔄 {{ _('Update Data') }}
|
||||
</button>
|
||||
</form>
|
||||
<script>
|
||||
document.getElementById('updateDataForm').addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const currentAppId = document.getElementById('game_appid').value;
|
||||
|
||||
document.getElementById('itad_steam_appid').value = currentAppId;
|
||||
|
||||
this.submit();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<form method="POST" aria-label="{{ _('Spiel bearbeiten') }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<div class="row g-3">
|
||||
<!-- Formularfelder -->
|
||||
<div class="col-md-6">
|
||||
<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">
|
||||
<label class="form-label">{{ _('Name') }} <span class="text-danger">*</span></label>
|
||||
<input type="text" name="name" class="form-control" value="{{ game.name }}" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<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 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 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>
|
||||
<label for="game_platform" class="form-label">{{ _('Platform') }} <span class="text-danger">*</span></label>
|
||||
<select id="game_platform" name="platform" class="form-select" required>
|
||||
{% for value, label in platforms %}
|
||||
<option value="{{ value }}" {% if game.platform == value %}selected{% endif %}>{{ _(label) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<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 class="col-md-6">
|
||||
<label for="game_status" class="form-label">{{ _('Status') }} <span class="text-danger">*</span></label>
|
||||
<select id="game_status" name="status" class="form-select" required>
|
||||
{% for value, label in statuses %}
|
||||
<option value="{{ value }}" {% if game.status == value %}selected{% endif %}>{{ _(label) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">{{ _('Steam Key') }} <span class="text-danger">*</span></label>
|
||||
<input type="text" name="steam_key" class="form-control" value="{{ game.steam_key }}" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="game_appid" class="form-label">{{ _('Steam AppID') }}</label>
|
||||
<input type="text" id="game_appid" name="steam_appid" class="form-control" value="{{ game.steam_appid or '' }}">
|
||||
<small class="text-muted">
|
||||
{{ _('For GOG games: Enter the Steam AppID here to enable price tracking.') }}
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<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="{{ game.redeem_date.strftime('%Y-%m-%d') if game.redeem_date else '' }}">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label for="game_recipient" class="form-label">{{ _('Recipient') }}</label>
|
||||
<input type="text" id="game_recipient" name="recipient" class="form-control" value="{{ game.recipient }}">
|
||||
</div>
|
||||
|
@ -41,27 +91,95 @@
|
|||
<label for="game_notes" class="form-label">{{ _('Notes') }}</label>
|
||||
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
|
||||
</div>
|
||||
|
||||
<!-- Show External Data -->
|
||||
<div class="col-12">
|
||||
{% if redeem_url and active_redeem %}
|
||||
<div class="mb-3">
|
||||
<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
|
||||
onclick="this.select()">
|
||||
<small class="text-muted">
|
||||
{{ _('Expires at') }}: {{ active_redeem.expires.strftime('%d.%m.%Y %H:%M') }}
|
||||
</small>
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<span>🔄 {{ _('External Data') }}</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if game.release_date %}
|
||||
<div class="mb-2">
|
||||
<strong>{{ _('Release Date:') }}</strong>
|
||||
{{ game.release_date|strftime('%d.%m.%Y') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if game.current_price %}
|
||||
<div class="text-center mb-2">
|
||||
<span class="badge bg-primary d-block">{{ _('Now') }}</span>
|
||||
<div class="fw-bold" style="font-size:1.1em;">
|
||||
{{ "%.2f"|format(game.current_price) }} €
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if game.historical_low %}
|
||||
<div class="text-center">
|
||||
<span class="badge bg-secondary d-block">{{ _('Hist. Low') }}</span>
|
||||
<div class="fw-bold" style="font-size:1.1em;">
|
||||
{{ "%.2f"|format(game.historical_low) }} €
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if game.itad_slug %}
|
||||
<a href="https://isthereanydeal.com/game/{{ game.itad_slug }}/info/" target="_blank" rel="noopener" class="btn btn-outline-info mt-2">
|
||||
🔗 {{ _('View on IsThereAnyDeal') }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Einlöse-Links -->
|
||||
{% if game.status == 'geschenkt' %}
|
||||
<div class="col-12">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">{{ _('Redeem-Link') }}</div>
|
||||
<div class="card-body">
|
||||
{% for token in game.redeem_tokens if not token.is_expired() %}
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" value="{{ url_for('redeem', token=token.token, _external=True) }}" readonly id="redeem-link-{{ loop.index }}">
|
||||
<button type="button" class="btn btn-outline-secondary copy-btn" data-clipboard-target="#redeem-link-{{ loop.index }}">
|
||||
{{ _('Copy') }}
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
{{ _('Expires at') }}: {{ token.expires.astimezone(local_tz).strftime('%d.%m.%Y %H:%M') }}
|
||||
</small>
|
||||
{% else %}
|
||||
<p class="text-muted mb-0">{{ _('No active redeem links') }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Buttons -->
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-primary">{{ _('Save') }}</button>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary ms-2">{{ _('Cancel') }}</a>
|
||||
<a href="{{ url_for('game_details', game_id=game.id) }}" class="btn btn-info ms-2">🔍 {{ _('View Details') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Copy-JavaScript -->
|
||||
<script>
|
||||
document.querySelectorAll('.copy-btn').forEach(btn => {
|
||||
btn.addEventListener('click', async function() {
|
||||
const input = document.querySelector(this.dataset.clipboardTarget);
|
||||
try {
|
||||
await navigator.clipboard.writeText(input.value);
|
||||
this.innerHTML = '✅ {{ _("Copied!") }}';
|
||||
setTimeout(() => this.innerHTML = '{{ _("Copy") }}', 2000);
|
||||
} catch (err) {
|
||||
this.innerHTML = '❌ {{ _("Error") }}';
|
||||
setTimeout(() => this.innerHTML = '{{ _("Copy") }}', 2000);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
|
62
steam-gift-manager/templates/game_details.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<h1>{{ game.name }}</h1>
|
||||
|
||||
<div class="row">
|
||||
<!-- Bild und Basis-Infos -->
|
||||
<div class="col-md-4">
|
||||
{% if game.steam_appid %}
|
||||
<img src="https://cdn.cloudflare.steamstatic.com/steam/apps/{{ game.steam_appid }}/header.jpg"
|
||||
class="img-fluid rounded mb-3"
|
||||
alt="{{ game.name }} Cover"
|
||||
loading="lazy">
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Details -->
|
||||
<div class="col-md-8">
|
||||
<dl class="row">
|
||||
<dt class="col-sm-3">{{ _('Status') }}</dt>
|
||||
<dd class="col-sm-9">
|
||||
{% if game.status == 'nicht eingelöst' %}
|
||||
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
|
||||
{% elif game.status == 'geschenkt' %}
|
||||
<span class="badge bg-success">{{ _('Gifted') }}</span>
|
||||
{% elif game.status == 'eingelöst' %}
|
||||
<span class="badge bg-secondary">{{ _('Redeemed') }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-3">{{ _('Release Date') }}</dt>
|
||||
<dd class="col-sm-9">{{ game.release_date|strftime('%d.%m.%Y') if game.release_date else 'N/A' }}</dd>
|
||||
|
||||
<dt class="col-sm-3">{{ _('Current Price') }}</dt>
|
||||
<dd class="col-sm-9">{{ "%.2f €"|format(game.current_price) if game.current_price else 'N/A' }}</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<a href="{{ url_for('edit_game', game_id=game.id) }}" class="btn btn-primary">
|
||||
{{ _('Edit') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% set lang = session.get('lang', 'en') %}
|
||||
{% set desc = getattr(game, 'steam_description_' + lang) %}
|
||||
{% if desc %}
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ _('Game Description') }}</div>
|
||||
<div class="card-body">
|
||||
{{ desc|safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
<th>{{ _('Created') }}</th>
|
||||
<th>{{ _('Redeem by') }}</th>
|
||||
<th>{{ _('Shop') }}</th>
|
||||
<th>{{ _('Price') }}</th>
|
||||
<th>{{ _('Actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -29,38 +30,40 @@
|
|||
{% for game in games %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if game.steam_appid %}
|
||||
<img src="https://cdn.cloudflare.steamstatic.com/steam/apps/{{ game.steam_appid }}/header.jpg"
|
||||
alt="Steam Header"
|
||||
class="game-cover"
|
||||
{% if loop.first %}fetchpriority="high"{% endif %}
|
||||
width="368"
|
||||
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"
|
||||
loading="lazy">
|
||||
{% endif %}
|
||||
<a href="{{ url_for('game_details', game_id=game.id) }}" title="{{ _('Details') }}">
|
||||
{% if game.steam_appid %}
|
||||
<img src="https://cdn.cloudflare.steamstatic.com/steam/apps/{{ game.steam_appid }}/header.jpg"
|
||||
alt="Steam Header"
|
||||
class="game-cover"
|
||||
{% if loop.first %}fetchpriority="high"{% endif %}
|
||||
width="368"
|
||||
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"
|
||||
loading="lazy">
|
||||
{% endif %}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ game.name }}</td>
|
||||
<td class="font-monospace">{{ game.steam_key }}</td>
|
||||
<td>
|
||||
{% if game.status == 'nicht eingelöst' %}
|
||||
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
|
||||
{% elif game.status == 'verschenkt' %}
|
||||
{% elif game.status == 'geschenkt' %}
|
||||
<span class="badge bg-success">{{ _('Gifted') }}</span>
|
||||
{% elif game.status == 'eingelöst' %}
|
||||
<span class="badge bg-secondary">{{ _('Redeemed') }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ format_date(game.created_at) }}</td>
|
||||
<td>{{ game.created_at|strftime('%d.%m.%Y') }}</td>
|
||||
<td>
|
||||
{% if game.redeem_date %}
|
||||
<span class="badge bg-danger">{{ format_date(game.redeem_date) }}</span>
|
||||
<span class="badge bg-danger">{{ game.redeem_date|strftime('%d.%m.%Y') }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
|
@ -68,9 +71,37 @@
|
|||
<a href="{{ game.url }}" target="_blank" class="btn btn-sm btn-outline-info">🔗 {{ _('Shop') }}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if game.current_price is not none %}
|
||||
<div {% if game.historical_low is not none %}class="mb-2"{% endif %}>
|
||||
<div class="text-body-secondary" style="font-size: 0.85em; line-height: 1.2;">
|
||||
{{ _('Current Deal') }}
|
||||
</div>
|
||||
<div style="font-size: 1.05em; line-height: 1.2;">
|
||||
{{ "%.2f"|format(game.current_price) }} €
|
||||
{% if game.current_price_shop %}
|
||||
<span class="d-block text-body-secondary" style="font-size: 0.75em; line-height: 1.1;">({{ game.current_price_shop }})</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Historical Low #}
|
||||
{% if game.historical_low is not none %}
|
||||
<div>
|
||||
<div class="text-body-secondary" style="font-size: 0.85em; line-height: 1.2;">
|
||||
{{ _('Hist. Low') }}
|
||||
</div>
|
||||
<div style="font-size: 1.05em; line-height: 1.2;">
|
||||
{{ "%.2f"|format(game.historical_low) }} €
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
{% if game.status == 'verschenkt' %}
|
||||
<button class="btn btn-sm btn-success generate-redeem"
|
||||
{% if game.status == 'geschenkt' %}
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-success generate-redeem"
|
||||
data-game-id="{{ game.id }}"
|
||||
title="{{ _('Generate redeem link') }}">
|
||||
🔗
|
||||
|
@ -87,29 +118,46 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||
|
||||
document.querySelectorAll('.generate-redeem').forEach(btn => {
|
||||
btn.addEventListener('click', async function() {
|
||||
const gameId = this.dataset.gameId;
|
||||
const flashContainer = document.querySelector('.flash-container');
|
||||
|
||||
try {
|
||||
const response = await fetch('/generate_redeem/' + gameId, {
|
||||
const response = await fetch(`/generate_redeem/${gameId}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').content,
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
});
|
||||
if (!response.ok) throw new Error('Network error');
|
||||
|
||||
const data = await response.json();
|
||||
if(data.url) {
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || '{{ _("Unknown error") }}');
|
||||
}
|
||||
|
||||
if (data.url) {
|
||||
await navigator.clipboard.writeText(data.url);
|
||||
alert('{{ _("Redeem link copied to clipboard!") }}');
|
||||
|
||||
// Erfolgsmeldung mit übersetztem Text
|
||||
flashContainer.innerHTML = `
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
{{ _("Link copied") }}: <a href="${data.url}" target="_blank">${data.url}</a>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
alert('{{ _("Error generating link") }}');
|
||||
// Fehlermeldung mit übersetztem Text
|
||||
flashContainer.innerHTML = `
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
{{ _("Error") }}: ${error.message}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6 col-lg-4">
|
||||
<h1 class="mb-4">{{ _('Login') }}</h1>
|
||||
<h1 class="mb-4 text-center">{{ _('Login') }}</h1>
|
||||
<form method="POST" aria-label="{{ _('Login form') }}" autocomplete="on">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<div class="mb-3">
|
||||
|
@ -26,18 +26,26 @@
|
|||
autocomplete="current-password"
|
||||
aria-required="true">
|
||||
</div>
|
||||
{% if error %}
|
||||
<div class="mb-3 form-check">
|
||||
<input type="checkbox" class="form-check-input" id="remember_me" name="remember_me" value="true">
|
||||
<label class="form-check-label" for="remember_me">{{ _('Remember me') }}</label>
|
||||
</div>
|
||||
{# Flash messages are handled in base.html, so the specific error block here can be removed #}
|
||||
{# {% if error %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<button type="submit" class="btn btn-primary w-100">{{ _('Login') }}</button>
|
||||
{% endif %} #}
|
||||
|
||||
<button type="submit" class="btn btn-primary w-100 mb-3">{{ _('Login') }}</button>
|
||||
</form>
|
||||
|
||||
{% if config.REGISTRATION_ENABLED %}
|
||||
<div class="mt-3 text-center">
|
||||
<a href="{{ url_for('register') }}">{{ _('No account? Register here!') }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
<code class="fs-3">{{ game.steam_key }}</code>
|
||||
</div>
|
||||
<a href="{{ platform_link }}{{ game.steam_key }}"
|
||||
class="btn btn-primary btn-lg mb-3"
|
||||
target="_blank">
|
||||
{{ _('Redeem now on') }} {% if game.steam_appid %}Steam{% else %}GOG{% endif %}
|
||||
class="btn btn-primary btn-lg mb-3"
|
||||
target="_blank">
|
||||
{{ _('Redeem now on') }} {{ platform_label }}
|
||||
</a>
|
||||
<div class="mt-4 text-muted">
|
||||
<small>
|
||||
|
@ -41,9 +41,10 @@
|
|||
</div>
|
||||
<script>
|
||||
const totalDuration = {{ redeem_token.total_hours * 3600 * 1000 }}; // Gesamtdauer in Millisekunden
|
||||
const expires = {{ (redeem_token.expires.timestamp() * 1000) | int }};
|
||||
const expires = {{ expires_timestamp }};
|
||||
const countdownEl = document.getElementById('expiry-countdown');
|
||||
const progressBar = document.getElementById('expiry-bar');
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||
|
||||
function formatTime(unit) {
|
||||
return unit < 10 ? `0${unit}` : unit;
|
||||
|
|
|
@ -1,71 +1,94 @@
|
|||
{
|
||||
"": "",
|
||||
"Access Forbidden": "Zugriff verweigert",
|
||||
"Action": "Aktion",
|
||||
"Actions": "Aktionen",
|
||||
"Active Redeem Link": "Aktiver Einlöse-Link",
|
||||
"Add Game": "Spiel hinzufügen",
|
||||
"Add New Game": "Neues Spiel hinzufügen",
|
||||
"Already have an account? Login!": "",
|
||||
"Admin": "Admin",
|
||||
"Already have an account? Login!": "Du hast schon ein Konto? Jetzt anmelden!",
|
||||
"Audit Logs": "Prüfprotokolle",
|
||||
"Back to Home": "Zurück zur Startseite",
|
||||
"Cancel": "Abbrechen",
|
||||
"Change Password": "Passwort ändern",
|
||||
"Change password form": "",
|
||||
"Changes saved!": "Änderungen gespeichert!",
|
||||
"Change password form": "Passwort ändern Formular",
|
||||
"Confirm New Password": "Neues Passwort bestätigen",
|
||||
"Confirm Password": "",
|
||||
"Confirm Password": "Passwort bestätigen",
|
||||
"Copied!": "Kopiert!",
|
||||
"Copy": "Kopieren",
|
||||
"Cover": "Cover",
|
||||
"Created": "Erstellt",
|
||||
"Current Deal": "Aktuelles Angebot",
|
||||
"Current Password": "Aktuelles Passwort",
|
||||
"Current passwort is wrong": "Aktuelles Passwort ist falsch",
|
||||
"Dark Mode": "Dunkler Modus",
|
||||
"Edit Game": "Spiel bearbeiten",
|
||||
"Error generating link": "Fehler beim Generieren des Links",
|
||||
"Error: ": "Fehler: ",
|
||||
"Expires at": "Ablaufdatum",
|
||||
"Current Price": "Aktueller Preis",
|
||||
"Delete": "Löschen",
|
||||
"Details": "Details",
|
||||
"Edit": "Bearbeiten",
|
||||
"Redeem-Link": "Einlöse-Link",
|
||||
"Error": "Fehler",
|
||||
"Expires at": "Läuft ab am",
|
||||
"Export CSV": "CSV exportieren",
|
||||
"Game Key": "Spiele-Key",
|
||||
"Game Key Manager": "Game-Key-Verwaltung",
|
||||
"Game List (without Keys)": "Spieleliste (ohne Keys)",
|
||||
"Game added successfully!": "Spiel erfolgreich hinzugefügt!",
|
||||
"Externe Daten": "Externe Daten",
|
||||
"For GOG games: Enter the Steam AppID here to enable price tracking.": "Für GOG-Spiele: Gib hier die Steam AppID ein, um die Preisüberwachung zu aktivieren.",
|
||||
"Game Description": "Spielbeschreibung",
|
||||
"Game Key": "Spielschlüssel",
|
||||
"Game Key Manager": "Game Key Manager",
|
||||
"Generate redeem link": "Einlöse-Link generieren",
|
||||
"Gifted": "Verschenkt",
|
||||
"Hist. Low": "Historischer Tiefstpreis",
|
||||
"Import": "Importieren",
|
||||
"Import CSV": "CSV importieren",
|
||||
"Import Games": "Spiele importieren",
|
||||
"Import error: %(error)s', error=str(e)), 'danger": "",
|
||||
"Invalid credentials": "Ungültige Anmeldedaten",
|
||||
"Key": "Key",
|
||||
"Key": "Schlüssel",
|
||||
"Link copied": "Link kopiert",
|
||||
"Login": "Anmelden",
|
||||
"Login form": "",
|
||||
"Login form": "Anmeldeformular",
|
||||
"Logout": "Abmelden",
|
||||
"My Games": "Meine Spiele",
|
||||
"Name": "Name",
|
||||
"New Password": "Neues Passwort",
|
||||
"New Passwords are not matching": "Neue Passwörter stimmen nicht überein",
|
||||
"No account? Register here!": "",
|
||||
"Next": "Weiter",
|
||||
"No account? Register here!": "Noch kein Konto? Hier registrieren!",
|
||||
"No active redeem links": "Keine aktiven Einlöse-Links",
|
||||
"No games yet": "Der Kornspeicher ist leer, Sire!",
|
||||
"No new registrations. They are deactivated!": "Keine neuen Registrierungen. Sie sind deaktiviert!",
|
||||
"Not redeemed": "Nicht eingelöst",
|
||||
"Notes": "Notizen",
|
||||
"Not redeemed": "Nicht eingelöst",
|
||||
"Now": "Jetzt",
|
||||
"Password": "Passwort",
|
||||
"Password changed successfully": "Passwort erfolgreich geändert",
|
||||
"Please upload a valid CSV file.": "Bitte eine gültige CSV-Datei hochladen.",
|
||||
"Platform": "Plattform",
|
||||
"Previous": "Zurück",
|
||||
"Price": "Preis",
|
||||
"Really delete?": "Wirklich löschen?",
|
||||
"Recipient": "Empfänger",
|
||||
"Redeem by": "Einzulösen vor",
|
||||
"Redeem link copied to clipboard!": "Einlöse-Link in die Zwischenablage kopiert!",
|
||||
"Redeem now on": "Jetzt einlösen bei",
|
||||
"Redeem by": "Einlösen bis",
|
||||
"Redeemed": "Eingelöst",
|
||||
"Redeem now on": "Jetzt einlösen bei",
|
||||
"Register": "Registrieren",
|
||||
"Registration form": "",
|
||||
"Registration form": "Registrierungsformular",
|
||||
"Registration is currently disabled.": "Registrierung ist derzeit deaktiviert.",
|
||||
"Release Date": "Veröffentlichungsdatum",
|
||||
"Remember me": "Angemeldet bleiben",
|
||||
"Reset Password": "Passwort zurücksetzen",
|
||||
"Save": "Speichern",
|
||||
"Search": "Suche",
|
||||
"Search games": "",
|
||||
"Search": "Suchen",
|
||||
"Search games": "Spiele suchen",
|
||||
"Select CSV file": "CSV-Datei auswählen",
|
||||
"Shop": "Shop",
|
||||
"Shop URL": "Shop-URL",
|
||||
"Sorry, you are not allowed to access this page.": "Du bist nicht berechtigt, diese Seite zu betreten.",
|
||||
"Spiel bearbeiten": "Spiel bearbeiten",
|
||||
"Status": "Status",
|
||||
"Steam AppID (optional)": "Steam-AppID (optional)",
|
||||
"Steam Key already exists!": "Steam-Key existiert bereits!",
|
||||
"Steam AppID": "Steam AppID",
|
||||
"Steam AppID (optional)": "Steam AppID (optional)",
|
||||
"Steam Key": "Steam-Schlüssel",
|
||||
"This page will expire in": "Diese Seite läuft ab in",
|
||||
"Timestamp": "Zeitstempel",
|
||||
"Unknown error": "Unbekannter Fehler",
|
||||
"Update Data": "Daten aktualisieren",
|
||||
"User": "Benutzer",
|
||||
"User Management": "Benutzerverwaltung",
|
||||
"Username": "Benutzername",
|
||||
"Username already exists": "Benutzername existiert bereits",
|
||||
"Your Key:": "Dein Key:"
|
||||
"Release Date:": "Veröffentlichung:",
|
||||
"View Details": "Details anzeigen",
|
||||
"View on IsThereAnyDeal": "Auf IsThereAnyDeal ansehen",
|
||||
"Your Key:": "Dein Schlüssel:"
|
||||
}
|
||||
|
|
|
@ -1,72 +1,94 @@
|
|||
{
|
||||
"": "",
|
||||
"Access Forbidden": "",
|
||||
"Action": "",
|
||||
"Actions": "",
|
||||
"Active Redeem Link": "",
|
||||
"Add Game": "",
|
||||
"Add New Game": "",
|
||||
"Admin": "",
|
||||
"Already have an account? Login!": "",
|
||||
"Audit Logs": "",
|
||||
"Back to Home": "",
|
||||
"Cancel": "",
|
||||
"Change Password": "",
|
||||
"Change password form": "",
|
||||
"Changes saved!": "",
|
||||
"Confirm New Password": "",
|
||||
"Confirm Password": "",
|
||||
"Copied!": "",
|
||||
"Copy": "",
|
||||
"Cover": "",
|
||||
"Created": "",
|
||||
"Current Deal": "",
|
||||
"Current Password": "",
|
||||
"Current passwort is wrong": "",
|
||||
"Dark Mode": "",
|
||||
"Edit Game": "",
|
||||
"Error: ": "",
|
||||
"Error generating link": "",
|
||||
"Current Price": "",
|
||||
"Delete": "",
|
||||
"Details": "",
|
||||
"Edit": "",
|
||||
"Error": "",
|
||||
"Expires at": "",
|
||||
"Export CSV": "",
|
||||
"Game added successfully!": "",
|
||||
"External Data": "",
|
||||
"For GOG games: Enter the Steam AppID here to enable price tracking.": "",
|
||||
"Game Description": "",
|
||||
"Game Key": "",
|
||||
"Game Key Manager": "",
|
||||
"Game List (without Keys)": "",
|
||||
"Generate redeem link": "",
|
||||
"Gifted": "",
|
||||
"Hist. Low": "",
|
||||
"Import": "",
|
||||
"Import CSV": "",
|
||||
"Import error: %(error)s', error=str(e)), 'danger": "",
|
||||
"Import Games": "",
|
||||
"Invalid credentials": "",
|
||||
"Key": "",
|
||||
"Link copied": "",
|
||||
"Login": "",
|
||||
"Login form": "",
|
||||
"Logout": "",
|
||||
"My Games": "",
|
||||
"Name": "",
|
||||
"%(new)d new games imported, %(dup)d skipped duplicates', new=new_games, dup=duplicates), 'success": "",
|
||||
"New Password": "",
|
||||
"New Passwords are not matching": "",
|
||||
"Next": "",
|
||||
"No account? Register here!": "",
|
||||
"No active redeem links": "",
|
||||
"No games yet": "",
|
||||
"No new registrations. They are deactivated!": "",
|
||||
"Notes": "",
|
||||
"Not redeemed": "",
|
||||
"Now": "",
|
||||
"Password": "",
|
||||
"Password changed successfully": "",
|
||||
"Please upload a valid CSV file.": "",
|
||||
"Platform": "",
|
||||
"Previous": "",
|
||||
"Price": "",
|
||||
"Really delete?": "",
|
||||
"Recipient": "",
|
||||
"Redeem by": "",
|
||||
"Redeemed": "",
|
||||
"Redeem link copied to clipboard!": "",
|
||||
"Redeem-Link": "",
|
||||
"Redeem now on": "",
|
||||
"Register": "",
|
||||
"Registration form": "",
|
||||
"Registration is currently disabled.": "",
|
||||
"Release Date": "",
|
||||
"Release Date:": "",
|
||||
"Remember me": "",
|
||||
"Reset Password": "",
|
||||
"Save": "",
|
||||
"Search": "",
|
||||
"Search games": "",
|
||||
"Select CSV file": "",
|
||||
"Shop": "",
|
||||
"Shop URL": "",
|
||||
"Sorry, you are not allowed to access this page.": "",
|
||||
"Spiel bearbeiten": "",
|
||||
"Status": "",
|
||||
"Steam AppID": "",
|
||||
"Steam AppID (optional)": "",
|
||||
"Steam Key already exists!": "",
|
||||
"Steam Key": "",
|
||||
"This page will expire in": "",
|
||||
"Timestamp": "",
|
||||
"Unknown error": "",
|
||||
"Update Data": "",
|
||||
"User": "",
|
||||
"User Management": "",
|
||||
"Username": "",
|
||||
"Username already exists": "",
|
||||
"View Details": "",
|
||||
"View on IsThereAnyDeal": "",
|
||||
"Your Key:": ""
|
||||
}
|
||||
|
|