AstraOS Ver. 1.22:
All checks were successful
Deploy AstraOS Panel / deploy (push) Successful in 11s

Fix:
- Pretty changes in Ets2 dlc
- User sehen ohne permissions nicht random rsachen
This commit is contained in:
MrWhiff 2026-04-19 12:29:01 +02:00
parent 55a0fbf94f
commit 386098f5ef
3 changed files with 38 additions and 19 deletions

View file

@ -3,7 +3,7 @@
{% block title %}AstraOS - ETS2 DLCs{% endblock %} {% block title %}AstraOS - ETS2 DLCs{% endblock %}
{% block content %} {% block content %}
<div x-data="{ showDeleteModal: false, packageToDelete: null }" class="space-y-10"> <div class="space-y-10">
<header class="flex justify-between items-center gap-4"> <header class="flex justify-between items-center gap-4">
<h2 class="text-4xl font-bold tracking-wide {% if maintenance_active %}text-yellow-300{% else %}text-purple-300{% endif %}">ETS2 DLCs</h2> <h2 class="text-4xl font-bold tracking-wide {% if maintenance_active %}text-yellow-300{% else %}text-purple-300{% endif %}">ETS2 DLCs</h2>
</header> </header>
@ -14,7 +14,6 @@
<tr> <tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Name</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Name</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">DLC Datum</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">DLC Datum</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Ordnerpfad</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Erstellt von</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Erstellt von</th>
<th class="px-6 py-3 text-right text-xs font-medium text-gray-300 uppercase tracking-wider">Aktionen</th> <th class="px-6 py-3 text-right text-xs font-medium text-gray-300 uppercase tracking-wider">Aktionen</th>
</tr> </tr>
@ -23,8 +22,7 @@
{% for package in dlc_packages %} {% for package in dlc_packages %}
<tr class="transition {% if maintenance_active %}hover:bg-yellow-500/5{% else %}hover:bg-purple-500/5{% endif %}"> <tr class="transition {% if maintenance_active %}hover:bg-yellow-500/5{% else %}hover:bg-purple-500/5{% endif %}">
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-white">{{ package.name }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-white">{{ package.name }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-300">{{ package.dlc_date }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-300">{{ package.dlc_date_display }}</td>
<td class="px-6 py-4 text-sm text-gray-300 break-all">{{ package.folder_path }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-300">{{ package.created_by or 'N/A' }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-300">{{ package.created_by or 'N/A' }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-right"> <td class="px-6 py-4 whitespace-nowrap text-sm text-right">
<div class="flex items-center justify-end gap-2"> <div class="flex items-center justify-end gap-2">
@ -32,9 +30,12 @@
Download Download
</a> </a>
{% if can_manage_ets2_dlcs %} {% if can_manage_ets2_dlcs %}
<button @click="packageToDelete = '{{ package._id }}'; showDeleteModal = true" class="px-3 py-2 text-sm font-semibold rounded-lg transition text-white bg-red-600/80 hover:bg-red-700"> <form action="{{ url_for('delete_ets2_dlc_package', package_id=package._id) }}" method="POST" onsubmit="return confirm('Möchtest du dieses DLC-Paket wirklich löschen?');">
Loschen <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="px-3 py-2 text-sm font-semibold rounded-lg transition text-white bg-red-600/80 hover:bg-red-700">
Löschen
</button> </button>
</form>
{% endif %} {% endif %}
</div> </div>
</td> </td>
@ -73,18 +74,6 @@
</form> </form>
</div> </div>
{% endif %} {% endif %}
<div x-show="showDeleteModal" @keydown.escape.window="showDeleteModal = false" class="fixed inset-0 bg-black/70 backdrop-blur-sm flex items-center justify-center z-50" style="display: none;">
<div @click.away="showDeleteModal = false" class="bg-gray-900 border border-red-500/50 rounded-xl shadow-2xl p-8 w-full max-w-md">
<h3 class="text-2xl font-bold text-red-400 mb-4">DLC-Paket loschen</h3>
<p class="text-gray-300 mb-6">Mochtest du dieses DLC-Paket wirklich loschen? Der Eintrag wird entfernt.</p>
<form :action="'/ets2_dlcs/delete/' + packageToDelete" method="POST" class="flex justify-end gap-4">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="button" @click="showDeleteModal = false" class="px-4 py-2 rounded-lg text-gray-300 hover:bg-gray-700 transition">Abbrechen</button>
<button type="submit" class="px-4 py-2 bg-red-600 hover:bg-red-700 text-white font-semibold rounded-lg transition">Loschen</button>
</form>
</div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -249,7 +249,9 @@
</button> </button>
<div class="pl-4 mt-1 space-y-1 content hidden"> <div class="pl-4 mt-1 space-y-1 content hidden">
{% set private_tools = namespace(has_access=false) %}
{% if 'manage_discord_bots' in session.get('permissions', []) %} {% if 'manage_discord_bots' in session.get('permissions', []) %}
{% set private_tools.has_access = true %}
<a href="{{ url_for('discord_bots') }}" <a href="{{ url_for('discord_bots') }}"
class="block px-3 py-1 rounded-md transition class="block px-3 py-1 rounded-md transition
{% if active_page == 'discord_bots' %}{% if maintenance_active %}bg-yellow-500/10 text-yellow-300{% else %}bg-purple-500/10 text-purple-300{% endif %}{% else %} {% if active_page == 'discord_bots' %}{% if maintenance_active %}bg-yellow-500/10 text-yellow-300{% else %}bg-purple-500/10 text-purple-300{% endif %}{% else %}
@ -258,6 +260,7 @@
</a> </a>
{% endif %} {% endif %}
{% if 'view_ets2_dlcs' in session.get('permissions', []) %} {% if 'view_ets2_dlcs' in session.get('permissions', []) %}
{% set private_tools.has_access = true %}
<a href="{{ url_for('ets2_dlcs') }}" <a href="{{ url_for('ets2_dlcs') }}"
class="block px-3 py-1 rounded-md transition class="block px-3 py-1 rounded-md transition
{% if active_page == 'ets2_dlcs' %}{% if maintenance_active %}bg-yellow-500/10 text-yellow-300{% else %}bg-purple-500/10 text-purple-300{% endif %}{% else %} {% if active_page == 'ets2_dlcs' %}{% if maintenance_active %}bg-yellow-500/10 text-yellow-300{% else %}bg-purple-500/10 text-purple-300{% endif %}{% else %}
@ -265,6 +268,11 @@
🚚 ETS2 DLCs 🚚 ETS2 DLCs
</a> </a>
{% endif %} {% endif %}
{% if not private_tools.has_access %}
<div class="block px-3 py-1 rounded-md text-gray-500 text-sm italic">
Du hast nicht genügend Berechtigungen für diese Sektion.
</div>
{% endif %}
</div> </div>
</div> </div>
@ -281,7 +289,9 @@
</button> </button>
<div class="pl-4 mt-1 space-y-1 content hidden"> <div class="pl-4 mt-1 space-y-1 content hidden">
{% set moonlab_tools = namespace(has_access=false) %}
{% if 'view_ip_analyzer' in session.get('permissions', []) %} {% if 'view_ip_analyzer' in session.get('permissions', []) %}
{% set moonlab_tools.has_access = true %}
<a href="{{ url_for('ip_analyzer') }}" <a href="{{ url_for('ip_analyzer') }}"
class="block px-3 py-1 rounded-md transition class="block px-3 py-1 rounded-md transition
{% if active_page == 'ip_analyzer' %}{% if maintenance_active %}bg-yellow-500/10 text-yellow-300{% else %}bg-purple-500/10 text-purple-300{% endif %}{% else %} {% if active_page == 'ip_analyzer' %}{% if maintenance_active %}bg-yellow-500/10 text-yellow-300{% else %}bg-purple-500/10 text-purple-300{% endif %}{% else %}
@ -289,15 +299,27 @@
🌐 IP Analyzer 🌐 IP Analyzer
</a> </a>
{% endif %} {% endif %}
{% if 'instranet' in session.get('permissions', []) %}
{% set moonlab_tools.has_access = true %}
<a href="https://intra.moon-lab.de" target="_blank" rel="noopener noreferrer" class="block px-3 py-1 rounded-md {% if maintenance_active %}hover:bg-yellow-500/10 hover:text-yellow-300{% else %}hover:bg-purple-500/10 hover:text-purple-300{% endif %}">🌐 Moonlab-Intranet</a> <a href="https://intra.moon-lab.de" target="_blank" rel="noopener noreferrer" class="block px-3 py-1 rounded-md {% if maintenance_active %}hover:bg-yellow-500/10 hover:text-yellow-300{% else %}hover:bg-purple-500/10 hover:text-purple-300{% endif %}">🌐 Moonlab-Intranet</a>
{% endif %}
{% if 'view_age_verification' in session.get('permissions', []) %} {% if 'view_age_verification' in session.get('permissions', []) %}
{% set moonlab_tools.has_access = true %}
<a href="{{ url_for('age_verification') }}" class="block px-3 py-1 rounded-md transition <a href="{{ url_for('age_verification') }}" class="block px-3 py-1 rounded-md transition
{% if active_page == 'age_verification' %}{% if maintenance_active %}bg-yellow-500/10 text-yellow-300{% else %}bg-purple-500/10 text-purple-300{% endif %}{% else %} {% if active_page == 'age_verification' %}{% if maintenance_active %}bg-yellow-500/10 text-yellow-300{% else %}bg-purple-500/10 text-purple-300{% endif %}{% else %}
{% if maintenance_active %}hover:bg-yellow-500/10 hover:text-yellow-300{% else %}hover:bg-purple-500/10 hover:text-purple-300{% endif %}{% endif %}"> {% if maintenance_active %}hover:bg-yellow-500/10 hover:text-yellow-300{% else %}hover:bg-purple-500/10 hover:text-purple-300{% endif %}{% endif %}">
🎂 Altersüberprüfung 🎂 Altersüberprüfung
</a> </a>
{% endif %} {% endif %}
{% if 'events' in session.get('permissions', []) %}
{% set moonlab_tools.has_access = true %}
<a href="javascript:void(0);" onclick="alert('Diese Funktion wird in Kürze verfügbar sein.')" class="block px-3 py-1 rounded-md {% if maintenance_active %}hover:bg-yellow-500/10 hover:text-yellow-300{% else %}hover:bg-purple-500/10 hover:text-purple-300{% endif %}">🎉 Events</a> <a href="javascript:void(0);" onclick="alert('Diese Funktion wird in Kürze verfügbar sein.')" class="block px-3 py-1 rounded-md {% if maintenance_active %}hover:bg-yellow-500/10 hover:text-yellow-300{% else %}hover:bg-purple-500/10 hover:text-purple-300{% endif %}">🎉 Events</a>
{% endif %}
{% if not moonlab_tools.has_access %}
<div class="block px-3 py-1 rounded-md text-gray-500 text-sm italic">
Du hast nicht genügend Berechtigungen für diese Sektion.
</div>
{% endif %}
</div> </div>
</div> </div>

View file

@ -86,6 +86,8 @@ try:
"manage_discord_bots", "manage_discord_bots",
"view_ets2_dlcs", "view_ets2_dlcs",
"manage_ets2_dlcs", "manage_ets2_dlcs",
"events",
"instranet",
"view_ip_analyzer", "view_ip_analyzer",
"view_age_verification", "view_age_verification",
"manage_age_verification" "manage_age_verification"
@ -996,6 +998,12 @@ def ets2_dlcs():
return redirect(url_for('dashboard')) return redirect(url_for('dashboard'))
packages = list(ets2_dlcs_collection.find().sort('created_at', -1)) packages = list(ets2_dlcs_collection.find().sort('created_at', -1))
for package in packages:
dlc_date = package.get('dlc_date')
try:
package['dlc_date_display'] = datetime.strptime(dlc_date, '%Y-%m-%d').strftime('%d.%m.%Y') if dlc_date else 'N/A'
except ValueError:
package['dlc_date_display'] = str(dlc_date) if dlc_date else 'N/A'
return render_template( return render_template(
'ets2_dlcs.html', 'ets2_dlcs.html',
active_page='ets2_dlcs', active_page='ets2_dlcs',