AstraOS Ver. 1.52 - Letzte Aenderung Kasten serverseitig Grid-Layout fix
All checks were successful
Deploy AstraOS Panel / deploy (push) Successful in 13s

This commit is contained in:
elias 2026-08-30 16:30:26 +02:00
parent 2164b23962
commit bdd95ce153
2 changed files with 38 additions and 31 deletions

View file

@ -61,13 +61,16 @@
</div> </div>
</div> </div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<div class="glow-card opacity-0 translate-y-8 bg-black/40 rounded-xl p-6 backdrop-blur <div class="glow-card opacity-0 translate-y-8 bg-black/40 rounded-xl p-6 backdrop-blur
{% if maintenance_active %}border border-yellow-500/30{% else %}border border-purple-500/20{% endif %}"> {% if maintenance_active %}border border-yellow-500/30{% else %}border border-purple-500/20{% endif %}">
<h3 class="text-xl font-semibold mb-2 {% if maintenance_active %}text-yellow-300{% else %}text-purple-300{% endif %}">Letzte Änderung</h3> <h3 class="text-xl font-semibold mb-2 {% if maintenance_active %}text-yellow-300{% else %}text-purple-300{% endif %}">Letzte Änderung</h3>
<p class="text-base font-bold text-slate-100 truncate" id="last-commit-msg">wird geladen…</p> <p class="text-base font-bold text-slate-100 truncate">{{ last_commit.message if last_commit else '–' }}</p>
<p class="text-xs text-slate-500 mt-0.5" id="last-commit-author">–</p> <p class="text-xs text-slate-500 mt-0.5">von {{ last_commit.author if last_commit else '–' }}</p>
<p class="text-xs text-purple-400 mt-1 font-mono" id="last-commit-time">–</p> <p class="text-xs text-purple-400 mt-1 font-mono">{{ last_commit.time_str if last_commit else '–' }}</p>
</div> </div>
<div class="glow-card opacity-0 translate-y-8 bg-black/40 rounded-xl p-6 backdrop-blur <div class="glow-card opacity-0 translate-y-8 bg-black/40 rounded-xl p-6 backdrop-blur
{% if maintenance_active %}border border-yellow-500/30{% else %}border border-purple-500/20{% endif %}"> {% if maintenance_active %}border border-yellow-500/30{% else %}border border-purple-500/20{% endif %}">
<h3 class="text-xl font-semibold mb-2 {% if maintenance_active %}text-yellow-300{% else %}text-purple-300{% endif %}">Aktive Nutzer</h3> <h3 class="text-xl font-semibold mb-2 {% if maintenance_active %}text-yellow-300{% else %}text-purple-300{% endif %}">Aktive Nutzer</h3>
@ -136,33 +139,6 @@
</div> </div>
</div> </div>
<script> <script>
// Letzte Änderung (Commit) laden
fetch('https://git.astra-os.de/api/v1/repos/MrWhiff/AstraOS-Panel/commits?limit=1', {signal: AbortSignal.timeout(4000)})
.then(r => r.json())
.then(data => {
const commit = data?.[0];
const msgEl = document.getElementById('last-commit-msg');
const authEl = document.getElementById('last-commit-author');
const timeEl = document.getElementById('last-commit-time');
if (!commit || !msgEl) return;
// Commit-Message (erste Zeile)
msgEl.textContent = (commit.commit?.message || '–').split('\n')[0];
// Autor
const author = commit.commit?.author?.name || commit.author?.login || '–';
authEl.textContent = `von ${author}`;
// Relative Zeit
const d = commit.created || commit.commit?.author?.date;
if (d) {
const diff = Math.round((Date.now() - new Date(d).getTime()) / 60000);
if (diff < 60) timeEl.textContent = `vor ${diff} Min.`;
else if (diff < 1440) timeEl.textContent = `vor ${Math.round(diff/60)} Std.`;
else timeEl.textContent = new Date(d).toLocaleDateString('de-DE', {day:'2-digit', month:'short', hour:'2-digit', minute:'2-digit'});
}
})
.catch(() => {
const el = document.getElementById('last-commit-msg');
if (el) el.textContent = 'nicht verfügbar';
});
gsap.registerPlugin(ScrollTrigger); gsap.registerPlugin(ScrollTrigger);

View file

@ -851,7 +851,38 @@ def dashboard():
"time_str": _dt_to_str(last_user_time) "time_str": _dt_to_str(last_user_time)
} }
} }
return render_template('dashboard.html', stats=stats, active_page='dashboard') # Letzten Commit von Forgejo laden
last_commit = None
try:
forgejo_token = os.environ.get('FORGEJO_API_TOKEN', '')
headers = {'Authorization': f'token {forgejo_token}'} if forgejo_token else {}
r = requests.get(
'https://git.astra-os.de/api/v1/repos/MrWhiff/AstraOS-Panel/commits?limit=1',
headers=headers, timeout=3
)
if r.status_code == 200:
commits = r.json()
if commits:
c = commits[0]
msg = (c.get('commit', {}).get('message') or '–').split('\n')[0]
author = c.get('commit', {}).get('author', {}).get('name') or c.get('author', {}).get('login') or '–'
raw_date = c.get('created') or c.get('commit', {}).get('author', {}).get('date')
if raw_date:
from datetime import timezone
dt = datetime.fromisoformat(raw_date.replace('Z', '+00:00'))
diff_min = int((datetime.now(timezone.utc) - dt).total_seconds() / 60)
if diff_min < 60:
time_str = f'vor {diff_min} Min.'
elif diff_min < 1440:
time_str = f'vor {diff_min // 60} Std.'
else:
time_str = dt.strftime('%d. %b %Y, %H:%M')
else:
time_str = '–'
last_commit = {'message': msg, 'author': author, 'time_str': time_str}
except Exception:
pass
return render_template('dashboard.html', stats=stats, active_page='dashboard', last_commit=last_commit, maintenance_active=bool(maint.get('enabled')))
@app.route('/logout') @app.route('/logout')
@login_required @login_required
def logout(): def logout():