Für Empfang, Lobby oder Tagungsraum lässt sich je Site eine öffentliche Seite anlegen (kiosk.php), die auf einem Bildschirm oder Tablet läuft: ein großer Knopf, ein Klick, ein Zugangscode mit QR-Code. Nach einer einstellbaren Anzeigedauer springt der Bildschirm zurück, damit der nächste Gast nicht den Code seines Vorgängers sieht. Verwaltung unter Administration → Display-Seiten: - Site und optionales Voucher-Profil (bestimmt Laufzeit, Geräte, QoS) - eigene Überschrift und Text für den Bildschirm - Codes pro Tag, Wartezeit zwischen zwei Codes, Anzeigedauer - geheimer Link zum Kopieren, als QR-Code anzeigbar und jederzeit erneuerbar (der alte Link gilt dann sofort nicht mehr) Absicherung: der Link ist der Zugang, deshalb Tageslimit und Wartezeit je Display, CSRF-Token am Formular, `noindex` im Kopf und ein Eintrag im Audit-Log für jeden ausgegebenen Code. Webhooks werden für Kiosk-Codes bewusst nicht ausgelöst – ein Empfangsdisplay würde den Kanal fluten. Technik: - neue Tabelle `kiosks`, `vouchers.kiosk_id` hält die Herkunft fest (Migration 0005, database.sql nachgezogen) - includes/Kiosk.php kapselt Token, Limits und Profil-Auflösung - includes/VoucherService.php bündelt die Voucher-Erstellung, die vorher in index.php lag und für den Kiosk ein zweites Mal nötig gewesen wäre - Startbildschirm zeigt zusätzlich einen QR auf sich selbst, damit Gäste die Seite am eigenen Handy öffnen können Tests: 9 neue Fälle für Token-Prüfung, Wartezeit, Tageslimit und Profil-Auflösung (38 Tests gesamt), PHPStan deckt Kiosk.php mit ab. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
81 lines
3.6 KiB
Python
Executable file
81 lines
3.6 KiB
Python
Executable file
#!/usr/bin/env python3
|
||
"""Erzeugt die Screenshots in docs/screenshots aus der laufenden Demo-Instanz.
|
||
|
||
Voraussetzung:
|
||
python3 tools/demo/build.py /tmp/uvt-demo
|
||
php -S 127.0.0.1:8123 -t /tmp/uvt-demo &
|
||
|
||
Aufruf:
|
||
python3 tools/screenshots.py [basis-url]
|
||
"""
|
||
import os
|
||
import shutil
|
||
import subprocess
|
||
import sys
|
||
|
||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||
OUT = os.path.join(ROOT, 'docs', 'screenshots')
|
||
SCALE = 2
|
||
|
||
# (Datei, Pfad, Breite, Hoehe) – Breite/Hoehe in CSS-Pixeln, Ausgabe in 2x
|
||
SHOTS = [
|
||
('login.png', 'login.php?anon=1', 1200, 850),
|
||
('login-branding.png', 'login.php?anon=1&brand=custom', 1200, 850),
|
||
('voucher-form.png', 'index.php', 1200, 880),
|
||
('voucher-result.png', 'index.php?demo=result', 1200, 900),
|
||
('bulk-vouchers.png', 'index.php?demo=bulk', 1200, 800),
|
||
('admin-dashboard.png', 'admin/index.php', 1200, 1400),
|
||
('admin-dashboard-dark.png', 'admin/index.php?theme=dark', 1200, 1400),
|
||
('vouchers.png', 'admin/vouchers.php', 1200, 1120),
|
||
('settings.png', 'admin/settings.php', 1200, 950),
|
||
('settings-login.png', 'admin/settings.php?tab=login', 1200, 1000),
|
||
('settings-branding.png', 'admin/settings.php?tab=branding', 1200, 900),
|
||
('api-keys.png', 'admin/api_keys.php?demo=new', 1200, 830),
|
||
('integrations.png', 'admin/integrations.php', 1200, 900),
|
||
('two-factor.png', 'admin/security.php', 1200, 900),
|
||
('updater.png', 'admin/update.php', 1200, 780),
|
||
('updater-available.png', 'admin/update.php?demo=available', 1200, 780),
|
||
('kiosk-display.png', 'kiosk.php?k=a1b2c3d4e5f60718293a4b5c6d7e8f90', 1200, 900),
|
||
('kiosk-code.png', 'kiosk.php?k=a1b2c3d4e5f60718293a4b5c6d7e8f90&demo=code', 1200, 900),
|
||
('kiosks-admin.png', 'admin/kiosks.php', 1200, 780),
|
||
('mobile-vouchers.png', 'admin/users.php', 430, 860),
|
||
('maintenance.png', 'updater/templates/maintenance.html', 1200, 700),
|
||
]
|
||
|
||
CANDIDATES = [
|
||
os.environ.get('CHROME_BIN', ''),
|
||
'/usr/bin/chromium', '/usr/bin/chromium-browser', '/usr/bin/google-chrome',
|
||
'/opt/pw-browsers/chromium', shutil.which('chromium') or '',
|
||
]
|
||
|
||
|
||
def find_browser() -> str:
|
||
for path in CANDIDATES:
|
||
if path and os.path.isfile(path) and os.access(path, os.X_OK):
|
||
return path
|
||
raise SystemExit('Kein Chromium gefunden – Pfad ueber CHROME_BIN setzen.')
|
||
|
||
|
||
def main() -> int:
|
||
base = (sys.argv[1] if len(sys.argv) > 1 else 'http://127.0.0.1:8123').rstrip('/')
|
||
browser = find_browser()
|
||
os.makedirs(OUT, exist_ok=True)
|
||
|
||
for name, path, width, height in SHOTS:
|
||
target = os.path.join(OUT, name)
|
||
subprocess.run([
|
||
browser, '--headless', '--no-sandbox', '--disable-gpu', '--hide-scrollbars',
|
||
'--force-color-profile=srgb', '--disable-lcd-text', '--font-render-hinting=none',
|
||
'--virtual-time-budget=4000', '--force-prefers-reduced-motion',
|
||
'--force-device-scale-factor=%d' % SCALE,
|
||
'--window-size=%d,%d' % (width, height),
|
||
'--screenshot=%s' % target,
|
||
'%s/%s' % (base, path),
|
||
], check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||
print('%-28s %s' % (name, 'ok' if os.path.exists(target) else 'FEHLER'))
|
||
|
||
return 0
|
||
|
||
|
||
if __name__ == '__main__':
|
||
raise SystemExit(main())
|