Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3c700283a | ||
|
|
61a47debdc | ||
|
|
bec74e6936 | ||
|
|
d2679361bc | ||
|
|
20c7fd8813 | ||
|
|
eaca6f7990 | ||
|
|
4eb1c0c2d8 | ||
|
|
c0a6dd057c | ||
|
|
8c2cd10ee4 | ||
|
|
2c3ca4acc1 |
No files matched your search
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "tesm"
|
name = "tesm"
|
||||||
version = "2.1.2"
|
version = "2.5.1"
|
||||||
description = "TESM -- Verwaltung und Ueberwachung von PoE-Endgeraeten und Aruba-Switchen"
|
description = "TESM -- Verwaltung und Ueberwachung von PoE-Endgeraeten und Aruba-Switchen"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -353,19 +353,32 @@ def _start_fileshare_sweep(app: Flask) -> None:
|
|||||||
weiter eingebunden.
|
weiter eingebunden.
|
||||||
"""
|
"""
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
from .services import fileshare
|
from .services import fileshare
|
||||||
|
|
||||||
|
def einmal() -> None:
|
||||||
|
with app.app_context():
|
||||||
|
geloest = fileshare.sweep_expired(core(app).database)
|
||||||
|
if geloest:
|
||||||
|
logger.info("%s abgelaufene Freigabe-Einbindungen geloest", geloest)
|
||||||
|
|
||||||
def schleife() -> None:
|
def schleife() -> None:
|
||||||
while True:
|
# Zwei Netze: das innere haelt den Faden am Leben, wenn ein einzelner
|
||||||
time.sleep(FILESHARE_SWEEP_SECONDS)
|
# Durchlauf scheitert; das aeussere sorgt dafuer, dass sein Ende
|
||||||
try:
|
# ueberhaupt auffaellt. Vorher fehlte der Import von "time" -- der
|
||||||
with app.app_context():
|
# NameError kam beim ersten sleep, also vor jedem try, und der Faden
|
||||||
geloest = fileshare.sweep_expired(core(app).database)
|
# war weg, ohne eine Zeile zu hinterlassen.
|
||||||
if geloest:
|
try:
|
||||||
logger.info("%s abgelaufene Freigabe-Einbindungen geloest", geloest)
|
while True:
|
||||||
except Exception: # noqa: BLE001 - der Webprozess darf nie sterben
|
time.sleep(FILESHARE_SWEEP_SECONDS)
|
||||||
logger.exception("Aufraeumen der Dateifreigaben fehlgeschlagen")
|
try:
|
||||||
|
einmal()
|
||||||
|
except Exception: # noqa: BLE001 - der Webprozess darf nie sterben
|
||||||
|
logger.exception("Aufraeumen der Dateifreigaben fehlgeschlagen")
|
||||||
|
except BaseException: # noqa: BLE001 - auch ein Abbruch gehoert protokolliert
|
||||||
|
logger.exception("Der Aufraeumfaden der Dateifreigaben ist beendet")
|
||||||
|
raise
|
||||||
|
|
||||||
threading.Thread(target=schleife, name="fileshare-sweep", daemon=True).start()
|
threading.Thread(target=schleife, name="fileshare-sweep", daemon=True).start()
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from tesm_core.licensing_client import LicenseError
|
|||||||
|
|
||||||
from ..services import transfer
|
from ..services import transfer
|
||||||
|
|
||||||
bp = Blueprint("backup", __name__, url_prefix="/sicherung")
|
bp = Blueprint("backup", __name__, url_prefix="/administration/backup")
|
||||||
|
|
||||||
MAX_IMPORT_BYTES = 64 * 1024 * 1024
|
MAX_IMPORT_BYTES = 64 * 1024 * 1024
|
||||||
PREVIEW_SESSION_KEY = "_import_token"
|
PREVIEW_SESSION_KEY = "_import_token"
|
||||||
@@ -78,7 +78,7 @@ def overview():
|
|||||||
|
|
||||||
@bp.post("/export")
|
@bp.post("/export")
|
||||||
@permission_required("backup.export")
|
@permission_required("backup.export")
|
||||||
@reauth_required
|
# Die frische Bestaetigung verlangt das Recht selbst (SENSITIVE_ACTIONS).
|
||||||
def export():
|
def export():
|
||||||
extension = core()
|
extension = core()
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -129,7 +129,7 @@ def export():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/import/vorschau")
|
@bp.post("/import/preview")
|
||||||
@permission_required("backup.execute")
|
@permission_required("backup.execute")
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def import_preview():
|
def import_preview():
|
||||||
@@ -161,7 +161,7 @@ def import_preview():
|
|||||||
return redirect(url_for("backup.overview"))
|
return redirect(url_for("backup.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/import/uebernehmen")
|
@bp.post("/import/apply")
|
||||||
@permission_required("backup.execute")
|
@permission_required("backup.execute")
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def import_apply():
|
def import_apply():
|
||||||
@@ -225,7 +225,7 @@ def import_apply():
|
|||||||
return redirect(url_for("backup.overview"))
|
return redirect(url_for("backup.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/import/verwerfen")
|
@bp.post("/import/discard")
|
||||||
@permission_required("backup.execute")
|
@permission_required("backup.execute")
|
||||||
def import_discard():
|
def import_discard():
|
||||||
token = session.pop(PREVIEW_SESSION_KEY, "")
|
token = session.pop(PREVIEW_SESSION_KEY, "")
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ from typing import Any
|
|||||||
|
|
||||||
from flask import Blueprint, abort, flash, redirect, render_template, request, url_for
|
from flask import Blueprint, abort, flash, redirect, render_template, request, url_for
|
||||||
from tesm_core import audit
|
from tesm_core import audit
|
||||||
from tesm_core.auth.models import current_user, permission_required, reauth_required
|
from tesm_core.auth.models import current_user, permission_required
|
||||||
from tesm_core.auth.service import client_ip
|
from tesm_core.auth.service import client_ip
|
||||||
from tesm_core.extension import core, db, transaction
|
from tesm_core.extension import core, db, transaction
|
||||||
|
|
||||||
from ..services import inventory
|
from ..services import inventory
|
||||||
|
|
||||||
bp = Blueprint("credentials", __name__, url_prefix="/zugangsdaten")
|
bp = Blueprint("credentials", __name__, url_prefix="/monitoring/credentials")
|
||||||
|
|
||||||
|
|
||||||
def _audit(conn: Any, action: str, target: str, detail: str = "", severity: str = "info") -> None:
|
def _audit(conn: Any, action: str, target: str, detail: str = "", severity: str = "info") -> None:
|
||||||
@@ -39,7 +39,7 @@ def overview():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/neu")
|
@bp.post("/new")
|
||||||
@permission_required("credentials.create")
|
@permission_required("credentials.create")
|
||||||
def create():
|
def create():
|
||||||
try:
|
try:
|
||||||
@@ -91,7 +91,7 @@ def update(credential_id: int):
|
|||||||
return redirect(url_for("credentials.overview"))
|
return redirect(url_for("credentials.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:credential_id>/loeschen")
|
@bp.post("/<int:credential_id>/delete")
|
||||||
@permission_required("credentials.delete")
|
@permission_required("credentials.delete")
|
||||||
def delete(credential_id: int):
|
def delete(credential_id: int):
|
||||||
try:
|
try:
|
||||||
@@ -109,9 +109,9 @@ def delete(credential_id: int):
|
|||||||
return redirect(url_for("credentials.overview"))
|
return redirect(url_for("credentials.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:credential_id>/anzeigen")
|
@bp.post("/<int:credential_id>/reveal")
|
||||||
@permission_required("credentials.secrets")
|
@permission_required("credentials.secrets")
|
||||||
@reauth_required
|
# Die frische Bestaetigung verlangt das Recht selbst (SENSITIVE_ACTIONS).
|
||||||
def reveal(credential_id: int):
|
def reveal(credential_id: int):
|
||||||
"""Zeigt ein gespeichertes Passwort im Klartext.
|
"""Zeigt ein gespeichertes Passwort im Klartext.
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ def _tiles(*, authenticated: bool) -> dict[str, Any]:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/uebersicht")
|
@bp.get("/overview")
|
||||||
def index():
|
def index():
|
||||||
from tesm_core.auth.models import current_user
|
from tesm_core.auth.models import current_user
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ def index_view():
|
|||||||
return index()
|
return index()
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/uebersicht/kacheln")
|
@bp.get("/overview/tiles")
|
||||||
@fragment
|
@fragment
|
||||||
def tiles():
|
def tiles():
|
||||||
"""Teilbereich fuer die automatische Aktualisierung -- liefert nur HTML-Fragment."""
|
"""Teilbereich fuer die automatische Aktualisierung -- liefert nur HTML-Fragment."""
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from tesm_core.extension import core, db, transaction
|
|||||||
|
|
||||||
from ..services import inventory, monitor, restart, ssh
|
from ..services import inventory, monitor, restart, ssh
|
||||||
|
|
||||||
bp = Blueprint("devices", __name__, url_prefix="/clients")
|
bp = Blueprint("devices", __name__, url_prefix="/monitoring/clients")
|
||||||
|
|
||||||
|
|
||||||
def _audit(conn: Any, action: str, target: str, detail: str = "", severity: str = "info") -> None:
|
def _audit(conn: Any, action: str, target: str, detail: str = "", severity: str = "info") -> None:
|
||||||
@@ -113,7 +113,7 @@ def _credential_from_form(conn: Any) -> int | None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/neu")
|
@bp.post("/new")
|
||||||
@permission_required("devices.create")
|
@permission_required("devices.create")
|
||||||
def create():
|
def create():
|
||||||
try:
|
try:
|
||||||
@@ -161,7 +161,7 @@ def update(device_id: int):
|
|||||||
return redirect(url_for("devices.overview"))
|
return redirect(url_for("devices.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:device_id>/aktiv")
|
@bp.post("/<int:device_id>/active")
|
||||||
@permission_required("devices.edit")
|
@permission_required("devices.edit")
|
||||||
def toggle_active(device_id: int):
|
def toggle_active(device_id: int):
|
||||||
active = request.form.get("active") == "1"
|
active = request.form.get("active") == "1"
|
||||||
@@ -180,7 +180,7 @@ def toggle_active(device_id: int):
|
|||||||
return redirect(request.referrer or url_for("devices.overview"))
|
return redirect(request.referrer or url_for("devices.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:device_id>/loeschen")
|
@bp.post("/<int:device_id>/delete")
|
||||||
@permission_required("devices.delete")
|
@permission_required("devices.delete")
|
||||||
def delete(device_id: int):
|
def delete(device_id: int):
|
||||||
with transaction() as conn:
|
with transaction() as conn:
|
||||||
@@ -193,7 +193,7 @@ def delete(device_id: int):
|
|||||||
return redirect(url_for("devices.overview"))
|
return redirect(url_for("devices.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:device_id>/neustart")
|
@bp.post("/<int:device_id>/restart")
|
||||||
@permission_required("devices.execute")
|
@permission_required("devices.execute")
|
||||||
def restart_device(device_id: int):
|
def restart_device(device_id: int):
|
||||||
"""Startet ein Geraet neu -- ueber den Weg, der dafuer gewaehlt wurde.
|
"""Startet ein Geraet neu -- ueber den Weg, der dafuer gewaehlt wurde.
|
||||||
@@ -351,7 +351,7 @@ def detail(device_id: int):
|
|||||||
categories=inventory.DEVICE_CATEGORIES,
|
categories=inventory.DEVICE_CATEGORIES,
|
||||||
host_keys=host_keys,
|
host_keys=host_keys,
|
||||||
method_labels=monitor.METHOD_LABELS,
|
method_labels=monitor.METHOD_LABELS,
|
||||||
terminal_enabled=bool(extension.settings.get(conn, "terminal_enabled")),
|
terminal_enabled=bool(extension.settings.get(conn, "terminal_clients_enabled")),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ def detail(device_id: int):
|
|||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:device_id>/hostkey/pruefen")
|
@bp.post("/<int:device_id>/host-key/probe")
|
||||||
@permission_required("devices.edit")
|
@permission_required("devices.edit")
|
||||||
def probe_host_key(device_id: int):
|
def probe_host_key(device_id: int):
|
||||||
"""Liest den Host-Schluessel des Clients, ohne sich anzumelden.
|
"""Liest den Host-Schluessel des Clients, ohne sich anzumelden.
|
||||||
@@ -390,7 +390,7 @@ def probe_host_key(device_id: int):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:device_id>/hostkey/freigeben")
|
@bp.post("/<int:device_id>/host-key/trust")
|
||||||
@permission_required("devices.edit")
|
@permission_required("devices.edit")
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def trust_host_key(device_id: int):
|
def trust_host_key(device_id: int):
|
||||||
@@ -424,7 +424,7 @@ def trust_host_key(device_id: int):
|
|||||||
return redirect(url_for("devices.detail", device_id=device_id))
|
return redirect(url_for("devices.detail", device_id=device_id))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:device_id>/hostkey/verwerfen")
|
@bp.post("/<int:device_id>/host-key/forget")
|
||||||
@permission_required("devices.edit")
|
@permission_required("devices.edit")
|
||||||
def forget_host_key(device_id: int):
|
def forget_host_key(device_id: int):
|
||||||
conn = db()
|
conn = db()
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ def overview():
|
|||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/einstellungen")
|
@bp.post("/settings")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def save_settings():
|
def save_settings():
|
||||||
extension = core()
|
extension = core()
|
||||||
@@ -122,7 +122,7 @@ def save_settings():
|
|||||||
return _write_and_redirect()
|
return _write_and_redirect()
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/subnetz")
|
@bp.post("/subnet")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def add_subnet():
|
def add_subnet():
|
||||||
extension = core()
|
extension = core()
|
||||||
@@ -158,7 +158,7 @@ def add_subnet():
|
|||||||
return _write_and_redirect()
|
return _write_and_redirect()
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/subnetz/<int:subnet_id>")
|
@bp.post("/subnet/<int:subnet_id>")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def update_subnet(subnet_id: int):
|
def update_subnet(subnet_id: int):
|
||||||
extension = core()
|
extension = core()
|
||||||
@@ -194,7 +194,7 @@ def update_subnet(subnet_id: int):
|
|||||||
return _write_and_redirect()
|
return _write_and_redirect()
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/subnetz/<int:subnet_id>/loeschen")
|
@bp.post("/subnet/<int:subnet_id>/delete")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def delete_subnet(subnet_id: int):
|
def delete_subnet(subnet_id: int):
|
||||||
with transaction() as conn:
|
with transaction() as conn:
|
||||||
@@ -209,7 +209,7 @@ def delete_subnet(subnet_id: int):
|
|||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/option/wert")
|
@bp.post("/option/value")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def set_option_value():
|
def set_option_value():
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -248,7 +248,7 @@ def _device_option_values(conn) -> dict[int, list[dict[str, Any]]]: # type: ign
|
|||||||
return gruppen
|
return gruppen
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/option/geraet")
|
@bp.post("/option/device")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def set_device_option_value():
|
def set_device_option_value():
|
||||||
"""Setzt eine Option fuer ein einzelnes Geraet.
|
"""Setzt eine Option fuer ein einzelnes Geraet.
|
||||||
@@ -296,7 +296,7 @@ def set_device_option_value():
|
|||||||
return _write_and_redirect()
|
return _write_and_redirect()
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/option/neu")
|
@bp.post("/option/new")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def add_custom_option():
|
def add_custom_option():
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -327,7 +327,7 @@ def add_custom_option():
|
|||||||
return redirect(url_for("dhcp.overview"))
|
return redirect(url_for("dhcp.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/option/<int:option_id>/loeschen")
|
@bp.post("/option/<int:option_id>/delete")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def delete_custom_option(option_id: int):
|
def delete_custom_option(option_id: int):
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -352,7 +352,7 @@ def delete_custom_option(option_id: int):
|
|||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/reservierung")
|
@bp.post("/reservation")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def add_reservation():
|
def add_reservation():
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -412,7 +412,7 @@ def add_reservation():
|
|||||||
return _write_and_redirect()
|
return _write_and_redirect()
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/reservierung/<int:reservation_id>/loeschen")
|
@bp.post("/reservation/<int:reservation_id>/delete")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def delete_reservation(reservation_id: int):
|
def delete_reservation(reservation_id: int):
|
||||||
with transaction() as conn:
|
with transaction() as conn:
|
||||||
@@ -480,13 +480,13 @@ def _write_and_redirect():
|
|||||||
return redirect(url_for("dhcp.overview"))
|
return redirect(url_for("dhcp.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/schreiben")
|
@bp.post("/write")
|
||||||
@permission_required("dhcp.edit")
|
@permission_required("dhcp.edit")
|
||||||
def write_config():
|
def write_config():
|
||||||
return _write_and_redirect()
|
return _write_and_redirect()
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/dienst/<action>")
|
@bp.post("/service/<action>")
|
||||||
@permission_required("dhcp.execute")
|
@permission_required("dhcp.execute")
|
||||||
def service_action(action: str):
|
def service_action(action: str):
|
||||||
allowed = {"install", "start", "stop"}
|
allowed = {"install", "start", "stop"}
|
||||||
|
|||||||
@@ -18,11 +18,12 @@ from flask import (
|
|||||||
from tesm_core import audit
|
from tesm_core import audit
|
||||||
from tesm_core.auth.models import current_user, permission_required
|
from tesm_core.auth.models import current_user, permission_required
|
||||||
from tesm_core.auth.service import client_ip
|
from tesm_core.auth.service import client_ip
|
||||||
|
from tesm_core import uploads
|
||||||
from tesm_core.extension import core, db, transaction
|
from tesm_core.extension import core, db, transaction
|
||||||
|
|
||||||
from ..services import fileshare as service
|
from ..services import fileshare as service
|
||||||
|
|
||||||
bp = Blueprint("fileshare", __name__, url_prefix="/dateifreigaben")
|
bp = Blueprint("fileshare", __name__, url_prefix="/fileshares")
|
||||||
|
|
||||||
|
|
||||||
@bp.before_request
|
@bp.before_request
|
||||||
@@ -59,8 +60,8 @@ def _mount_or_404(token: str) -> service.Mount:
|
|||||||
def browse():
|
def browse():
|
||||||
conn = db()
|
conn = db()
|
||||||
mounts = service.active_mounts(conn, current_user.id)
|
mounts = service.active_mounts(conn, current_user.id)
|
||||||
token = request.args.get("freigabe") or (mounts[0].token if mounts else "")
|
token = request.args.get("share") or (mounts[0].token if mounts else "")
|
||||||
relative = request.args.get("pfad") or ""
|
relative = request.args.get("path") or ""
|
||||||
listing = None
|
listing = None
|
||||||
error = ""
|
error = ""
|
||||||
if token:
|
if token:
|
||||||
@@ -75,15 +76,23 @@ def browse():
|
|||||||
token=token,
|
token=token,
|
||||||
listing=listing,
|
listing=listing,
|
||||||
error=error,
|
error=error,
|
||||||
max_upload_mb=int(core().settings.get(conn, "fileshare_upload_max_mb") or 512),
|
# Dieselbe Zahl, die auch die Anfrage begrenzt und in nginx steht --
|
||||||
|
# vorher versprach diese Seite 512 MB, waehrend bei 64 MB abgebrochen
|
||||||
|
# wurde.
|
||||||
|
max_upload_mb=uploads.limit_mb(conn),
|
||||||
|
# Vorschlagsliste fuer "Ausgefuellt speichern": wohin darf es gehen?
|
||||||
|
verzeichnisse=(service.all_directories(mount) if listing else []),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/<token>/herunterladen")
|
@bp.get("/<token>/download")
|
||||||
@permission_required("fileshare.view")
|
# Herunterladen traegt Daten aus dem System heraus -- in der Rechtematrix ist
|
||||||
|
# das "Exportieren", nicht "Ansehen". Eine Vorschau bleibt im Haus, eine
|
||||||
|
# heruntergeladene Datei nicht.
|
||||||
|
@permission_required("fileshare.export")
|
||||||
def download(token: str):
|
def download(token: str):
|
||||||
mount = _mount_or_404(token)
|
mount = _mount_or_404(token)
|
||||||
relative = request.args.get("pfad") or ""
|
relative = request.args.get("path") or ""
|
||||||
try:
|
try:
|
||||||
path = service.resolve_path(mount, relative)
|
path = service.resolve_path(mount, relative)
|
||||||
except service.FileshareError as exc:
|
except service.FileshareError as exc:
|
||||||
@@ -95,15 +104,20 @@ def download(token: str):
|
|||||||
path,
|
path,
|
||||||
as_attachment=True,
|
as_attachment=True,
|
||||||
download_name=path.name,
|
download_name=path.name,
|
||||||
mimetype=service.download_mime(path.name),
|
# Bewusst der neutrale Typ und nicht der erkannte: iOS Safari
|
||||||
|
# entscheidet nach dem MIME-Typ und zeigt eine "application/pdf" im
|
||||||
|
# Browser an, auch wenn sie als Anhang ausgeliefert wird. Wer hier
|
||||||
|
# klickt, will die Datei aber ablegen -- angesehen wird sie in der
|
||||||
|
# Vorschau. Fuer alle anderen Browser aendert sich damit nichts.
|
||||||
|
mimetype="application/octet-stream",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/<token>/vorschau")
|
@bp.get("/<token>/preview")
|
||||||
@permission_required("fileshare.view")
|
@permission_required("fileshare.view")
|
||||||
def preview(token: str):
|
def preview(token: str):
|
||||||
mount = _mount_or_404(token)
|
mount = _mount_or_404(token)
|
||||||
relative = request.args.get("pfad") or ""
|
relative = request.args.get("path") or ""
|
||||||
try:
|
try:
|
||||||
path = service.resolve_path(mount, relative)
|
path = service.resolve_path(mount, relative)
|
||||||
mimetype = service.preview_mime(path.name)
|
mimetype = service.preview_mime(path.name)
|
||||||
@@ -138,17 +152,17 @@ def preview(token: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<token>/hochladen")
|
@bp.post("/<token>/upload")
|
||||||
@permission_required("fileshare.create")
|
@permission_required("fileshare.create")
|
||||||
def upload(token: str):
|
def upload(token: str):
|
||||||
mount = _mount_or_404(token)
|
mount = _mount_or_404(token)
|
||||||
relative = request.form.get("pfad") or ""
|
relative = request.form.get("path") or ""
|
||||||
files = request.files.getlist("files")
|
files = request.files.getlist("files")
|
||||||
if not files:
|
if not files:
|
||||||
flash("Keine Datei ausgewaehlt.", "danger")
|
flash("Keine Datei ausgewaehlt.", "danger")
|
||||||
return redirect(url_for("fileshare.browse", freigabe=token, pfad=relative))
|
return redirect(url_for("fileshare.browse", share=token, path=relative))
|
||||||
|
|
||||||
limit = int(core().settings.get(db(), "fileshare_upload_max_mb") or 512) * 1024 * 1024
|
limit = uploads.limit_bytes(db())
|
||||||
stored = 0
|
stored = 0
|
||||||
try:
|
try:
|
||||||
target_dir = service.resolve_path(mount, relative)
|
target_dir = service.resolve_path(mount, relative)
|
||||||
@@ -164,52 +178,128 @@ def upload(token: str):
|
|||||||
stored += 1
|
stored += 1
|
||||||
except service.FileshareError as exc:
|
except service.FileshareError as exc:
|
||||||
flash(str(exc), "danger")
|
flash(str(exc), "danger")
|
||||||
return redirect(url_for("fileshare.browse", freigabe=token, pfad=relative))
|
return redirect(url_for("fileshare.browse", share=token, path=relative))
|
||||||
|
|
||||||
if stored:
|
if stored:
|
||||||
_audit("fileshare.uploaded", f"{mount.label}:{relative}", f"{stored} Datei(en)")
|
_audit("fileshare.uploaded", f"{mount.label}:{relative}", f"{stored} Datei(en)")
|
||||||
flash(f"{stored} Datei(en) hochgeladen.", "success")
|
flash(f"{stored} Datei(en) hochgeladen.", "success")
|
||||||
return redirect(url_for("fileshare.browse", freigabe=token, pfad=relative))
|
return redirect(url_for("fileshare.browse", share=token, path=relative))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<token>/ordner")
|
@bp.post("/<token>/form")
|
||||||
|
@permission_required("fileshare_pdf.create")
|
||||||
|
def save_form(token: str):
|
||||||
|
"""Nimmt ein in der Vorschau ausgefuelltes PDF und legt es daneben ab.
|
||||||
|
|
||||||
|
Als **neue** Datei: auf einer Freigabe liegt in der Regel die leere
|
||||||
|
Vorlage, und die soll leer bleiben. Wer das Original ersetzen will, kann
|
||||||
|
die alte Datei danach loeschen -- das ist eine bewusste Handlung.
|
||||||
|
"""
|
||||||
|
mount = _mount_or_404(token)
|
||||||
|
relative = request.form.get("path") or ""
|
||||||
|
upload_file = request.files.get("datei")
|
||||||
|
if upload_file is None or not upload_file.filename:
|
||||||
|
return {"error": "Es kam keine Datei an."}, 400
|
||||||
|
|
||||||
|
grenze = uploads.limit_bytes(db())
|
||||||
|
daten = upload_file.stream.read(grenze + 1)
|
||||||
|
if len(daten) > grenze:
|
||||||
|
return {"error": f"Zu gross (Grenze {grenze // 1024 // 1024} MB)."}, 413
|
||||||
|
if not daten.startswith(b"%PDF-"):
|
||||||
|
# Diese Route nimmt nur, was pdf.js hier ablegt. Ein anderer Inhalt
|
||||||
|
# waere ein Umweg, um beliebige Dateien in die Freigabe zu bekommen.
|
||||||
|
return {"error": "Das ist keine PDF-Datei."}, 415
|
||||||
|
|
||||||
|
# Geprueft wird die **Datei**, nicht ein mitgeschicktes Auswahlfeld: wer nur
|
||||||
|
# anlegen darf, legt endgueltige Fassungen ab. Traegt die Datei noch
|
||||||
|
# Formularfelder, ist sie weiter veraenderbar -- dafuer braucht es
|
||||||
|
# "PDF-Formulare: Bearbeiten". Ein umgebogenes Feld im Browser hilft damit
|
||||||
|
# niemandem weiter.
|
||||||
|
if service.hat_formularfelder(daten) and not current_user.has("fileshare_pdf.edit"):
|
||||||
|
return {
|
||||||
|
"error": "Sie duerfen ausgefuellte Formulare nur abgeschlossen speichern "
|
||||||
|
"(Felder gesperrt). Bitte im Auswahlfeld 'Abgeschlossen' waehlen."
|
||||||
|
}, 403
|
||||||
|
|
||||||
|
# Wohin und unter welchem Namen -- beides darf der Benutzer bestimmen.
|
||||||
|
ordner = (request.form.get("ordner") or "").strip().strip("/")
|
||||||
|
wunschname = (request.form.get("name") or "").strip()
|
||||||
|
ersetzen = request.form.get("ersetzen") == "1"
|
||||||
|
|
||||||
|
try:
|
||||||
|
original = service.resolve_path(mount, relative)
|
||||||
|
# Mit Namen entscheidet das Ordnerfeld -- leer heisst Wurzelverzeichnis,
|
||||||
|
# so wie es im Feld steht. Ohne Namen (Aufruf ohne Oberflaeche) bleibt
|
||||||
|
# es beim Ordner des Originals.
|
||||||
|
if wunschname:
|
||||||
|
zielordner = service.resolve_path(mount, ordner)
|
||||||
|
else:
|
||||||
|
zielordner = service.resolve_path(mount, ordner) if ordner else original.parent
|
||||||
|
if not zielordner.is_dir():
|
||||||
|
return {"error": f"Den Ordner '{ordner}' gibt es in dieser Freigabe nicht."}, 400
|
||||||
|
if wunschname:
|
||||||
|
# Eingegeben wird der Name ohne Endung; die kommt von hier. Wer
|
||||||
|
# sie mittippt, bekommt sie nicht doppelt -- und wer eine falsche
|
||||||
|
# tippt, bekommt trotzdem eine Datei, die sich oeffnen laesst.
|
||||||
|
name = service.safe_filename(wunschname)
|
||||||
|
if not name.lower().endswith(".pdf"):
|
||||||
|
name += ".pdf"
|
||||||
|
ziel = zielordner / name
|
||||||
|
if ziel.exists() and not ersetzen:
|
||||||
|
return {
|
||||||
|
"error": f"'{name}' gibt es dort schon. Anderen Namen waehlen oder "
|
||||||
|
"'Vorhandene ersetzen' ankreuzen."
|
||||||
|
}, 409
|
||||||
|
else:
|
||||||
|
# Ohne Angabe wie bisher: neben das Original, ohne etwas zu ueberschreiben.
|
||||||
|
ziel = service.free_name(original.parent, original.stem, "-ausgefuellt", ".pdf")
|
||||||
|
ziel.write_bytes(daten)
|
||||||
|
except service.FileshareError as exc:
|
||||||
|
return {"error": str(exc)}, 400
|
||||||
|
|
||||||
|
wohin = ziel.relative_to(mount.path.resolve()).as_posix()
|
||||||
|
_audit("fileshare.form_saved", f"{mount.label}:{relative}", wohin, severity="notice")
|
||||||
|
return {"message": f"Gespeichert als {wohin}.", "path": wohin}
|
||||||
|
|
||||||
|
|
||||||
|
@bp.post("/<token>/folder")
|
||||||
@permission_required("fileshare.create")
|
@permission_required("fileshare.create")
|
||||||
def make_directory(token: str):
|
def make_directory(token: str):
|
||||||
mount = _mount_or_404(token)
|
mount = _mount_or_404(token)
|
||||||
relative = request.form.get("pfad") or ""
|
relative = request.form.get("path") or ""
|
||||||
try:
|
try:
|
||||||
service.make_directory(mount, relative, request.form.get("name", ""))
|
service.make_directory(mount, relative, request.form.get("name", ""))
|
||||||
except (service.FileshareError, OSError) as exc:
|
except (service.FileshareError, OSError) as exc:
|
||||||
flash(str(exc), "danger")
|
flash(str(exc), "danger")
|
||||||
return redirect(url_for("fileshare.browse", freigabe=token, pfad=relative))
|
return redirect(url_for("fileshare.browse", share=token, path=relative))
|
||||||
_audit("fileshare.directory_created", f"{mount.label}:{relative}/{request.form.get('name')}")
|
_audit("fileshare.directory_created", f"{mount.label}:{relative}/{request.form.get('name')}")
|
||||||
flash("Ordner angelegt.", "success")
|
flash("Ordner angelegt.", "success")
|
||||||
return redirect(url_for("fileshare.browse", freigabe=token, pfad=relative))
|
return redirect(url_for("fileshare.browse", share=token, path=relative))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<token>/umbenennen")
|
@bp.post("/<token>/rename")
|
||||||
@permission_required("fileshare.edit")
|
@permission_required("fileshare.edit")
|
||||||
def rename(token: str):
|
def rename(token: str):
|
||||||
mount = _mount_or_404(token)
|
mount = _mount_or_404(token)
|
||||||
relative = request.form.get("pfad") or ""
|
relative = request.form.get("path") or ""
|
||||||
parent = request.form.get("parent") or ""
|
parent = request.form.get("parent") or ""
|
||||||
try:
|
try:
|
||||||
service.rename_entry(mount, relative, request.form.get("name", ""))
|
service.rename_entry(mount, relative, request.form.get("name", ""))
|
||||||
except (service.FileshareError, OSError) as exc:
|
except (service.FileshareError, OSError) as exc:
|
||||||
flash(str(exc), "danger")
|
flash(str(exc), "danger")
|
||||||
return redirect(url_for("fileshare.browse", freigabe=token, pfad=parent))
|
return redirect(url_for("fileshare.browse", share=token, path=parent))
|
||||||
_audit("fileshare.renamed", f"{mount.label}:{relative}")
|
_audit("fileshare.renamed", f"{mount.label}:{relative}")
|
||||||
flash("Umbenannt.", "success")
|
flash("Umbenannt.", "success")
|
||||||
return redirect(url_for("fileshare.browse", freigabe=token, pfad=parent))
|
return redirect(url_for("fileshare.browse", share=token, path=parent))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<token>/loeschen")
|
@bp.post("/<token>/delete")
|
||||||
@permission_required("fileshare.delete")
|
@permission_required("fileshare.delete")
|
||||||
def delete(token: str):
|
def delete(token: str):
|
||||||
mount = _mount_or_404(token)
|
mount = _mount_or_404(token)
|
||||||
parent = request.form.get("parent") or ""
|
parent = request.form.get("parent") or ""
|
||||||
removed = 0
|
removed = 0
|
||||||
for relative in request.form.getlist("pfade"):
|
for relative in request.form.getlist("paths"):
|
||||||
try:
|
try:
|
||||||
kind = service.delete_entry(mount, relative)
|
kind = service.delete_entry(mount, relative)
|
||||||
_audit("fileshare.deleted", f"{mount.label}:{relative}", kind, severity="warning")
|
_audit("fileshare.deleted", f"{mount.label}:{relative}", kind, severity="warning")
|
||||||
@@ -218,10 +308,10 @@ def delete(token: str):
|
|||||||
flash(str(exc), "danger")
|
flash(str(exc), "danger")
|
||||||
if removed:
|
if removed:
|
||||||
flash(f"{removed} Eintrag/Eintraege geloescht.", "success")
|
flash(f"{removed} Eintrag/Eintraege geloescht.", "success")
|
||||||
return redirect(url_for("fileshare.browse", freigabe=token, pfad=parent))
|
return redirect(url_for("fileshare.browse", share=token, path=parent))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<token>/freigeben")
|
@bp.post("/<token>/release")
|
||||||
@permission_required("fileshare.view")
|
@permission_required("fileshare.view")
|
||||||
def release(token: str):
|
def release(token: str):
|
||||||
mount = _mount_or_404(token)
|
mount = _mount_or_404(token)
|
||||||
@@ -237,7 +327,7 @@ def release(token: str):
|
|||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/zuordnungen")
|
@bp.get("/mappings")
|
||||||
@permission_required("fileshare.edit")
|
@permission_required("fileshare.edit")
|
||||||
def mappings():
|
def mappings():
|
||||||
from tesm_core.auth import directory
|
from tesm_core.auth import directory
|
||||||
@@ -251,7 +341,7 @@ def mappings():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/zuordnungen")
|
@bp.post("/mappings")
|
||||||
@permission_required("fileshare.edit")
|
@permission_required("fileshare.edit")
|
||||||
def mapping_add():
|
def mapping_add():
|
||||||
try:
|
try:
|
||||||
@@ -263,18 +353,33 @@ def mapping_add():
|
|||||||
label=request.form.get("label", ""),
|
label=request.form.get("label", ""),
|
||||||
unc=request.form.get("unc", ""),
|
unc=request.form.get("unc", ""),
|
||||||
)
|
)
|
||||||
_audit("fileshare.mapping_added", request.form.get("label", ""), severity="notice")
|
_audit(
|
||||||
|
"fileshare.mapping_added",
|
||||||
|
request.form.get("label", ""),
|
||||||
|
service.describe_mapping(
|
||||||
|
{
|
||||||
|
"unc": request.form.get("unc", ""),
|
||||||
|
"ad_group_name": request.form.get("ad_group_name", ""),
|
||||||
|
"ad_group_dn": request.form.get("ad_group_dn", ""),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
severity="notice",
|
||||||
|
)
|
||||||
flash("Zuordnung gespeichert.", "success")
|
flash("Zuordnung gespeichert.", "success")
|
||||||
except service.FileshareError as exc:
|
except service.FileshareError as exc:
|
||||||
flash(str(exc), "danger")
|
flash(str(exc), "danger")
|
||||||
return redirect(url_for("fileshare.mappings"))
|
return redirect(url_for("fileshare.mappings"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/zuordnungen/<int:mapping_id>")
|
@bp.post("/mappings/<int:mapping_id>")
|
||||||
@permission_required("fileshare.edit")
|
@permission_required("fileshare.edit")
|
||||||
def mapping_update(mapping_id: int):
|
def mapping_update(mapping_id: int):
|
||||||
try:
|
try:
|
||||||
with transaction() as conn:
|
with transaction() as conn:
|
||||||
|
# Den Stand vor der Aenderung merken -- danach ist er weg, und
|
||||||
|
# "geaendert" ohne "was" beantwortet keine einzige Frage, die man
|
||||||
|
# spaeter an ein Protokoll stellt.
|
||||||
|
vorher = service.get_mapping(conn, mapping_id)
|
||||||
service.update_mapping(
|
service.update_mapping(
|
||||||
conn,
|
conn,
|
||||||
mapping_id,
|
mapping_id,
|
||||||
@@ -283,18 +388,32 @@ def mapping_update(mapping_id: int):
|
|||||||
label=request.form.get("label", ""),
|
label=request.form.get("label", ""),
|
||||||
unc=request.form.get("unc", ""),
|
unc=request.form.get("unc", ""),
|
||||||
)
|
)
|
||||||
_audit("fileshare.mapping_updated", request.form.get("label", ""), severity="notice")
|
nachher = service.get_mapping(conn, mapping_id)
|
||||||
|
_audit(
|
||||||
|
"fileshare.mapping_updated",
|
||||||
|
str((nachher or {}).get("label") or request.form.get("label", "")),
|
||||||
|
service.mapping_changes(vorher, nachher) or "keine inhaltliche Aenderung",
|
||||||
|
severity="notice",
|
||||||
|
)
|
||||||
flash("Zuordnung geaendert.", "success")
|
flash("Zuordnung geaendert.", "success")
|
||||||
except service.FileshareError as exc:
|
except service.FileshareError as exc:
|
||||||
flash(str(exc), "danger")
|
flash(str(exc), "danger")
|
||||||
return redirect(url_for("fileshare.mappings"))
|
return redirect(url_for("fileshare.mappings"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/zuordnungen/<int:mapping_id>/loeschen")
|
@bp.post("/mappings/<int:mapping_id>/delete")
|
||||||
@permission_required("fileshare.edit")
|
@permission_required("fileshare.edit")
|
||||||
def mapping_delete(mapping_id: int):
|
def mapping_delete(mapping_id: int):
|
||||||
with transaction() as conn:
|
with transaction() as conn:
|
||||||
|
entfernt = service.get_mapping(conn, mapping_id)
|
||||||
service.delete_mapping(conn, mapping_id)
|
service.delete_mapping(conn, mapping_id)
|
||||||
_audit("fileshare.mapping_deleted", str(mapping_id), severity="notice")
|
# Eine entfernte Zuordnung nimmt allen Mitgliedern der Gruppe den Zugang
|
||||||
|
# zu dieser Freigabe -- das ist keine Notiz am Rande, sondern eine Warnung.
|
||||||
|
_audit(
|
||||||
|
"fileshare.mapping_deleted",
|
||||||
|
str((entfernt or {}).get("label") or mapping_id),
|
||||||
|
service.describe_mapping(entfernt),
|
||||||
|
severity="warning",
|
||||||
|
)
|
||||||
flash("Zuordnung entfernt.", "success")
|
flash("Zuordnung entfernt.", "success")
|
||||||
return redirect(url_for("fileshare.mappings"))
|
return redirect(url_for("fileshare.mappings"))
|
||||||
@@ -31,7 +31,7 @@ from tesm_core.extension import core, db, transaction
|
|||||||
|
|
||||||
from ..services import inventory, ssh
|
from ..services import inventory, ssh
|
||||||
|
|
||||||
bp = Blueprint("hostkeys", __name__, url_prefix="/hostschluessel")
|
bp = Blueprint("hostkeys", __name__, url_prefix="/monitoring/host-keys")
|
||||||
|
|
||||||
KIND_DEVICE = "client"
|
KIND_DEVICE = "client"
|
||||||
KIND_SWITCH = "switch"
|
KIND_SWITCH = "switch"
|
||||||
@@ -142,7 +142,7 @@ def _require(kind: str) -> None:
|
|||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<kind>/<int:target_id>/pruefen")
|
@bp.post("/<kind>/<int:target_id>/probe")
|
||||||
@permission_required("devices.view", "switches.view", mode="any")
|
@permission_required("devices.view", "switches.view", mode="any")
|
||||||
def probe(kind: str, target_id: int):
|
def probe(kind: str, target_id: int):
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -169,7 +169,7 @@ def probe(kind: str, target_id: int):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<kind>/<int:target_id>/freigeben")
|
@bp.post("/<kind>/<int:target_id>/trust")
|
||||||
@permission_required("devices.view", "switches.view", mode="any")
|
@permission_required("devices.view", "switches.view", mode="any")
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def trust(kind: str, target_id: int):
|
def trust(kind: str, target_id: int):
|
||||||
@@ -203,7 +203,7 @@ def trust(kind: str, target_id: int):
|
|||||||
return redirect(url_for("hostkeys.overview"))
|
return redirect(url_for("hostkeys.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<kind>/<int:target_id>/verwerfen")
|
@bp.post("/<kind>/<int:target_id>/forget")
|
||||||
@permission_required("devices.view", "switches.view", mode="any")
|
@permission_required("devices.view", "switches.view", mode="any")
|
||||||
def forget(kind: str, target_id: int):
|
def forget(kind: str, target_id: int):
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -222,7 +222,7 @@ def forget(kind: str, target_id: int):
|
|||||||
return redirect(url_for("hostkeys.overview"))
|
return redirect(url_for("hostkeys.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/verwaist/verwerfen")
|
@bp.post("/orphaned/forget")
|
||||||
@permission_required("devices.edit", "switches.edit", mode="any")
|
@permission_required("devices.edit", "switches.edit", mode="any")
|
||||||
def forget_orphan():
|
def forget_orphan():
|
||||||
"""Entfernt eine Freigabe, zu der es kein Ziel mehr gibt."""
|
"""Entfernt eine Freigabe, zu der es kein Ziel mehr gibt."""
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from tesm_core.licensing_client import LICENSED_FEATURES, LicenseError
|
|||||||
|
|
||||||
import tesm_licensing as lic
|
import tesm_licensing as lic
|
||||||
|
|
||||||
bp = Blueprint("license", __name__, url_prefix="/lizenz")
|
bp = Blueprint("license", __name__, url_prefix="/administration/license")
|
||||||
|
|
||||||
MAX_UPLOAD_BYTES = 256 * 1024
|
MAX_UPLOAD_BYTES = 256 * 1024
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ def overview():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/einspielen")
|
@bp.post("/install")
|
||||||
@permission_required("settings_license.edit")
|
@permission_required("settings_license.edit")
|
||||||
def upload():
|
def upload():
|
||||||
extension = core()
|
extension = core()
|
||||||
@@ -110,13 +110,13 @@ def upload():
|
|||||||
return redirect(url_for("license.overview"))
|
return redirect(url_for("license.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/aktivieren")
|
@bp.post("/activate")
|
||||||
@permission_required("settings_license.edit")
|
@permission_required("settings_license.edit")
|
||||||
def activate():
|
def activate():
|
||||||
return _handshake("activate")
|
return _handshake("activate")
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/deaktivieren")
|
@bp.post("/deactivate")
|
||||||
@permission_required("settings_license.edit")
|
@permission_required("settings_license.edit")
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def deactivate():
|
def deactivate():
|
||||||
@@ -158,7 +158,7 @@ def _handshake(action: str):
|
|||||||
return redirect(url_for("license.overview"))
|
return redirect(url_for("license.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/offline-antwort")
|
@bp.post("/offline-response")
|
||||||
@permission_required("settings_license.edit")
|
@permission_required("settings_license.edit")
|
||||||
def offline_response():
|
def offline_response():
|
||||||
extension = core()
|
extension = core()
|
||||||
@@ -177,7 +177,7 @@ def offline_response():
|
|||||||
return redirect(url_for("license.overview"))
|
return redirect(url_for("license.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/serverzertifikat")
|
@bp.post("/server-certificate")
|
||||||
@permission_required("settings_license.edit")
|
@permission_required("settings_license.edit")
|
||||||
def server_certificate():
|
def server_certificate():
|
||||||
"""Hinterlegt das Zertifikat des Lizenzservers.
|
"""Hinterlegt das Zertifikat des Lizenzservers.
|
||||||
@@ -222,7 +222,7 @@ def server_certificate():
|
|||||||
return redirect(url_for("license.overview"))
|
return redirect(url_for("license.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/aussteller/<key_id>/entfernen")
|
@bp.post("/issuer/<key_id>/remove")
|
||||||
@admin_required
|
@admin_required
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def remove_trusted_key(key_id: str):
|
def remove_trusted_key(key_id: str):
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ from tesm_core.extension import core, db
|
|||||||
|
|
||||||
from ..services import kea, monitor
|
from ..services import kea, monitor
|
||||||
|
|
||||||
bp = Blueprint("tesmlogs", __name__, url_prefix="/protokolle")
|
bp = Blueprint("tesmlogs", __name__, url_prefix="/logs")
|
||||||
|
|
||||||
MAX_TAIL_LINES = 2000
|
MAX_TAIL_LINES = 2000
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/kea")
|
@bp.get("/dhcp")
|
||||||
@permission_required("logs_dhcp.view")
|
@permission_required("logs_dhcp.view")
|
||||||
def dhcp():
|
def dhcp():
|
||||||
extension = core()
|
extension = core()
|
||||||
@@ -38,7 +38,7 @@ def dhcp():
|
|||||||
return render_template("tesm/logs_kea.html", lines=lines, path=kea.LOG_PATH, error=error)
|
return render_template("tesm/logs_kea.html", lines=lines, path=kea.LOG_PATH, error=error)
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/neustarts")
|
@bp.get("/restarts")
|
||||||
@permission_required("devices.view")
|
@permission_required("devices.view")
|
||||||
def restarts():
|
def restarts():
|
||||||
"""Alle Neustarts -- ueber den PoE-Port und per Befehl aus der Wartung.
|
"""Alle Neustarts -- ueber den PoE-Port und per Befehl aus der Wartung.
|
||||||
@@ -48,7 +48,7 @@ def restarts():
|
|||||||
der Neustart-Historie vollstaendig -- obwohl genau dort jemand nachsieht,
|
der Neustart-Historie vollstaendig -- obwohl genau dort jemand nachsieht,
|
||||||
der wissen will, warum ein Geraet weg war.
|
der wissen will, warum ein Geraet weg war.
|
||||||
"""
|
"""
|
||||||
method = (request.args.get("methode") or "").strip()
|
method = (request.args.get("method") or "").strip()
|
||||||
if method and method not in monitor.METHOD_LABELS:
|
if method and method not in monitor.METHOD_LABELS:
|
||||||
method = ""
|
method = ""
|
||||||
sql = (
|
sql = (
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ from tesm_core.extension import core, db, transaction
|
|||||||
|
|
||||||
from ..services import inventory, maintenance as service, ssh, windowsops, monitor
|
from ..services import inventory, maintenance as service, ssh, windowsops, monitor
|
||||||
|
|
||||||
bp = Blueprint("maintenance", __name__, url_prefix="/wartung")
|
bp = Blueprint("maintenance", __name__, url_prefix="/maintenance")
|
||||||
|
|
||||||
|
|
||||||
@bp.before_request
|
@bp.before_request
|
||||||
@@ -85,7 +85,7 @@ def overview():
|
|||||||
category_labels=dict(inventory.CREDENTIAL_CATEGORIES),
|
category_labels=dict(inventory.CREDENTIAL_CATEGORIES),
|
||||||
category_effects=inventory.CATEGORY_EFFECTS,
|
category_effects=inventory.CATEGORY_EFFECTS,
|
||||||
update_category=inventory.MAINTENANCE_CATEGORY,
|
update_category=inventory.MAINTENANCE_CATEGORY,
|
||||||
terminal_enabled=bool(core().settings.get(conn, "terminal_enabled")),
|
terminal_enabled=bool(core().settings.get(conn, "terminal_clients_enabled")),
|
||||||
windows_tool_missing=_windows_tool_missing(conn),
|
windows_tool_missing=_windows_tool_missing(conn),
|
||||||
windows_package=windowsops.REQUIRED_PACKAGE,
|
windows_package=windowsops.REQUIRED_PACKAGE,
|
||||||
)
|
)
|
||||||
@@ -105,7 +105,7 @@ def _windows_tool_missing(conn) -> bool: # type: ignore[no-untyped-def]
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/paket-nachinstallieren")
|
@bp.post("/install-package")
|
||||||
@permission_required("maintenance.execute")
|
@permission_required("maintenance.execute")
|
||||||
def install_windows_tool():
|
def install_windows_tool():
|
||||||
"""Installiert das Paket, das der Fehlermeldung nach fehlt.
|
"""Installiert das Paket, das der Fehlermeldung nach fehlt.
|
||||||
@@ -165,7 +165,7 @@ def status():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/auftrag/<job_id>")
|
@bp.get("/job/<job_id>")
|
||||||
@permission_required("maintenance.view", "maintenance.execute", mode="any")
|
@permission_required("maintenance.view", "maintenance.execute", mode="any")
|
||||||
def job_detail(job_id: str):
|
def job_detail(job_id: str):
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -175,7 +175,7 @@ def job_detail(job_id: str):
|
|||||||
return render_template("tesm/maintenance_job.html", job=job)
|
return render_template("tesm/maintenance_job.html", job=job)
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/auftrag/<job_id>/ausgabe")
|
@bp.get("/job/<job_id>/output")
|
||||||
@permission_required("maintenance.view", "maintenance.execute", mode="any")
|
@permission_required("maintenance.view", "maintenance.execute", mode="any")
|
||||||
@fragment
|
@fragment
|
||||||
def job_output(job_id: str):
|
def job_output(job_id: str):
|
||||||
@@ -276,14 +276,14 @@ def _start(kind: str) -> None:
|
|||||||
flash(f"{started} Auftrag/Auftraege gestartet.", "success")
|
flash(f"{started} Auftrag/Auftraege gestartet.", "success")
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/aktualisieren")
|
@bp.post("/update")
|
||||||
@permission_required("maintenance.execute")
|
@permission_required("maintenance.execute")
|
||||||
def start_update():
|
def start_update():
|
||||||
_start(service.JOB_KIND_UPDATE)
|
_start(service.JOB_KIND_UPDATE)
|
||||||
return redirect(url_for("maintenance.overview"))
|
return redirect(url_for("maintenance.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/neustarten")
|
@bp.post("/restart")
|
||||||
@permission_required("maintenance.execute")
|
@permission_required("maintenance.execute")
|
||||||
def start_reboot():
|
def start_reboot():
|
||||||
_start(service.JOB_KIND_REBOOT)
|
_start(service.JOB_KIND_REBOOT)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from tesm_core.auth.service import client_ip
|
|||||||
from tesm_core.extension import core, db, transaction
|
from tesm_core.extension import core, db, transaction
|
||||||
from tesm_core.licensing_client import LicenseError
|
from tesm_core.licensing_client import LicenseError
|
||||||
|
|
||||||
bp = Blueprint("settings", __name__, url_prefix="/einstellungen")
|
bp = Blueprint("settings", __name__, url_prefix="/administration")
|
||||||
|
|
||||||
|
|
||||||
def _audit(action: str, target: str = "", detail: str = "", severity: str = "info") -> None:
|
def _audit(action: str, target: str = "", detail: str = "", severity: str = "info") -> None:
|
||||||
@@ -79,9 +79,12 @@ def system():
|
|||||||
"monitor_failures_before_restart",
|
"monitor_failures_before_restart",
|
||||||
"monitor_auto_restart",
|
"monitor_auto_restart",
|
||||||
"dashboard_public",
|
"dashboard_public",
|
||||||
"terminal_enabled",
|
"terminal_switches_enabled",
|
||||||
|
"terminal_clients_enabled",
|
||||||
"terminal_idle_timeout",
|
"terminal_idle_timeout",
|
||||||
"trash_retention_days",
|
"trash_retention_days",
|
||||||
|
"session_idle_minutes",
|
||||||
|
"session_absolute_hours",
|
||||||
"log_rotate_interval",
|
"log_rotate_interval",
|
||||||
"log_rotate_keep",
|
"log_rotate_keep",
|
||||||
],
|
],
|
||||||
@@ -92,6 +95,7 @@ def system():
|
|||||||
timezones=_timezone_choices(),
|
timezones=_timezone_choices(),
|
||||||
nav_items=extension.nav.items,
|
nav_items=extension.nav.items,
|
||||||
nav_order=extension.settings.get(conn, "nav_order") or extension.nav.default_order(),
|
nav_order=extension.settings.get(conn, "nav_order") or extension.nav.default_order(),
|
||||||
|
nav_child_order=extension.settings.get(conn, "nav_child_order") or {},
|
||||||
license_hint=_license_hint("monitor_interval"),
|
license_hint=_license_hint("monitor_interval"),
|
||||||
sysops_available=bool(sysops and sysops.available),
|
sysops_available=bool(sysops and sysops.available),
|
||||||
)
|
)
|
||||||
@@ -109,9 +113,12 @@ def system_save():
|
|||||||
"monitor_failures_before_restart",
|
"monitor_failures_before_restart",
|
||||||
"monitor_auto_restart",
|
"monitor_auto_restart",
|
||||||
"dashboard_public",
|
"dashboard_public",
|
||||||
"terminal_enabled",
|
"terminal_switches_enabled",
|
||||||
|
"terminal_clients_enabled",
|
||||||
"terminal_idle_timeout",
|
"terminal_idle_timeout",
|
||||||
"trash_retention_days",
|
"trash_retention_days",
|
||||||
|
"session_idle_minutes",
|
||||||
|
"session_absolute_hours",
|
||||||
"log_rotate_interval",
|
"log_rotate_interval",
|
||||||
"log_rotate_keep",
|
"log_rotate_keep",
|
||||||
):
|
):
|
||||||
@@ -181,7 +188,7 @@ def set_hostname():
|
|||||||
return redirect(url_for("settings.system"))
|
return redirect(url_for("settings.system"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/system/zeitzone")
|
@bp.post("/system/timezone")
|
||||||
@permission_required("settings_system.execute")
|
@permission_required("settings_system.execute")
|
||||||
def set_timezone():
|
def set_timezone():
|
||||||
extension = core()
|
extension = core()
|
||||||
@@ -210,7 +217,7 @@ def set_timezone():
|
|||||||
return redirect(url_for("settings.system"))
|
return redirect(url_for("settings.system"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/system/pruefung-jetzt")
|
@bp.post("/system/check-now")
|
||||||
@permission_required("settings_system.execute")
|
@permission_required("settings_system.execute")
|
||||||
def run_check_now():
|
def run_check_now():
|
||||||
"""Startet einen Ueberwachungsdurchlauf sofort, im Hintergrund."""
|
"""Startet einen Ueberwachungsdurchlauf sofort, im Hintergrund."""
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from tesm_core.extension import core, db, transaction
|
|||||||
|
|
||||||
from ..services import inventory, ssh, switchcli
|
from ..services import inventory, ssh, switchcli
|
||||||
|
|
||||||
bp = Blueprint("switches", __name__, url_prefix="/switche")
|
bp = Blueprint("switches", __name__, url_prefix="/monitoring/switches")
|
||||||
|
|
||||||
|
|
||||||
def _audit(conn: Any, action: str, target: str, detail: str = "", severity: str = "info") -> None:
|
def _audit(conn: Any, action: str, target: str, detail: str = "", severity: str = "info") -> None:
|
||||||
@@ -54,11 +54,11 @@ def overview():
|
|||||||
"tesm/switches.html",
|
"tesm/switches.html",
|
||||||
switches=inventory.list_switches(conn),
|
switches=inventory.list_switches(conn),
|
||||||
credentials=inventory.list_credentials(conn),
|
credentials=inventory.list_credentials(conn),
|
||||||
terminal_enabled=bool(core().settings.get(conn, "terminal_enabled")),
|
terminal_enabled=bool(core().settings.get(conn, "terminal_switches_enabled")),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/neu")
|
@bp.post("/new")
|
||||||
@permission_required("switches.create")
|
@permission_required("switches.create")
|
||||||
def create():
|
def create():
|
||||||
try:
|
try:
|
||||||
@@ -98,7 +98,7 @@ def update(switch_id: int):
|
|||||||
return redirect(request.referrer or url_for("switches.overview"))
|
return redirect(request.referrer or url_for("switches.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:switch_id>/loeschen")
|
@bp.post("/<int:switch_id>/delete")
|
||||||
@permission_required("switches.delete")
|
@permission_required("switches.delete")
|
||||||
def delete(switch_id: int):
|
def delete(switch_id: int):
|
||||||
try:
|
try:
|
||||||
@@ -142,7 +142,7 @@ def detail(switch_id: int):
|
|||||||
devices=devices,
|
devices=devices,
|
||||||
credentials=inventory.list_credentials(conn),
|
credentials=inventory.list_credentials(conn),
|
||||||
safe_commands=switchcli.SAFE_COMMANDS,
|
safe_commands=switchcli.SAFE_COMMANDS,
|
||||||
terminal_enabled=bool(core().settings.get(conn, "terminal_enabled")),
|
terminal_enabled=bool(core().settings.get(conn, "terminal_switches_enabled")),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ def detail(switch_id: int):
|
|||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:switch_id>/hostkey/pruefen")
|
@bp.post("/<int:switch_id>/host-key/probe")
|
||||||
@permission_required("switches.edit")
|
@permission_required("switches.edit")
|
||||||
def probe_host_key(switch_id: int):
|
def probe_host_key(switch_id: int):
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -176,7 +176,7 @@ def probe_host_key(switch_id: int):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:switch_id>/hostkey/freigeben")
|
@bp.post("/<int:switch_id>/host-key/trust")
|
||||||
@permission_required("switches.edit")
|
@permission_required("switches.edit")
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def trust_host_key(switch_id: int):
|
def trust_host_key(switch_id: int):
|
||||||
@@ -215,7 +215,7 @@ def trust_host_key(switch_id: int):
|
|||||||
return redirect(url_for("switches.detail", switch_id=switch_id))
|
return redirect(url_for("switches.detail", switch_id=switch_id))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:switch_id>/hostkey/verwerfen")
|
@bp.post("/<int:switch_id>/host-key/forget")
|
||||||
@permission_required("switches.edit")
|
@permission_required("switches.edit")
|
||||||
def forget_host_key(switch_id: int):
|
def forget_host_key(switch_id: int):
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -234,7 +234,7 @@ def forget_host_key(switch_id: int):
|
|||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/<int:switch_id>/kommando")
|
@bp.post("/<int:switch_id>/command")
|
||||||
@permission_required("switches.execute")
|
@permission_required("switches.execute")
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def run_command(switch_id: int):
|
def run_command(switch_id: int):
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ Rechteausweitung, die dieses Projekt an anderer Stelle ausschliesst.
|
|||||||
Gemeinsame Sicherheitsmerkmale:
|
Gemeinsame Sicherheitsmerkmale:
|
||||||
|
|
||||||
* Frische Passwortbestaetigung, zusaetzlich zum Recht.
|
* Frische Passwortbestaetigung, zusaetzlich zum Recht.
|
||||||
* Abschaltbar ueber die Einstellung ``terminal_enabled``.
|
* Abschaltbar -- getrennt fuer Switche (``terminal_switches_enabled``) und
|
||||||
|
Clients (``terminal_clients_enabled``). Das Freigeben von Host-Schluesseln
|
||||||
|
haengt an eigenen Routen und bleibt davon unberuehrt: es wird fuer den
|
||||||
|
PoE-Neustart gebraucht.
|
||||||
* Der Host-Schluessel muss vorher freigegeben sein -- die Konsole akzeptiert
|
* Der Host-Schluessel muss vorher freigegeben sein -- die Konsole akzeptiert
|
||||||
keine unbekannten Schluessel (anders als der Vorgaenger, der sie hier
|
keine unbekannten Schluessel (anders als der Vorgaenger, der sie hier
|
||||||
interaktiv uebernahm). Freigegeben wird auf der jeweiligen Detailseite.
|
interaktiv uebernahm). Freigegeben wird auf der jeweiligen Detailseite.
|
||||||
@@ -128,6 +131,18 @@ def _load_target(conn: Any, kind: str, target_id: int) -> Target | None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _konsole_erlaubt(conn: Any, kind: str) -> bool:
|
||||||
|
"""Ist die Konsole fuer diese Art Ziel eingeschaltet?
|
||||||
|
|
||||||
|
Zwei Schalter, weil beides unabhaengig voneinander gebraucht wird: eine
|
||||||
|
Werkstatt will vielleicht auf Switche, aber nicht auf Clients.
|
||||||
|
"""
|
||||||
|
schluessel = (
|
||||||
|
"terminal_switches_enabled" if kind == KIND_SWITCH else "terminal_clients_enabled"
|
||||||
|
)
|
||||||
|
return bool(core().settings.get(conn, schluessel))
|
||||||
|
|
||||||
|
|
||||||
def _client_module_active() -> bool:
|
def _client_module_active() -> bool:
|
||||||
manager = core().license
|
manager = core().license
|
||||||
return manager is None or manager.module_active("maintenance")
|
return manager is None or manager.module_active("maintenance")
|
||||||
@@ -136,7 +151,7 @@ def _client_module_active() -> bool:
|
|||||||
def _render_console(target: Target): # type: ignore[no-untyped-def]
|
def _render_console(target: Target): # type: ignore[no-untyped-def]
|
||||||
extension = core()
|
extension = core()
|
||||||
conn = db()
|
conn = db()
|
||||||
if not extension.settings.get(conn, "terminal_enabled"):
|
if not _konsole_erlaubt(conn, target.kind):
|
||||||
abort(404)
|
abort(404)
|
||||||
if not target.credential_id:
|
if not target.credential_id:
|
||||||
abort(409, description="Fuer dieses Ziel sind keine Zugangsdaten hinterlegt.")
|
abort(409, description="Fuer dieses Ziel sind keine Zugangsdaten hinterlegt.")
|
||||||
@@ -151,7 +166,7 @@ def _render_console(target: Target): # type: ignore[no-untyped-def]
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/switche/<int:switch_id>/konsole")
|
@bp.get("/monitoring/switches/<int:switch_id>/console")
|
||||||
@permission_required("switches.execute")
|
@permission_required("switches.execute")
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def switch_console(switch_id: int):
|
def switch_console(switch_id: int):
|
||||||
@@ -161,7 +176,7 @@ def switch_console(switch_id: int):
|
|||||||
return _render_console(target)
|
return _render_console(target)
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/clients/<int:device_id>/konsole")
|
@bp.get("/monitoring/clients/<int:device_id>/console")
|
||||||
@permission_required("maintenance.execute")
|
@permission_required("maintenance.execute")
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def device_console(device_id: int):
|
def device_console(device_id: int):
|
||||||
@@ -217,7 +232,7 @@ def _handle_socket(ws, kind: str, target_id: int) -> None: # type: ignore[no-un
|
|||||||
if not reauth_is_fresh():
|
if not reauth_is_fresh():
|
||||||
_send(ws, "error", "Die Passwortbestaetigung ist abgelaufen. Bitte Seite neu laden.")
|
_send(ws, "error", "Die Passwortbestaetigung ist abgelaufen. Bitte Seite neu laden.")
|
||||||
return
|
return
|
||||||
if not extension.settings.get(conn, "terminal_enabled"):
|
if not _konsole_erlaubt(conn, kind):
|
||||||
_send(ws, "error", "Die Konsole ist in dieser Installation abgeschaltet.")
|
_send(ws, "error", "Die Konsole ist in dieser Installation abgeschaltet.")
|
||||||
return
|
return
|
||||||
if kind == KIND_DEVICE and not _client_module_active():
|
if kind == KIND_DEVICE and not _client_module_active():
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ def _has_fileshare_mounts(user: Any) -> bool:
|
|||||||
|
|
||||||
NAVIGATION = NavTree(
|
NAVIGATION = NavTree(
|
||||||
[
|
[
|
||||||
NavItem(key="index", label="Statusuebersicht", icon="grid", endpoint="dashboard.index"),
|
NavItem(key="index", label="Statusübersicht", icon="grid", endpoint="dashboard.index"),
|
||||||
NavItem(
|
NavItem(
|
||||||
key="monitoring",
|
key="monitoring",
|
||||||
label="Ueberwachung",
|
label="Überwachung",
|
||||||
icon="cpu",
|
icon="cpu",
|
||||||
children=(
|
children=(
|
||||||
NavItem(
|
NavItem(
|
||||||
@@ -74,21 +74,21 @@ NAVIGATION = NavTree(
|
|||||||
),
|
),
|
||||||
NavItem(
|
NavItem(
|
||||||
key="hostkeys",
|
key="hostkeys",
|
||||||
label="Host-Schluessel",
|
label="Host-Schlüssel",
|
||||||
icon="shield",
|
icon="shield",
|
||||||
endpoint="hostkeys.overview",
|
endpoint="hostkeys.overview",
|
||||||
permissions=("devices.view", "switches.view"),
|
permissions=("devices.view", "switches.view"),
|
||||||
),
|
),
|
||||||
NavItem(
|
|
||||||
key="maintenance",
|
|
||||||
label="Wartung",
|
|
||||||
icon="wrench",
|
|
||||||
endpoint="maintenance.overview",
|
|
||||||
permissions=("maintenance.view", "maintenance.execute"),
|
|
||||||
condition=_module("maintenance"),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
NavItem(
|
||||||
|
key="maintenance",
|
||||||
|
label="Wartung",
|
||||||
|
icon="wrench",
|
||||||
|
endpoint="maintenance.overview",
|
||||||
|
permissions=("maintenance.view", "maintenance.execute"),
|
||||||
|
condition=_module("maintenance"),
|
||||||
|
),
|
||||||
NavItem(
|
NavItem(
|
||||||
key="dhcp",
|
key="dhcp",
|
||||||
label="DHCP-Server",
|
label="DHCP-Server",
|
||||||
@@ -147,7 +147,7 @@ NAVIGATION = NavTree(
|
|||||||
),
|
),
|
||||||
NavItem(
|
NavItem(
|
||||||
key="logs_dhcp",
|
key="logs_dhcp",
|
||||||
label="Kea-DHCP",
|
label="DHCP",
|
||||||
icon="network",
|
icon="network",
|
||||||
endpoint="tesmlogs.dhcp",
|
endpoint="tesmlogs.dhcp",
|
||||||
permissions=("logs_dhcp.view",),
|
permissions=("logs_dhcp.view",),
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ DEVICES = Resource(
|
|||||||
key="devices",
|
key="devices",
|
||||||
label="Clients",
|
label="Clients",
|
||||||
actions=(A.VIEW, A.CREATE, A.EDIT, A.DELETE, A.EXECUTE),
|
actions=(A.VIEW, A.CREATE, A.EDIT, A.DELETE, A.EXECUTE),
|
||||||
hint="Ueberwachte PoE-Endgeraete",
|
hint="Überwachte PoE-Endgeräte",
|
||||||
action_hints={
|
action_hints={
|
||||||
A.EXECUTE: "PoE-Neustart eines Geraets manuell ausloesen. Der automatische "
|
A.EXECUTE: "PoE-Neustart eines Geraets manuell ausloesen. Der automatische "
|
||||||
"Neustart bei Ausfall ist davon unabhaengig und laeuft immer.",
|
"Neustart bei Ausfall ist davon unabhaengig und laeuft immer.",
|
||||||
@@ -75,7 +75,7 @@ DHCP = Resource(
|
|||||||
key="dhcp",
|
key="dhcp",
|
||||||
label="DHCP-Server",
|
label="DHCP-Server",
|
||||||
actions=(A.VIEW, A.EDIT, A.EXECUTE),
|
actions=(A.VIEW, A.EDIT, A.EXECUTE),
|
||||||
hint="Kea-DHCP: Subnetze, Optionen, Reservierungen (lizenzpflichtiges Modul)",
|
hint="DHCP: Subnetze, Optionen, Reservierungen (lizenzpflichtiges Modul)",
|
||||||
action_hints={
|
action_hints={
|
||||||
A.EDIT: "Konfiguration aendern und schreiben.",
|
A.EDIT: "Konfiguration aendern und schreiben.",
|
||||||
A.EXECUTE: "Dienst installieren, starten oder stoppen.",
|
A.EXECUTE: "Dienst installieren, starten oder stoppen.",
|
||||||
@@ -85,23 +85,48 @@ DHCP = Resource(
|
|||||||
FILESHARE = Resource(
|
FILESHARE = Resource(
|
||||||
key="fileshare",
|
key="fileshare",
|
||||||
label="Dateifreigaben",
|
label="Dateifreigaben",
|
||||||
actions=(A.VIEW, A.CREATE, A.EDIT, A.DELETE),
|
actions=(A.VIEW, A.CREATE, A.EDIT, A.DELETE, A.EXPORT),
|
||||||
hint="SMB-Freigaben aus dem Verzeichnisdienst (lizenzpflichtiges Modul)",
|
hint="SMB-Freigaben aus dem Verzeichnisdienst (lizenzpflichtiges Modul)",
|
||||||
action_hints={
|
action_hints={
|
||||||
A.CREATE: "Ordner anlegen und Dateien hochladen.",
|
A.CREATE: "Ordner anlegen und Dateien hochladen.",
|
||||||
A.EDIT: "Umbenennen und verschieben.",
|
A.EDIT: "Umbenennen und verschieben.",
|
||||||
|
# Genau die Bedeutung aus der Legende: Daten aus dem System
|
||||||
|
# heraustragen. Ansehen und Mitnehmen sind zweierlei -- eine Vorschau
|
||||||
|
# bleibt im Haus, eine heruntergeladene Datei nicht.
|
||||||
|
A.EXPORT: "Dateien herunterladen.",
|
||||||
|
},
|
||||||
|
# Exporte verlangen sonst eine frische Passwortbestaetigung. Hier nicht:
|
||||||
|
# Herunterladen ist in einer Dateifreigabe der Alltag, nicht der
|
||||||
|
# Sonderfall. Alle 15 Minuten ein Passwort waere Schikane -- und wuerde
|
||||||
|
# nur dazu fuehren, dass jemand das Recht pauschal vergibt oder ganz
|
||||||
|
# weglaesst. Die Grenze zieht hier das Recht selbst, nicht die Abfrage.
|
||||||
|
ohne_wiederanmeldung=(A.EXPORT,),
|
||||||
|
)
|
||||||
|
|
||||||
|
#: Eigene Zeile statt Anhaengsel von "Dateifreigaben": ein Formular auszufuellen
|
||||||
|
#: ist ein anderer Vorgang als eine Datei hochzuladen, und wer umbenennen darf,
|
||||||
|
#: soll deshalb nicht automatisch veraenderbare Formulare ablegen duerfen.
|
||||||
|
FILESHARE_PDF = Resource(
|
||||||
|
key="fileshare_pdf",
|
||||||
|
label="PDF-Formulare",
|
||||||
|
actions=(A.VIEW, A.CREATE, A.EDIT),
|
||||||
|
hint="Formulare in der Vorschau ausfuellen und in der Freigabe ablegen",
|
||||||
|
action_hints={
|
||||||
|
A.VIEW: "In der Vorschau ausfuellen (ohne Speichern).",
|
||||||
|
A.CREATE: "Ausgefuellt speichern -- abgeschlossen, Felder gesperrt.",
|
||||||
|
A.EDIT: "Ausgefuellt speichern -- weiter ausfuellbar, inklusive Bild.",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
LOGS_DHCP = Resource(
|
LOGS_DHCP = Resource(
|
||||||
key="logs_dhcp",
|
key="logs_dhcp",
|
||||||
label="Kea-DHCP-Protokoll",
|
label="DHCP-Protokoll",
|
||||||
actions=(A.VIEW,),
|
actions=(A.VIEW,),
|
||||||
)
|
)
|
||||||
|
|
||||||
MONITORING_AREA = Area(
|
MONITORING_AREA = Area(
|
||||||
key="monitoring",
|
key="monitoring",
|
||||||
label="Ueberwachung",
|
label="Überwachung",
|
||||||
icon="cpu",
|
icon="cpu",
|
||||||
hint="Geraete, Switche, Zugangsdaten und Wartung. Ohne diesen Zugang bleibt der "
|
hint="Geraete, Switche, Zugangsdaten und Wartung. Ohne diesen Zugang bleibt der "
|
||||||
"gesamte Bereich verborgen.",
|
"gesamte Bereich verborgen.",
|
||||||
@@ -119,7 +144,7 @@ FILES_AREA = Area(
|
|||||||
key="files",
|
key="files",
|
||||||
label="Dateifreigaben",
|
label="Dateifreigaben",
|
||||||
icon="folder",
|
icon="folder",
|
||||||
resources=(FILESHARE,),
|
resources=(FILESHARE, FILESHARE_PDF),
|
||||||
)
|
)
|
||||||
|
|
||||||
PERMISSIONS = PermissionTree(
|
PERMISSIONS = PermissionTree(
|
||||||
|
|||||||
@@ -250,8 +250,49 @@ CREATE INDEX IF NOT EXISTS idx_restart_events_method ON restart_events(method, t
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# Neue Rechte sind nach einem Update bei niemandem gesetzt -- ohne diesen
|
||||||
|
# Schritt koennte niemand mehr herunterladen oder ein Formular speichern,
|
||||||
|
# obwohl sich an den Gruppen nichts geaendert hat. Die Zuordnung bildet ab, was
|
||||||
|
# vorher galt.
|
||||||
|
V4 = """
|
||||||
|
INSERT OR IGNORE INTO group_permissions (group_id, permission)
|
||||||
|
SELECT group_id, 'fileshare.export' FROM group_permissions
|
||||||
|
WHERE permission = 'fileshare.view';
|
||||||
|
|
||||||
|
INSERT OR IGNORE INTO group_permissions (group_id, permission)
|
||||||
|
SELECT group_id, 'fileshare_pdf.view' FROM group_permissions
|
||||||
|
WHERE permission = 'fileshare.view';
|
||||||
|
|
||||||
|
INSERT OR IGNORE INTO group_permissions (group_id, permission)
|
||||||
|
SELECT group_id, 'fileshare_pdf.create' FROM group_permissions
|
||||||
|
WHERE permission = 'fileshare.create';
|
||||||
|
|
||||||
|
INSERT OR IGNORE INTO group_permissions (group_id, permission)
|
||||||
|
SELECT group_id, 'fileshare_pdf.edit' FROM group_permissions
|
||||||
|
WHERE permission = 'fileshare.edit';
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# Aus einem Schalter werden zwei. Wer die Konsole abgeschaltet hatte, soll sie
|
||||||
|
# nicht durch ein Update zurueckbekommen -- der alte Wert gilt deshalb fuer
|
||||||
|
# beide weiter. Fehlt er, greift die Vorgabe der Einstellung.
|
||||||
|
V5 = """
|
||||||
|
INSERT OR IGNORE INTO settings (key, value, updated_at, updated_by)
|
||||||
|
SELECT 'terminal_switches_enabled', value, datetime('now'), 'migration'
|
||||||
|
FROM settings WHERE key = 'terminal_enabled';
|
||||||
|
|
||||||
|
INSERT OR IGNORE INTO settings (key, value, updated_at, updated_by)
|
||||||
|
SELECT 'terminal_clients_enabled', value, datetime('now'), 'migration'
|
||||||
|
FROM settings WHERE key = 'terminal_enabled';
|
||||||
|
|
||||||
|
DELETE FROM settings WHERE key = 'terminal_enabled';
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
TESM_MIGRATIONS: tuple[Migration, ...] = (
|
TESM_MIGRATIONS: tuple[Migration, ...] = (
|
||||||
Migration(version=1, name="baseline", sql=V1),
|
Migration(version=1, name="baseline", sql=V1),
|
||||||
Migration(version=2, name="seed-dhcp-options", fn=seed_dhcp_options),
|
Migration(version=2, name="seed-dhcp-options", fn=seed_dhcp_options),
|
||||||
Migration(version=3, name="restart-events", sql=V3),
|
Migration(version=3, name="restart-events", sql=V3),
|
||||||
|
Migration(version=4, name="fileshare-pdf-rechte", sql=V4),
|
||||||
|
Migration(version=5, name="terminal-getrennt", sql=V5),
|
||||||
)
|
)
|
||||||
@@ -21,6 +21,7 @@ Sicherheitsrelevante Aenderungen gegenueber dem Vorgaenger:
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import zlib
|
||||||
import logging
|
import logging
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import os
|
import os
|
||||||
@@ -32,7 +33,7 @@ import sqlite3
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from pathlib import Path, PurePosixPath
|
from pathlib import Path, PurePosixPath
|
||||||
from typing import Any, Iterable
|
from typing import Any, Iterable, Mapping
|
||||||
|
|
||||||
from tesm_core.db import Database
|
from tesm_core.db import Database
|
||||||
from tesm_core.extension import core
|
from tesm_core.extension import core
|
||||||
@@ -57,6 +58,10 @@ PREVIEW_MIME: dict[str, str] = {
|
|||||||
".gif": "image/gif",
|
".gif": "image/gif",
|
||||||
".webp": "image/webp",
|
".webp": "image/webp",
|
||||||
".bmp": "image/bmp",
|
".bmp": "image/bmp",
|
||||||
|
# Das Format, in dem ein iPad fotografiert. Safari zeigt es an, andere
|
||||||
|
# Browser nicht -- die Vorschau sagt es dann und bietet den Download an.
|
||||||
|
".heic": "image/heic",
|
||||||
|
".heif": "image/heif",
|
||||||
".txt": "text/plain; charset=utf-8",
|
".txt": "text/plain; charset=utf-8",
|
||||||
".csv": "text/plain; charset=utf-8",
|
".csv": "text/plain; charset=utf-8",
|
||||||
".log": "text/plain; charset=utf-8",
|
".log": "text/plain; charset=utf-8",
|
||||||
@@ -68,6 +73,21 @@ PREVIEW_MIME: dict[str, str] = {
|
|||||||
#: im Ursprung der Anwendung ausgefuehrt. Download bleibt moeglich.
|
#: im Ursprung der Anwendung ausgefuehrt. Download bleibt moeglich.
|
||||||
|
|
||||||
|
|
||||||
|
def preview_kind(name: str) -> str:
|
||||||
|
"""Welche Anzeige passt: ``bild``, ``pdf`` oder ``text``?
|
||||||
|
|
||||||
|
Die Unterscheidung gehoert hierher und nicht in die Vorlage: die
|
||||||
|
Zuordnung Endung -> MIME-Typ steht schon hier, und eine zweite Liste in
|
||||||
|
Jinja liefe frueher oder spaeter auseinander.
|
||||||
|
"""
|
||||||
|
mime = PREVIEW_MIME.get(Path(name).suffix.lower(), "")
|
||||||
|
if mime.startswith("image/"):
|
||||||
|
return "bild"
|
||||||
|
if mime == "application/pdf":
|
||||||
|
return "pdf"
|
||||||
|
return "text"
|
||||||
|
|
||||||
|
|
||||||
class FileshareError(Exception):
|
class FileshareError(Exception):
|
||||||
"""Fehler mit Klartextmeldung fuer die Oberflaeche."""
|
"""Fehler mit Klartextmeldung fuer die Oberflaeche."""
|
||||||
|
|
||||||
@@ -188,6 +208,50 @@ def list_mappings(conn: sqlite3.Connection) -> list[dict[str, Any]]:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#: Felder einer Zuordnung mit der Beschriftung, unter der sie in der
|
||||||
|
#: Oberflaeche stehen. Das Protokoll soll dieselben Woerter benutzen wie das
|
||||||
|
#: Formular -- sonst muss man beim Lesen uebersetzen.
|
||||||
|
MAPPING_FELDER: tuple[tuple[str, str], ...] = (
|
||||||
|
("label", "Anzeigename"),
|
||||||
|
("unc", "Pfad"),
|
||||||
|
("ad_group_name", "Gruppe"),
|
||||||
|
("ad_group_dn", "Gruppen-DN"),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_mapping(conn: sqlite3.Connection, mapping_id: int) -> dict[str, Any] | None:
|
||||||
|
return Database.one(conn, "SELECT * FROM fileshare_mappings WHERE id=?", (mapping_id,))
|
||||||
|
|
||||||
|
|
||||||
|
def describe_mapping(row: Mapping[str, Any] | None) -> str:
|
||||||
|
"""Eine Zuordnung in einer Zeile -- fuer das Protokoll.
|
||||||
|
|
||||||
|
Ohne sie stand beim Loeschen nur die Nummer der Zuordnung im Protokoll.
|
||||||
|
Die ist nach dem Loeschen nirgends mehr nachschlagbar; damit war der
|
||||||
|
Eintrag da, aber wertlos.
|
||||||
|
"""
|
||||||
|
if row is None:
|
||||||
|
return ""
|
||||||
|
teile = [str(row["unc"] or "")]
|
||||||
|
gruppe = str(row["ad_group_name"] or row["ad_group_dn"] or "")
|
||||||
|
if gruppe:
|
||||||
|
teile.append(f"Gruppe: {gruppe}")
|
||||||
|
return " -- ".join(teil for teil in teile if teil)
|
||||||
|
|
||||||
|
|
||||||
|
def mapping_changes(vorher: Mapping[str, Any] | None, nachher: Mapping[str, Any] | None) -> str:
|
||||||
|
"""Was sich geaendert hat, Feld fuer Feld: ``Anzeigename: alt -> neu``."""
|
||||||
|
if vorher is None or nachher is None:
|
||||||
|
return ""
|
||||||
|
geaendert = []
|
||||||
|
for feld, beschriftung in MAPPING_FELDER:
|
||||||
|
alt = str(vorher[feld] or "")
|
||||||
|
neu = str(nachher[feld] or "")
|
||||||
|
if alt != neu:
|
||||||
|
geaendert.append(f"{beschriftung}: {alt or '(leer)'} -> {neu or '(leer)'}")
|
||||||
|
return "; ".join(geaendert)
|
||||||
|
|
||||||
|
|
||||||
def add_mapping(
|
def add_mapping(
|
||||||
conn: sqlite3.Connection, *, ad_group_dn: str, ad_group_name: str, label: str, unc: str
|
conn: sqlite3.Connection, *, ad_group_dn: str, ad_group_name: str, label: str, unc: str
|
||||||
) -> int:
|
) -> int:
|
||||||
@@ -369,7 +433,39 @@ def mount_for_login(
|
|||||||
if not password:
|
if not password:
|
||||||
return ["Kein Passwort fuer den Fileserver verfuegbar -- keine Einbindungen."]
|
return ["Kein Passwort fuer den Fileserver verfuegbar -- keine Einbindungen."]
|
||||||
|
|
||||||
|
# Was zuerst kommt: das Ende der Sitzung oder die eigene Obergrenze. Die
|
||||||
|
# Sitzung ist die eigentliche Klammer -- mit ihr endet die Einbindung; die
|
||||||
|
# Obergrenze sorgt dafuer, dass eine sehr lange Sitzung nicht beliebig
|
||||||
|
# lange auf fremden Zugangsdaten sitzt.
|
||||||
hours = int(extension.settings.get(conn, "fileshare_max_age_hours") or 12)
|
hours = int(extension.settings.get(conn, "fileshare_max_age_hours") or 12)
|
||||||
|
frist = _now() + timedelta(hours=hours)
|
||||||
|
# Die Sitzungszeile gibt es hier noch nicht: eingebunden wird waehrend der
|
||||||
|
# Anmeldung, geschrieben wird sie erst beim Speichern der Antwort. Die
|
||||||
|
# Dauer steht aber in derselben Einstellung, aus der die Sitzung sie
|
||||||
|
# gleich bekommt -- und falls die Zeile doch schon steht (erneutes
|
||||||
|
# Einbinden), gilt deren Ende.
|
||||||
|
zeile = (
|
||||||
|
Database.one(
|
||||||
|
conn, "SELECT absolute_expires_at FROM user_sessions WHERE id=?", (session_id,)
|
||||||
|
)
|
||||||
|
if session_id
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
if zeile is not None and zeile["absolute_expires_at"]:
|
||||||
|
try:
|
||||||
|
sitzungsende = datetime.fromisoformat(str(zeile["absolute_expires_at"]))
|
||||||
|
if sitzungsende.tzinfo is None:
|
||||||
|
sitzungsende = sitzungsende.replace(tzinfo=timezone.utc)
|
||||||
|
frist = min(frist, sitzungsende)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
dauer = int(extension.settings.get(conn, "session_absolute_hours") or 0)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
dauer = 0
|
||||||
|
if dauer > 0:
|
||||||
|
frist = min(frist, _now() + timedelta(hours=dauer))
|
||||||
root = Path(str(extension.settings.get(conn, "fileshare_mount_root") or "/mnt/tesm-shares"))
|
root = Path(str(extension.settings.get(conn, "fileshare_mount_root") or "/mnt/tesm-shares"))
|
||||||
messages: list[str] = []
|
messages: list[str] = []
|
||||||
|
|
||||||
@@ -399,7 +495,7 @@ def mount_for_login(
|
|||||||
str(share["unc"]),
|
str(share["unc"]),
|
||||||
str(target),
|
str(target),
|
||||||
_iso(_now()),
|
_iso(_now()),
|
||||||
_iso(_now() + timedelta(hours=hours)),
|
_iso(frist),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
messages.append(f"{share['label']}: eingebunden")
|
messages.append(f"{share['label']}: eingebunden")
|
||||||
@@ -454,7 +550,10 @@ def sweep_expired(database: Any) -> int:
|
|||||||
released = 0
|
released = 0
|
||||||
with database.session() as conn:
|
with database.session() as conn:
|
||||||
# Eine Einbindung lebt genau so lange wie die Sitzung, aus der sie
|
# Eine Einbindung lebt genau so lange wie die Sitzung, aus der sie
|
||||||
# entstanden ist. Vorher hing sie an einer eigenen Frist von zwoelf
|
# entstanden ist. Ohne Sitzungsangabe gilt allein die eigene Frist:
|
||||||
|
# "keine Sitzung eingetragen" ist etwas anderes als "Sitzung
|
||||||
|
# abgelaufen". Diese Verwechslung hat jede frische Einbindung binnen
|
||||||
|
# Minuten wieder geloest, weil die ID beim Anmelden noch nicht stand. Vorher hing sie an einer eigenen Frist von zwoelf
|
||||||
# Stunden: nach dem Abmelden -- oder nach der automatischen Abmeldung
|
# Stunden: nach dem Abmelden -- oder nach der automatischen Abmeldung
|
||||||
# bei Leerlauf -- blieb die Freigabe mit den Zugangsdaten des Benutzers
|
# bei Leerlauf -- blieb die Freigabe mit den Zugangsdaten des Benutzers
|
||||||
# weiter eingebunden. Die eigene Frist bleibt als Obergrenze bestehen;
|
# weiter eingebunden. Die eigene Frist bleibt als Obergrenze bestehen;
|
||||||
@@ -467,10 +566,11 @@ def sweep_expired(database: Any) -> int:
|
|||||||
LEFT JOIN user_sessions s ON s.id = m.session_id
|
LEFT JOIN user_sessions s ON s.id = m.session_id
|
||||||
WHERE m.released_at IS NULL
|
WHERE m.released_at IS NULL
|
||||||
AND (m.expires_at <= ?
|
AND (m.expires_at <= ?
|
||||||
OR s.id IS NULL
|
OR (COALESCE(m.session_id, '') <> ''
|
||||||
OR s.revoked_at IS NOT NULL
|
AND (s.id IS NULL
|
||||||
OR s.idle_expires_at <= ?
|
OR s.revoked_at IS NOT NULL
|
||||||
OR s.absolute_expires_at <= ?)
|
OR s.idle_expires_at <= ?
|
||||||
|
OR s.absolute_expires_at <= ?)))
|
||||||
""",
|
""",
|
||||||
(_iso(_now()), _iso(_now()), _iso(_now())),
|
(_iso(_now()), _iso(_now()), _iso(_now())),
|
||||||
)
|
)
|
||||||
@@ -528,6 +628,11 @@ def list_directory(mount: Mount, relative: str = "") -> dict[str, Any]:
|
|||||||
directories.append(record)
|
directories.append(record)
|
||||||
else:
|
else:
|
||||||
record["previewable"] = entry.suffix.lower() in PREVIEW_MIME
|
record["previewable"] = entry.suffix.lower() in PREVIEW_MIME
|
||||||
|
record["preview_kind"] = preview_kind(entry.name)
|
||||||
|
# Getrennt, damit die Oberflaeche nur den Namen zum Bearbeiten
|
||||||
|
# gibt und die Endung danebenstellt.
|
||||||
|
record["stem"] = entry.stem
|
||||||
|
record["suffix"] = entry.suffix
|
||||||
files.append(record)
|
files.append(record)
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
raise FileshareError(f"Verzeichnis nicht lesbar ({exc}).") from exc
|
raise FileshareError(f"Verzeichnis nicht lesbar ({exc}).") from exc
|
||||||
@@ -568,6 +673,76 @@ def safe_filename(name: str) -> str:
|
|||||||
return cleaned
|
return cleaned
|
||||||
|
|
||||||
|
|
||||||
|
def all_directories(mount: Mount, *, tiefe: int = 4, grenze: int = 400) -> list[str]:
|
||||||
|
"""Die Ordner der Freigabe, relativ und alphabetisch -- fuer eine Auswahlliste.
|
||||||
|
|
||||||
|
Begrenzt in Tiefe und Anzahl: eine Netzwerkfreigabe kann zehntausende
|
||||||
|
Verzeichnisse haben, und eine Liste, die den Browser lahmlegt, hilft
|
||||||
|
niemandem. Wer tiefer speichern will, tippt den Pfad -- das Feld nimmt
|
||||||
|
beides.
|
||||||
|
"""
|
||||||
|
wurzel = mount.path.resolve()
|
||||||
|
gefunden: list[str] = []
|
||||||
|
|
||||||
|
def hinein(verzeichnis: Path, ebene: int) -> None:
|
||||||
|
if ebene > tiefe or len(gefunden) >= grenze:
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
eintraege = sorted(verzeichnis.iterdir(), key=lambda e: e.name.lower())
|
||||||
|
except OSError:
|
||||||
|
return
|
||||||
|
for eintrag in eintraege:
|
||||||
|
if len(gefunden) >= grenze:
|
||||||
|
return
|
||||||
|
if not eintrag.is_dir() or eintrag.name.startswith("."):
|
||||||
|
continue
|
||||||
|
gefunden.append(eintrag.relative_to(wurzel).as_posix())
|
||||||
|
hinein(eintrag, ebene + 1)
|
||||||
|
|
||||||
|
hinein(wurzel, 1)
|
||||||
|
return gefunden
|
||||||
|
|
||||||
|
|
||||||
|
def hat_formularfelder(daten: bytes) -> bool:
|
||||||
|
"""Steckt in diesen PDF-Bytes noch ein ausfuellbares Formular?
|
||||||
|
|
||||||
|
Gesucht wird nach Formularfeldern (``/Subtype /Widget``) -- auch in
|
||||||
|
gepackten Objektstroemen, denn moderne Schreiber legen fast alles dort ab.
|
||||||
|
Ein flach gerechnetes Formular hat keine mehr.
|
||||||
|
|
||||||
|
Bewusst ohne Zusatzpaket: die Frage ist einfach genug, und eine
|
||||||
|
PDF-Bibliothek auf jedem Zielsystem waere ein hoher Preis dafuer.
|
||||||
|
"""
|
||||||
|
text = bytearray(daten)
|
||||||
|
for treffer in re.finditer(rb"stream\r?\n", daten):
|
||||||
|
start = treffer.end()
|
||||||
|
ende = daten.find(b"endstream", start)
|
||||||
|
if ende == -1:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
text += b"\n" + zlib.decompress(daten[start:ende])
|
||||||
|
except zlib.error:
|
||||||
|
continue # kein zlib-Strom -- Bilder, Schriften, alles moegliche
|
||||||
|
return re.search(rb"/Subtype\s*/Widget", bytes(text)) is not None
|
||||||
|
|
||||||
|
|
||||||
|
def free_name(parent: Path, stem: str, zusatz: str, suffix: str) -> Path:
|
||||||
|
"""Ein freier Name neben dem Original: ``vorlage-ausgefuellt.pdf``.
|
||||||
|
|
||||||
|
Nichts ueberschreiben: auf einer Freigabe liegt meist die leere Vorlage,
|
||||||
|
und zwei Leute fuellen sie nacheinander aus. Ab dem zweiten Mal wird
|
||||||
|
durchnummeriert.
|
||||||
|
"""
|
||||||
|
kandidat = parent / f"{stem}{zusatz}{suffix}"
|
||||||
|
zaehler = 2
|
||||||
|
while kandidat.exists():
|
||||||
|
kandidat = parent / f"{stem}{zusatz}-{zaehler}{suffix}"
|
||||||
|
zaehler += 1
|
||||||
|
if zaehler > 200:
|
||||||
|
raise FileshareError("Zu viele Dateien dieses Namens -- bitte aufraeumen.")
|
||||||
|
return kandidat
|
||||||
|
|
||||||
|
|
||||||
def delete_entry(mount: Mount, relative: str) -> str:
|
def delete_entry(mount: Mount, relative: str) -> str:
|
||||||
path = resolve_path(mount, relative)
|
path = resolve_path(mount, relative)
|
||||||
if path == mount.path.resolve():
|
if path == mount.path.resolve():
|
||||||
@@ -589,8 +764,26 @@ def make_directory(mount: Mount, relative: str, name: str) -> Path:
|
|||||||
|
|
||||||
|
|
||||||
def rename_entry(mount: Mount, relative: str, new_name: str) -> Path:
|
def rename_entry(mount: Mount, relative: str, new_name: str) -> Path:
|
||||||
|
"""Benennt um und behaelt die Endung der Datei.
|
||||||
|
|
||||||
|
Eingegeben wird nur der Name ohne Endung. Eine Datei, die danach auf
|
||||||
|
``.pdf.txt`` oder auf gar nichts endet, waere auf einer Windows-Freigabe
|
||||||
|
praktisch kaputt -- sie oeffnet sich nicht mehr mit dem richtigen
|
||||||
|
Programm. Verzeichnisse haben keine Endung; dort bleibt der Name, wie er
|
||||||
|
eingegeben wurde.
|
||||||
|
|
||||||
|
Wer die Endung trotzdem mittippt, bekommt sie nicht doppelt.
|
||||||
|
"""
|
||||||
path = resolve_path(mount, relative)
|
path = resolve_path(mount, relative)
|
||||||
target = path.parent / safe_filename(new_name)
|
endung = path.suffix if path.is_file() else ""
|
||||||
|
gewuenscht = (new_name or "").strip()
|
||||||
|
if endung and gewuenscht.lower().endswith(endung.lower()):
|
||||||
|
gewuenscht = gewuenscht[: -len(endung)]
|
||||||
|
if not gewuenscht:
|
||||||
|
raise FileshareError("Der Name darf nicht leer sein.")
|
||||||
|
target = path.parent / safe_filename(gewuenscht + endung)
|
||||||
|
if target == path:
|
||||||
|
return path
|
||||||
if target.exists():
|
if target.exists():
|
||||||
raise FileshareError("Ein Eintrag mit diesem Namen existiert bereits.")
|
raise FileshareError("Ein Eintrag mit diesem Namen existiert bereits.")
|
||||||
path.rename(target)
|
path.rename(target)
|
||||||
|
|||||||
@@ -79,15 +79,6 @@ TESM_SETTINGS: tuple[SettingSpec, ...] = (
|
|||||||
minimum=1,
|
minimum=1,
|
||||||
maximum=168,
|
maximum=168,
|
||||||
),
|
),
|
||||||
SettingSpec(
|
|
||||||
"fileshare_upload_max_mb",
|
|
||||||
512,
|
|
||||||
"int",
|
|
||||||
"Maximale Dateigroesse beim Hochladen (MB)",
|
|
||||||
section="fileshare",
|
|
||||||
minimum=1,
|
|
||||||
maximum=8192,
|
|
||||||
),
|
|
||||||
# -- Wartung ------------------------------------------------------------ #
|
# -- Wartung ------------------------------------------------------------ #
|
||||||
SettingSpec(
|
SettingSpec(
|
||||||
"maintenance_command_timeout",
|
"maintenance_command_timeout",
|
||||||
@@ -109,12 +100,23 @@ TESM_SETTINGS: tuple[SettingSpec, ...] = (
|
|||||||
),
|
),
|
||||||
# -- Terminal ----------------------------------------------------------- #
|
# -- Terminal ----------------------------------------------------------- #
|
||||||
SettingSpec(
|
SettingSpec(
|
||||||
"terminal_enabled",
|
"terminal_switches_enabled",
|
||||||
True,
|
True,
|
||||||
"bool",
|
"bool",
|
||||||
"Browser-Terminal fuer Switche aktiv",
|
"Browser-Konsole fuer Switche zulassen",
|
||||||
hint="Auch wenn aktiv: erfordert das Recht 'Ausfuehren' auf Switche, eine frische "
|
hint="Auch wenn aktiv: erfordert das Recht 'Ausfuehren' auf Switche, eine frische "
|
||||||
"Passwortbestaetigung und wird vollstaendig protokolliert.",
|
"Passwortbestaetigung und wird vollstaendig protokolliert. Das Freigeben von "
|
||||||
|
"Host-Schluesseln bleibt davon unberuehrt -- es wird fuer den PoE-Neustart "
|
||||||
|
"gebraucht.",
|
||||||
|
section="monitoring",
|
||||||
|
),
|
||||||
|
SettingSpec(
|
||||||
|
"terminal_clients_enabled",
|
||||||
|
True,
|
||||||
|
"bool",
|
||||||
|
"Browser-Konsole fuer Clients zulassen",
|
||||||
|
hint="Braucht zusaetzlich das Modul Wartung und das Recht 'Ausfuehren' auf Wartung. "
|
||||||
|
"Das Freigeben von Host-Schluesseln bleibt davon unberuehrt.",
|
||||||
section="monitoring",
|
section="monitoring",
|
||||||
),
|
),
|
||||||
SettingSpec(
|
SettingSpec(
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
{% for mount in mounts %}
|
{% for mount in mounts %}
|
||||||
<a class="tab {{ 'is-active' if mount.token == token else '' }}"
|
<a class="tab {{ 'is-active' if mount.token == token else '' }}"
|
||||||
href="{{ url_for('fileshare.browse', freigabe=mount.token) }}">{{ mount.label }}</a>
|
href="{{ url_for('fileshare.browse', share=mount.token) }}">{{ mount.label }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -33,9 +33,9 @@
|
|||||||
<div class="card__header">
|
<div class="card__header">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<nav class="breadcrumb">
|
<nav class="breadcrumb">
|
||||||
<span><a href="{{ url_for('fileshare.browse', freigabe=token) }}">{{ current.label }}</a></span>
|
<span><a href="{{ url_for('fileshare.browse', share=token) }}">{{ current.label }}</a></span>
|
||||||
{% for crumb in listing.breadcrumb %}
|
{% for crumb in listing.breadcrumb %}
|
||||||
<span><a href="{{ url_for('fileshare.browse', freigabe=token, pfad=crumb.relative) }}">{{ crumb.name }}</a></span>
|
<span><a href="{{ url_for('fileshare.browse', share=token, path=crumb.relative) }}">{{ crumb.name }}</a></span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</nav>
|
</nav>
|
||||||
<div class="card__sub mono fs-xs">{{ current.unc }}</div>
|
<div class="card__sub mono fs-xs">{{ current.unc }}</div>
|
||||||
@@ -69,8 +69,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
{% if current_user.has('fileshare.delete') %}<td></td>{% endif %}
|
{% if current_user.has('fileshare.delete') %}<td></td>{% endif %}
|
||||||
<td colspan="4">
|
<td colspan="4">
|
||||||
<a class="link-icon" href="{{ url_for('fileshare.browse', freigabe=token,
|
<a class="link-icon" href="{{ url_for('fileshare.browse', share=token,
|
||||||
pfad=(listing.breadcrumb[-2].relative if listing.breadcrumb | length > 1 else '')) }}">
|
path=(listing.breadcrumb[-2].relative if listing.breadcrumb | length > 1 else '')) }}">
|
||||||
{{ icon('chevron-right', size=14) }} eine Ebene höher
|
{{ icon('chevron-right', size=14) }} eine Ebene höher
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -79,11 +79,11 @@
|
|||||||
{% for entry in listing.directories %}
|
{% for entry in listing.directories %}
|
||||||
<tr>
|
<tr>
|
||||||
{% if current_user.has('fileshare.delete') %}
|
{% if current_user.has('fileshare.delete') %}
|
||||||
<td><label class="check"><input type="checkbox" name="pfade" value="{{ entry.relative }}"><span class="sr-only">auswählen</span></label></td>
|
<td><label class="check"><input type="checkbox" name="paths" value="{{ entry.relative }}"><span class="sr-only">auswählen</span></label></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>
|
<td>
|
||||||
{{ icon('folder', size=15) }}
|
{{ icon('folder', size=15) }}
|
||||||
<a href="{{ url_for('fileshare.browse', freigabe=token, pfad=entry.relative) }}">{{ entry.name }}</a>
|
<a href="{{ url_for('fileshare.browse', share=token, path=entry.relative) }}">{{ entry.name }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="numeric faint">–</td>
|
<td class="numeric faint">–</td>
|
||||||
<td class="fs-sm">{{ entry.modified | dt }}</td>
|
<td class="fs-sm">{{ entry.modified | dt }}</td>
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
{% for entry in listing.files %}
|
{% for entry in listing.files %}
|
||||||
<tr>
|
<tr>
|
||||||
{% if current_user.has('fileshare.delete') %}
|
{% if current_user.has('fileshare.delete') %}
|
||||||
<td><label class="check"><input type="checkbox" name="pfade" value="{{ entry.relative }}"><span class="sr-only">auswählen</span></label></td>
|
<td><label class="check"><input type="checkbox" name="paths" value="{{ entry.relative }}"><span class="sr-only">auswählen</span></label></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# Der Name ist die grösste Fläche der Zeile -- er soll auch
|
{# Der Name ist die grösste Fläche der Zeile -- er soll auch
|
||||||
das Naheliegende tun. Was sich anzeigen lässt, öffnet die
|
das Naheliegende tun. Was sich anzeigen lässt, öffnet die
|
||||||
@@ -102,16 +102,26 @@
|
|||||||
{% if entry.previewable %}
|
{% if entry.previewable %}
|
||||||
<button class="link-icon file-name" type="button"
|
<button class="link-icon file-name" type="button"
|
||||||
data-dialog-open="file-preview"
|
data-dialog-open="file-preview"
|
||||||
data-fill-Src="{{ url_for('fileshare.preview', token=token, pfad=entry.relative) }}"
|
data-fill-Src="{{ url_for('fileshare.preview', token=token, path=entry.relative) }}"
|
||||||
|
data-fill-Kind="{{ entry.preview_kind }}"
|
||||||
|
data-fill-Pfad="{{ entry.relative }}"
|
||||||
data-fill-Name="{{ entry.name }}"
|
data-fill-Name="{{ entry.name }}"
|
||||||
data-fill-Download="{{ url_for('fileshare.download', token=token, pfad=entry.relative) }}">
|
{% if current_user.has('fileshare.export') %}data-fill-Download="{{ url_for('fileshare.download', token=token, path=entry.relative) }}"{% endif %}>
|
||||||
{{ icon('file-text', size=15) }} {{ entry.name }}
|
{{ icon('file-text', size=15) }} {{ entry.name }}
|
||||||
</button>
|
</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="link-icon"
|
{% if current_user.has('fileshare.export') %}
|
||||||
href="{{ url_for('fileshare.download', token=token, pfad=entry.relative) }}">
|
<a class="link-icon"
|
||||||
{{ icon('file-text', size=15) }} {{ entry.name }}
|
href="{{ url_for('fileshare.download', token=token, path=entry.relative) }}">
|
||||||
</a>
|
{{ icon('file-text', size=15) }} {{ entry.name }}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
{# Ohne Exportrecht bleibt der Name Text: es gibt hier
|
||||||
|
nichts zu holen, und ein toter Link waere Spott. #}
|
||||||
|
<span class="link-icon faint">
|
||||||
|
{{ icon('file-text', size=15) }} {{ entry.name }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="numeric fs-sm">{{ entry.size | bytes }}</td>
|
<td class="numeric fs-sm">{{ entry.size | bytes }}</td>
|
||||||
@@ -120,21 +130,26 @@
|
|||||||
{% if entry.previewable %}
|
{% if entry.previewable %}
|
||||||
<button class="btn btn--sm btn--ghost" type="button"
|
<button class="btn btn--sm btn--ghost" type="button"
|
||||||
data-dialog-open="file-preview"
|
data-dialog-open="file-preview"
|
||||||
data-fill-Src="{{ url_for('fileshare.preview', token=token, pfad=entry.relative) }}"
|
data-fill-Src="{{ url_for('fileshare.preview', token=token, path=entry.relative) }}"
|
||||||
|
data-fill-Kind="{{ entry.preview_kind }}"
|
||||||
|
data-fill-Pfad="{{ entry.relative }}"
|
||||||
data-fill-Name="{{ entry.name }}"
|
data-fill-Name="{{ entry.name }}"
|
||||||
data-fill-Download="{{ url_for('fileshare.download', token=token, pfad=entry.relative) }}"
|
{% if current_user.has('fileshare.export') %}data-fill-Download="{{ url_for('fileshare.download', token=token, path=entry.relative) }}"{% endif %}
|
||||||
aria-label="Vorschau">{{ icon('eye', size=15) }}</button>
|
aria-label="Vorschau">{{ icon('eye', size=15) }}</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if current_user.has('fileshare.edit') %}
|
{% if current_user.has('fileshare.edit') %}
|
||||||
<button class="btn btn--sm btn--ghost" type="button"
|
<button class="btn btn--sm btn--ghost" type="button"
|
||||||
data-dialog-open="file-rename"
|
data-dialog-open="file-rename"
|
||||||
data-fill-Pfad="{{ entry.relative }}"
|
data-fill-Pfad="{{ entry.relative }}"
|
||||||
data-fill-Name="{{ entry.name }}"
|
data-fill-Name="{{ entry.stem }}"
|
||||||
|
data-fill-Endung="{{ entry.suffix or '' }}"
|
||||||
aria-label="Umbenennen">{{ icon('pencil', size=15) }}</button>
|
aria-label="Umbenennen">{{ icon('pencil', size=15) }}</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="btn btn--sm btn--ghost"
|
{% if current_user.has('fileshare.export') %}
|
||||||
href="{{ url_for('fileshare.download', token=token, pfad=entry.relative) }}"
|
<a class="btn btn--sm btn--ghost"
|
||||||
aria-label="Herunterladen">{{ icon('download', size=15) }}</a>
|
href="{{ url_for('fileshare.download', token=token, path=entry.relative) }}"
|
||||||
|
aria-label="Herunterladen">{{ icon('download', size=15) }}</a>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -167,7 +182,7 @@
|
|||||||
<form method="post" enctype="multipart/form-data" data-no-guard
|
<form method="post" enctype="multipart/form-data" data-no-guard
|
||||||
action="{{ url_for('fileshare.upload', token=token) }}">
|
action="{{ url_for('fileshare.upload', token=token) }}">
|
||||||
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
||||||
<input type="hidden" name="pfad" value="{{ listing.relative }}">
|
<input type="hidden" name="path" value="{{ listing.relative }}">
|
||||||
<div class="card__body row">
|
<div class="card__body row">
|
||||||
<input class="input" type="file" name="files" multiple required style="flex:1">
|
<input class="input" type="file" name="files" multiple required style="flex:1">
|
||||||
<button class="btn btn--primary" type="submit" data-busy-label="Lädt ...">Hochladen</button>
|
<button class="btn btn--primary" type="submit" data-busy-label="Lädt ...">Hochladen</button>
|
||||||
@@ -184,7 +199,7 @@
|
|||||||
{% call modal('folder-new', 'Ordner anlegen', listing.relative or 'Wurzelverzeichnis', 'narrow') %}
|
{% call modal('folder-new', 'Ordner anlegen', listing.relative or 'Wurzelverzeichnis', 'narrow') %}
|
||||||
<form method="post" action="{{ url_for('fileshare.make_directory', token=token) }}">
|
<form method="post" action="{{ url_for('fileshare.make_directory', token=token) }}">
|
||||||
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
||||||
<input type="hidden" name="pfad" value="{{ listing.relative }}">
|
<input type="hidden" name="path" value="{{ listing.relative }}">
|
||||||
<div class="modal__body">{{ field('name', 'Name', required=True) }}</div>
|
<div class="modal__body">{{ field('name', 'Name', required=True) }}</div>
|
||||||
<div class="modal__footer">
|
<div class="modal__footer">
|
||||||
<button class="btn" type="button" data-dialog-close>Abbrechen</button>
|
<button class="btn" type="button" data-dialog-close>Abbrechen</button>
|
||||||
@@ -201,17 +216,95 @@
|
|||||||
Dialog für alle Dateien statt einer je Zeile. #}
|
Dialog für alle Dateien statt einer je Zeile. #}
|
||||||
{% call modal('file-preview', 'Vorschau', '', 'wide') %}
|
{% call modal('file-preview', 'Vorschau', '', 'wide') %}
|
||||||
<div class="modal__caption" data-fill-target="Name"></div>
|
<div class="modal__caption" data-fill-target="Name"></div>
|
||||||
<div class="modal__body modal__body--flush">
|
{# Drei Anzeigen, eine je Art. Ein Rahmen für alles zeigte ein Foto vom
|
||||||
<iframe class="file-preview" title="Vorschau" data-fill-target="Src" data-fill-as="src"
|
iPad in Originalgrösse (also einen Ausschnitt) und ein PDF auf iPadOS
|
||||||
src="about:blank" referrerpolicy="same-origin"></iframe>
|
nur als Standbild -- Formularfelder liessen sich nicht anfassen. #}
|
||||||
|
<div class="modal__body modal__body--flush" data-viewer
|
||||||
|
{# Ohne das Recht zum Ausfuellen zeigt die Vorschau das Dokument so,
|
||||||
|
wie es ist -- mit seinen eigenen Marken, ohne Eingabefelder. #}
|
||||||
|
data-viewer-formulare="{{ '1' if current_user.has('fileshare_pdf.view') else '' }}"
|
||||||
|
data-viewer-pdfjs="{{ asset_url('vendor/pdfjs/pdf.min.js') }}"
|
||||||
|
data-viewer-pdflib="{{ asset_url('vendor/pdflib/pdf-lib.min.js') }}">
|
||||||
|
<div class="viewer">
|
||||||
|
<div class="viewer__stage" data-viewer-bildbuehne hidden>
|
||||||
|
<img class="viewer__img" alt="" data-viewer-bild>
|
||||||
|
</div>
|
||||||
|
<div class="viewer__pdf" data-viewer-pdf hidden>
|
||||||
|
{# Zwei Ebenen: aussen ein normaler Kasten, der sich die Hoehe mit
|
||||||
|
Leiste und Speicherzeile teilt, innen der absolute Scrollbereich,
|
||||||
|
den pdf.js verlangt. #}
|
||||||
|
<div class="viewer__pdfscroll" data-viewer-pdfscroll>
|
||||||
|
<div class="pdfViewer" data-viewer-pdfseiten></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<iframe class="file-preview" title="Vorschau" data-viewer-rahmen
|
||||||
|
src="about:blank" referrerpolicy="same-origin" hidden></iframe>
|
||||||
|
{# Gefragt wird erst, wenn gespeichert werden soll -- vorher waere es
|
||||||
|
eine Zeile Formular über jeder Bildvorschau. Und nur, wer Formulare
|
||||||
|
ablegen darf, sieht sie überhaupt. #}
|
||||||
|
{% if current_user.has('fileshare_pdf.create') %}
|
||||||
|
<div class="viewer__save" data-viewer-speichernzeile hidden>
|
||||||
|
<label class="viewer__feld">
|
||||||
|
<span class="field__label">Ordner</span>
|
||||||
|
<input class="input" list="freigabe-ordner" data-viewer-ordner
|
||||||
|
placeholder="Wurzelverzeichnis der Freigabe" autocomplete="off">
|
||||||
|
</label>
|
||||||
|
<label class="viewer__feld">
|
||||||
|
<span class="field__label">Dateiname (ohne Endung)</span>
|
||||||
|
<input class="input" data-viewer-name autocomplete="off">
|
||||||
|
</label>
|
||||||
|
<label class="viewer__feld">
|
||||||
|
<span class="field__label">Speichern als</span>
|
||||||
|
{# Zwei Wege, beide gewollt: weiter ausfüllbar (das Bild wird das
|
||||||
|
Aussehen des Knopfes und lässt sich später austauschen) oder
|
||||||
|
abgeschlossen (alle Felder werden Teil der Seite). #}
|
||||||
|
{# Nur, was das Recht hergibt: "weiter ausfüllbar" hängt an
|
||||||
|
PDF-Formulare/Bearbeiten, "abgeschlossen" an Anlegen. Wer nur
|
||||||
|
anlegen darf, sieht eine Zeile statt einer Auswahl. #}
|
||||||
|
<select class="select" data-viewer-modus>
|
||||||
|
{% if current_user.has('fileshare_pdf.edit') %}
|
||||||
|
<option value="formular">Formular – weiter ausfüllbar</option>
|
||||||
|
{% endif %}
|
||||||
|
<option value="fertig">Abgeschlossen – Felder gesperrt</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="check">
|
||||||
|
<input type="checkbox" data-viewer-ersetzen>
|
||||||
|
<span>Vorhandene ersetzen</span>
|
||||||
|
</label>
|
||||||
|
<button class="btn btn--sm btn--primary" type="button" data-viewer-jetzt>Speichern</button>
|
||||||
|
<button class="btn btn--sm btn--ghost" type="button" data-viewer-abbrechen>Abbrechen</button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="viewer__bar" data-viewer-leiste hidden>
|
||||||
|
<button class="btn btn--sm btn--ghost" type="button" data-viewer-zoom="aus"
|
||||||
|
aria-label="Verkleinern">{{ icon('minus', size=15) }}</button>
|
||||||
|
<button class="btn btn--sm btn--ghost" type="button" data-viewer-zoom="fit">Anpassen</button>
|
||||||
|
<button class="btn btn--sm btn--ghost" type="button" data-viewer-zoom="ein"
|
||||||
|
aria-label="Vergrössern">{{ icon('plus', size=15) }}</button>
|
||||||
|
<span class="viewer__hint fs-xs faint" data-viewer-hinweis></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal__footer">
|
<div class="modal__footer">
|
||||||
<a class="btn btn--sm" data-fill-target="Download" data-fill-as="href" href="#" download>
|
{% if current_user.has('fileshare.export') %}
|
||||||
{{ icon('download', size=15) }} Herunterladen
|
<a class="btn btn--sm" data-fill-target="Download" data-fill-as="href" href="#" download>
|
||||||
</a>
|
{{ icon('download', size=15) }} Herunterladen
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if current_user.has('fileshare_pdf.create') %}
|
||||||
|
<button class="btn btn--sm" type="button" data-viewer-speichern hidden
|
||||||
|
data-url="{{ url_for('fileshare.save_form', token=token) }}">
|
||||||
|
{{ icon('save', size=15) }} Ausgefüllt speichern
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
<button class="btn btn--primary" type="button" data-dialog-close>Schliessen</button>
|
<button class="btn btn--primary" type="button" data-dialog-close>Schliessen</button>
|
||||||
</div>
|
</div>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
{# Die Ordner der Freigabe als Vorschlag; getippt werden darf trotzdem. #}
|
||||||
|
<datalist id="freigabe-ordner">
|
||||||
|
{% for eintrag in verzeichnisse %}<option value="{{ eintrag }}"></option>{% endfor %}
|
||||||
|
</datalist>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if listing and current_user.has('fileshare.edit') %}
|
{% if listing and current_user.has('fileshare.edit') %}
|
||||||
@@ -219,11 +312,14 @@
|
|||||||
<form method="post" action="{{ url_for('fileshare.rename', token=token) }}">
|
<form method="post" action="{{ url_for('fileshare.rename', token=token) }}">
|
||||||
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
||||||
<input type="hidden" name="parent" value="{{ listing.relative }}">
|
<input type="hidden" name="parent" value="{{ listing.relative }}">
|
||||||
<input type="hidden" name="pfad" data-fill-target="Pfad" value="">
|
<input type="hidden" name="path" data-fill-target="Pfad" value="">
|
||||||
<div class="modal__body">
|
<div class="modal__body">
|
||||||
{{ field('name', 'Neuer Name', required=True, attrs='data-fill-target="Name"') }}
|
{{ field('name', 'Neuer Name (ohne Endung)', required=True,
|
||||||
|
attrs='data-fill-target="Name"') }}
|
||||||
<p class="fs-xs faint">
|
<p class="fs-xs faint">
|
||||||
Umbenannt wird auf der Freigabe selbst -- es gibt dort keinen Papierkorb.
|
Die Endung <code data-fill-target="Endung"></code> bleibt, wie sie ist --
|
||||||
|
eine Datei ohne passende Endung öffnet auf der Freigabe nichts mehr.
|
||||||
|
Umbenannt wird dort direkt; einen Papierkorb gibt es nicht.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal__footer">
|
<div class="modal__footer">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% extends "tesm_core/base.html" %}
|
{% extends "tesm_core/base.html" %}
|
||||||
{% from "tesm_core/macros.html" import alert %}
|
{% from "tesm_core/macros.html" import alert %}
|
||||||
{% block page_title %}Kea-DHCP-Protokoll{% endblock %}
|
{% block page_title %}DHCP-Protokoll{% endblock %}
|
||||||
{% block page_sub %}{{ path }}{% endblock %}
|
{% block page_sub %}{{ path }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if error %}{{ alert(error, 'warning') }}{% endif %}
|
{% if error %}{{ alert(error, 'warning') }}{% endif %}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Der Vorgänger protokollierte Neustarts ausdrücklich nicht.', 'info') }}
|
|||||||
<div class="card__sub">
|
<div class="card__sub">
|
||||||
{% for value, label in methods %}
|
{% for value, label in methods %}
|
||||||
<a class="btn btn--sm {{ 'btn--ghost' if method != value else '' }}"
|
<a class="btn btn--sm {{ 'btn--ghost' if method != value else '' }}"
|
||||||
href="{{ url_for('tesmlogs.restarts', methode=value) }}">{{ label }}</a>
|
href="{{ url_for('tesmlogs.restarts', method=value) }}">{{ label }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<a class="btn btn--sm {{ 'btn--ghost' if method else '' }}"
|
<a class="btn btn--sm {{ 'btn--ghost' if method else '' }}"
|
||||||
href="{{ url_for('tesmlogs.restarts') }}">Alle</a>
|
href="{{ url_for('tesmlogs.restarts') }}">Alle</a>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{% extends "tesm_core/base.html" %}
|
{% extends "tesm_core/base.html" %}
|
||||||
{% from "tesm_core/macros.html" import field, select_field, checkbox, alert, pill %}
|
{% from "tesm_core/macros.html" import field, select_field, checkbox, alert, pill, nav_order_card %}
|
||||||
|
|
||||||
{% block page_title %}Systemeinstellungen{% endblock %}
|
{% block page_title %}Systemeinstellungen{% endblock %}
|
||||||
{% block page_sub %}Überwachung, Protokolle, Host, Navigation{% endblock %}
|
{% block page_sub %}Überwachung, Protokolle, Host, Navigation{% endblock %}
|
||||||
@@ -54,18 +54,23 @@
|
|||||||
<section class="card">
|
<section class="card">
|
||||||
<div class="card__header">
|
<div class="card__header">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<div class="card__title">{{ icon('terminal', size=17) }} Switch-Konsole</div>
|
<div class="card__title">{{ icon('terminal', size=17) }} Terminal</div>
|
||||||
<div class="card__sub">
|
<div class="card__sub">
|
||||||
Auch bei aktiver Konsole gilt: eigenes Recht, frische Passwortbestätigung,
|
Auch bei aktiver Konsole gilt: eigenes Recht, frische Passwortbestätigung,
|
||||||
vollständige Mitschrift
|
vollständige Mitschrift. Abgeschaltet bleibt das Freigeben von
|
||||||
|
SSH-Host-Schlüsseln möglich – es wird für den PoE-Neustart gebraucht.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="{{ url_for('settings.system_save') }}">
|
<form method="post" action="{{ url_for('settings.system_save') }}">
|
||||||
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
||||||
<div class="card__body stack">
|
<div class="card__body stack">
|
||||||
{{ checkbox('terminal_enabled', 'Browser-Konsole für Switche zulassen',
|
{{ checkbox('terminal_switches_enabled', 'Browser-Konsole für Switche zulassen',
|
||||||
checked=values.terminal_enabled) }}
|
checked=values.terminal_switches_enabled,
|
||||||
|
hint_text=specs['terminal_switches_enabled'].hint) }}
|
||||||
|
{{ checkbox('terminal_clients_enabled', 'Browser-Konsole für Clients zulassen',
|
||||||
|
checked=values.terminal_clients_enabled,
|
||||||
|
hint_text=specs['terminal_clients_enabled'].hint) }}
|
||||||
{{ field('terminal_idle_timeout', 'Trennen bei Untätigkeit (Sekunden)',
|
{{ field('terminal_idle_timeout', 'Trennen bei Untätigkeit (Sekunden)',
|
||||||
value=values.terminal_idle_timeout, type='number') }}
|
value=values.terminal_idle_timeout, type='number') }}
|
||||||
</div>
|
</div>
|
||||||
@@ -73,6 +78,37 @@
|
|||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
{# Eigene Karte: die Abmeldung stand zwischen Protokollrotation und
|
||||||
|
Papierkorb -- drei Dinge ohne Zusammenhang. Wer die Sitzungsdauer sucht,
|
||||||
|
sucht sie nicht unter "Protokolle". #}
|
||||||
|
<section class="card">
|
||||||
|
<div class="card__header">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="card__title">{{ icon('clock', size=17) }} Sitzungen</div>
|
||||||
|
<div class="card__sub">
|
||||||
|
Wie lange eine Anmeldung gilt. Beides bestimmt auch, wie lange eine
|
||||||
|
eingebundene Dateifreigabe bestehen bleibt -- sie endet mit der Sitzung.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form method="post" action="{{ url_for('settings.system_save') }}">
|
||||||
|
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
||||||
|
<div class="card__body">
|
||||||
|
<div class="form-grid">
|
||||||
|
{{ field('session_idle_minutes', 'Automatische Abmeldung nach Leerlauf (Minuten)',
|
||||||
|
value=values.session_idle_minutes, type='number',
|
||||||
|
attrs='min="5" max="1440" step="1"',
|
||||||
|
hint_text=specs['session_idle_minutes'].hint) }}
|
||||||
|
{{ field('session_absolute_hours', 'Längstmögliche Sitzungsdauer (Stunden)',
|
||||||
|
value=values.session_absolute_hours, type='number',
|
||||||
|
attrs='min="1" max="168" step="1"',
|
||||||
|
hint_text=specs['session_absolute_hours'].hint) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card__footer"><button class="btn btn--primary" type="submit">Speichern</button></div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="card">
|
<section class="card">
|
||||||
<div class="card__header">
|
<div class="card__header">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
@@ -87,9 +123,6 @@
|
|||||||
specs['log_rotate_interval'].choices, selected=values.log_rotate_interval) }}
|
specs['log_rotate_interval'].choices, selected=values.log_rotate_interval) }}
|
||||||
{{ field('log_rotate_keep', 'Aufbewahrte Rotationen', value=values.log_rotate_keep,
|
{{ field('log_rotate_keep', 'Aufbewahrte Rotationen', value=values.log_rotate_keep,
|
||||||
type='number') }}
|
type='number') }}
|
||||||
{{ field('session_idle_minutes', 'Automatische Abmeldung (Minuten)',
|
|
||||||
value=values.session_idle_minutes, type='number',
|
|
||||||
hint_text=specs['session_idle_minutes'].hint) }}
|
|
||||||
{{ field('trash_retention_days', 'Papierkorb-Aufbewahrung (Tage)',
|
{{ field('trash_retention_days', 'Papierkorb-Aufbewahrung (Tage)',
|
||||||
value=values.trash_retention_days, type='number',
|
value=values.trash_retention_days, type='number',
|
||||||
hint_text=specs['trash_retention_days'].hint) }}
|
hint_text=specs['trash_retention_days'].hint) }}
|
||||||
@@ -133,39 +166,8 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
{% if current_user.is_admin %}
|
{% if current_user.is_admin %}
|
||||||
<section class="card">
|
{{ nav_order_card(nav_items, nav_order, nav_child_order,
|
||||||
<div class="card__header">
|
url_for('admin.nav_order'), csrf_field_name, csrf_token()) }}
|
||||||
<div class="flex-1">
|
|
||||||
<div class="card__title">{{ icon('sliders', size=17) }} Navigationsreihenfolge</div>
|
|
||||||
<div class="card__sub">Gilt für alle Benutzer; jeder sieht weiter nur, was er darf</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form method="post" action="{{ url_for('admin.nav_order') }}">
|
|
||||||
<input type="hidden" name="{{ csrf_field_name }}" value="{{ csrf_token() }}">
|
|
||||||
<div class="card__body">
|
|
||||||
<ol class="stack stack--tight">
|
|
||||||
{% for key in nav_order %}
|
|
||||||
{% set item = nav_items | selectattr('key', 'equalto', key) | list | first %}
|
|
||||||
{% if item %}
|
|
||||||
<li class="row row--tight">
|
|
||||||
<input class="input" type="number" name="position_{{ item.key }}" value="{{ loop.index }}"
|
|
||||||
min="1" style="width:70px" disabled>
|
|
||||||
<input type="hidden" name="order" value="{{ item.key }}">
|
|
||||||
<span class="flex-1">{{ icon(item.icon, size=15) }} {{ item.label }}</span>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</ol>
|
|
||||||
<p class="fs-xs faint mt-3">
|
|
||||||
Die Reihenfolge folgt der Liste. Zum Umsortieren die Einträge in der gewünschten
|
|
||||||
Reihenfolge speichern (Drag-and-drop folgt in einer späteren Version).
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="card__footer">
|
|
||||||
<button class="btn btn--sm" type="submit">Reihenfolge speichern</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -190,7 +190,10 @@ fi
|
|||||||
# nicht ausdruecklich neu gesetzt wird.
|
# nicht ausdruecklich neu gesetzt wird.
|
||||||
ENV_FILE="$ETC_TESM/$NAME.env"
|
ENV_FILE="$ETC_TESM/$NAME.env"
|
||||||
# Wo die Daten liegen, steht in der Umgebungsdatei; ohne sie beim Vorgabeort.
|
# Wo die Daten liegen, steht in der Umgebungsdatei; ohne sie beim Vorgabeort.
|
||||||
DATEN_DIR="$(sed -n "s/^${ENV_PREFIX}DATA_DIR=//p" "$ENV_FILE" 2>/dev/null | tail -1)"
|
# "|| true": bei einer Neuinstallation gibt es die Datei noch nicht, und ein
|
||||||
|
# scheiterndes sed in einer Zuweisung beendet unter "set -e" das ganze Skript.
|
||||||
|
DATEN_DIR="$(sed -n "s/^${ENV_PREFIX}DATA_DIR=//p" "$ENV_FILE" 2>/dev/null || true)"
|
||||||
|
DATEN_DIR="$(printf '%s' "$DATEN_DIR" | tail -1)"
|
||||||
DATEN_DIR="${DATEN_DIR:-$ROOT/data}"
|
DATEN_DIR="${DATEN_DIR:-$ROOT/data}"
|
||||||
if [[ -z "$PORT" && -f "$ENV_FILE" ]]; then
|
if [[ -z "$PORT" && -f "$ENV_FILE" ]]; then
|
||||||
PORT="$(sed -n "s/^${ENV_PREFIX}BIND=127\.0\.0\.1:\([0-9]\{1,5\}\)$/\1/p" "$ENV_FILE" | head -1)"
|
PORT="$(sed -n "s/^${ENV_PREFIX}BIND=127\.0\.0\.1:\([0-9]\{1,5\}\)$/\1/p" "$ENV_FILE" | head -1)"
|
||||||
@@ -617,7 +620,7 @@ for attempt in $(seq 1 20); do
|
|||||||
# pruefen ging schon einmal schief -- auf einem gemeinsamen Port antwortete
|
# pruefen ging schon einmal schief -- auf einem gemeinsamen Port antwortete
|
||||||
# eine andere Instanz, und ein toter Dienst galt als gesund.
|
# eine andere Instanz, und ein toter Dienst galt als gesund.
|
||||||
if systemctl is-active --quiet "$UNIT" &&
|
if systemctl is-active --quiet "$UNIT" &&
|
||||||
curl -fsS --max-time 3 "http://127.0.0.1:$PORT/gesundheit" >/dev/null 2>&1; then
|
curl -fsS --max-time 3 "http://127.0.0.1:$PORT/health" >/dev/null 2>&1; then
|
||||||
HEALTHY=1
|
HEALTHY=1
|
||||||
info "Antwort nach ${attempt}x"
|
info "Antwort nach ${attempt}x"
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ Unverzichtbar:
|
|||||||
**Die Anwendung antwortet nicht.**
|
**Die Anwendung antwortet nicht.**
|
||||||
```bash
|
```bash
|
||||||
journalctl -u tesm -n 200 --no-pager
|
journalctl -u tesm -n 200 --no-pager
|
||||||
curl -s http://127.0.0.1:5000/gesundheit
|
curl -s http://127.0.0.1:5000/health
|
||||||
```
|
```
|
||||||
Antwortet gunicorn, aber der Browser nicht, liegt es an nginx.
|
Antwortet gunicorn, aber der Browser nicht, liegt es an nginx.
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "tesm-core"
|
name = "tesm-core"
|
||||||
version = "2.1.2"
|
version = "2.5.1"
|
||||||
description = "Gemeinsames Anwendungsgeruest (Auth, RBAC, Navigation, Design-System, Migrationen) fuer TESM und TESM-Lizenzserver"
|
description = "Gemeinsames Anwendungsgeruest (Auth, RBAC, Navigation, Design-System, Migrationen) fuer TESM und TESM-Lizenzserver"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -13,10 +13,12 @@ import secrets
|
|||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from typing import Any, Sequence
|
from typing import Any, Sequence
|
||||||
|
|
||||||
from flask import Blueprint, Flask, g, render_template, request
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
|
from flask import Blueprint, Flask, g, redirect, render_template, request
|
||||||
from werkzeug.exceptions import HTTPException
|
from werkzeug.exceptions import HTTPException
|
||||||
|
|
||||||
from . import audit, logging_setup, ui
|
from . import audit, legacy_urls, logging_setup, ui
|
||||||
from .config import CoreConfig
|
from .config import CoreConfig
|
||||||
from .core_schema import CORE_MIGRATIONS
|
from .core_schema import CORE_MIGRATIONS
|
||||||
from .db import Database
|
from .db import Database
|
||||||
@@ -31,6 +33,7 @@ from .security import csrf
|
|||||||
from .security import sessions as session_store
|
from .security import sessions as session_store
|
||||||
from .security.sessions import SqliteSessionInterface
|
from .security.sessions import SqliteSessionInterface
|
||||||
from .settings_store import SettingSpec, SettingsStore
|
from .settings_store import SettingSpec, SettingsStore
|
||||||
|
from . import uploads
|
||||||
from .sysops import SysOps
|
from .sysops import SysOps
|
||||||
from .auth import directory
|
from .auth import directory
|
||||||
from .auth import routes as auth_routes
|
from .auth import routes as auth_routes
|
||||||
@@ -61,6 +64,17 @@ CORE_SETTINGS: tuple[SettingSpec, ...] = (
|
|||||||
minimum=1,
|
minimum=1,
|
||||||
maximum=3650,
|
maximum=3650,
|
||||||
),
|
),
|
||||||
|
SettingSpec(
|
||||||
|
"session_absolute_hours",
|
||||||
|
12,
|
||||||
|
"int",
|
||||||
|
"Laengstmoegliche Sitzungsdauer (Stunden)",
|
||||||
|
hint="Danach ist Schluss, auch bei staendiger Arbeit -- eine Sitzung soll nicht "
|
||||||
|
"ewig leben. Die eingebundenen Dateifreigaben enden mit ihr.",
|
||||||
|
section="system",
|
||||||
|
minimum=1,
|
||||||
|
maximum=168,
|
||||||
|
),
|
||||||
SettingSpec(
|
SettingSpec(
|
||||||
"session_idle_minutes",
|
"session_idle_minutes",
|
||||||
30,
|
30,
|
||||||
@@ -134,7 +148,7 @@ def create_base_app(
|
|||||||
#: Wortmarke, ohne Zeile darunter; die Marke selbst zeigen beide
|
#: Wortmarke, ohne Zeile darunter; die Marke selbst zeigen beide
|
||||||
#: Anwendungen.
|
#: Anwendungen.
|
||||||
auth_tagline: str = "",
|
auth_tagline: str = "",
|
||||||
app_version: str = "2.1.2",
|
app_version: str = "2.5.1",
|
||||||
built_in_trusted_keys: tuple[str, ...] = (),
|
built_in_trusted_keys: tuple[str, ...] = (),
|
||||||
enable_license: bool = True,
|
enable_license: bool = True,
|
||||||
template_folder: str | None = None,
|
template_folder: str | None = None,
|
||||||
@@ -163,6 +177,10 @@ def create_base_app(
|
|||||||
config.data_dir.mkdir(parents=True, exist_ok=True)
|
config.data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
config.log_dir.mkdir(parents=True, exist_ok=True)
|
config.log_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# Die Groessengrenze einer Anfrage kommt aus der Einstellung, nicht aus
|
||||||
|
# der Konfiguration beim Start.
|
||||||
|
app.request_class = uploads.UploadLimitRequest
|
||||||
|
|
||||||
app.config.update(
|
app.config.update(
|
||||||
SECRET_KEY=load_or_create_secret_key(config.secret_key_file),
|
SECRET_KEY=load_or_create_secret_key(config.secret_key_file),
|
||||||
# site_key statt app_key: Cookies unterscheiden keine Ports. Zwei
|
# site_key statt app_key: Cookies unterscheiden keine Ports. Zwei
|
||||||
@@ -172,6 +190,9 @@ def create_base_app(
|
|||||||
SESSION_COOKIE_HTTPONLY=True,
|
SESSION_COOKIE_HTTPONLY=True,
|
||||||
SESSION_COOKIE_SECURE=config.security.cookie_secure,
|
SESSION_COOKIE_SECURE=config.security.cookie_secure,
|
||||||
SESSION_COOKIE_SAMESITE=config.security.cookie_samesite,
|
SESSION_COOKIE_SAMESITE=config.security.cookie_samesite,
|
||||||
|
# Nur die aeussere Schranke aus der Umgebung. Die eigentliche Grenze
|
||||||
|
# steht in der Einstellung und wird pro Anfrage gelesen (uploads.py) --
|
||||||
|
# sonst braeuchte jede Aenderung einen Neustart aller Arbeiter.
|
||||||
MAX_CONTENT_LENGTH=config.security.max_content_length,
|
MAX_CONTENT_LENGTH=config.security.max_content_length,
|
||||||
JSON_SORT_KEYS=False,
|
JSON_SORT_KEYS=False,
|
||||||
TRAP_HTTP_EXCEPTIONS=False,
|
TRAP_HTTP_EXCEPTIONS=False,
|
||||||
@@ -222,12 +243,21 @@ def create_base_app(
|
|||||||
wert = 0
|
wert = 0
|
||||||
return wert if wert > 0 else config.security.session_idle_minutes
|
return wert if wert > 0 else config.security.session_idle_minutes
|
||||||
|
|
||||||
|
def _gesamtdauer(conn: Any) -> int:
|
||||||
|
"""Gesamtdauer aus den Einstellungen -- ueber dieselbe offene Verbindung."""
|
||||||
|
try:
|
||||||
|
wert = int(settings.get(conn, "session_absolute_hours") or 0)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
wert = 0
|
||||||
|
return wert if wert > 0 else config.security.session_absolute_hours
|
||||||
|
|
||||||
app.session_interface = SqliteSessionInterface(
|
app.session_interface = SqliteSessionInterface(
|
||||||
database,
|
database,
|
||||||
cookie_name=app.config["SESSION_COOKIE_NAME"],
|
cookie_name=app.config["SESSION_COOKIE_NAME"],
|
||||||
idle_minutes=config.security.session_idle_minutes,
|
idle_minutes=config.security.session_idle_minutes,
|
||||||
absolute_hours=config.security.session_absolute_hours,
|
absolute_hours=config.security.session_absolute_hours,
|
||||||
idle_lookup=_leerlauf,
|
idle_lookup=_leerlauf,
|
||||||
|
absolute_lookup=_gesamtdauer,
|
||||||
)
|
)
|
||||||
|
|
||||||
# -- Schema und Startzustand ------------------------------------------ #
|
# -- Schema und Startzustand ------------------------------------------ #
|
||||||
@@ -328,6 +358,26 @@ def create_base_app(
|
|||||||
# -- Fehlerseiten ------------------------------------------------------ #
|
# -- Fehlerseiten ------------------------------------------------------ #
|
||||||
@app.errorhandler(HTTPException)
|
@app.errorhandler(HTTPException)
|
||||||
def _http_error(error: HTTPException): # type: ignore[no-untyped-def]
|
def _http_error(error: HTTPException): # type: ignore[no-untyped-def]
|
||||||
|
if error.code == 404:
|
||||||
|
# Vor der Fehlerseite: war das eine Adresse aus der Zeit vor 2.5.0?
|
||||||
|
# Erst hier gefragt, damit die Tabelle nie eine bestehende Route
|
||||||
|
# verdeckt -- auf dem Lizenzserver ist /lizenz/<ticket> echt.
|
||||||
|
ziel = legacy_urls.neue_adresse(request.path)
|
||||||
|
if ziel is not None:
|
||||||
|
parameter = legacy_urls.neue_parameter(request.args.to_dict(flat=True))
|
||||||
|
if parameter:
|
||||||
|
ziel = ziel + "?" + urlencode(parameter)
|
||||||
|
return redirect(ziel)
|
||||||
|
if error.code == 413:
|
||||||
|
# "Request Entity Too Large" allein hilft niemandem weiter: die
|
||||||
|
# Zahl steht in einer Einstellung, und wer hochlaedt, soll sie
|
||||||
|
# sehen. Vorher stand hier nur der nackte Status.
|
||||||
|
grenze = uploads.limit_mb()
|
||||||
|
error.description = (
|
||||||
|
f"Diese Datei ist groesser als erlaubt. Zurzeit sind {grenze} MB je Upload "
|
||||||
|
"eingestellt; aendern kann das ein Administrator unter "
|
||||||
|
'"Einstellungen -> Webserver und TLS".'
|
||||||
|
)
|
||||||
if _wants_json():
|
if _wants_json():
|
||||||
return {
|
return {
|
||||||
"error": error.name,
|
"error": error.name,
|
||||||
@@ -381,7 +431,7 @@ def create_base_app(
|
|||||||
with app.app_context():
|
with app.app_context():
|
||||||
trash_views.register_core_providers()
|
trash_views.register_core_providers()
|
||||||
|
|
||||||
app.add_url_rule("/gesundheit", "health", _health, methods=["GET"])
|
app.add_url_rule("/health", "health", _health, methods=["GET"])
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|||||||
@@ -220,6 +220,37 @@ def login_required(view: Callable[..., Any]) -> Callable[..., Any]:
|
|||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
def _verlangt_wiederanmeldung(permission: str) -> bool:
|
||||||
|
"""Fragt das Rechtemodell -- ausserhalb einer Anwendung nie."""
|
||||||
|
try:
|
||||||
|
from ..extension import core
|
||||||
|
|
||||||
|
return bool(core().permissions.verlangt_wiederanmeldung(permission))
|
||||||
|
except Exception: # noqa: BLE001 - ohne Modell keine zusaetzliche Huerde
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def _wiederanmeldung_frisch() -> bool:
|
||||||
|
from .service import reauth_is_fresh # zyklischen Import vermeiden
|
||||||
|
|
||||||
|
return reauth_is_fresh()
|
||||||
|
|
||||||
|
|
||||||
|
def _bitte_bestaetigen(permission: str) -> Any:
|
||||||
|
"""Zur Passwortbestaetigung schicken -- oder es einem Skript sagen.
|
||||||
|
|
||||||
|
Ein Aufruf per fetch bekaeme sonst die Anmeldeseite als Antwort und wuesste
|
||||||
|
nichts damit anzufangen.
|
||||||
|
"""
|
||||||
|
if is_automatic(request) or (
|
||||||
|
request.accept_mimetypes.accept_json and not request.accept_mimetypes.accept_html
|
||||||
|
):
|
||||||
|
abort(403, description="Bitte bestaetigen Sie zur Sicherheit Ihr Passwort.")
|
||||||
|
session["_after_reauth"] = request.full_path if request.query_string else request.path
|
||||||
|
flash("Bitte bestaetigen Sie zur Sicherheit Ihr Passwort.", "info")
|
||||||
|
return redirect(url_for("auth.reauth"))
|
||||||
|
|
||||||
|
|
||||||
def permission_required(*permissions: str, mode: str = "all") -> Callable[..., Any]:
|
def permission_required(*permissions: str, mode: str = "all") -> Callable[..., Any]:
|
||||||
"""Erzwingt Rechte serverseitig.
|
"""Erzwingt Rechte serverseitig.
|
||||||
|
|
||||||
@@ -238,6 +269,14 @@ def permission_required(*permissions: str, mode: str = "all") -> Callable[..., A
|
|||||||
)
|
)
|
||||||
if not ok:
|
if not ok:
|
||||||
return _deny("Fuer diese Seite fehlt Ihnen die Berechtigung.")
|
return _deny("Fuer diese Seite fehlt Ihnen die Berechtigung.")
|
||||||
|
# Geheimnisse und Exporte verlangen eine frische Bestaetigung --
|
||||||
|
# das steht im Rechtemodell und wird deshalb hier abgefragt, nicht
|
||||||
|
# in jeder Route einzeln. Vorher hing es daran, dass jemand an den
|
||||||
|
# Dekorator dachte: dieselbe Lizenz herunterzuladen fragte nach,
|
||||||
|
# sie per Mail zu verschicken nicht.
|
||||||
|
heikel = [p for p in permissions if _verlangt_wiederanmeldung(p)]
|
||||||
|
if heikel and not _wiederanmeldung_frisch():
|
||||||
|
return _bitte_bestaetigen(heikel[0])
|
||||||
return view(*args, **kwargs)
|
return view(*args, **kwargs)
|
||||||
|
|
||||||
wrapper._required_permissions = permissions # type: ignore[attr-defined]
|
wrapper._required_permissions = permissions # type: ignore[attr-defined]
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ def login():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/login/zweiter-faktor", methods=["GET", "POST"])
|
@bp.route("/login/second-factor", methods=["GET", "POST"])
|
||||||
def second_factor():
|
def second_factor():
|
||||||
conn = db()
|
conn = db()
|
||||||
user_row = service.pending_totp_user(conn)
|
user_row = service.pending_totp_user(conn)
|
||||||
@@ -116,7 +116,7 @@ def logout_get():
|
|||||||
return redirect(url_for("auth.login"))
|
return redirect(url_for("auth.login"))
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/bestaetigen", methods=["GET", "POST"])
|
@bp.route("/confirm", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def reauth():
|
def reauth():
|
||||||
target = _safe_next(session.get("_after_reauth"))
|
target = _safe_next(session.get("_after_reauth"))
|
||||||
|
|||||||
@@ -257,6 +257,24 @@ def _verify_credentials(
|
|||||||
return AuthOutcome("ok", user_row=user_row, group_dns=result.profile.group_dns)
|
return AuthOutcome("ok", user_row=user_row, group_dns=result.profile.group_dns)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _ist_erstanmeldung(user_row: dict[str, Any]) -> bool:
|
||||||
|
"""Meldet sich dieses Konto zum ersten Mal ueberhaupt an?
|
||||||
|
|
||||||
|
Das Aenderungsprotokoll soll Aenderungen zeigen. Eine taegliche Anmeldung
|
||||||
|
ist keine -- sie erzeugte aber jedes Mal eine Zeile und schob damit echte
|
||||||
|
Eintraege aus dem Blickfeld. Interessant ist genau die erste: mit ihr
|
||||||
|
entsteht das Konto aus dem Verzeichnisdienst und betritt jemand die
|
||||||
|
Anwendung, der vorher nicht darin war.
|
||||||
|
|
||||||
|
Nicht betroffen: fehlgeschlagene Anmeldungen und Sperren. Die stehen
|
||||||
|
weiterhin **jedes Mal** im Protokoll -- dort liegt der sicherheitsrelevante
|
||||||
|
Teil, und Haeufung ist dort das Signal. Wer wann zuletzt angemeldet war,
|
||||||
|
steht ausserdem unveraendert am Konto und in der Sitzungsuebersicht.
|
||||||
|
"""
|
||||||
|
return not str(user_row.get("last_login_at") or "").strip()
|
||||||
|
|
||||||
|
|
||||||
def complete_login(
|
def complete_login(
|
||||||
conn: sqlite3.Connection,
|
conn: sqlite3.Connection,
|
||||||
user_row: dict[str, Any],
|
user_row: dict[str, Any],
|
||||||
@@ -275,21 +293,26 @@ def complete_login(
|
|||||||
"""
|
"""
|
||||||
from ..security import csrf
|
from ..security import csrf
|
||||||
|
|
||||||
|
# Vor dem UPDATE lesen -- danach steht ueberall ein Zeitstempel.
|
||||||
|
erstanmeldung = _ist_erstanmeldung(user_row)
|
||||||
|
|
||||||
with core().database.transaction(conn):
|
with core().database.transaction(conn):
|
||||||
session_store.rotate(conn, session, reason="login") # type: ignore[arg-type]
|
session_store.rotate(conn, session, reason="login") # type: ignore[arg-type]
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"UPDATE users SET last_login_at=? WHERE id=?", (_iso(_now()), user_row["id"])
|
"UPDATE users SET last_login_at=? WHERE id=?", (_iso(_now()), user_row["id"])
|
||||||
)
|
)
|
||||||
audit.log(
|
if erstanmeldung:
|
||||||
conn,
|
audit.log(
|
||||||
actor=str(user_row["username"]),
|
conn,
|
||||||
actor_id=int(user_row["id"]),
|
actor=str(user_row["username"]),
|
||||||
action="auth.login",
|
actor_id=int(user_row["id"]),
|
||||||
target=str(user_row["username"]),
|
action="auth.first_login",
|
||||||
detail=f"Quelle: {user_row.get('auth_source') or 'local'}",
|
target=str(user_row["username"]),
|
||||||
ip=ip,
|
detail=f"Erste Anmeldung -- Quelle: {user_row.get('auth_source') or 'local'}",
|
||||||
request_id=getattr(g, "request_id", ""),
|
ip=ip,
|
||||||
)
|
request_id=getattr(g, "request_id", ""),
|
||||||
|
severity="notice",
|
||||||
|
)
|
||||||
|
|
||||||
session.clear()
|
session.clear()
|
||||||
session[SESSION_USER_KEY] = int(user_row["id"])
|
session[SESSION_USER_KEY] = int(user_row["id"])
|
||||||
|
|||||||
@@ -0,0 +1,242 @@
|
|||||||
|
"""Alte, deutsche Adressen auf die neuen englischen umlenken.
|
||||||
|
|
||||||
|
Mit 2.5.0 folgen die Adressen der Navigation und sind englisch:
|
||||||
|
``/monitoring/host-keys`` statt ``/hostschluessel``. Das ist eine gute
|
||||||
|
Aenderung und eine unangenehme zugleich -- Lesezeichen, offene Browsertabs und
|
||||||
|
ein Link in einer Mail zeigen weiter auf die alte Adresse. Ein offener Tab ist
|
||||||
|
dabei der unangenehmste Fall: die Statusuebersicht fragt alle 20 Sekunden ihre
|
||||||
|
Kacheln ab und bekam nach dem Update jedes Mal einen 404.
|
||||||
|
|
||||||
|
Deshalb diese Tabelle. Sie greift **nur, wenn sonst ein 404 herauskaeme** --
|
||||||
|
also nie vor einer bestehenden Route. Das ist keine Feinheit: auf dem
|
||||||
|
Lizenzserver ist ``/lizenz/<ticket>`` eine echte, weiterhin gueltige Adresse
|
||||||
|
(sie steht in verschickten Mails), waehrend dieselbe Wurzel in TESM zur
|
||||||
|
Lizenzseite fuehrte. Wer zuerst das Routing fragt, muss sich nicht zwischen
|
||||||
|
beidem entscheiden.
|
||||||
|
|
||||||
|
Die Tabelle ist bewusst vollstaendig und nicht nur auf Wurzeln gekuerzt: eine
|
||||||
|
Umleitung von ``/dateifreigaben/x/vorschau`` auf eine Uebersichtsseite waere
|
||||||
|
zwar kein 404 mehr, aber auch nicht das, was jemand angeklickt hat.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Mapping
|
||||||
|
|
||||||
|
#: Alte Wurzel -> (neue Wurzel, Uebersetzung der Segmente darunter).
|
||||||
|
WURZELN: dict[str, tuple[str, Mapping[str, str]]] = {
|
||||||
|
"/dateifreigaben": (
|
||||||
|
"/fileshares",
|
||||||
|
{
|
||||||
|
"herunterladen": "download",
|
||||||
|
"vorschau": "preview",
|
||||||
|
"hochladen": "upload",
|
||||||
|
"formular": "form",
|
||||||
|
"ordner": "folder",
|
||||||
|
"umbenennen": "rename",
|
||||||
|
"loeschen": "delete",
|
||||||
|
"freigeben": "release",
|
||||||
|
"zuordnungen": "mappings",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/hostschluessel": (
|
||||||
|
"/monitoring/host-keys",
|
||||||
|
{"pruefen": "probe", "freigeben": "trust", "verwerfen": "forget", "verwaist": "orphaned"},
|
||||||
|
),
|
||||||
|
"/zugangsdaten": (
|
||||||
|
"/monitoring/credentials",
|
||||||
|
{"neu": "new", "loeschen": "delete", "anzeigen": "reveal"},
|
||||||
|
),
|
||||||
|
"/switche": (
|
||||||
|
"/monitoring/switches",
|
||||||
|
{
|
||||||
|
"neu": "new",
|
||||||
|
"loeschen": "delete",
|
||||||
|
"hostkey": "host-key",
|
||||||
|
"pruefen": "probe",
|
||||||
|
"freigeben": "trust",
|
||||||
|
"verwerfen": "forget",
|
||||||
|
"kommando": "command",
|
||||||
|
"konsole": "console",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/clients": (
|
||||||
|
"/monitoring/clients",
|
||||||
|
{
|
||||||
|
"neu": "new",
|
||||||
|
"aktiv": "active",
|
||||||
|
"loeschen": "delete",
|
||||||
|
"neustart": "restart",
|
||||||
|
"hostkey": "host-key",
|
||||||
|
"pruefen": "probe",
|
||||||
|
"freigeben": "trust",
|
||||||
|
"verwerfen": "forget",
|
||||||
|
"konsole": "console",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/wartung": (
|
||||||
|
"/maintenance",
|
||||||
|
{
|
||||||
|
"paket-nachinstallieren": "install-package",
|
||||||
|
"auftrag": "job",
|
||||||
|
"ausgabe": "output",
|
||||||
|
"aktualisieren": "update",
|
||||||
|
"neustarten": "restart",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/protokolle": (
|
||||||
|
"/logs",
|
||||||
|
{
|
||||||
|
"kea": "dhcp",
|
||||||
|
"neustarts": "restarts",
|
||||||
|
"laufend": "live",
|
||||||
|
"inhalt": "content",
|
||||||
|
"verlauf": "history",
|
||||||
|
"datei": "file",
|
||||||
|
"archiv": "archive",
|
||||||
|
"archiv-export": "archive-export",
|
||||||
|
"archiv-loeschen": "archive-delete",
|
||||||
|
"aenderungen": "audit",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/verwaltung": (
|
||||||
|
"/administration",
|
||||||
|
{
|
||||||
|
"benutzer": "users",
|
||||||
|
"neu": "new",
|
||||||
|
"loeschen": "delete",
|
||||||
|
"sitzungen-beenden": "end-sessions",
|
||||||
|
"verzeichnis-suche": "directory-search",
|
||||||
|
"verzeichnis-uebernehmen": "directory-import",
|
||||||
|
"gruppen": "groups",
|
||||||
|
"vorlage-anwenden": "apply-preset",
|
||||||
|
"sitzungen": "sessions",
|
||||||
|
"beenden": "end",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/einstellungen": (
|
||||||
|
"/administration",
|
||||||
|
{
|
||||||
|
"zeitzone": "timezone",
|
||||||
|
"pruefung-jetzt": "check-now",
|
||||||
|
"netzwerk": "network",
|
||||||
|
"bestaetigen": "confirm",
|
||||||
|
"webserver": "web",
|
||||||
|
"uebernehmen": "apply",
|
||||||
|
"zertifikat": "certificate",
|
||||||
|
"selbstsigniert": "self-signed",
|
||||||
|
"verzeichnisdienst": "directory",
|
||||||
|
"gruppensuche": "group-search",
|
||||||
|
"zuordnung": "mapping",
|
||||||
|
"loeschen": "delete",
|
||||||
|
"anbieter": "vendor",
|
||||||
|
"logo-entfernen": "remove-logo",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/sicherung": (
|
||||||
|
"/administration/backup",
|
||||||
|
{"vorschau": "preview", "uebernehmen": "apply", "verwerfen": "discard"},
|
||||||
|
),
|
||||||
|
"/papierkorb": (
|
||||||
|
"/administration/trash",
|
||||||
|
{"wiederherstellen": "restore", "endgueltig-loeschen": "purge", "leeren": "empty"},
|
||||||
|
),
|
||||||
|
"/diagnose": (
|
||||||
|
"/administration/diagnostics",
|
||||||
|
{"aufraeumen": "cleanup", "schluessel-rotieren": "rotate-keys"},
|
||||||
|
),
|
||||||
|
"/eigene-lizenz": (
|
||||||
|
"/own-license",
|
||||||
|
{
|
||||||
|
"einspielen": "install",
|
||||||
|
"aktivieren": "activate",
|
||||||
|
"deaktivieren": "deactivate",
|
||||||
|
"offline-antwort": "offline-response",
|
||||||
|
"signaturschluessel": "signing-key",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/lizenzen": (
|
||||||
|
"/licenses",
|
||||||
|
{
|
||||||
|
"aus-ticket": "from-ticket",
|
||||||
|
"datei": "file",
|
||||||
|
"neu-signieren": "resign",
|
||||||
|
"widerrufen": "revoke",
|
||||||
|
"loeschen": "delete",
|
||||||
|
"versenden": "send",
|
||||||
|
"sub-lizenzserver": "sub-servers",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/lizenz": (
|
||||||
|
"/administration/license",
|
||||||
|
{
|
||||||
|
"einspielen": "install",
|
||||||
|
"aktivieren": "activate",
|
||||||
|
"deaktivieren": "deactivate",
|
||||||
|
"offline-antwort": "offline-response",
|
||||||
|
"serverzertifikat": "server-certificate",
|
||||||
|
"aussteller": "issuer",
|
||||||
|
"entfernen": "remove",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/kunden": ("/customers", {"neu": "new", "loeschen": "delete"}),
|
||||||
|
"/konto": (
|
||||||
|
"/account",
|
||||||
|
{
|
||||||
|
"stammdaten": "profile",
|
||||||
|
"profilbild": "avatar",
|
||||||
|
"sicherheit": "security",
|
||||||
|
"passwort": "password",
|
||||||
|
"zwei-faktor": "two-factor",
|
||||||
|
"starten": "start",
|
||||||
|
"bestaetigen": "confirm",
|
||||||
|
"deaktivieren": "disable",
|
||||||
|
"codes-erneuern": "recovery-codes",
|
||||||
|
"sitzungen": "sessions",
|
||||||
|
"beenden": "end",
|
||||||
|
"alle-beenden": "end-all",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"/uebersicht": ("/overview", {"kacheln": "tiles"}),
|
||||||
|
"/gesundheit": ("/health", {}),
|
||||||
|
"/bestaetigen": ("/confirm", {}),
|
||||||
|
}
|
||||||
|
|
||||||
|
#: Abfrageparameter, die mit umbenannt wurden.
|
||||||
|
PARAMETER = {
|
||||||
|
"freigabe": "share",
|
||||||
|
"pfad": "path",
|
||||||
|
"aktion": "action",
|
||||||
|
"benutzer": "actor",
|
||||||
|
"stufe": "severity",
|
||||||
|
"seite": "page",
|
||||||
|
"methode": "method",
|
||||||
|
"kunde": "customer",
|
||||||
|
"freischalten": "unlocked",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#: Wurzeln, unter denen eine unbekannte Unterseite **nicht** umgelenkt wird.
|
||||||
|
#: ``/lizenz/<ticket>`` ist auf dem Lizenzserver eine echte Adresse; ein
|
||||||
|
#: abgelaufenes oder falsches Ticket gehoert dort auf die Fehlerseite und nicht
|
||||||
|
#: in die Verwaltung.
|
||||||
|
STRENG = {"/lizenz"}
|
||||||
|
|
||||||
|
|
||||||
|
def neue_adresse(pfad: str) -> str | None:
|
||||||
|
"""Uebersetzt eine alte Adresse -- oder ``None``, wenn es keine ist."""
|
||||||
|
for alt, (neu, segmente) in WURZELN.items():
|
||||||
|
if pfad != alt and not pfad.startswith(alt + "/"):
|
||||||
|
continue
|
||||||
|
rest = pfad[len(alt) :]
|
||||||
|
teile = rest.split("/")
|
||||||
|
if alt in STRENG:
|
||||||
|
erstes = next((teil for teil in teile if teil), "")
|
||||||
|
if erstes and erstes not in segmente:
|
||||||
|
return None
|
||||||
|
return neu + "/".join(segmente.get(teil, teil) for teil in teile)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def neue_parameter(args: Mapping[str, str]) -> dict[str, str]:
|
||||||
|
return {PARAMETER.get(name, name): wert for name, wert in args.items()}
|
||||||
@@ -77,7 +77,7 @@ SETTINGS_NETWORK = Resource(
|
|||||||
|
|
||||||
BACKUP = Resource(
|
BACKUP = Resource(
|
||||||
key="backup",
|
key="backup",
|
||||||
label="Sicherung und Uebertragung",
|
label="Sicherung und Übertragung",
|
||||||
actions=(A.VIEW, A.EXECUTE, A.EXPORT, A.SECRETS),
|
actions=(A.VIEW, A.EXECUTE, A.EXPORT, A.SECRETS),
|
||||||
hint="Verschluesselter Export und Import",
|
hint="Verschluesselter Export und Import",
|
||||||
action_hints={
|
action_hints={
|
||||||
@@ -121,7 +121,7 @@ LOGS_HISTORY = Resource(
|
|||||||
|
|
||||||
LOGS_AUDIT = Resource(
|
LOGS_AUDIT = Resource(
|
||||||
key="logs_audit",
|
key="logs_audit",
|
||||||
label="Aenderungsprotokoll",
|
label="Änderungsprotokoll",
|
||||||
actions=(A.VIEW, A.EXPORT),
|
actions=(A.VIEW, A.EXPORT),
|
||||||
hint="Wer hat wann was geaendert",
|
hint="Wer hat wann was geaendert",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ class Resource:
|
|||||||
hint: str = ""
|
hint: str = ""
|
||||||
#: Abweichende Erklaerung einzelner Aktionen (z. B. was "Ausfuehren" hier meint).
|
#: Abweichende Erklaerung einzelner Aktionen (z. B. was "Ausfuehren" hier meint).
|
||||||
action_hints: Mapping[Action, str] = field(default_factory=dict)
|
action_hints: Mapping[Action, str] = field(default_factory=dict)
|
||||||
|
#: Aktionen, die hier **keine** frische Passwortbestaetigung verlangen,
|
||||||
|
#: obwohl sie in SENSITIVE_ACTIONS stehen. Bewusst hier und nicht als
|
||||||
|
#: stilles Weglassen in der Route: eine Ausnahme von einer
|
||||||
|
#: Sicherheitsregel gehoert dorthin, wo man sie sieht und begruenden muss.
|
||||||
|
ohne_wiederanmeldung: tuple[Action, ...] = ()
|
||||||
|
|
||||||
def permission(self, action: Action) -> str:
|
def permission(self, action: Action) -> str:
|
||||||
return f"{self.key}.{action.value}"
|
return f"{self.key}.{action.value}"
|
||||||
@@ -159,6 +164,25 @@ class PermissionTree:
|
|||||||
def resource(self, key: str) -> tuple[Area, Resource] | None:
|
def resource(self, key: str) -> tuple[Area, Resource] | None:
|
||||||
return self._resources.get(key)
|
return self._resources.get(key)
|
||||||
|
|
||||||
|
def verlangt_wiederanmeldung(self, permission: str) -> bool:
|
||||||
|
"""Braucht dieses Recht eine frische Passwortbestaetigung?
|
||||||
|
|
||||||
|
Die Antwort steht im Modell (``SENSITIVE_ACTIONS``) und nicht in der
|
||||||
|
Route -- sonst vergisst sie die naechste, die dazukommt.
|
||||||
|
"""
|
||||||
|
resource_key, _, action_value = permission.rpartition(".")
|
||||||
|
entry = self._resources.get(resource_key)
|
||||||
|
if entry is None:
|
||||||
|
return False
|
||||||
|
_, resource = entry
|
||||||
|
try:
|
||||||
|
action = Action(action_value)
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
if action in resource.ohne_wiederanmeldung:
|
||||||
|
return False
|
||||||
|
return action in SENSITIVE_ACTIONS
|
||||||
|
|
||||||
def label_for(self, permission: str) -> str:
|
def label_for(self, permission: str) -> str:
|
||||||
"""Menschenlesbare Beschreibung eines Rechteschluessels -- fuer Audit-Logs."""
|
"""Menschenlesbare Beschreibung eines Rechteschluessels -- fuer Audit-Logs."""
|
||||||
if permission.endswith(".view") and permission[:-5] in self._by_key:
|
if permission.endswith(".view") and permission[:-5] in self._by_key:
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ class SqliteSessionInterface(SessionInterface):
|
|||||||
idle_minutes: int,
|
idle_minutes: int,
|
||||||
absolute_hours: int,
|
absolute_hours: int,
|
||||||
idle_lookup: Any = None,
|
idle_lookup: Any = None,
|
||||||
|
absolute_lookup: Any = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.database = database
|
self.database = database
|
||||||
self.cookie_name = cookie_name
|
self.cookie_name = cookie_name
|
||||||
@@ -172,6 +173,16 @@ class SqliteSessionInterface(SessionInterface):
|
|||||||
#: Zeit zur Laufzeit einstellbar, ohne den Dienst neu zu starten -- und
|
#: Zeit zur Laufzeit einstellbar, ohne den Dienst neu zu starten -- und
|
||||||
#: ohne eine zweite Datenbankverbindung, denn sie bekommt die offene.
|
#: ohne eine zweite Datenbankverbindung, denn sie bekommt die offene.
|
||||||
self._idle_lookup = idle_lookup
|
self._idle_lookup = idle_lookup
|
||||||
|
self._absolute_lookup = absolute_lookup
|
||||||
|
|
||||||
|
def _absolute(self, conn: Any) -> int:
|
||||||
|
"""Gesamtdauer in Stunden -- einstellbar wie die Leerlaufgrenze."""
|
||||||
|
if self._absolute_lookup is None:
|
||||||
|
return self.absolute_hours
|
||||||
|
try:
|
||||||
|
return int(self._absolute_lookup(conn)) or self.absolute_hours
|
||||||
|
except Exception: # pragma: no cover - Einstellung unlesbar
|
||||||
|
return self.absolute_hours
|
||||||
|
|
||||||
def _idle(self, conn: Any) -> int:
|
def _idle(self, conn: Any) -> int:
|
||||||
if self._idle_lookup is None:
|
if self._idle_lookup is None:
|
||||||
@@ -280,7 +291,10 @@ class SqliteSessionInterface(SessionInterface):
|
|||||||
payload = json.dumps(dict(session), separators=(",", ":"), sort_keys=True)
|
payload = json.dumps(dict(session), separators=(",", ":"), sort_keys=True)
|
||||||
with self.database.session() as conn, self.database.transaction(conn):
|
with self.database.session() as conn, self.database.transaction(conn):
|
||||||
if session.new or not session.sid:
|
if session.new or not session.sid:
|
||||||
session.sid = secrets.token_urlsafe(SESSION_ID_BYTES)
|
# Eine vorhandene ID nicht wegwerfen: nach einem Wechsel beim
|
||||||
|
# Anmelden steht sie schon, und andere haben sie sich gemerkt.
|
||||||
|
if not session.sid:
|
||||||
|
session.sid = secrets.token_urlsafe(SESSION_ID_BYTES)
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"INSERT INTO user_sessions "
|
"INSERT INTO user_sessions "
|
||||||
"(id, user_id, created_at, last_seen_at, idle_expires_at, "
|
"(id, user_id, created_at, last_seen_at, idle_expires_at, "
|
||||||
@@ -292,7 +306,7 @@ class SqliteSessionInterface(SessionInterface):
|
|||||||
_iso(now),
|
_iso(now),
|
||||||
_iso(now),
|
_iso(now),
|
||||||
_iso(now + timedelta(minutes=self._idle(conn))),
|
_iso(now + timedelta(minutes=self._idle(conn))),
|
||||||
_iso(now + timedelta(hours=self.absolute_hours)),
|
_iso(now + timedelta(hours=self._absolute(conn))),
|
||||||
session.get("_ip", ""),
|
session.get("_ip", ""),
|
||||||
session.get("_ua", ""),
|
session.get("_ua", ""),
|
||||||
payload,
|
payload,
|
||||||
@@ -371,7 +385,12 @@ def rotate(conn: sqlite3.Connection, session: ServerSession, *, reason: str = "p
|
|||||||
"UPDATE user_sessions SET revoked_at=?, revoked_reason=? WHERE id=?",
|
"UPDATE user_sessions SET revoked_at=?, revoked_reason=? WHERE id=?",
|
||||||
(_iso(_now()), reason, old_sid),
|
(_iso(_now()), reason, old_sid),
|
||||||
)
|
)
|
||||||
session.sid = ""
|
# Die neue ID entsteht **jetzt** und nicht erst beim Speichern der Antwort.
|
||||||
|
# Zwischen beidem laufen die Anmeldehaken, und einer davon bindet die
|
||||||
|
# Dateifreigaben ein und schreibt sich die Sitzung dazu. Mit einer leeren
|
||||||
|
# Sitzung hielt der Aufraeumer diese Einbindungen fuer verwaist und loeste
|
||||||
|
# sie binnen Minuten wieder.
|
||||||
|
session.sid = secrets.token_urlsafe(SESSION_ID_BYTES)
|
||||||
session.new = True
|
session.new = True
|
||||||
session.modified = True
|
session.modified = True
|
||||||
return old_sid
|
return old_sid
|
||||||
|
|||||||
@@ -685,7 +685,10 @@
|
|||||||
.modal__sub { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 2px; }
|
.modal__sub { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 2px; }
|
||||||
/* Eine Datei-Vorschau soll die ganze Flaeche des Dialogs nutzen; der
|
/* Eine Datei-Vorschau soll die ganze Flaeche des Dialogs nutzen; der
|
||||||
uebliche Innenabstand des Dialogkoerpers wuerde sie einrahmen. */
|
uebliche Innenabstand des Dialogkoerpers wuerde sie einrahmen. */
|
||||||
.modal__body--flush { padding: 0; max-height: none; }
|
/* Zwei Klassen am selben Element: diese hier muss gewinnen, obwohl
|
||||||
|
.modal__body weiter unten steht. Mit der doppelten Klasse haengt das
|
||||||
|
nicht mehr an der Reihenfolge im Stylesheet. */
|
||||||
|
.modal__body.modal__body--flush { padding: 0; max-height: none; overflow: visible; }
|
||||||
.modal__caption {
|
.modal__caption {
|
||||||
padding: 0 var(--sp-5) var(--sp-2);
|
padding: 0 var(--sp-5) var(--sp-2);
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
@@ -702,6 +705,155 @@
|
|||||||
darunter. --surface-0 gibt es nicht, der Rahmen blieb durchsichtig. */
|
darunter. --surface-0 gibt es nicht, der Rahmen blieb durchsichtig. */
|
||||||
background: var(--surface-1);
|
background: var(--surface-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -- Betrachter: Bild, PDF, Rahmen ------------------------------------- */
|
||||||
|
/* Eine feste Hoehe fuer alle drei Anzeigen: sonst springt der Dialog beim
|
||||||
|
Wechsel zwischen Foto und PDF. */
|
||||||
|
.viewer {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
/* Was der Dialog uebrig laesst: Kopf, Dateiname und Fusszeile brauchen
|
||||||
|
zusammen rund 190 Pixel. Ein fester Anteil der Fensterhoehe schob die
|
||||||
|
Zoomleiste auf kleinen Fenstern unter den Rand. */
|
||||||
|
height: min(calc(100dvh - 240px), 760px);
|
||||||
|
min-height: 220px;
|
||||||
|
background: var(--surface-1);
|
||||||
|
}
|
||||||
|
/* Hochkant -- Tablet oder Monitor im Hochformat -- gibt es unter dem Dialog
|
||||||
|
viel Platz, den die Obergrenze verschenkt. Beim Ausfuellen eines
|
||||||
|
Formulars zaehlt jede sichtbare Zeile, also nehmen wir dort die Hoehe,
|
||||||
|
die da ist. Der Rest (Kopf, Dateiname, Fusszeile) braucht rund 200 Pixel;
|
||||||
|
die 240 lassen etwas Luft. */
|
||||||
|
@media (orientation: portrait) {
|
||||||
|
.viewer {
|
||||||
|
height: calc(100dvh - 240px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.viewer > .file-preview {
|
||||||
|
flex: 1;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
.viewer__stage {
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
|
/* Ohne min-height waechst die Buehne mit dem Bild, und dessen
|
||||||
|
max-height:100% haengt dann an sich selbst: ein 4032x3024-Foto stand
|
||||||
|
36 Pixel ueber den Rand hinaus. */
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
overflow: hidden;
|
||||||
|
/* Die Seite darf nicht mitwandern, wenn im Bild geschoben wird. */
|
||||||
|
touch-action: none;
|
||||||
|
cursor: zoom-in;
|
||||||
|
}
|
||||||
|
.viewer__stage--gezogen {
|
||||||
|
cursor: grab;
|
||||||
|
}
|
||||||
|
.viewer__img {
|
||||||
|
/* Der Ausgangszustand ist "passt in die Flaeche" -- genau das fehlte:
|
||||||
|
ein Foto vom iPad ist 4032 Pixel breit und wurde im Rahmen 1:1
|
||||||
|
gezeigt, also als Ausschnitt aus der Mitte. */
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
/* Zoomen soll nicht unscharf wirken, solange nicht vergroessert wird. */
|
||||||
|
transform-origin: center center;
|
||||||
|
will-change: transform;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-drag: none;
|
||||||
|
}
|
||||||
|
/* pdf.js verlangt einen absolut positionierten, scrollenden Behaelter --
|
||||||
|
der liegt deshalb *innen*. Aussen ein gewoehnlicher Flex-Kasten, damit
|
||||||
|
Zoomleiste und Speicherzeile ihren Platz behalten. Vorher rechnete der
|
||||||
|
Bereich mit "bottom: var(--sp-10)", also mit genau einer Leiste; die
|
||||||
|
zweite Zeile lag dann unter dem Dialogrand. */
|
||||||
|
.viewer__pdf {
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
/* Ein PDF ist weisses Papier. pdf.js malt Formularfelder mit Systemfarben
|
||||||
|
und ueberlaesst Ankreuzfelder dem Browser -- im dunklen Design heisst
|
||||||
|
CanvasText weiss, und die Haken waren auf dem Papier unsichtbar. Fuer
|
||||||
|
diesen Ausschnitt gilt deshalb immer das helle Schema. */
|
||||||
|
color-scheme: light;
|
||||||
|
}
|
||||||
|
/* pdf.js rechnet fuer die Seite mit dem Standard "content-box": ihr
|
||||||
|
9-Pixel-Rahmen liegt *ausserhalb* der angegebenen Breite. Unser globales
|
||||||
|
"border-box" rechnete ihn hinein -- die Leinwand wurde 18 Pixel schmaler
|
||||||
|
als die Anmerkungsebene, und die Formularfelder wanderten nach rechts
|
||||||
|
unten, immer weiter je weiter unten sie lagen. */
|
||||||
|
.viewer__pdf .pdfViewer .page {
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
.viewer__pdfscroll {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
overflow: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
.viewer__bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--sp-2);
|
||||||
|
padding: var(--sp-2) var(--sp-4);
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
background: var(--surface-2, var(--surface-1));
|
||||||
|
}
|
||||||
|
.viewer__hint {
|
||||||
|
margin-inline-start: auto;
|
||||||
|
}
|
||||||
|
/* Bildfeld eines Formulars: der Kasten zeigt das gewaehlte Foto, die
|
||||||
|
Schaltflaeche liegt darin. Acrobats eigener Knopf tut im Browser nichts --
|
||||||
|
das hier ist der Ersatz. */
|
||||||
|
.viewer__bildfeld [data-viewer-bildvorschau] {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.viewer__bildwahl {
|
||||||
|
position: absolute;
|
||||||
|
inset: auto 0 4px 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.viewer__bildwahl > span {
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: var(--r-sm, 6px);
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
font-size: var(--fs-xs);
|
||||||
|
font-weight: 600;
|
||||||
|
box-shadow: var(--shadow-sm, 0 1px 3px rgb(0 0 0 / 0.3));
|
||||||
|
}
|
||||||
|
.viewer__bildfeld--belegt .viewer__bildwahl > span {
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
.viewer__save {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: var(--sp-3);
|
||||||
|
padding: var(--sp-3) var(--sp-4);
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
background: var(--surface-2, var(--surface-1));
|
||||||
|
}
|
||||||
|
.viewer__save .viewer__feld {
|
||||||
|
flex: 1 1 12rem;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
/* Eigener Name: ".field--inline" gibt es schon und steht dort fuer
|
||||||
|
"waagerecht" -- diese Regel haette sie app-weit umgestellt. */
|
||||||
|
.viewer__feld {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
/* Der Dateiname ist ein Knopf (er oeffnet die Vorschau), soll aber wie ein
|
/* Der Dateiname ist ein Knopf (er oeffnet die Vorschau), soll aber wie ein
|
||||||
Link aussehen -- ein Knopf mit Rahmen mitten in einer Tabellenzeile waere
|
Link aussehen -- ein Knopf mit Rahmen mitten in einer Tabellenzeile waere
|
||||||
unruhig. */
|
unruhig. */
|
||||||
@@ -1163,3 +1315,72 @@
|
|||||||
.hide-sm { display: none !important; }
|
.hide-sm { display: none !important; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -- Sortierbare Liste (Navigationsreihenfolge) --------------------------- */
|
||||||
|
/* Symbol und Beschriftung stehen in einer Zeile -- so wie im Menue selbst.
|
||||||
|
Vorher brach die Beschriftung unter das Symbol, und die Liste sah aus wie
|
||||||
|
etwas anderes als das, was sie sortiert. */
|
||||||
|
|
||||||
|
.reorder {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reorder__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--r-sm);
|
||||||
|
background: var(--surface-2);
|
||||||
|
cursor: grab;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reorder__row > .flex-1 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reorder__row.is-dragging {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reorder__grip {
|
||||||
|
color: var(--text-muted);
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reorder__pos {
|
||||||
|
min-width: 1.6em;
|
||||||
|
text-align: right;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: var(--fs-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
.reorder__moves {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reorder__group {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reorder--child {
|
||||||
|
margin: 4px 0 4px 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reorder--child .reorder__row {
|
||||||
|
background: transparent;
|
||||||
|
border-style: dashed;
|
||||||
|
}
|
||||||
@@ -856,6 +856,81 @@ function initTileFilters() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -- Reihenfolge aendern -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eine Liste, deren Reihenfolge man aendern kann -- ohne Bibliothek.
|
||||||
|
*
|
||||||
|
* Die Reihenfolge steckt in der Reihenfolge der versteckten Felder: das
|
||||||
|
* Formular schickt sie als wiederholtes Feld, und der Server liest sie als
|
||||||
|
* Liste. Verschiebt man einen Eintrag, verschiebt sich das Feld mit ihm.
|
||||||
|
*
|
||||||
|
* Zwei Wege, weil es zwei Arten von Geraeten gibt: Ziehen mit der Maus und
|
||||||
|
* zwei Knoepfe je Zeile. Die Knoepfe sind nicht die Notloesung -- auf einem
|
||||||
|
* Tablet sind sie der einzige Weg, der zuverlaessig funktioniert, und mit der
|
||||||
|
* Tastatur ebenso.
|
||||||
|
*/
|
||||||
|
function initReorder() {
|
||||||
|
$$('[data-behavior="reorder"]').forEach((liste) => {
|
||||||
|
// Nur die eigenen Zeilen: Gruppen enthalten wiederum eine sortierbare
|
||||||
|
// Liste, und deren Zeilen gehoeren der inneren Liste, nicht dieser.
|
||||||
|
const zeilen = () => Array.from(liste.querySelectorAll(":scope > [data-reorder-item]"));
|
||||||
|
|
||||||
|
const nummerieren = () => {
|
||||||
|
zeilen().forEach((zeile, index) => {
|
||||||
|
const nummer = zeile.querySelector("[data-reorder-position-text]");
|
||||||
|
if (nummer) nummer.textContent = String(index + 1);
|
||||||
|
const hoch = zeile.querySelector('[data-reorder-move="up"]');
|
||||||
|
const runter = zeile.querySelector('[data-reorder-move="down"]');
|
||||||
|
if (hoch) hoch.disabled = index === 0;
|
||||||
|
if (runter) runter.disabled = index === zeilen().length - 1;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
liste.addEventListener("click", (event) => {
|
||||||
|
const knopf = event.target.closest("[data-reorder-move]");
|
||||||
|
if (!knopf) return;
|
||||||
|
const zeile = knopf.closest("[data-reorder-item]");
|
||||||
|
if (!zeile || zeile.parentElement !== liste) return;
|
||||||
|
event.preventDefault();
|
||||||
|
if (knopf.dataset.reorderMove === "up") {
|
||||||
|
const davor = zeile.previousElementSibling;
|
||||||
|
if (davor) liste.insertBefore(zeile, davor);
|
||||||
|
} else {
|
||||||
|
const danach = zeile.nextElementSibling;
|
||||||
|
if (danach) liste.insertBefore(danach, zeile);
|
||||||
|
}
|
||||||
|
nummerieren();
|
||||||
|
zeile.querySelector(`[data-reorder-move="${knopf.dataset.reorderMove}"]`)?.focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
let gezogen = null;
|
||||||
|
liste.addEventListener("dragstart", (event) => {
|
||||||
|
const zeile = event.target.closest("[data-reorder-item]");
|
||||||
|
if (!zeile || zeile.parentElement !== liste) return;
|
||||||
|
gezogen = zeile;
|
||||||
|
gezogen.classList.add("is-dragging");
|
||||||
|
if (event.dataTransfer) event.dataTransfer.effectAllowed = "move";
|
||||||
|
});
|
||||||
|
liste.addEventListener("dragend", () => {
|
||||||
|
if (gezogen) gezogen.classList.remove("is-dragging");
|
||||||
|
gezogen = null;
|
||||||
|
nummerieren();
|
||||||
|
});
|
||||||
|
liste.addEventListener("dragover", (event) => {
|
||||||
|
if (!gezogen) return;
|
||||||
|
event.preventDefault();
|
||||||
|
const ziel = event.target.closest("[data-reorder-item]");
|
||||||
|
if (!ziel || ziel === gezogen || ziel.parentElement !== liste) return;
|
||||||
|
const kasten = ziel.getBoundingClientRect();
|
||||||
|
const obereHaelfte = event.clientY < kasten.top + kasten.height / 2;
|
||||||
|
liste.insertBefore(gezogen, obereHaelfte ? ziel : ziel.nextElementSibling);
|
||||||
|
});
|
||||||
|
|
||||||
|
nummerieren();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* -- Start ---------------------------------------------------------------- */
|
/* -- Start ---------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -893,8 +968,23 @@ function boot() {
|
|||||||
initPalette();
|
initPalette();
|
||||||
initSubmitGuards();
|
initSubmitGuards();
|
||||||
initTileFilters();
|
initTileFilters();
|
||||||
|
initReorder();
|
||||||
initLogTails();
|
initLogTails();
|
||||||
unsavedGuard.init();
|
unsavedGuard.init();
|
||||||
|
initViewer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Der Dateibetrachter kommt nur auf Seiten mit Vorschau -- und er zieht bei
|
||||||
|
einem PDF noch pdf.js nach. Beides erst dann, wenn es gebraucht wird. */
|
||||||
|
function initViewer() {
|
||||||
|
if (!document.querySelector("[data-viewer]")) return;
|
||||||
|
// Dieselbe Version wie diese Datei: app.js wird als ".../app.js?v=<Zeit>"
|
||||||
|
// eingebunden, und nginx liefert /core-assets/ mit "expires 7d". Ohne das
|
||||||
|
// Anhaengsel bliebe der alte Betrachter nach einem Update im Cache liegen.
|
||||||
|
const version = new URL(import.meta.url).search;
|
||||||
|
import(`./viewer.js${version}`)
|
||||||
|
.then((modul) => modul.initFilePreview())
|
||||||
|
.catch((fehler) => console.error("Dateibetrachter", fehler));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.readyState === "loading") {
|
if (document.readyState === "loading") {
|
||||||
|
|||||||
@@ -0,0 +1,677 @@
|
|||||||
|
/* =============================================================================
|
||||||
|
* Dateivorschau: Bilder zoomen, PDF-Formulare ausfuellen.
|
||||||
|
*
|
||||||
|
* Vorher lief jede Vorschau durch einen <iframe> -- der Browser entschied
|
||||||
|
* selbst. Zwei Dinge gingen dabei schief:
|
||||||
|
*
|
||||||
|
* * Ein Foto vom iPad ist 4032 Pixel breit. Der Rahmen zeigte es 1:1, also
|
||||||
|
* einen Ausschnitt aus der Mitte, und zoomen liess sich nichts.
|
||||||
|
* * Ein PDF im Rahmen ist auf iPadOS nur ein Standbild der ersten Seite.
|
||||||
|
* Formularfelder sind dort nicht anfassbar.
|
||||||
|
*
|
||||||
|
* Jetzt entscheidet die Art der Datei (bild | pdf | text), welche Anzeige
|
||||||
|
* aufgeht. Bilder bekommen einen eigenen Betrachter mit Zoom und Verschieben
|
||||||
|
* (Finger, Rad, Knoepfe); PDFs werden von pdf.js gerendert -- damit sind
|
||||||
|
* Formularfelder echte Eingabefelder, auch in Safari.
|
||||||
|
*
|
||||||
|
* pdf.js liegt im Paket (static/vendor/pdfjs) und wird erst geladen, wenn
|
||||||
|
* wirklich ein PDF geoeffnet wird: 1,7 MB gehoeren nicht in jeden Seitenaufruf.
|
||||||
|
*
|
||||||
|
* Die Dateien heissen ".js" und nicht ".mjs": die mime.types von nginx kennen
|
||||||
|
* ".mjs" nicht und liefern "application/octet-stream" -- damit lehnt jeder
|
||||||
|
* Browser ein Modul ab, und zwar ohne dass der Benutzer erfaehrt, warum. Am
|
||||||
|
* Inhalt aendert die Endung nichts.
|
||||||
|
* ========================================================================== */
|
||||||
|
|
||||||
|
const MIN_ZOOM = 0.1;
|
||||||
|
const MAX_ZOOM = 8;
|
||||||
|
|
||||||
|
/* -- Bilder ---------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/** Zoom und Verschieben fuer ein einzelnes Bild. */
|
||||||
|
function bildBetrachter(buehne, bild) {
|
||||||
|
let zoom = 1;
|
||||||
|
let x = 0;
|
||||||
|
let y = 0;
|
||||||
|
let angepasst = true; // noch nie von Hand gezoomt -> passt sich der Flaeche an
|
||||||
|
|
||||||
|
const anwenden = () => {
|
||||||
|
bild.style.transform = `translate(${x}px, ${y}px) scale(${zoom})`;
|
||||||
|
buehne.classList.toggle("viewer__stage--gezogen", zoom > 1);
|
||||||
|
buehne.dispatchEvent(new CustomEvent("zoom", { detail: { zoom, angepasst } }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const grenzen = () => {
|
||||||
|
// Nicht aus dem Bild herausschieben: was ueber die Buehne hinausragt,
|
||||||
|
// darf verschoben werden, mehr nicht.
|
||||||
|
const b = buehne.getBoundingClientRect();
|
||||||
|
const breite = (bild.clientWidth * zoom - b.width) / 2;
|
||||||
|
const hoehe = (bild.clientHeight * zoom - b.height) / 2;
|
||||||
|
x = Math.min(Math.max(x, -Math.max(0, breite)), Math.max(0, breite));
|
||||||
|
y = Math.min(Math.max(y, -Math.max(0, hoehe)), Math.max(0, hoehe));
|
||||||
|
};
|
||||||
|
|
||||||
|
const setzen = (wert, { fest = false } = {}) => {
|
||||||
|
zoom = Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, wert));
|
||||||
|
angepasst = !fest && Math.abs(zoom - 1) < 0.001;
|
||||||
|
if (zoom <= 1) {
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
} else {
|
||||||
|
grenzen();
|
||||||
|
}
|
||||||
|
anwenden();
|
||||||
|
};
|
||||||
|
|
||||||
|
const zuruecksetzen = () => {
|
||||||
|
zoom = 1;
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
angepasst = true;
|
||||||
|
anwenden();
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Ziehen mit Maus oder einem Finger, sobald hineingezoomt ist. */
|
||||||
|
let zieht = null;
|
||||||
|
buehne.addEventListener("pointerdown", (event) => {
|
||||||
|
if (zoom <= 1 || event.pointerType === "touch" && event.isPrimary === false) return;
|
||||||
|
zieht = { id: event.pointerId, x: event.clientX - x, y: event.clientY - y };
|
||||||
|
buehne.setPointerCapture(event.pointerId);
|
||||||
|
});
|
||||||
|
buehne.addEventListener("pointermove", (event) => {
|
||||||
|
if (!zieht || event.pointerId !== zieht.id) return;
|
||||||
|
event.preventDefault();
|
||||||
|
x = event.clientX - zieht.x;
|
||||||
|
y = event.clientY - zieht.y;
|
||||||
|
grenzen();
|
||||||
|
anwenden();
|
||||||
|
});
|
||||||
|
const loslassen = (event) => {
|
||||||
|
if (zieht && event.pointerId === zieht.id) zieht = null;
|
||||||
|
};
|
||||||
|
buehne.addEventListener("pointerup", loslassen);
|
||||||
|
buehne.addEventListener("pointercancel", loslassen);
|
||||||
|
|
||||||
|
/* Zwei Finger: aufziehen und zusammenziehen. Der Dialog liegt ueber der
|
||||||
|
Seite, deren eigenes Zoomen hier nicht greift -- also selbst rechnen. */
|
||||||
|
let start = null;
|
||||||
|
const abstand = (t) => Math.hypot(t[0].clientX - t[1].clientX, t[0].clientY - t[1].clientY);
|
||||||
|
buehne.addEventListener(
|
||||||
|
"touchstart",
|
||||||
|
(event) => {
|
||||||
|
if (event.touches.length !== 2) return;
|
||||||
|
start = { d: abstand(event.touches), zoom };
|
||||||
|
},
|
||||||
|
{ passive: true }
|
||||||
|
);
|
||||||
|
buehne.addEventListener(
|
||||||
|
"touchmove",
|
||||||
|
(event) => {
|
||||||
|
if (!start || event.touches.length !== 2) return;
|
||||||
|
event.preventDefault();
|
||||||
|
setzen((start.zoom * abstand(event.touches)) / start.d, { fest: true });
|
||||||
|
},
|
||||||
|
{ passive: false }
|
||||||
|
);
|
||||||
|
buehne.addEventListener("touchend", () => {
|
||||||
|
start = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Rad zoomt, Umschalt oder Strg nicht noetig -- im Dialog gibt es nichts
|
||||||
|
anderes zu scrollen. */
|
||||||
|
buehne.addEventListener(
|
||||||
|
"wheel",
|
||||||
|
(event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
setzen(zoom * (event.deltaY < 0 ? 1.12 : 1 / 1.12), { fest: true });
|
||||||
|
},
|
||||||
|
{ passive: false }
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Doppeltippen: zwischen angepasst und doppelt umschalten. */
|
||||||
|
buehne.addEventListener("dblclick", () => setzen(zoom > 1 ? 1 : 2, { fest: zoom <= 1 }));
|
||||||
|
|
||||||
|
return {
|
||||||
|
hinein: () => setzen(zoom * 1.25, { fest: true }),
|
||||||
|
hinaus: () => setzen(zoom / 1.25, { fest: true }),
|
||||||
|
anpassen: zuruecksetzen,
|
||||||
|
zuruecksetzen,
|
||||||
|
get zoom() {
|
||||||
|
return zoom;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- Bildfelder in Formularen ---------------------------------------------- */
|
||||||
|
|
||||||
|
//: Groesser muss ein Foto in einem Formular nicht sein.
|
||||||
|
const FOTO_KANTE = 1600;
|
||||||
|
|
||||||
|
/** Macht aus einer gewaehlten Datei ein JPEG in vertretbarer Groesse.
|
||||||
|
*
|
||||||
|
* Ueber eine Leinwand, nicht roh: damit wird aus allem, was der Browser
|
||||||
|
* anzeigen kann, ein JPEG -- auf einem iPad also auch aus HEIC, das pdf-lib
|
||||||
|
* nicht kennt. Und ein 12-Megapixel-Foto blaeht das Formular nicht auf.
|
||||||
|
*/
|
||||||
|
async function fotoAlsJpeg(datei) {
|
||||||
|
// Keine Objektadresse: die CSP erlaubt Bilder nur von "self" und als data:.
|
||||||
|
// createImageBitmap nimmt die Datei unmittelbar; wo es fehlt, tut es eine
|
||||||
|
// data:-Adresse.
|
||||||
|
let bild;
|
||||||
|
if (typeof createImageBitmap === "function") {
|
||||||
|
try {
|
||||||
|
bild = await createImageBitmap(datei);
|
||||||
|
} catch {
|
||||||
|
bild = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!bild) {
|
||||||
|
const daten = await new Promise((fertig, schiefgegangen) => {
|
||||||
|
const leser = new FileReader();
|
||||||
|
leser.onload = () => fertig(String(leser.result));
|
||||||
|
leser.onerror = () => schiefgegangen(new Error("Die Datei liess sich nicht lesen."));
|
||||||
|
leser.readAsDataURL(datei);
|
||||||
|
});
|
||||||
|
bild = await new Promise((fertig, schiefgegangen) => {
|
||||||
|
const el = new Image();
|
||||||
|
el.onload = () => fertig(el);
|
||||||
|
el.onerror = () => schiefgegangen(new Error("Dieses Bild kann der Browser nicht anzeigen."));
|
||||||
|
el.src = daten;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const breiteRoh = bild.width || bild.naturalWidth;
|
||||||
|
const hoeheRoh = bild.height || bild.naturalHeight;
|
||||||
|
const faktor = Math.min(1, FOTO_KANTE / Math.max(breiteRoh, hoeheRoh));
|
||||||
|
const leinwand = document.createElement("canvas");
|
||||||
|
leinwand.width = Math.max(1, Math.round(breiteRoh * faktor));
|
||||||
|
leinwand.height = Math.max(1, Math.round(hoeheRoh * faktor));
|
||||||
|
leinwand.getContext("2d").drawImage(bild, 0, 0, leinwand.width, leinwand.height);
|
||||||
|
bild.close?.();
|
||||||
|
const klecks = await new Promise((fertig) => leinwand.toBlob(fertig, "image/jpeg", 0.85));
|
||||||
|
return {
|
||||||
|
bytes: new Uint8Array(await klecks.arrayBuffer()),
|
||||||
|
breite: leinwand.width,
|
||||||
|
hoehe: leinwand.height,
|
||||||
|
vorschau: leinwand.toDataURL("image/jpeg", 0.6),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let pdflibGeladen = null;
|
||||||
|
|
||||||
|
/** pdf-lib nachladen -- nur wenn wirklich ein Bild eingesetzt wird. */
|
||||||
|
async function pdflibLaden(adresse) {
|
||||||
|
if (!pdflibGeladen) {
|
||||||
|
pdflibGeladen = new Promise((fertig, schiefgegangen) => {
|
||||||
|
const skript = document.createElement("script");
|
||||||
|
skript.src = adresse;
|
||||||
|
skript.onload = () => fertig(window.PDFLib);
|
||||||
|
skript.onerror = () => {
|
||||||
|
pdflibGeladen = null;
|
||||||
|
schiefgegangen(new Error("pdf-lib liess sich nicht laden."));
|
||||||
|
};
|
||||||
|
document.head.append(skript);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return pdflibGeladen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Setzt die Fotos ein und schliesst das Formular auf Wunsch ab.
|
||||||
|
*
|
||||||
|
* Eingabe sind die Bytes, die pdf.js nach dem Ausfuellen geschrieben hat --
|
||||||
|
* die Feldwerte bleiben also erhalten.
|
||||||
|
*
|
||||||
|
* Das Foto wird das **Aussehen des Bildknopfes** und nicht in die Seite
|
||||||
|
* gestempelt: so bleibt der Knopf erhalten, das Bild ist trotzdem zu sehen,
|
||||||
|
* und beim naechsten Oeffnen laesst es sich austauschen. Genau das tut
|
||||||
|
* Acrobat mit "buttonImportIcon".
|
||||||
|
*
|
||||||
|
* ``abschliessen`` rechnet danach alle Felder flach in die Seite: heraus kommt
|
||||||
|
* ein PDF ohne Formular -- nichts mehr zu verstellen.
|
||||||
|
*/
|
||||||
|
async function nachbearbeiten(bytes, bilder, adresse, { abschliessen = false } = {}) {
|
||||||
|
const PDFLib = await pdflibLaden(adresse);
|
||||||
|
const dokument = await PDFLib.PDFDocument.load(bytes);
|
||||||
|
const formular = dokument.getForm();
|
||||||
|
|
||||||
|
for (const eintrag of bilder) {
|
||||||
|
const jpeg = await dokument.embedJpg(eintrag.foto.bytes);
|
||||||
|
const knopf = eintrag.feldname ? formular.getFieldMaybe(eintrag.feldname) : null;
|
||||||
|
if (knopf && typeof knopf.setImage === "function") {
|
||||||
|
knopf.setImage(jpeg);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Kein Knopf gefunden: dann eben in die Seite. Damit nichts darueber
|
||||||
|
// liegt, muss das Feld weichen.
|
||||||
|
const seite = dokument.getPage(eintrag.seite - 1);
|
||||||
|
const [x1, y1, x2, y2] = eintrag.rechteck;
|
||||||
|
const kastenBreite = Math.abs(x2 - x1);
|
||||||
|
const kastenHoehe = Math.abs(y2 - y1);
|
||||||
|
// Einpassen statt verzerren: das Seitenverhaeltnis des Fotos bleibt.
|
||||||
|
const faktor = Math.min(kastenBreite / jpeg.width, kastenHoehe / jpeg.height);
|
||||||
|
seite.drawImage(jpeg, {
|
||||||
|
x: Math.min(x1, x2) + (kastenBreite - jpeg.width * faktor) / 2,
|
||||||
|
y: Math.min(y1, y2) + (kastenHoehe - jpeg.height * faktor) / 2,
|
||||||
|
width: jpeg.width * faktor,
|
||||||
|
height: jpeg.height * faktor,
|
||||||
|
});
|
||||||
|
if (knopf) {
|
||||||
|
try {
|
||||||
|
formular.removeField(knopf);
|
||||||
|
} catch (fehler) {
|
||||||
|
console.warn("Bildknopf liess sich nicht entfernen", fehler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (abschliessen) {
|
||||||
|
// Alle Felder werden Teil der Seite. Danach gibt es kein Formular mehr --
|
||||||
|
// gewollt: so kann niemand mehr etwas verstellen.
|
||||||
|
formular.flatten();
|
||||||
|
}
|
||||||
|
return dokument.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- PDF ------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
let pdfjsGeladen = null;
|
||||||
|
|
||||||
|
/** Die Adressen der pdf.js-Dateien -- alle mit derselben Version.
|
||||||
|
*
|
||||||
|
* Uebergeben wird die Adresse von pdf.min.js samt "?v=<Zeit>"; die
|
||||||
|
* Geschwister liegen daneben. Ohne die Version bliebe nach einem Update die
|
||||||
|
* alte Fassung im Cache von nginx ("expires 7d") haengen.
|
||||||
|
*/
|
||||||
|
function pdfjsAdressen(adresse) {
|
||||||
|
const url = new URL(adresse, location.href);
|
||||||
|
const verzeichnis = url.pathname.replace(/[^/]*$/, "");
|
||||||
|
const mit = (datei) => `${url.origin}${verzeichnis}${datei}${url.search}`;
|
||||||
|
return {
|
||||||
|
lib: mit("pdf.min.js"),
|
||||||
|
komponenten: mit("pdf_viewer.js"),
|
||||||
|
worker: mit("pdf.worker.min.js"),
|
||||||
|
stil: mit("pdf_viewer.css"),
|
||||||
|
schriften: `${url.origin}${verzeichnis}standard_fonts/`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Laedt pdf.js einmalig nach; das Paket liegt neben dieser Datei. */
|
||||||
|
async function pdfjsLaden(basis) {
|
||||||
|
const adressen = pdfjsAdressen(basis);
|
||||||
|
if (!pdfjsGeladen) {
|
||||||
|
pdfjsGeladen = (async () => {
|
||||||
|
const lib = await import(adressen.lib);
|
||||||
|
// Der Komponentenbau von pdf.js sucht die Bibliothek unter diesem Namen.
|
||||||
|
globalThis.pdfjsLib = lib;
|
||||||
|
const komponenten = await import(adressen.komponenten);
|
||||||
|
// Das Stylesheet von pdf.js zeichnet die Formularfelder. 100 KB gehoeren
|
||||||
|
// nicht in jeden Seitenaufruf -- also erst hier.
|
||||||
|
const stil = document.createElement("link");
|
||||||
|
stil.rel = "stylesheet";
|
||||||
|
stil.href = adressen.stil;
|
||||||
|
document.head.append(stil);
|
||||||
|
lib.GlobalWorkerOptions.workerSrc = adressen.worker;
|
||||||
|
return { lib, komponenten };
|
||||||
|
})().catch((fehler) => {
|
||||||
|
pdfjsGeladen = null;
|
||||||
|
throw fehler;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return pdfjsGeladen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Zeigt ein PDF -- mit ausfuellbaren Feldern, sofern das erlaubt ist.
|
||||||
|
*
|
||||||
|
* Ohne ``formulare`` bleibt es bei der Darstellung aus dem Dokument: pdf.js
|
||||||
|
* malt dann die Marken, die im PDF stehen (etwa rotes Kreuz und gruener
|
||||||
|
* Haken), statt Bedienelemente des Browsers einzusetzen.
|
||||||
|
*/
|
||||||
|
async function pdfBetrachter(behaelter, seiten, url, basis, { formulare = true } = {}) {
|
||||||
|
const { lib, komponenten } = await pdfjsLaden(basis);
|
||||||
|
const adressen = pdfjsAdressen(basis);
|
||||||
|
const eventBus = new komponenten.EventBus();
|
||||||
|
const linkService = new komponenten.PDFLinkService({ eventBus });
|
||||||
|
const viewer = new komponenten.PDFViewer({
|
||||||
|
container: behaelter,
|
||||||
|
viewer: seiten,
|
||||||
|
eventBus,
|
||||||
|
linkService,
|
||||||
|
// Der Kern der Sache: Formularfelder werden zu echten Eingabefeldern --
|
||||||
|
// wer nicht ausfuellen darf, bekommt die Darstellung aus dem Dokument.
|
||||||
|
annotationMode: formulare
|
||||||
|
? lib.AnnotationMode.ENABLE_FORMS
|
||||||
|
: lib.AnnotationMode.ENABLE,
|
||||||
|
textLayerMode: 1,
|
||||||
|
});
|
||||||
|
linkService.setViewer(viewer);
|
||||||
|
|
||||||
|
const dokument = await lib.getDocument({
|
||||||
|
url,
|
||||||
|
// Ohne die Standardschriften bleibt jede Seite mit Text leer: Helvetica
|
||||||
|
// und Verwandte liegen als Datei im Paket, nicht im Browser.
|
||||||
|
standardFontDataUrl: adressen.schriften,
|
||||||
|
isEvalSupported: false,
|
||||||
|
}).promise;
|
||||||
|
viewer.setDocument(dokument);
|
||||||
|
linkService.setDocument(dokument, null);
|
||||||
|
await new Promise((fertig) => eventBus.on("pagesinit", fertig, { once: true }));
|
||||||
|
// Auf einem iPad ist die Seitenbreite das, was man sehen will.
|
||||||
|
viewer.currentScaleValue = "page-width";
|
||||||
|
|
||||||
|
/* Zwei Finger zoomen auch hier. */
|
||||||
|
let start = null;
|
||||||
|
const abstand = (t) => Math.hypot(t[0].clientX - t[1].clientX, t[0].clientY - t[1].clientY);
|
||||||
|
behaelter.addEventListener(
|
||||||
|
"touchstart",
|
||||||
|
(event) => {
|
||||||
|
if (event.touches.length === 2) start = { d: abstand(event.touches), s: viewer.currentScale };
|
||||||
|
},
|
||||||
|
{ passive: true }
|
||||||
|
);
|
||||||
|
behaelter.addEventListener(
|
||||||
|
"touchmove",
|
||||||
|
(event) => {
|
||||||
|
if (!start || event.touches.length !== 2) return;
|
||||||
|
event.preventDefault();
|
||||||
|
const wert = (start.s * abstand(event.touches)) / start.d;
|
||||||
|
viewer.currentScale = Math.min(MAX_ZOOM, Math.max(0.25, wert));
|
||||||
|
},
|
||||||
|
{ passive: false }
|
||||||
|
);
|
||||||
|
behaelter.addEventListener("touchend", () => {
|
||||||
|
start = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Bildknoepfe: eigene Schaltflaeche darueber, denn Acrobats Aktion
|
||||||
|
("buttonImportIcon") fuehrt kein Browser aus. Gesammelt wird, was beim
|
||||||
|
Speichern in die Datei gestempelt werden soll. */
|
||||||
|
const bilder = new Map();
|
||||||
|
|
||||||
|
const bildknoepfeAufsetzen = async (nurSeite) => {
|
||||||
|
if (!formulare) return;
|
||||||
|
for (let nummer = 1; nummer <= dokument.numPages; nummer++) {
|
||||||
|
if (nurSeite && nummer !== nurSeite) continue;
|
||||||
|
const seite = await dokument.getPage(nummer);
|
||||||
|
const annots = await seite.getAnnotations({ intent: "display" });
|
||||||
|
for (const annot of annots) {
|
||||||
|
const quelltext = (annot.actions?.Action || []).join(" ");
|
||||||
|
if (!quelltext.includes("buttonImportIcon")) continue;
|
||||||
|
const kasten = behaelter.querySelector(
|
||||||
|
`section[data-annotation-id="${annot.id}"]`
|
||||||
|
);
|
||||||
|
if (!kasten || kasten.querySelector("[data-viewer-bildwahl]")) continue;
|
||||||
|
kasten.classList.add("viewer__bildfeld");
|
||||||
|
const knopf = document.createElement("label");
|
||||||
|
knopf.className = "viewer__bildwahl";
|
||||||
|
knopf.setAttribute("data-viewer-bildwahl", "");
|
||||||
|
knopf.innerHTML =
|
||||||
|
'<input type="file" accept="image/*" hidden>' +
|
||||||
|
"<span>Bild einsetzen</span>";
|
||||||
|
const feld = knopf.querySelector("input");
|
||||||
|
feld.addEventListener("change", async () => {
|
||||||
|
const datei = feld.files?.[0];
|
||||||
|
if (!datei) return;
|
||||||
|
try {
|
||||||
|
const foto = await fotoAlsJpeg(datei);
|
||||||
|
bilder.set(annot.id, {
|
||||||
|
seite: nummer,
|
||||||
|
rechteck: annot.rect,
|
||||||
|
feldname: annot.fieldName,
|
||||||
|
foto,
|
||||||
|
});
|
||||||
|
// Als eigenes Bild und nicht als Hintergrund: der Kasten traegt
|
||||||
|
// eine Leinwand von pdf.js (das Aussehen des Knopfes aus dem PDF),
|
||||||
|
// und die liegt ueber jedem Hintergrund.
|
||||||
|
let vorschau = kasten.querySelector("[data-viewer-bildvorschau]");
|
||||||
|
if (!vorschau) {
|
||||||
|
vorschau = document.createElement("img");
|
||||||
|
vorschau.setAttribute("data-viewer-bildvorschau", "");
|
||||||
|
vorschau.alt = "";
|
||||||
|
kasten.append(vorschau);
|
||||||
|
}
|
||||||
|
vorschau.src = foto.vorschau;
|
||||||
|
kasten.classList.add("viewer__bildfeld--belegt");
|
||||||
|
knopf.querySelector("span").textContent = "Anderes Bild";
|
||||||
|
} catch (fehler) {
|
||||||
|
window.tesm.showToast(fehler.message || "Bild nicht lesbar.", "danger");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
kasten.append(knopf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Die Knoepfe koennen erst auf eine gerenderte Anmerkungsebene -- die
|
||||||
|
// entsteht je Seite, wenn sie sichtbar wird.
|
||||||
|
eventBus.on("annotationlayerrendered", (ereignis) => {
|
||||||
|
bildknoepfeAufsetzen(ereignis.pageNumber).catch((fehler) =>
|
||||||
|
console.error("Bildfelder", fehler)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
await bildknoepfeAufsetzen();
|
||||||
|
|
||||||
|
return {
|
||||||
|
hinein: () => {
|
||||||
|
viewer.currentScale = Math.min(MAX_ZOOM, viewer.currentScale * 1.2);
|
||||||
|
},
|
||||||
|
hinaus: () => {
|
||||||
|
viewer.currentScale = Math.max(0.25, viewer.currentScale / 1.2);
|
||||||
|
},
|
||||||
|
anpassen: () => {
|
||||||
|
viewer.currentScaleValue = "page-width";
|
||||||
|
},
|
||||||
|
/** Das ausgefuellte Formular als Bytes.
|
||||||
|
*
|
||||||
|
* pdf.js schreibt die Feldwerte; gewaehlte Fotos kommen danach mit
|
||||||
|
* pdf-lib hinein -- pdf.js kann nichts in ein PDF zeichnen.
|
||||||
|
*/
|
||||||
|
speichern: async (pdflibAdresse, { abschliessen = false } = {}) => {
|
||||||
|
const bytes = await dokument.saveDocument();
|
||||||
|
// Ohne Bild und ohne Abschluss braucht es pdf-lib gar nicht.
|
||||||
|
if (!bilder.size && !abschliessen) return bytes;
|
||||||
|
return nachbearbeiten(bytes, [...bilder.values()], pdflibAdresse, { abschliessen });
|
||||||
|
},
|
||||||
|
/** Wurde ueberhaupt etwas eingetragen? */
|
||||||
|
veraendert: () => {
|
||||||
|
const s = dokument.annotationStorage;
|
||||||
|
return Boolean(s && s.size);
|
||||||
|
},
|
||||||
|
schliessen: () => {
|
||||||
|
viewer.setDocument(null);
|
||||||
|
linkService.setDocument(null);
|
||||||
|
dokument.destroy();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- Zusammenbau ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
export function initFilePreview(wurzel = document) {
|
||||||
|
const rumpf = wurzel.querySelector("[data-viewer]");
|
||||||
|
if (!rumpf) return;
|
||||||
|
// Fusszeile und Titel liegen ausserhalb des Rumpfes -- gesucht wird deshalb
|
||||||
|
// im ganzen Dialog. (Der Speichern-Knopf blieb sonst immer verborgen.)
|
||||||
|
const dialog = rumpf.closest("dialog") || rumpf;
|
||||||
|
|
||||||
|
const stueck = (name) => dialog.querySelector(`[data-viewer-${name}]`);
|
||||||
|
const bildBuehne = stueck("bildbuehne");
|
||||||
|
const bild = stueck("bild");
|
||||||
|
const pdfBehaelter = stueck("pdf");
|
||||||
|
const pdfScroll = stueck("pdfscroll");
|
||||||
|
const pdfSeiten = stueck("pdfseiten");
|
||||||
|
const rahmen = stueck("rahmen");
|
||||||
|
const leiste = stueck("leiste");
|
||||||
|
const hinweis = stueck("hinweis");
|
||||||
|
const speichern = stueck("speichern");
|
||||||
|
const zeile = stueck("speichernzeile");
|
||||||
|
const ordnerFeld = stueck("ordner");
|
||||||
|
const nameFeld = stueck("name");
|
||||||
|
const ersetzenFeld = stueck("ersetzen");
|
||||||
|
const jetzt = stueck("jetzt");
|
||||||
|
const abbrechen = stueck("abbrechen");
|
||||||
|
const modusFeld = stueck("modus");
|
||||||
|
const basis = rumpf.dataset.viewerPdfjs || "";
|
||||||
|
|
||||||
|
// Ein Format, das dieser Browser nicht kann (HEIC ausserhalb von Safari),
|
||||||
|
// soll nicht als leere Flaeche enden.
|
||||||
|
bild.addEventListener("error", () => {
|
||||||
|
if (bildBuehne.hidden || !bild.getAttribute("src")) return;
|
||||||
|
if (hinweis) {
|
||||||
|
hinweis.textContent =
|
||||||
|
"Dieses Bildformat kann Ihr Browser nicht anzeigen -- bitte herunterladen.";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const bilder = bildBetrachter(bildBuehne, bild);
|
||||||
|
bildBuehne.addEventListener("zoom", (event) => {
|
||||||
|
if (!hinweis || bildBuehne.hidden) return;
|
||||||
|
const { zoom, angepasst } = event.detail;
|
||||||
|
hinweis.textContent = angepasst ? "eingepasst" : `${Math.round(zoom * 100)} %`;
|
||||||
|
});
|
||||||
|
let pdf = null;
|
||||||
|
let aktuell = null;
|
||||||
|
|
||||||
|
const zeigen = (art) => {
|
||||||
|
bildBuehne.hidden = art !== "bild";
|
||||||
|
pdfBehaelter.hidden = art !== "pdf";
|
||||||
|
rahmen.hidden = art !== "text";
|
||||||
|
leiste.hidden = art === "text";
|
||||||
|
if (speichern) speichern.hidden = art !== "pdf";
|
||||||
|
};
|
||||||
|
|
||||||
|
const aufraeumen = () => {
|
||||||
|
bild.removeAttribute("src");
|
||||||
|
bilder.zuruecksetzen();
|
||||||
|
rahmen.src = "about:blank";
|
||||||
|
if (pdf) {
|
||||||
|
try {
|
||||||
|
pdf.schliessen();
|
||||||
|
} catch {
|
||||||
|
/* ein halb geladenes Dokument darf beim Schliessen nicht stoeren */
|
||||||
|
}
|
||||||
|
pdf = null;
|
||||||
|
}
|
||||||
|
pdfSeiten.replaceChildren();
|
||||||
|
if (hinweis) hinweis.textContent = "";
|
||||||
|
if (zeile) zeile.hidden = true;
|
||||||
|
aktuell = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const oeffnen = async (ausloeser) => {
|
||||||
|
aufraeumen();
|
||||||
|
const art = ausloeser.dataset.fillKind || "text";
|
||||||
|
const quelle = ausloeser.dataset.fillSrc || "";
|
||||||
|
aktuell = { art, quelle, pfad: ausloeser.dataset.fillPfad || "" };
|
||||||
|
zeigen(art);
|
||||||
|
if (art === "bild") {
|
||||||
|
bild.src = quelle;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (art !== "pdf") {
|
||||||
|
rahmen.src = quelle;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (hinweis) hinweis.textContent = "PDF wird geladen ...";
|
||||||
|
try {
|
||||||
|
pdf = await pdfBetrachter(pdfScroll, pdfSeiten, quelle, basis, {
|
||||||
|
formulare: rumpf.dataset.viewerFormulare === "1",
|
||||||
|
});
|
||||||
|
if (hinweis) hinweis.textContent = "";
|
||||||
|
} catch (fehler) {
|
||||||
|
// Kein weisses Feld: sagen, was los ist, und auf die einfache Anzeige
|
||||||
|
// zurueckfallen. Die kann wenigstens lesen, wenn auch nicht ausfuellen.
|
||||||
|
console.error("pdf.js", fehler);
|
||||||
|
zeigen("text");
|
||||||
|
rahmen.src = quelle;
|
||||||
|
if (hinweis) {
|
||||||
|
// Den Grund mitgeben: auf einem fremden Geraet ist die Meldung des
|
||||||
|
// Browsers die einzige Spur, die man hat.
|
||||||
|
const grund = String(fehler?.message || fehler || "").slice(0, 120);
|
||||||
|
hinweis.textContent =
|
||||||
|
"Die Formularansicht liess sich nicht laden -- es bleibt bei der einfachen Anzeige." +
|
||||||
|
(grund ? ` (${grund})` : "");
|
||||||
|
// Die Leiste traegt den Hinweis. "zeigen('text')" hat sie gerade
|
||||||
|
// verborgen -- ohne diese Zeile blieb der Fehlschlag unsichtbar, und
|
||||||
|
// es sah aus, als koennte die Vorschau einfach keine Formulare.
|
||||||
|
leiste.hidden = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener("click", (event) => {
|
||||||
|
const ausloeser = event.target.closest('[data-dialog-open="file-preview"]');
|
||||||
|
if (ausloeser) {
|
||||||
|
// Der Dialog selbst wird von app.js geoeffnet; hier nur der Inhalt.
|
||||||
|
oeffnen(ausloeser);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const knopf = event.target.closest("[data-viewer-zoom]");
|
||||||
|
if (!knopf) return;
|
||||||
|
event.preventDefault();
|
||||||
|
const betrachter = pdf || bilder;
|
||||||
|
({ ein: betrachter.hinein, aus: betrachter.hinaus, fit: betrachter.anpassen })[
|
||||||
|
knopf.dataset.viewerZoom
|
||||||
|
]?.();
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.addEventListener("close", aufraeumen);
|
||||||
|
|
||||||
|
/* Ausgefuelltes Formular zurueck in die Freigabe -- erst fragen, wohin. */
|
||||||
|
|
||||||
|
const vorschlagen = () => {
|
||||||
|
if (!aktuell) return;
|
||||||
|
const teile = aktuell.pfad.split("/");
|
||||||
|
const datei = teile.pop() || "formular.pdf";
|
||||||
|
ordnerFeld.value = teile.join("/");
|
||||||
|
// Ohne Endung: die haengt der Server an. Eine Datei, die auf ".pdf.txt"
|
||||||
|
// oder auf gar nichts endet, oeffnet auf einer Freigabe nichts mehr.
|
||||||
|
// Der Zusatz haelt die Vorlage heil, auch wenn jemand blind speichert.
|
||||||
|
nameFeld.value = datei.replace(/\.pdf$/i, "") + "-ausgefuellt";
|
||||||
|
ersetzenFeld.checked = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
speichern?.addEventListener("click", () => {
|
||||||
|
if (!pdf || !aktuell) return;
|
||||||
|
vorschlagen();
|
||||||
|
zeile.hidden = false;
|
||||||
|
nameFeld.focus();
|
||||||
|
nameFeld.select();
|
||||||
|
});
|
||||||
|
|
||||||
|
abbrechen?.addEventListener("click", () => {
|
||||||
|
zeile.hidden = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
jetzt?.addEventListener("click", async () => {
|
||||||
|
if (!pdf || !aktuell) return;
|
||||||
|
const ziel = speichern.dataset.url;
|
||||||
|
jetzt.disabled = true;
|
||||||
|
const vorher = jetzt.textContent;
|
||||||
|
jetzt.textContent = "Speichern ...";
|
||||||
|
try {
|
||||||
|
const bytes = await pdf.speichern(rumpf.dataset.viewerPdflib || "", {
|
||||||
|
abschliessen: modusFeld?.value === "fertig",
|
||||||
|
});
|
||||||
|
const daten = new FormData();
|
||||||
|
daten.append("path", aktuell.pfad);
|
||||||
|
daten.append("ordner", ordnerFeld.value.trim());
|
||||||
|
daten.append("name", nameFeld.value.trim());
|
||||||
|
if (ersetzenFeld.checked) daten.append("ersetzen", "1");
|
||||||
|
daten.append(
|
||||||
|
"datei",
|
||||||
|
new Blob([bytes], { type: "application/pdf" }),
|
||||||
|
`${nameFeld.value.trim() || "formular"}.pdf`
|
||||||
|
);
|
||||||
|
const antwort = await window.tesm.api(ziel, { method: "POST", body: daten });
|
||||||
|
window.tesm.showToast(antwort.message || "Gespeichert.", "success");
|
||||||
|
dialog.close();
|
||||||
|
window.location.reload();
|
||||||
|
} catch (fehler) {
|
||||||
|
// Die Meldung fuer den Benutzer, die Einzelheiten fuer die Konsole. Die
|
||||||
|
// Zeile bleibt offen: meist ist es ein Name, der schon vergeben ist.
|
||||||
|
console.error("Formular speichern", fehler);
|
||||||
|
window.tesm.showToast(fehler.message || "Speichern fehlgeschlagen.", "danger");
|
||||||
|
} finally {
|
||||||
|
jetzt.disabled = false;
|
||||||
|
jetzt.textContent = vorher;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
pdf.js 4.10.38 -- https://github.com/mozilla/pdf.js
|
||||||
|
Aus dem npm-Paket pdfjs-dist; nur build/pdf.min.mjs, build/pdf.worker.min.mjs,
|
||||||
|
web/pdf_viewer.mjs, web/pdf_viewer.css, web/images und standard_fonts.
|
||||||
|
Apache-2.0, siehe LICENSE.
|
||||||
|
|
||||||
|
Die drei Skriptdateien sind von .mjs auf .js umbenannt: die mime.types von
|
||||||
|
nginx kennen .mjs nicht, und mit application/octet-stream lehnt jeder Browser
|
||||||
|
ein Modul ab. Der Inhalt ist unveraendert.
|
||||||
|
|
||||||
|
Warum eingebettet und nicht von einem CDN: TESM laeuft in abgeschotteten
|
||||||
|
Netzen. Was die Oberflaeche braucht, muss im Paket liegen.
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
4.10.38
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="12" height="13" viewBox="0 0 12 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M5.375 7.625V11.875C5.375 12.0408 5.44085 12.1997 5.55806 12.3169C5.67527 12.4342 5.83424 12.5 6 12.5C6.16576 12.5 6.32473 12.4342 6.44194 12.3169C6.55915 12.1997 6.625 12.0408 6.625 11.875V7.625L7.125 7.125H11.375C11.5408 7.125 11.6997 7.05915 11.8169 6.94194C11.9342 6.82473 12 6.66576 12 6.5C12 6.33424 11.9342 6.17527 11.8169 6.05806C11.6997 5.94085 11.5408 5.875 11.375 5.875H7.125L6.625 5.375V1.125C6.625 0.95924 6.55915 0.800269 6.44194 0.683058C6.32473 0.565848 6.16576 0.5 6 0.5C5.83424 0.5 5.67527 0.565848 5.55806 0.683058C5.44085 0.800269 5.375 0.95924 5.375 1.125V5.375L4.875 5.875H0.625C0.45924 5.875 0.300269 5.94085 0.183058 6.05806C0.065848 6.17527 0 6.33424 0 6.5C0 6.66576 0.065848 6.82473 0.183058 6.94194C0.300269 7.05915 0.45924 7.125 0.625 7.125H4.762L5.375 7.625Z" fill="black"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 920 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.49073 1.3015L3.30873 2.1505C3.29349 2.22246 3.25769 2.28844 3.20568 2.34045C3.15368 2.39246 3.08769 2.42826 3.01573 2.4435L2.16673 2.6255C1.76473 2.7125 1.76473 3.2865 2.16673 3.3725L3.01573 3.5555C3.08769 3.57074 3.15368 3.60654 3.20568 3.65855C3.25769 3.71056 3.29349 3.77654 3.30873 3.8485L3.49073 4.6975C3.57773 5.0995 4.15173 5.0995 4.23773 4.6975L4.42073 3.8485C4.43598 3.77654 4.47177 3.71056 4.52378 3.65855C4.57579 3.60654 4.64178 3.57074 4.71373 3.5555L5.56173 3.3725C5.96373 3.2855 5.96373 2.7115 5.56173 2.6255L4.71273 2.4435C4.64083 2.42814 4.57491 2.3923 4.52292 2.34031C4.47093 2.28832 4.43509 2.2224 4.41973 2.1505L4.23773 1.3015C4.15073 0.8995 3.57673 0.8995 3.49073 1.3015ZM10.8647 13.9995C10.4853 14.0056 10.1158 13.8782 9.82067 13.6397C9.52553 13.4013 9.32347 13.0667 9.24973 12.6945L8.89273 11.0275C8.83676 10.7687 8.70738 10.5316 8.52009 10.3445C8.3328 10.1574 8.09554 10.0282 7.83673 9.9725L6.16973 9.6155C5.38873 9.4465 4.86473 8.7975 4.86473 7.9995C4.86473 7.2015 5.38873 6.5525 6.16973 6.3845L7.83673 6.0275C8.09551 5.97135 8.33267 5.84193 8.51992 5.65468C8.70716 5.46744 8.83658 5.23028 8.89273 4.9715L9.25073 3.3045C9.41773 2.5235 10.0667 1.9995 10.8647 1.9995C11.6627 1.9995 12.3117 2.5235 12.4797 3.3045L12.8367 4.9715C12.9507 5.4995 13.3647 5.9135 13.8927 6.0265L15.5597 6.3835C16.3407 6.5525 16.8647 7.2015 16.8647 7.9995C16.8647 8.7975 16.3407 9.4465 15.5597 9.6145L13.8927 9.9715C13.6337 10.0275 13.3963 10.157 13.209 10.3445C13.0217 10.5319 12.8925 10.7694 12.8367 11.0285L12.4787 12.6945C12.4054 13.0667 12.2036 13.4014 11.9086 13.6399C11.6135 13.8784 11.2441 14.0057 10.8647 13.9995ZM10.8647 3.2495C10.7667 3.2495 10.5337 3.2795 10.4727 3.5655L10.1147 5.2335C10.0081 5.72777 9.76116 6.18082 9.40361 6.53837C9.04606 6.89593 8.59301 7.14283 8.09873 7.2495L6.43173 7.6065C6.14573 7.6685 6.11473 7.9015 6.11473 7.9995C6.11473 8.0975 6.14573 8.3305 6.43173 8.3925L8.09873 8.7495C8.59301 8.85617 9.04606 9.10307 9.40361 9.46062C9.76116 9.81817 10.0081 10.2712 10.1147 10.7655L10.4727 12.4335C10.5337 12.7195 10.7667 12.7495 10.8647 12.7495C10.9627 12.7495 11.1957 12.7195 11.2567 12.4335L11.6147 10.7665C11.7212 10.272 11.9681 9.81878 12.3256 9.46103C12.6832 9.10329 13.1363 8.85624 13.6307 8.7495L15.2977 8.3925C15.5837 8.3305 15.6147 8.0975 15.6147 7.9995C15.6147 7.9015 15.5837 7.6685 15.2977 7.6065L13.6307 7.2495C13.1365 7.14283 12.6834 6.89593 12.3259 6.53837C11.9683 6.18082 11.7214 5.72777 11.6147 5.2335L11.2567 3.5655C11.1957 3.2795 10.9627 3.2495 10.8647 3.2495ZM3.30873 12.1505L3.49073 11.3015C3.57673 10.8995 4.15073 10.8995 4.23773 11.3015L4.41973 12.1505C4.43509 12.2224 4.47093 12.2883 4.52292 12.3403C4.57491 12.3923 4.64083 12.4281 4.71273 12.4435L5.56173 12.6255C5.96373 12.7115 5.96373 13.2855 5.56173 13.3725L4.71273 13.5545C4.64083 13.5699 4.57491 13.6057 4.52292 13.6577C4.47093 13.7097 4.43509 13.7756 4.41973 13.8475L4.23773 14.6965C4.15173 15.0985 3.57773 15.0985 3.49073 14.6965L3.30873 13.8475C3.29337 13.7756 3.25754 13.7097 3.20555 13.6577C3.15356 13.6057 3.08764 13.5699 3.01573 13.5545L2.16673 13.3725C1.76473 13.2865 1.76473 12.7125 2.16673 12.6255L3.01573 12.4435C3.08769 12.4283 3.15368 12.3925 3.20568 12.3405C3.25769 12.2884 3.29349 12.2225 3.30873 12.1505Z" fill="black"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="12" height="13" viewBox="0 0 12 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M6 0.5C5.21207 0.5 4.43185 0.655195 3.7039 0.956723C2.97595 1.25825 2.31451 1.70021 1.75736 2.25736C1.20021 2.81451 0.758251 3.47595 0.456723 4.2039C0.155195 4.93185 0 5.71207 0 6.5C0 7.28793 0.155195 8.06815 0.456723 8.7961C0.758251 9.52405 1.20021 10.1855 1.75736 10.7426C2.31451 11.2998 2.97595 11.7417 3.7039 12.0433C4.43185 12.3448 5.21207 12.5 6 12.5C7.5913 12.5 9.11742 11.8679 10.2426 10.7426C11.3679 9.61742 12 8.0913 12 6.5C12 4.9087 11.3679 3.38258 10.2426 2.25736C9.11742 1.13214 7.5913 0.5 6 0.5ZM5.06 8.9L2.9464 6.7856C2.85273 6.69171 2.80018 6.56446 2.80033 6.43183C2.80048 6.29921 2.85331 6.17207 2.9472 6.0784C3.04109 5.98473 3.16834 5.93218 3.30097 5.93233C3.43359 5.93248 3.56073 5.98531 3.6544 6.0792L5.3112 7.7368L8.3464 4.7008C8.44109 4.6109 8.56715 4.56153 8.69771 4.56322C8.82827 4.56492 8.95301 4.61754 9.04534 4.70986C9.13766 4.80219 9.19028 4.92693 9.19198 5.05749C9.19367 5.18805 9.1443 5.31411 9.0544 5.4088L5.5624 8.9H5.06Z" fill="#FBFBFE"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,30 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
|
||||||
|
<style>
|
||||||
|
@media not (prefers-reduced-motion) {
|
||||||
|
@keyframes loadingRotate {
|
||||||
|
from { rotate: 0; } to { rotate: 360deg }
|
||||||
|
}
|
||||||
|
#circle-arrows {
|
||||||
|
animation: loadingRotate 1.8s linear infinite;
|
||||||
|
transform-origin: 50% 50%;
|
||||||
|
}
|
||||||
|
#hourglass {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion) {
|
||||||
|
#circle-arrows {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<path id="circle-arrows" d="M9 5.528c0 .42.508.63.804.333l2.528-2.528a.47.47 0 0 0 0-.666L9.805.14A.471.471 0 0 0 9 .472v1.866A5.756 5.756 0 0 0 2.25 8c0 .942.232 1.83.635 2.615l1.143-1.143A4.208 4.208 0 0 1 3.75 8 4.254 4.254 0 0 1 8 3.75c.345 0 .68.042 1 .122v1.656zM7 10.472v1.656c.32.08.655.122 1 .122A4.254 4.254 0 0 0 12.25 8c0-.52-.107-1.013-.279-1.474l1.143-1.143c.404.786.636 1.674.636 2.617A5.756 5.756 0 0 1 7 13.662v1.866a.47.47 0 0 1-.804.333l-2.528-2.528a.47.47 0 0 1 0-.666l2.528-2.528a.47.47 0 0 1 .804.333z"/>
|
||||||
|
<g id="hourglass">
|
||||||
|
<path d="M13,1 C13.5522847,1 14,1.44771525 14,2 C14,2.55228475 13.5522847,3 13,3 L12.9854217,2.99990801 C12.9950817,3.16495885 13,3.33173274 13,3.5 C13,5.24679885 10.9877318,6.01090495 10.9877318,8.0017538 C10.9877318,9.99260264 13,10.7536922 13,12.5 C13,12.6686079 12.9950617,12.8357163 12.985363,13.0010943 L13,13 C13.5522847,13 14,13.4477153 14,14 C14,14.5522847 13.5522847,15 13,15 L3,15 C2.44771525,15 2,14.5522847 2,14 C2,13.4477153 2.44771525,13 3,13 L3.01463704,13.0010943 C3.00493827,12.8357163 3,12.6686079 3,12.5 C3,10.7536922 4.9877318,9.99260264 5,8.0017538 C5.0122682,6.01090495 3,5.24679885 3,3.5 C3,3.33173274 3.00491834,3.16495885 3.01457832,2.99990801 L3,3 C2.44771525,3 2,2.55228475 2,2 C2,1.44771525 2.44771525,1 3,1 L13,1 Z M10.987,3 L5.012,3 L5.00308914,3.24815712 C5.00103707,3.33163368 5,3.4155948 5,3.5 C5,5.36125069 6.99153646,6.01774089 6.99153646,8.0017538 C6.99153646,9.98576671 5,10.6393737 5,12.5 L5.00307746,12.7513676 L5.01222201,12.9998392 L5.60191711,12.9988344 L6.0425138,12.2959826 C7.02362731,10.7653275 7.67612271,10 8,10 C8.37014547,10 9.16950644,10.9996115 10.3980829,12.9988344 L10.987778,12.9998392 C10.9958674,12.8352104 11,12.66849 11,12.5 C11,10.6393737 8.98689779,10.0147381 8.98689779,8.0017538 C8.98689779,5.98876953 11,5.36125069 11,3.5 L10.9969109,3.24815712 L10.987,3 Z"/>
|
||||||
|
<path d="M6,4 L10,4 C8.95166016,6 8.28499349,7 8,7 C7.71500651,7 7.04833984,6 6,4 Z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.78182 2.63903C8.58882 2.28803 8.25782 2.25003 8.12482 2.25003C7.99019 2.24847 7.85771 2.28393 7.74185 2.35253C7.62599 2.42113 7.5312 2.52023 7.46782 2.63903L1.97082 12.639C1.90673 12.7528 1.87406 12.8816 1.87617 13.0122C1.87828 13.1427 1.91509 13.2704 1.98282 13.382C2.04798 13.4951 2.14207 13.5888 2.25543 13.6535C2.36879 13.7182 2.49732 13.7515 2.62782 13.75H13.6218C13.7523 13.7515 13.8809 13.7182 13.9942 13.6535C14.1076 13.5888 14.2017 13.4951 14.2668 13.382C14.3346 13.2704 14.3714 13.1427 14.3735 13.0122C14.3756 12.8816 14.3429 12.7528 14.2788 12.639L8.78182 2.63903ZM6.37282 2.03703C6.75182 1.34603 7.43882 1.00003 8.12482 1.00003C8.48341 0.997985 8.83583 1.09326 9.14454 1.2757C9.45325 1.45814 9.70668 1.72092 9.87782 2.03603L15.3748 12.036C16.1078 13.369 15.1438 15 13.6228 15H2.62782C1.10682 15 0.141823 13.37 0.875823 12.037L6.37282 2.03703ZM8.74982 9.06203C8.74982 9.22779 8.68397 9.38676 8.56676 9.50397C8.44955 9.62118 8.29058 9.68703 8.12482 9.68703C7.95906 9.68703 7.80009 9.62118 7.68288 9.50397C7.56566 9.38676 7.49982 9.22779 7.49982 9.06203V5.62503C7.49982 5.45927 7.56566 5.3003 7.68288 5.18309C7.80009 5.06588 7.95906 5.00003 8.12482 5.00003C8.29058 5.00003 8.44955 5.06588 8.56676 5.18309C8.68397 5.3003 8.74982 5.45927 8.74982 5.62503V9.06203ZM7.74982 12L7.49982 11.75V11L7.74982 10.75H8.49982L8.74982 11V11.75L8.49982 12H7.74982Z" fill="black"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<path
|
||||||
|
d="M 1.5006714,23.536225 6.8925879,18.994244 14.585721,26.037937 34.019683,4.5410479 38.499329,9.2235032 14.585721,35.458952 z"
|
||||||
|
id="path4"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;stroke:#000000;stroke-width:1.25402856;stroke-opacity:1" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 415 B |
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
height="40"
|
||||||
|
width="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<rect
|
||||||
|
style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
width="33.76017"
|
||||||
|
height="33.76017"
|
||||||
|
x="3.119915"
|
||||||
|
y="3.119915" />
|
||||||
|
<path
|
||||||
|
d="m 20.677967,8.54499 c -7.342801,0 -13.295293,4.954293 -13.295293,11.065751 0,2.088793 0.3647173,3.484376 1.575539,5.150563 L 6.0267418,31.45501 13.560595,29.011117 c 2.221262,1.387962 4.125932,1.665377 7.117372,1.665377 7.3428,0 13.295291,-4.954295 13.295291,-11.065753 0,-6.111458 -5.952491,-11.065751 -13.295291,-11.065751 z"
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.93031836;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 883 B |
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<g
|
||||||
|
transform="translate(0,-60)"
|
||||||
|
id="layer1">
|
||||||
|
<rect
|
||||||
|
width="36.460953"
|
||||||
|
height="34.805603"
|
||||||
|
x="1.7695236"
|
||||||
|
y="62.597198"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.30826771;stroke-opacity:1" />
|
||||||
|
<g
|
||||||
|
transform="matrix(0.88763677,0,0,0.88763677,2.2472646,8.9890584)">
|
||||||
|
<path
|
||||||
|
d="M 20,64.526342 C 11.454135,64.526342 4.5263421,71.454135 4.5263421,80 4.5263421,88.545865 11.454135,95.473658 20,95.473658 28.545865,95.473658 35.473658,88.545865 35.473658,80 35.473658,71.454135 28.545865,64.526342 20,64.526342 z m -0.408738,9.488564 c 3.527079,0 6.393832,2.84061 6.393832,6.335441 0,3.494831 -2.866753,6.335441 -6.393832,6.335441 -3.527079,0 -6.393832,-2.84061 -6.393832,-6.335441 0,-3.494831 2.866753,-6.335441 6.393832,-6.335441 z"
|
||||||
|
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.02768445;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
<path
|
||||||
|
d="m 7.2335209,71.819938 4.9702591,4.161823 c -1.679956,2.581606 -1.443939,6.069592 0.159325,8.677725 l -5.1263071,3.424463 c 0.67516,1.231452 3.0166401,3.547686 4.2331971,4.194757 l 3.907728,-4.567277 c 2.541952,1.45975 5.730694,1.392161 8.438683,-0.12614 l 3.469517,6.108336 c 1.129779,-0.44367 4.742234,-3.449633 5.416358,-5.003859 l -5.46204,-4.415541 c 1.44319,-2.424098 1.651175,-5.267515 0.557303,-7.748623 l 5.903195,-3.833951 C 33.14257,71.704996 30.616217,69.018606 29.02952,67.99296 l -4.118813,4.981678 C 22.411934,71.205099 18.900853,70.937534 16.041319,72.32916 l -3.595408,-5.322091 c -1.345962,0.579488 -4.1293881,2.921233 -5.2123901,4.812869 z m 8.1010311,3.426672 c 2.75284,-2.446266 6.769149,-2.144694 9.048998,0.420874 2.279848,2.56557 2.113919,6.596919 -0.638924,9.043185 -2.752841,2.446267 -6.775754,2.13726 -9.055604,-0.428308 -2.279851,-2.565568 -2.107313,-6.589485 0.64553,-9.035751 z"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64">
|
||||||
|
<path
|
||||||
|
d="M 32.003143,1.4044602 57.432701,62.632577 6.5672991,62.627924 z"
|
||||||
|
style="fill:#ffff00;fill-opacity:0.94117647;fill-rule:nonzero;stroke:#000000;stroke-width:1.00493038;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 408 B |
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64">
|
||||||
|
<path
|
||||||
|
d="M 25.470843,9.4933766 C 25.30219,12.141818 30.139101,14.445969 34.704831,13.529144 40.62635,12.541995 41.398833,7.3856498 35.97505,5.777863 31.400921,4.1549155 25.157674,6.5445892 25.470843,9.4933766 z M 4.5246282,17.652051 C 4.068249,11.832873 9.2742983,5.9270407 18.437379,3.0977088 29.751911,-0.87185184 45.495663,1.4008022 53.603953,7.1104009 c 9.275765,6.1889221 7.158128,16.2079421 -3.171076,21.5939521 -1.784316,1.635815 -6.380222,1.21421 -7.068351,3.186186 -1.04003,0.972427 -1.288046,2.050158 -1.232864,3.168203 1.015111,2.000108 -3.831548,1.633216 -3.270553,3.759574 0.589477,5.264544 -0.179276,10.53738 -0.362842,15.806257 -0.492006,2.184998 1.163456,4.574232 -0.734888,6.610642 -2.482919,2.325184 -7.30604,2.189143 -9.193497,-0.274767 -2.733688,-1.740626 -8.254447,-3.615254 -6.104247,-6.339626 3.468112,-1.708686 -2.116197,-3.449897 0.431242,-5.080274 5.058402,-1.39256 -2.393215,-2.304318 -0.146889,-4.334645 3.069198,-0.977415 2.056986,-2.518352 -0.219121,-3.540397 1.876567,-1.807151 1.484149,-4.868919 -2.565455,-5.942205 0.150866,-1.805474 2.905737,-4.136876 -1.679967,-5.20493 C 10.260902,27.882167 4.6872697,22.95045 4.5245945,17.652051 z"
|
||||||
|
id="path604"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;stroke:#000000;stroke-width:1.72665179;stroke-opacity:1" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64">
|
||||||
|
<path
|
||||||
|
d="M 32.003143,10.913072 57.432701,53.086929 6.567299,53.083723 z"
|
||||||
|
id="path2985"
|
||||||
|
style="fill:#ffff00;fill-opacity:0.94117647;fill-rule:nonzero;stroke:#000000;stroke-width:0.83403099;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 426 B |
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 158 B |
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<rect
|
||||||
|
width="36.075428"
|
||||||
|
height="31.096582"
|
||||||
|
x="1.962286"
|
||||||
|
y="4.4517088"
|
||||||
|
id="rect4"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.23004246;stroke-opacity:1" />
|
||||||
|
<rect
|
||||||
|
width="27.96859"
|
||||||
|
height="1.5012145"
|
||||||
|
x="6.0157046"
|
||||||
|
y="10.285"
|
||||||
|
id="rect6"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
<rect
|
||||||
|
width="27.96859"
|
||||||
|
height="0.85783684"
|
||||||
|
x="6.0157056"
|
||||||
|
y="23.21689"
|
||||||
|
id="rect8"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
<rect
|
||||||
|
width="27.96859"
|
||||||
|
height="0.85783684"
|
||||||
|
x="5.8130345"
|
||||||
|
y="28.964394"
|
||||||
|
id="rect10"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
<rect
|
||||||
|
width="27.96859"
|
||||||
|
height="0.85783684"
|
||||||
|
x="6.0157046"
|
||||||
|
y="17.426493"
|
||||||
|
id="rect12"
|
||||||
|
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,6 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="40" width="40">
|
||||||
|
<path d="M9 3.5a1.5 1.5 0 0 0-3-.001v7.95C6 12.83 7.12 14 8.5 14s2.5-1.17 2.5-2.55V5.5a.5.5 0 0 1 1 0v6.03C11.955 13.427 10.405 15 8.5 15S5.044 13.426 5 11.53V3.5a2.5 2.5 0 0 1 5 0v7.003a1.5 1.5 0 0 1-3-.003v-5a.5.5 0 0 1 1 0v5a.5.5 0 0 0 1 0Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 552 B |
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="40"
|
||||||
|
height="40"
|
||||||
|
viewBox="0 0 40 40">
|
||||||
|
<rect
|
||||||
|
width="33.76017"
|
||||||
|
height="33.76017"
|
||||||
|
x="3.119915"
|
||||||
|
y="3.119915"
|
||||||
|
style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
<path
|
||||||
|
d="m 17.692678,34.50206 0,-16.182224 c -1.930515,-0.103225 -3.455824,-0.730383 -4.57593,-1.881473 -1.12011,-1.151067 -1.680164,-2.619596 -1.680164,-4.405591 0,-1.992435 0.621995,-3.5796849 1.865988,-4.7617553 1.243989,-1.1820288 3.06352,-1.7730536 5.458598,-1.7730764 l 9.802246,0 0,2.6789711 -2.229895,0 0,26.3251486 -2.632515,0 0,-26.3251486 -3.45324,0 0,26.3251486 z"
|
||||||
|
style="font-size:29.42051125px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.07795751;stroke-opacity:1;font-family:Arial;-inkscape-font-specification:Arial" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,7 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="40" width="40">
|
||||||
|
<path d="M8.156 12.5a.99.99 0 0 0 .707-.294l.523-2.574L10.5 8.499l1.058-1.04 2.65-.601a.996.996 0 0 0 0-1.414l-3.657-3.658a.996.996 0 0 0-1.414 0l-.523 2.576L7.5 5.499 6.442 6.535l-2.65.6a.996.996 0 0 0 0 1.413l3.657 3.658a.999.999 0 0 0 .707.295z"/>
|
||||||
|
<path d="M9.842.996c-.386 0-.77.146-1.06.44a.5.5 0 0 0-.136.251l-.492 2.43-1.008 1.03-.953.933-2.511.566a.5.5 0 0 0-.243.133 1.505 1.505 0 0 0-.002 2.123l1.477 1.477-2.768 2.767a.5.5 0 0 0 0 .707.5.5 0 0 0 .708 0l2.767-2.767 1.475 1.474a1.494 1.494 0 0 0 2.123-.002.5.5 0 0 0 .135-.254l.492-2.427 1.008-1.024.953-.937 2.511-.57a.5.5 0 0 0 .243-.132c.586-.58.583-1.543.002-2.125l-3.659-3.656A1.501 1.501 0 0 0 9.842.996Zm.05 1.025a.394.394 0 0 1 .305.12l3.658 3.657c.18.18.141.432.002.627l-2.41.545a.5.5 0 0 0-.24.131L10.15 8.142a.5.5 0 0 0-.007.006L9.029 9.283a.5.5 0 0 0-.133.25l-.48 2.36c-.082.053-.165.109-.26.109a.492.492 0 0 1-.353-.149L4.145 8.195c-.18-.18-.141-.432-.002-.627l2.41-.545a.5.5 0 0 0 .238-.13L7.85 5.857a.5.5 0 0 0 .007-.008l1.114-1.138a.5.5 0 0 0 .133-.25l.472-2.323a.619.619 0 0 1 .317-.117Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg width="18" height="19" viewBox="0 0 18 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.2 3.09C12.28 3.01 12.43 3 12.43 3C12.48 3 12.58 3.02 12.66 3.1L14.45 4.89C14.58 5.02 14.58 5.22 14.45 5.35L11.7713 8.02872L9.51628 5.77372L12.2 3.09ZM13.2658 5.12L11.7713 6.6145L10.9305 5.77372L12.425 4.27921L13.2658 5.12Z" fill="#FBFBFE"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.98 9.32L8.23 11.57L10.7106 9.08938L8.45562 6.83438L5.98 9.31V9.32ZM8.23 10.1558L9.29641 9.08938L8.45562 8.24859L7.38921 9.315L8.23 10.1558Z" fill="#FBFBFE"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.1526 13.1816L16.2125 7.1217C16.7576 6.58919 17.05 5.8707 17.05 5.12C17.05 4.36931 16.7576 3.65084 16.2126 3.11834L14.4317 1.33747C13.8992 0.79242 13.1807 0.5 12.43 0.5C11.6643 0.5 10.9529 0.812929 10.4329 1.33289L3.68289 8.08289C3.04127 8.72452 3.00459 9.75075 3.57288 10.4363L1.29187 12.7239C1.09186 12.9245 0.990263 13.1957 1.0007 13.4685L1 14.5C0.447715 14.5 0 14.9477 0 15.5V17.5C0 18.0523 0.447715 18.5 1 18.5H16C16.5523 18.5 17 18.0523 17 17.5V15.5C17 14.9477 16.5523 14.5 16 14.5H10.2325C9.83594 14.5 9.39953 13.9347 10.1526 13.1816ZM4.39 9.85L4.9807 10.4407L2.39762 13.0312H6.63877L7.10501 12.565L7.57125 13.0312H8.88875L15.51 6.41C15.86 6.07 16.05 5.61 16.05 5.12C16.05 4.63 15.86 4.17 15.51 3.83L13.72 2.04C13.38 1.69 12.92 1.5 12.43 1.5C11.94 1.5 11.48 1.7 11.14 2.04L4.39 8.79C4.1 9.08 4.1 9.56 4.39 9.85ZM16 17.5V15.5H1V17.5H16Z" fill="#FBFBFE"/>
|
||||||
|
<path d="M15.1616 6.05136L15.1616 6.05132L15.1564 6.05645L8.40645 12.8064C8.35915 12.8537 8.29589 12.88 8.23 12.88C8.16411 12.88 8.10085 12.8537 8.05355 12.8064L7.45857 12.2115L7.10501 11.8579L6.75146 12.2115L6.03289 12.93H3.20465L5.33477 10.7937L5.6873 10.4402L5.33426 10.0871L4.74355 9.49645C4.64882 9.40171 4.64882 9.23829 4.74355 9.14355L11.4936 2.39355C11.7436 2.14354 12.0779 2 12.43 2C12.7883 2 13.1179 2.13776 13.3614 2.38839L13.3613 2.38843L13.3664 2.39355L15.1564 4.18355L15.1564 4.18359L15.1616 4.18864C15.4122 4.43211 15.55 4.76166 15.55 5.12C15.55 5.47834 15.4122 5.80789 15.1616 6.05136ZM7.87645 11.9236L8.23 12.2771L8.58355 11.9236L11.0642 9.44293L11.4177 9.08938L11.0642 8.73582L8.80918 6.48082L8.45562 6.12727L8.10207 6.48082L5.62645 8.95645L5.48 9.10289V9.31V9.32V9.52711L5.62645 9.67355L7.87645 11.9236ZM11.4177 8.38227L11.7713 8.73582L12.1248 8.38227L14.8036 5.70355C15.1288 5.37829 15.1288 4.86171 14.8036 4.53645L13.0136 2.74645C12.8186 2.55146 12.5792 2.5 12.43 2.5H12.4134L12.3967 2.50111L12.43 3C12.3967 2.50111 12.3966 2.50112 12.3965 2.50112L12.3963 2.50114L12.3957 2.50117L12.3947 2.50125L12.3924 2.50142L12.387 2.50184L12.3732 2.50311C12.3628 2.50416 12.3498 2.50567 12.3346 2.50784C12.3049 2.51208 12.2642 2.51925 12.2178 2.53146C12.1396 2.55202 11.9797 2.60317 11.8464 2.73645L9.16273 5.42016L8.80918 5.77372L9.16273 6.12727L11.4177 8.38227ZM1.5 16H15.5V17H1.5V16Z" stroke="#15141A"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2.75H12.5V2.25V1V0.5H12H10.358C9.91165 0.5 9.47731 0.625661 9.09989 0.860442L9.09886 0.861087L8 1.54837L6.89997 0.860979L6.89911 0.860443C6.5218 0.625734 6.08748 0.5 5.642 0.5H4H3.5V1V2.25V2.75H4H5.642C5.66478 2.75 5.6885 2.75641 5.71008 2.76968C5.71023 2.76977 5.71038 2.76986 5.71053 2.76995L6.817 3.461C6.81704 3.46103 6.81709 3.46105 6.81713 3.46108C6.81713 3.46108 6.81713 3.46108 6.81714 3.46109C6.8552 3.48494 6.876 3.52285 6.876 3.567V8V12.433C6.876 12.4771 6.85523 12.515 6.81722 12.5389C6.81715 12.5389 6.81707 12.539 6.817 12.539L5.70953 13.23C5.70941 13.2301 5.70929 13.2302 5.70917 13.2303C5.68723 13.2438 5.6644 13.25 5.641 13.25H4H3.5V13.75V15V15.5H4H5.642C6.08835 15.5 6.52269 15.3743 6.90011 15.1396L6.90086 15.1391L8 14.4526L9.10003 15.14L9.10089 15.1406C9.47831 15.3753 9.91265 15.501 10.359 15.501H12H12.5V15.001V13.751V13.251H12H10.358C10.3352 13.251 10.3115 13.2446 10.2899 13.2313C10.2897 13.2312 10.2896 13.2311 10.2895 13.231L9.183 12.54C9.18298 12.54 9.18295 12.54 9.18293 12.54C9.18291 12.5399 9.18288 12.5399 9.18286 12.5399C9.14615 12.5169 9.125 12.4797 9.125 12.434V8V3.567C9.125 3.52266 9.14603 3.48441 9.18364 3.4606C9.18377 3.46052 9.1839 3.46043 9.18404 3.46035L10.2895 2.76995C10.2896 2.76985 10.2898 2.76975 10.2899 2.76966C10.3119 2.75619 10.3346 2.75 10.358 2.75H12Z" fill="black" stroke="white"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M0.0189877 13.6645L0.612989 10.4635C0.687989 10.0545 0.884989 9.6805 1.18099 9.3825L9.98199 0.5805C10.756 -0.1925 12.015 -0.1945 12.792 0.5805L14.42 2.2085C15.194 2.9835 15.194 4.2435 14.42 5.0185L5.61599 13.8215C5.31999 14.1165 4.94599 14.3125 4.53799 14.3875L1.33599 14.9815C1.26599 14.9935 1.19799 15.0005 1.12999 15.0005C0.832989 15.0005 0.544988 14.8835 0.330988 14.6695C0.0679874 14.4055 -0.0490122 14.0305 0.0189877 13.6645Z" fill="white"/>
|
||||||
|
<path d="M0.0189877 13.6645L0.612989 10.4635C0.687989 10.0545 0.884989 9.6805 1.18099 9.3825L9.98199 0.5805C10.756 -0.1925 12.015 -0.1945 12.792 0.5805L14.42 2.2085C15.194 2.9835 15.194 4.2435 14.42 5.0185L5.61599 13.8215C5.31999 14.1165 4.94599 14.3125 4.53799 14.3875L1.33599 14.9815C1.26599 14.9935 1.19799 15.0005 1.12999 15.0005C0.832989 15.0005 0.544988 14.8835 0.330988 14.6695C0.0679874 14.4055 -0.0490122 14.0305 0.0189877 13.6645ZM12.472 5.1965L13.632 4.0365L13.631 3.1885L11.811 1.3675L10.963 1.3685L9.80299 2.5285L12.472 5.1965ZM4.31099 13.1585C4.47099 13.1285 4.61799 13.0515 4.73399 12.9345L11.587 6.0815L8.91899 3.4135L2.06599 10.2655C1.94899 10.3835 1.87199 10.5305 1.84099 10.6915L1.36699 13.2485L1.75199 13.6335L4.31099 13.1585Z" fill="black"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,8 @@
|
|||||||
|
<svg width="29" height="32" viewBox="0 0 29 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M28 16.75C28.2761 16.75 28.5 16.5261 28.5 16.25V15C28.5 14.7239 28.2761 14.5 28 14.5H26.358C25.9117 14.5 25.4773 14.6257 25.0999 14.8604L25.0989 14.8611L24 15.5484L22.9 14.861L22.8991 14.8604C22.5218 14.6257 22.0875 14.5 21.642 14.5H20C19.7239 14.5 19.5 14.7239 19.5 15V16.25C19.5 16.5261 19.7239 16.75 20 16.75H21.642C21.6648 16.75 21.6885 16.7564 21.7101 16.7697C21.7102 16.7698 21.7104 16.7699 21.7105 16.77L22.817 17.461C22.817 17.461 22.8171 17.4611 22.8171 17.4611C22.8171 17.4611 22.8171 17.4611 22.8171 17.4611C22.8552 17.4849 22.876 17.5229 22.876 17.567V22.625V27.683C22.876 27.7271 22.8552 27.765 22.8172 27.7889C22.8171 27.7889 22.8171 27.789 22.817 27.789L21.7095 28.48C21.7094 28.4801 21.7093 28.4802 21.7092 28.4803C21.6872 28.4938 21.6644 28.5 21.641 28.5H20C19.7239 28.5 19.5 28.7239 19.5 29V30.25C19.5 30.5261 19.7239 30.75 20 30.75H21.642C22.0883 30.75 22.5227 30.6243 22.9001 30.3896L22.9009 30.3891L24 29.7026L25.1 30.39L25.1009 30.3906C25.4783 30.6253 25.9127 30.751 26.359 30.751H28C28.2761 30.751 28.5 30.5271 28.5 30.251V29.001C28.5 28.7249 28.2761 28.501 28 28.501H26.358C26.3352 28.501 26.3115 28.4946 26.2899 28.4813C26.2897 28.4812 26.2896 28.4811 26.2895 28.481L25.183 27.79C25.183 27.79 25.183 27.79 25.1829 27.79C25.1829 27.7899 25.1829 27.7899 25.1829 27.7899C25.1462 27.7669 25.125 27.7297 25.125 27.684V22.625V17.567C25.125 17.5227 25.146 17.4844 25.1836 17.4606C25.1838 17.4605 25.1839 17.4604 25.184 17.4603L26.2895 16.77C26.2896 16.7699 26.2898 16.7698 26.2899 16.7697C26.3119 16.7562 26.3346 16.75 26.358 16.75H28Z" fill="black" stroke="#FBFBFE" stroke-linejoin="round"/>
|
||||||
|
<path d="M24.625 17.567C24.625 17.35 24.735 17.152 24.918 17.037L26.026 16.345C26.126 16.283 26.24 16.25 26.358 16.25H28V15H26.358C26.006 15 25.663 15.099 25.364 15.285L24.256 15.978C24.161 16.037 24.081 16.113 24 16.187C23.918 16.113 23.839 16.037 23.744 15.978L22.635 15.285C22.336 15.099 21.993 15 21.642 15H20V16.25H21.642C21.759 16.25 21.874 16.283 21.974 16.345L23.082 17.037C23.266 17.152 23.376 17.35 23.376 17.567V22.625V27.683C23.376 27.9 23.266 28.098 23.082 28.213L21.973 28.905C21.873 28.967 21.759 29 21.641 29H20V30.25H21.642C21.994 30.25 22.337 30.151 22.636 29.965L23.744 29.273C23.84 29.213 23.919 29.137 24 29.064C24.081 29.137 24.161 29.213 24.256 29.273L25.365 29.966C25.664 30.152 26.007 30.251 26.359 30.251H28V29.001H26.358C26.241 29.001 26.126 28.968 26.026 28.906L24.918 28.214C24.734 28.099 24.625 27.901 24.625 27.684V22.625V17.567Z" fill="black"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.2 2.59C12.28 2.51 12.43 2.5 12.43 2.5C12.48 2.5 12.58 2.52 12.66 2.6L14.45 4.39C14.58 4.52 14.58 4.72 14.45 4.85L11.7713 7.52872L9.51628 5.27372L12.2 2.59ZM13.2658 4.62L11.7713 6.1145L10.9305 5.27372L12.425 3.77921L13.2658 4.62Z" fill="#FBFBFE"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.98 8.82L8.23 11.07L10.7106 8.58938L8.45562 6.33438L5.98 8.81V8.82ZM8.23 9.65579L9.29641 8.58938L8.45562 7.74859L7.38921 8.815L8.23 9.65579Z" fill="#FBFBFE"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.1526 12.6816L16.2125 6.6217C16.7576 6.08919 17.05 5.3707 17.05 4.62C17.05 3.86931 16.7576 3.15084 16.2126 2.61834L14.4317 0.837474C13.8992 0.29242 13.1807 0 12.43 0C11.6643 0 10.9529 0.312929 10.4329 0.832893L3.68289 7.58289C3.04127 8.22452 3.00459 9.25075 3.57288 9.93634L1.29187 12.2239C1.09186 12.4245 0.990263 12.6957 1.0007 12.9685L1 14C0.447715 14 0 14.4477 0 15V17C0 17.5523 0.447715 18 1 18H16C16.5523 18 17 17.5523 17 17V15C17 14.4477 16.5523 14 16 14H10.2325C9.83594 14 9.39953 13.4347 10.1526 12.6816ZM4.39 9.35L4.9807 9.9407L2.39762 12.5312H6.63877L7.10501 12.065L7.57125 12.5312H8.88875L15.51 5.91C15.86 5.57 16.05 5.11 16.05 4.62C16.05 4.13 15.86 3.67 15.51 3.33L13.72 1.54C13.38 1.19 12.92 1 12.43 1C11.94 1 11.48 1.2 11.14 1.54L4.39 8.29C4.1 8.58 4.1 9.06 4.39 9.35ZM16 17V15H1V17H16Z" fill="#FBFBFE"/>
|
||||||
|
<path d="M15.1616 5.55136L15.1616 5.55132L15.1564 5.55645L8.40645 12.3064C8.35915 12.3537 8.29589 12.38 8.23 12.38C8.16411 12.38 8.10085 12.3537 8.05355 12.3064L7.45857 11.7115L7.10501 11.3579L6.75146 11.7115L6.03289 12.43H3.20465L5.33477 10.2937L5.6873 9.94019L5.33426 9.58715L4.74355 8.99645C4.64882 8.90171 4.64882 8.73829 4.74355 8.64355L11.4936 1.89355C11.7436 1.64354 12.0779 1.5 12.43 1.5C12.7883 1.5 13.1179 1.63776 13.3614 1.88839L13.3613 1.88843L13.3664 1.89355L15.1564 3.68355L15.1564 3.68359L15.1616 3.68864C15.4122 3.93211 15.55 4.26166 15.55 4.62C15.55 4.97834 15.4122 5.30789 15.1616 5.55136ZM5.48 8.82V9.02711L5.62645 9.17355L7.87645 11.4236L8.23 11.7771L8.58355 11.4236L11.0642 8.94293L11.4177 8.58938L11.0642 8.23582L8.80918 5.98082L8.45562 5.62727L8.10207 5.98082L5.62645 8.45645L5.48 8.60289V8.81V8.82ZM11.4177 7.88227L11.7713 8.23582L12.1248 7.88227L14.8036 5.20355C15.1288 4.87829 15.1288 4.36171 14.8036 4.03645L13.0136 2.24645C12.8186 2.05146 12.5792 2 12.43 2H12.4134L12.3967 2.00111L12.43 2.5C12.3967 2.00111 12.3966 2.00112 12.3965 2.00112L12.3963 2.00114L12.3957 2.00117L12.3947 2.00125L12.3924 2.00142L12.387 2.00184L12.3732 2.00311C12.3628 2.00416 12.3498 2.00567 12.3346 2.00784C12.3049 2.01208 12.2642 2.01925 12.2178 2.03146C12.1396 2.05202 11.9797 2.10317 11.8464 2.23645L9.16273 4.92016L8.80918 5.27372L9.16273 5.62727L11.4177 7.88227ZM1.5 16.5V15.5H15.5V16.5H1.5Z" stroke="#15141A"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||||
|
d="M11 3H13.6C14 3 14.3 3.3 14.3 3.6C14.3 3.9 14 4.2 13.7 4.2H13.3V14C13.3 15.1 12.4 16 11.3 16H4.80005C3.70005 16 2.80005 15.1 2.80005 14V4.2H2.40005C2.00005 4.2 1.80005 4 1.80005 3.6C1.80005 3.2 2.00005 3 2.40005 3H5.00005V2C5.00005 0.9 5.90005 0 7.00005 0H9.00005C10.1 0 11 0.9 11 2V3ZM6.90005 1.2L6.30005 1.8V3H9.80005V1.8L9.20005 1.2H6.90005ZM11.4 14.7L12 14.1V4.2H4.00005V14.1L4.60005 14.7H11.4ZM7.00005 12.4C7.00005 12.7 6.70005 13 6.40005 13C6.10005 13 5.80005 12.7 5.80005 12.4V7.6C5.70005 7.3 6.00005 7 6.40005 7C6.80005 7 7.00005 7.3 7.00005 7.6V12.4ZM10.2001 12.4C10.2001 12.7 9.90006 13 9.60006 13C9.30006 13 9.00006 12.7 9.00006 12.4V7.6C9.00006 7.3 9.30006 7 9.60006 7C9.90006 7 10.2001 7.3 10.2001 7.6V12.4Z"
|
||||||
|
fill="black" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 909 B |
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M7.85822 8.84922L4.85322 11.8542C4.75891 11.9453 4.63261 11.9957 4.50151 11.9946C4.37042 11.9934 4.24501 11.9408 4.15231 11.8481C4.0596 11.7554 4.00702 11.63 4.00588 11.4989C4.00474 11.3678 4.05514 11.2415 4.14622 11.1472L7.15122 8.14222V7.85922L4.14622 4.85322C4.05514 4.75891 4.00474 4.63261 4.00588 4.50151C4.00702 4.37042 4.0596 4.24501 4.15231 4.15231C4.24501 4.0596 4.37042 4.00702 4.50151 4.00588C4.63261 4.00474 4.75891 4.05514 4.85322 4.14622L7.85822 7.15122H8.14122L11.1462 4.14622C11.2405 4.05514 11.3668 4.00474 11.4979 4.00588C11.629 4.00702 11.7544 4.0596 11.8471 4.15231C11.9398 4.24501 11.9924 4.37042 11.9936 4.50151C11.9947 4.63261 11.9443 4.75891 11.8532 4.85322L8.84822 7.85922V8.14222L11.8532 11.1472C11.9443 11.2415 11.9947 11.3678 11.9936 11.4989C11.9924 11.63 11.9398 11.7554 11.8471 11.8481C11.7544 11.9408 11.629 11.9934 11.4979 11.9946C11.3668 11.9957 11.2405 11.9453 11.1462 11.8542L8.14122 8.84922L8.14222 8.85022L7.85822 8.84922Z" fill="black"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M14.8748 12.037L9.37782 2.037C8.99682 1.346 8.31082 1 7.62482 1C6.93882 1 6.25282 1.346 5.87282 2.037L0.375823 12.037C-0.358177 13.37 0.606823 15 2.12782 15H13.1228C14.6428 15 15.6078 13.37 14.8748 12.037ZM8.24982 11.75L7.99982 12H7.24982L6.99982 11.75V11L7.24982 10.75H7.99982L8.24982 11V11.75ZM8.24982 9.062C8.24982 9.22776 8.18398 9.38673 8.06677 9.50394C7.94955 9.62115 7.79058 9.687 7.62482 9.687C7.45906 9.687 7.30009 9.62115 7.18288 9.50394C7.06567 9.38673 6.99982 9.22776 6.99982 9.062V5.625C6.99982 5.45924 7.06567 5.30027 7.18288 5.18306C7.30009 5.06585 7.45906 5 7.62482 5C7.79058 5 7.94955 5.06585 8.06677 5.18306C8.18398 5.30027 8.24982 5.45924 8.24982 5.625V9.062Z" fill="black"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 811 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5ZM0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8ZM8.75 4V5.5H7.25V4H8.75ZM8.75 12V7H7.25V12H8.75Z" fill="black"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 417 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.10918 11.66C7.24918 11.8 7.43918 11.88 7.63918 11.88C7.83918 11.88 8.02918 11.8 8.16918 11.66L14.9192 4.91C15.2692 4.57 15.4592 4.11 15.4592 3.62C15.4592 3.13 15.2692 2.67 14.9192 2.33L13.1292 0.54C12.7892 0.19 12.3292 0 11.8392 0C11.3492 0 10.8892 0.2 10.5492 0.54L3.79918 7.29C3.50918 7.58 3.50918 8.06 3.79918 8.35L4.38988 8.9407L1.40918 11.93H5.64918L6.51419 11.065L7.10918 11.66ZM7.63918 10.07L5.38918 7.82V7.81L7.8648 5.33438L10.1198 7.58938L7.63918 10.07ZM11.1805 6.52872L13.8592 3.85C13.9892 3.72 13.9892 3.52 13.8592 3.39L12.0692 1.6C11.9892 1.52 11.8892 1.5 11.8392 1.5C11.8392 1.5 11.6892 1.51 11.6092 1.59L8.92546 4.27372L11.1805 6.52872Z" fill="#000"/>
|
||||||
|
<path d="M0.40918 14H15.4092V16H0.40918V14Z" fill="#000"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 910 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M8.23336 10.4664L11.8474 6.85339C11.894 6.8071 11.931 6.75203 11.9563 6.69136C11.9816 6.63069 11.9946 6.56562 11.9946 6.49989C11.9946 6.43417 11.9816 6.3691 11.9563 6.30843C11.931 6.24776 11.894 6.19269 11.8474 6.14639C11.7536 6.05266 11.6264 6 11.4939 6C11.3613 6 11.2341 6.05266 11.1404 6.14639L7.99236 9.29339L4.84736 6.14739C4.75305 6.05631 4.62675 6.00592 4.49566 6.00706C4.36456 6.0082 4.23915 6.06078 4.14645 6.15348C4.05374 6.24619 4.00116 6.37159 4.00002 6.50269C3.99888 6.63379 4.04928 6.76009 4.14036 6.85439L7.75236 10.4674L8.23336 10.4664Z" fill="black"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 681 B |
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* @licstart The following is the entire license notice for the
|
||||||
|
* JavaScript code in this page
|
||||||
|
*
|
||||||
|
* Copyright 2024 Mozilla Foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* @licend The above is the entire license notice for the
|
||||||
|
* JavaScript code in this page
|
||||||
|
*/var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},__webpack_exports__ = globalThis.pdfjsLib = {};t.d(__webpack_exports__,{AbortException:()=>AbortException,AnnotationEditorLayer:()=>AnnotationEditorLayer,AnnotationEditorParamsType:()=>m,AnnotationEditorType:()=>g,AnnotationEditorUIManager:()=>AnnotationEditorUIManager,AnnotationLayer:()=>AnnotationLayer,AnnotationMode:()=>p,ColorPicker:()=>ColorPicker,DOMSVGFactory:()=>DOMSVGFactory,DrawLayer:()=>DrawLayer,FeatureTest:()=>util_FeatureTest,GlobalWorkerOptions:()=>GlobalWorkerOptions,ImageKind:()=>_,InvalidPDFException:()=>InvalidPDFException,MissingPDFException:()=>MissingPDFException,OPS:()=>X,OutputScale:()=>OutputScale,PDFDataRangeTransport:()=>PDFDataRangeTransport,PDFDateString:()=>PDFDateString,PDFWorker:()=>PDFWorker,PasswordResponses:()=>K,PermissionFlag:()=>f,PixelsPerInch:()=>PixelsPerInch,RenderingCancelledException:()=>RenderingCancelledException,TextLayer:()=>TextLayer,TouchManager:()=>TouchManager,UnexpectedResponseException:()=>UnexpectedResponseException,Util:()=>Util,VerbosityLevel:()=>q,XfaLayer:()=>XfaLayer,build:()=>Nt,createValidAbsoluteUrl:()=>createValidAbsoluteUrl,fetchData:()=>fetchData,getDocument:()=>getDocument,getFilenameFromUrl:()=>getFilenameFromUrl,getPdfFilenameFromUrl:()=>getPdfFilenameFromUrl,getXfaPageViewport:()=>getXfaPageViewport,isDataScheme:()=>isDataScheme,isPdfFile:()=>isPdfFile,noContextMenu:()=>noContextMenu,normalizeUnicode:()=>normalizeUnicode,setLayerDimensions:()=>setLayerDimensions,shadow:()=>shadow,stopEvent:()=>stopEvent,version:()=>Ot});const e=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),i=[1,0,0,1,0,0],s=[.001,0,0,.001,0,0],n=1.35,a=1,r=2,o=4,l=16,h=32,d=64,c=128,u=256,p={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},g={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},m={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},f={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},b=0,A=1,w=2,v=3,y=3,x=4,_={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},E=1,S=2,C=3,T=4,M=5,P=6,D=7,k=8,R=9,I=10,F=11,L=12,O=13,N=14,B=15,H=16,z=17,U=20,G=1,$=2,V=3,j=4,W=5,q={ERRORS:0,WARNINGS:1,INFOS:5},X={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},K={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Y=q.WARNINGS;function setVerbosityLevel(t){Number.isInteger(t)&&(Y=t)}function getVerbosityLevel(){return Y}function info(t){Y>=q.INFOS&&console.log(`Info: ${t}`)}function warn(t){Y>=q.WARNINGS&&console.log(`Warning: ${t}`)}function unreachable(t){throw new Error(t)}function assert(t,e){t||unreachable(e)}function createValidAbsoluteUrl(t,e=null,i=null){if(!t)return null;try{if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=function stringToUTF8String(t){return decodeURIComponent(escape(t))}(t)}catch{}}const s=e?new URL(t,e):new URL(t);if(function _isValidProtocol(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:Line truncated
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* @licstart The following is the entire license notice for the
|
||||||
|
* JavaScript code in this page
|
||||||
|
*
|
||||||
|
* Copyright 2024 Mozilla Foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* @licend The above is the entire license notice for the
|
||||||
|
* JavaScript code in this page
|
||||||
|
*/var e={d:(t,i)=>{for(var a in i)e.o(i,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:i[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},__webpack_exports__ = globalThis.pdfjsWorker = {};e.d(__webpack_exports__,{WorkerMessageHandler:()=>WorkerMessageHandler});const t=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),i=[1,0,0,1,0,0],a=[.001,0,0,.001,0,0],s=1.35,r=.35,n=.25925925925925924,g=1,o=2,c=4,C=8,h=16,l=64,Q=128,E=256,u="pdfjs_internal_editor_",d=3,f=9,p=13,m=15,y={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},w=0,D=4,b=1,F=2,S=3,k=1,R=2,N=3,G=4,M=5,U=6,x=7,L=8,H=9,J=10,Y=11,v=12,K=13,T=14,q=15,O=16,W=17,j=20,X="Group",Z="R",V=1,z=2,_=4,$=16,AA=32,eA=128,tA=512,iA=1,aA=2,sA=4096,rA=8192,nA=32768,gA=65536,oA=131072,IA=1048576,cA=2097152,CA=8388608,hA=16777216,lA=1,BA=2,QA=3,EA=4,uA=5,dA={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},fA={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},pA={O:"PageOpen",C:"PageClose"},mA=1,yA=5,wA=1,DA=2,bA=3,FA=4,SA=5,kA=6,RA=7,NA=8,GA=9,MA=10,UA=11,xA=12,LA=13,HA=14,JA=15,YA=16,vA=17,KA=18,TA=19,qA=20,OA=21,PA=22,WA=23,jA=24,XA=25,ZA=26,VA=27,zA=28,_A=29,$A=30,Ae=31,ee=32,te=33,ie=34,ae=35,se=36,re=37,ne=38,ge=39,oe=40,Ie=41,ce=42,Ce=43,he=44,le=45,Be=46,Qe=47,Ee=48,ue=49,de=50,fe=51,pe=52,me=53,ye=54,we=55,De=56,be=57,Fe=58,Se=59,ke=60,Re=61,Ne=62,Ge=63,Me=64,Ue=65,xe=66,Le=67,He=68,Je=69,Ye=70,ve=71,Ke=72,Te=73,qe=74,Oe=75,Pe=76,We=77,je=80,Xe=81,Ze=83,Ve=84,ze=85,_e=86,$e=87,At=88,et=89,tt=90,it=91,at=92,st=93,rt=1,nt=2;let gt=mA;function getVerbosityLevel(){return gt}function info(e){gt>=yA&&console.log(`Info: ${e}`)}function warn(e){gt>=mA&&console.log(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function createValidAbsoluteUrl(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=stringToUTF8String(e)}catch{}}const a=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(a))return a}catch{}return null}function shadow(e,t,i,a=!1){Object.defineProperty(e,t,{value:i,enumerable:!a,configurable:!0,writable:!1});return i}const ot=function BaseExceptionClosure(){function BaseException(e,t){this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class PasswordException extends ot{constructor(e,t){super(e,"PasswordException");this.code=t}}class UnknownErrorException extends ot{constructor(e,t){super(e,"UnknownErrorException");this.details=t}}class InvalidPDFException extends ot{constructor(e){super(e,"InvalidPDFException")}}class MissingPDFException extends ot{constructor(e){super(e,"MissingPDFException")}}class UnexpectedResponseException extends ot{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}}class FormatError extends ot{constructor(e){super(e,"FormatError")}}class AbortException extends ot{constructor(e){super(e,"AbortException")}}function bytesToString(e){"object"==typeof e&&void 0!==e?.length||unreachable("Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const a=[];for(let s=0;s<t;s+=i){const r=Math.min(s+i,t),n=e.subarray(s,r);a.push(String.fromCharCode.apply(null,n))}return a.join("")}function stringToBytes(e){"string"!=typeof e&&unreachable("Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let a=0;a<t;++a)i[a]=255&e.charCodeAt(a);return i}function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}function objectSize(e){return Object.keys(e).length}class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return shadow(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?shadow(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navLine truncated
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Copyright 2014 PDFium Authors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
Digitized data copyright (c) 2010 Google Corporation
|
||||||
|
with Reserved Font Arimo, Tinos and Cousine.
|
||||||
|
Copyright (c) 2012 Red Hat, Inc.
|
||||||
|
with Reserved Font Name Liberation.
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License,
|
||||||
|
Version 1.1.
|
||||||
|
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
|
||||||
|
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
|
||||||
|
worldwide development of collaborative font projects, to support the font
|
||||||
|
creation efforts of academic and linguistic communities, and to provide
|
||||||
|
a free and open framework in which fonts may be shared and improved in
|
||||||
|
partnership with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves.
|
||||||
|
The fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply to
|
||||||
|
any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such.
|
||||||
|
This may include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components
|
||||||
|
as distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting ? in part or in whole ?
|
||||||
|
any of the components of the Original Version, by changing formats or
|
||||||
|
by porting the Font Software to a new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical writer
|
||||||
|
or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,in
|
||||||
|
Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the
|
||||||
|
corresponding Copyright Holder. This restriction only applies to the
|
||||||
|
primary font name as presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole, must
|
||||||
|
be distributed entirely under this license, and must not be distributed
|
||||||
|
under any other license. The requirement for fonts to remain under
|
||||||
|
this license does not apply to any document created using the Font
|
||||||
|
Software.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are not met.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
|
||||||
|
DEALINGS IN THE FONT SOFTWARE.
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
pdf-lib 1.17.1 -- https://github.com/Hopding/pdf-lib (MIT, siehe LICENSE)
|
||||||
|
|
||||||
|
Aus dem CDN-Bau "pdf-lib.min.js" (UMD, setzt window.PDFLib).
|
||||||
|
|
||||||
|
Wofuer: pdf.js kann Formulare ausfuellen, aber nichts in ein PDF zeichnen. Fuer
|
||||||
|
den Bildknopf in Formularen (Acrobats "buttonImportIcon", das kein Browser
|
||||||
|
ausfuehren kann) wird das gewaehlte Foto damit in das Feld gestempelt.
|
||||||
|
|
||||||
|
Geladen wird die Datei erst, wenn wirklich ein Bild eingesetzt wird.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Andrew Dillon
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
1.17.1
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).PDFLib={})}(this,(function(t){"use strict";
|
||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||||
|
this file except in compliance with the License. You may obtain a copy of the
|
||||||
|
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||||
|
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||||
|
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||||
|
|
||||||
|
See the Apache Version 2.0 License for specific language governing permissions
|
||||||
|
and limitations under the License.
|
||||||
|
***************************************************************************** */var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,n)};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function a(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}for(var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=new Uint8Array(256),h=0;h<s.length;h++)l[s.charCodeAt(h)]=h;var u,c=function(t){for(var e="",n=t.length,r=0;r<n;r+=3)e+=s[t[r]>>2],e+=s[(3&t[r])<<4|t[r+1]>>4],e+=s[(15&t[r+1])<<2|t[r+2]>>6],e+=s[63&t[r+2]];return n%3==2?e=e.substring(0,e.length-1)+"=":n%3==1&&(e=e.substring(0,e.length-2)+"=="),e},d=function(t){var e,n,r,i,o,a=.75*t.length,s=t.length,h=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var u=new Uint8Array(a);for(e=0;e<s;e+=4)n=l[t.charCodeAt(e)],r=l[t.charCodeAt(e+1)],i=l[t.charCodeAt(e+2)],o=l[t.charCodeAt(e+3)],u[h++]=n<<2|r>>4,u[h++]=(15&r)<<4|i>>2,u[h++]=(3&i)<<6|63&o;return u},f=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,p=function(t){var e=t.trim(),n=e.substring(0,100).match(f);if(!n)return d(e);var r=n[0],i=e.substring(r.length);return d(i)},g=function(t){return t.charCodeAt(0)},v=function(t){return t.codePointAt(0)},y=function(t,e){return x(t.toString(16),e,"0").toUpperCase()},m=function(t){return y(t,2)},b=function(t){return String.fromCharCode(t)},w=function(t){return b(parseInt(t,16))},x=function(t,e,n){for(var r="",i=0,o=e-t.length;i<o;i++)r+=n;return r+t},k=function(t,e,n){for(var r=t.length,i=0;i<r;i++)e[n++]=t.charCodeAt(i);return r},F=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},S=function(t){return t.replace(/\t|\u0085|\u2028|\u2029/g," ").replace(/[\b\v]/g,"")},C=["\\n","\\f","\\r","\\u000B"],A=function(t){return/^[\n\f\r\u000B]$/.test(t)},T=function(t){return t.split(/[\n\f\r\u000B]/)},P=function(t){return t.replace(/[\n\f\r\u000B]/g," ")},z=function(t,e){var n,r=t.charCodeAt(e),i=e+1,o=1;return r>=55296&&r<=56319&&t.length>i&&(n=t.charCodeAt(i))>=56320&&n<=57343&&(o=2),[t.slice(e,e+o),o]},R=function(t){for(var e=[],n=0,r=t.length;n<r;){var i=z(t,n),o=i[0],a=i[1];e.push(o),n+=a}return e},O=function(t,e,n,r){for(var i=function(t){for(var e=C.join("|"),n=["$"],r=0,i=t.length;r<i;r++){var o=t[r];if(A(o))throw new TypeError("`wordBreak` must not include "+e);n.push(""===o?".":F(o))}var a=n.join("|");return new RegExp("("+e+")|((.*?)("+a+"))","gm")}(e),o=S(t).match(i),a="",s=0,l=[],h=function(){""!==a&&l.push(a),a="",s=0},u=0,c=o.length;u<c;u++){var d=o[u];if(A(d))h();else{var f=r(d);s+f>n&&h(),a+=d,s+=f}}return h(),l},D=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,B=function(t){var e=t.match(D);if(e){var n=e[1],r=e[2],i=void 0===r?"01":r,o=e[3],a=void 0===o?"01":o,s=e[4],l=void 0===s?"00":s,h=e[5],u=void 0===h?"00":h,c=e[6],d=void 0===c?"00":c,f=e[7],p=void 0===f?"Z":f,g=e[8],v=void 0===g?"00":g,y=e[9];return new Date(n+"-"+i+"-"+a+"T"+l+":"+u+":"+d+("Z"===p?"Z":""+p+v+":"+(void 0===y?"00":y)))}},N=function(t,e){for(var n,r,i=0;i<t.length;){var o=t.substring(i).match(e);if(!o)return{match:r,pos:i};r=o,i+=(null!==(n=o.index)&&void 0Line truncated
|
||||||
|
//# sourceMappingURL=pdf-lib.min.js.map
|
||||||
@@ -26,6 +26,7 @@ from dataclasses import dataclass
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from .. import uploads
|
||||||
from ..sysops import SysOps
|
from ..sysops import SysOps
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -99,7 +100,10 @@ def validate_domain(value: str) -> str:
|
|||||||
|
|
||||||
def render(config: WebConfig) -> str:
|
def render(config: WebConfig) -> str:
|
||||||
"""Erzeugt die vollstaendige Site-Konfiguration."""
|
"""Erzeugt die vollstaendige Site-Konfiguration."""
|
||||||
body = f"{max(1, config.max_body_mb)}m"
|
# Bewusst mehr als die Anwendung erlaubt: laeuft die Grenze hier zuerst
|
||||||
|
# auf, sieht der Benutzer die nackte 413 von nginx. Kommt die Anfrage
|
||||||
|
# dagegen bis zur Anwendung, sagt die, wie viel erlaubt ist.
|
||||||
|
body = f"{uploads.nginx_mb(config.max_body_mb)}m"
|
||||||
# Kopfzeilen und proxy_pass -- ohne Zeitlimits. Die kommen je Block dazu,
|
# Kopfzeilen und proxy_pass -- ohne Zeitlimits. Die kommen je Block dazu,
|
||||||
# denn nginx lehnt eine doppelte Direktive im selben Block ab (auf POETEST
|
# denn nginx lehnt eine doppelte Direktive im selben Block ab (auf POETEST
|
||||||
# real passiert: der Websocket-Block erbte 120s und setzte noch einmal
|
# real passiert: der Websocket-Block erbte 120s und setzte noch einmal
|
||||||
@@ -194,8 +198,9 @@ def render(config: WebConfig) -> str:
|
|||||||
def _site_body(config: WebConfig, common_proxy: list[str], body: str, *, tls: bool) -> list[str]:
|
def _site_body(config: WebConfig, common_proxy: list[str], body: str, *, tls: bool) -> list[str]:
|
||||||
lines = [
|
lines = [
|
||||||
f" client_max_body_size {body};",
|
f" client_max_body_size {body};",
|
||||||
" # Groesser als das Limit der Anwendung, damit deren eigene, erklaerende",
|
f" # {uploads.NGINX_ZUSCHLAG_MB} MB mehr als die Anwendung erlaubt, damit deren"
|
||||||
" # Fehlerseite gewinnt statt der generischen 413 von nginx.",
|
" eigene,",
|
||||||
|
" # erklaerende Fehlerseite gewinnt statt der generischen 413 von nginx.",
|
||||||
"",
|
"",
|
||||||
" location /assets/ {",
|
" location /assets/ {",
|
||||||
f" alias {config.static_root.rstrip('/')}/;",
|
f" alias {config.static_root.rstrip('/')}/;",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<strong>nicht</strong> bei jedem Neustart auf die Vorlage zurückgesetzt –
|
<strong>nicht</strong> bei jedem Neustart auf die Vorlage zurückgesetzt –
|
||||||
Anpassungen bleiben erhalten.
|
Anpassungen bleiben erhalten.
|
||||||
{% if current_user.has('groups.edit') %}
|
{% if current_user.has('groups.edit') %}
|
||||||
<a class="btn btn--sm mt-2" href="{{ url_for('admin.group_detail', group_id=group.id, freischalten=1) }}">
|
<a class="btn btn--sm mt-2" href="{{ url_for('admin.group_detail', group_id=group.id, unlocked=1) }}">
|
||||||
{{ icon('unlock', size=14) }} Rechte freischalten
|
{{ icon('unlock', size=14) }} Rechte freischalten
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -26,19 +26,19 @@
|
|||||||
{{ icon('search', size=15) }}
|
{{ icon('search', size=15) }}
|
||||||
<input class="input" type="search" name="q" value="{{ filters.q }}" placeholder="Ziel, Detail, Aktion ...">
|
<input class="input" type="search" name="q" value="{{ filters.q }}" placeholder="Ziel, Detail, Aktion ...">
|
||||||
</span>
|
</span>
|
||||||
<select class="select" name="aktion" style="width:auto;max-width:240px">
|
<select class="select" name="action" style="width:auto;max-width:240px">
|
||||||
<option value="">alle Aktionen</option>
|
<option value="">alle Aktionen</option>
|
||||||
{% for action in actions %}
|
{% for action in actions %}
|
||||||
<option value="{{ action }}" {% if action == filters.aktion %}selected{% endif %}>{{ action }}</option>
|
<option value="{{ action }}" {% if action == filters.action %}selected{% endif %}>{{ action }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<select class="select" name="stufe" style="width:auto">
|
<select class="select" name="severity" style="width:auto">
|
||||||
<option value="">alle Stufen</option>
|
<option value="">alle Stufen</option>
|
||||||
{% for level in ['info', 'notice', 'warning', 'critical'] %}
|
{% for level in ['info', 'notice', 'warning', 'critical'] %}
|
||||||
<option value="{{ level }}" {% if level == filters.stufe %}selected{% endif %}>{{ level }}</option>
|
<option value="{{ level }}" {% if level == filters.severity %}selected{% endif %}>{{ level }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<input class="input" type="text" name="benutzer" value="{{ filters.benutzer }}"
|
<input class="input" type="text" name="actor" value="{{ filters.actor }}"
|
||||||
placeholder="Benutzer" style="width:150px">
|
placeholder="Benutzer" style="width:150px">
|
||||||
<button class="btn btn--sm" type="submit">Filtern</button>
|
<button class="btn btn--sm" type="submit">Filtern</button>
|
||||||
<a class="btn btn--sm btn--ghost" href="{{ url_for('logs.audit_view') }}">Zurücksetzen</a>
|
<a class="btn btn--sm btn--ghost" href="{{ url_for('logs.audit_view') }}">Zurücksetzen</a>
|
||||||
@@ -88,10 +88,10 @@
|
|||||||
<span class="fs-sm muted">Seite {{ page }}</span>
|
<span class="fs-sm muted">Seite {{ page }}</span>
|
||||||
<span class="row row--tight">
|
<span class="row row--tight">
|
||||||
{% if page > 1 %}
|
{% if page > 1 %}
|
||||||
<a class="btn btn--sm" href="{{ url_for('logs.audit_view', seite=page-1, **filters) }}">Zurück</a>
|
<a class="btn btn--sm" href="{{ url_for('logs.audit_view', page=page-1, **filters) }}">Zurück</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if rows | length == per_page %}
|
{% if rows | length == per_page %}
|
||||||
<a class="btn btn--sm" href="{{ url_for('logs.audit_view', seite=page+1, **filters) }}">Weiter</a>
|
<a class="btn btn--sm" href="{{ url_for('logs.audit_view', page=page+1, **filters) }}">Weiter</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -235,3 +235,69 @@
|
|||||||
die Spalte gehört zu einer anderen Zeile desselben Bereichs.</span>
|
die Spalte gehört zu einer anderen Zeile desselben Bereichs.</span>
|
||||||
</div>
|
</div>
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{# --------------------------------------------------------------------------
|
||||||
|
Navigationsreihenfolge. Die Reihenfolge der versteckten Felder ist die
|
||||||
|
Reihenfolge -- verschiebt sich eine Zeile, verschiebt sich das Feld mit ihr.
|
||||||
|
Ziehen mit der Maus oder die zwei Knoepfe je Zeile; auf einem Tablet sind
|
||||||
|
die Knoepfe der verlaessliche Weg.
|
||||||
|
-------------------------------------------------------------------------- #}
|
||||||
|
{% macro _reorder_row(item, field_name, label) -%}
|
||||||
|
<li class="reorder__row" data-reorder-item draggable="true">
|
||||||
|
<span class="reorder__grip" aria-hidden="true">{{ icon('menu', size=14) }}</span>
|
||||||
|
<span class="reorder__pos" data-reorder-position-text>1</span>
|
||||||
|
<input type="hidden" name="{{ field_name }}" value="{{ item.key }}">
|
||||||
|
<span class="flex-1">{{ icon(item.icon, size=15) }} {{ item.label }}</span>
|
||||||
|
<span class="reorder__moves">
|
||||||
|
<button class="btn btn--icon btn--sm" type="button" data-reorder-move="up"
|
||||||
|
aria-label="{{ label }} nach oben">{{ icon('chevron-up', size=14) }}</button>
|
||||||
|
<button class="btn btn--icon btn--sm" type="button" data-reorder-move="down"
|
||||||
|
aria-label="{{ label }} nach unten">{{ icon('chevron-down', size=14) }}</button>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{% macro nav_order_card(items, order, child_order, action, csrf_field, csrf_value,
|
||||||
|
sub='Gilt für alle Benutzer; jeder sieht weiter nur, was er darf') -%}
|
||||||
|
<section class="card">
|
||||||
|
<div class="card__header">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="card__title">{{ icon('sliders', size=17) }} Navigationsreihenfolge</div>
|
||||||
|
<div class="card__sub">{{ sub }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form method="post" action="{{ action }}">
|
||||||
|
<input type="hidden" name="{{ csrf_field }}" value="{{ csrf_value }}">
|
||||||
|
<div class="card__body">
|
||||||
|
<ol class="reorder" data-behavior="reorder">
|
||||||
|
{% for key in order %}
|
||||||
|
{% set item = items | selectattr('key', 'equalto', key) | list | first %}
|
||||||
|
{% if item %}
|
||||||
|
{{ _reorder_row(item, 'order', item.label) }}
|
||||||
|
{% if item.children %}
|
||||||
|
<li class="reorder__group">
|
||||||
|
<ol class="reorder reorder--child" data-behavior="reorder">
|
||||||
|
{% set kinder = child_order.get(item.key) or (item.children | map(attribute='key') | list) %}
|
||||||
|
{% for child_key in kinder %}
|
||||||
|
{% set child = item.children | selectattr('key', 'equalto', child_key) | list | first %}
|
||||||
|
{% if child %}
|
||||||
|
{{ _reorder_row(child, 'child_order_' ~ item.key, item.label ~ ' / ' ~ child.label) }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ol>
|
||||||
|
<p class="fs-xs faint mt-3">
|
||||||
|
Zeilen ziehen oder mit den Pfeilen verschieben, dann speichern. Untergeordnete
|
||||||
|
Punkte werden innerhalb ihrer Gruppe sortiert.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card__footer">
|
||||||
|
<button class="btn btn--sm" type="submit">Reihenfolge speichern</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
{%- endmacro %}
|
||||||
@@ -41,6 +41,15 @@ blieb dadurch über Jahre bestehen und lieferte alle statischen Dateien als 404.
|
|||||||
disabled=bool(license_hint), extra_class='field--full') }}
|
disabled=bool(license_hint), extra_class='field--full') }}
|
||||||
{{ field('web_acme_webroot', 'ACME-Webroot', value=config.acme_webroot,
|
{{ field('web_acme_webroot', 'ACME-Webroot', value=config.acme_webroot,
|
||||||
disabled=bool(license_hint), extra_class='field--full') }}
|
disabled=bool(license_hint), extra_class='field--full') }}
|
||||||
|
{# Eine Zahl für beides. Vorher galt in der Anwendung eine andere
|
||||||
|
Grenze als in nginx: die Freigabeseite versprach 512 MB, bei
|
||||||
|
64 MB brach die Anfrage mit einer nackten 413 ab. #}
|
||||||
|
{{ field('web_max_body_mb', 'Maximale Uploadgröße (MB)',
|
||||||
|
value=config.max_body_mb, type='number',
|
||||||
|
attrs='min="1" max="8192" step="1"',
|
||||||
|
hint_text='Gilt für die Anwendung sofort. nginx bekommt beim Übernehmen
|
||||||
|
' ~ nginx_zuschlag ~ ' MB mehr, damit die Anwendung erklären kann, was zu
|
||||||
|
groß war -- statt einer nackten Fehlerseite des Webservers.') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="stack stack--tight">
|
<div class="stack stack--tight">
|
||||||
{{ checkbox('web_https_enabled', 'HTTPS auf Port 443 anbieten',
|
{{ checkbox('web_https_enabled', 'HTTPS auf Port 443 anbieten',
|
||||||
|
|||||||
@@ -38,12 +38,16 @@ ICONS: dict[str, str] = {
|
|||||||
"menu": '<path d="M4 6h16M4 12h16M4 18h16"/>',
|
"menu": '<path d="M4 6h16M4 12h16M4 18h16"/>',
|
||||||
"chevron-right": '<path d="m9 6 6 6-6 6"/>',
|
"chevron-right": '<path d="m9 6 6 6-6 6"/>',
|
||||||
"chevron-down": '<path d="m6 9 6 6 6-6"/>',
|
"chevron-down": '<path d="m6 9 6 6 6-6"/>',
|
||||||
|
"chevron-up": '<path d="m6 15 6-6 6 6"/>',
|
||||||
"sun": '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19"/>',
|
"sun": '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19"/>',
|
||||||
"moon": '<path d="M20 14.5A8.5 8.5 0 1 1 9.5 4a7 7 0 0 0 10.5 10.5z"/>',
|
"moon": '<path d="M20 14.5A8.5 8.5 0 1 1 9.5 4a7 7 0 0 0 10.5 10.5z"/>',
|
||||||
"monitor": '<rect x="2" y="4" width="20" height="13" rx="2"/><path d="M8 21h8M12 17v4"/>',
|
"monitor": '<rect x="2" y="4" width="20" height="13" rx="2"/><path d="M8 21h8M12 17v4"/>',
|
||||||
"log-out": '<path d="M15 4h3a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-3M10 8l-4 4 4 4M6 12h10"/>',
|
"log-out": '<path d="M15 4h3a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-3M10 8l-4 4 4 4M6 12h10"/>',
|
||||||
"settings": '<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.9.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1A1.7 1.7 0 0 0 4.6 9a1.7 1.7 0 0 0-.3-1.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.9.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.9-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.9V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>',
|
"settings": '<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.9.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1A1.7 1.7 0 0 0 4.6 9a1.7 1.7 0 0 0-.3-1.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.9.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.9-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.9V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>',
|
||||||
"plus": '<path d="M12 5v14M5 12h14"/>',
|
"plus": '<path d="M12 5v14M5 12h14"/>',
|
||||||
|
"minus": '<path d="M5 12h14"/>',
|
||||||
|
# Diskette -- die Vorschau schreibt ein ausgefuelltes Formular zurueck.
|
||||||
|
"save": '<path d="M5 4h11l3 3v13H5z"/><path d="M8 4v5h7V4M8 20v-6h8v6"/>',
|
||||||
"pencil": '<path d="M4 20h4l10.5-10.5a2.1 2.1 0 0 0-3-3L5 17v3z"/>',
|
"pencil": '<path d="M4 20h4l10.5-10.5a2.1 2.1 0 0 0-3-3L5 17v3z"/>',
|
||||||
"x": '<path d="M6 6l12 12M18 6 6 18"/>',
|
"x": '<path d="M6 6l12 12M18 6 6 18"/>',
|
||||||
"check": '<path d="m5 13 4 4L19 7"/>',
|
"check": '<path d="m5 13 4 4L19 7"/>',
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
"""Die zulaessige Groesse eines Uploads -- **eine** Zahl fuer alles.
|
||||||
|
|
||||||
|
Vorher gab es drei Grenzen, die nichts voneinander wussten:
|
||||||
|
|
||||||
|
* ``MAX_CONTENT_LENGTH`` der Anwendung (64 MB, aus einer Umgebungsvariablen),
|
||||||
|
* ``client_max_body_size`` von nginx (aus der Einstellung ``web_max_body_mb``),
|
||||||
|
* eine eigene Grenze der Dateifreigabe (512 MB, nirgends einstellbar).
|
||||||
|
|
||||||
|
Wirksam war die kleinste, sichtbar die groesste: die Freigabeseite versprach
|
||||||
|
512 MB je Datei, und bei 64 MB brach die Anfrage mit einer nackten 413 ab.
|
||||||
|
|
||||||
|
Jetzt gilt ``web_max_body_mb`` fuer beides. Und weil eine Einstellung erst
|
||||||
|
nuetzlich ist, wenn sie sofort greift, liest die Anwendung sie **pro Anfrage**
|
||||||
|
statt beim Start -- sonst braeuchte jede Aenderung einen Neustart des Dienstes.
|
||||||
|
|
||||||
|
nginx bekommt bewusst etwas mehr als die Anwendung: laeuft die Grenze im
|
||||||
|
Webserver zuerst auf, sieht der Benutzer die generische Fehlerseite von nginx.
|
||||||
|
Kommt die Anfrage dagegen bis zur Anwendung, kann diese erklaeren, was zu gross
|
||||||
|
war und wie viel erlaubt ist.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from flask import Request, current_app
|
||||||
|
|
||||||
|
#: Wieviel nginx mehr erlaubt als die Anwendung. Nicht null: die Anwendung soll
|
||||||
|
#: die Grenze melden duerfen, nicht der Webserver.
|
||||||
|
NGINX_ZUSCHLAG_MB = 16
|
||||||
|
|
||||||
|
#: Wird die Einstellung nicht gefunden (fruehe Anfrage, kaputte Datenbank),
|
||||||
|
#: gilt diese Grenze. Gross genug fuer den Alltag, klein genug, um nicht als
|
||||||
|
#: unbegrenzt durchzugehen.
|
||||||
|
NOTFALL_MB = 128
|
||||||
|
|
||||||
|
SETTING = "web_max_body_mb"
|
||||||
|
|
||||||
|
|
||||||
|
def limit_mb(conn: Any = None) -> int:
|
||||||
|
"""Die eingestellte Grenze in MB.
|
||||||
|
|
||||||
|
Ohne Verbindung wird die der laufenden Anfrage benutzt. Faellt irgendetwas
|
||||||
|
aus -- keine Anwendung, keine Datenbank --, gilt ``NOTFALL_MB``: eine
|
||||||
|
Groessenpruefung darf nie daran scheitern, dass sie ihre Grenze nicht
|
||||||
|
kennt.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
from .extension import core, db
|
||||||
|
|
||||||
|
extension = core()
|
||||||
|
return max(1, int(extension.settings.get(conn if conn is not None else db(), SETTING)))
|
||||||
|
except Exception: # noqa: BLE001 - Grenze muss immer eine Zahl sein
|
||||||
|
return NOTFALL_MB
|
||||||
|
|
||||||
|
|
||||||
|
def limit_bytes(conn: Any = None) -> int:
|
||||||
|
return limit_mb(conn) * 1024 * 1024
|
||||||
|
|
||||||
|
|
||||||
|
def nginx_mb(app_limit_mb: int) -> int:
|
||||||
|
"""Was in ``client_max_body_size`` gehoert."""
|
||||||
|
return max(1, int(app_limit_mb)) + NGINX_ZUSCHLAG_MB
|
||||||
|
|
||||||
|
|
||||||
|
class UploadLimitRequest(Request):
|
||||||
|
"""Anfrage, deren Groessengrenze aus der Einstellung kommt.
|
||||||
|
|
||||||
|
Flask liest ``MAX_CONTENT_LENGTH`` aus der Konfiguration -- also aus dem
|
||||||
|
Zustand beim Start des Prozesses. Bei mehreren gunicorn-Arbeitern haette
|
||||||
|
eine Aenderung damit erst nach einem Neustart in allen gewirkt. Diese
|
||||||
|
Eigenschaft fragt stattdessen die Einstellung; das ist ein Lesezugriff auf
|
||||||
|
SQLite und passiert nur, wenn eine Anfrage ueberhaupt einen Koerper hat.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def max_content_length(self) -> int | None: # type: ignore[override]
|
||||||
|
if current_app:
|
||||||
|
return limit_bytes()
|
||||||
|
return super().max_content_length
|
||||||
@@ -31,7 +31,7 @@ from ..extension import core, db, transaction
|
|||||||
from ..rbac import service as rbac
|
from ..rbac import service as rbac
|
||||||
from ..security import passwords, sessions as session_store, totp
|
from ..security import passwords, sessions as session_store, totp
|
||||||
|
|
||||||
bp = Blueprint("account", __name__, url_prefix="/konto")
|
bp = Blueprint("account", __name__, url_prefix="/account")
|
||||||
|
|
||||||
ALLOWED_AVATAR_SUFFIXES = {".png", ".jpg", ".jpeg", ".webp", ".gif"}
|
ALLOWED_AVATAR_SUFFIXES = {".png", ".jpg", ".jpeg", ".webp", ".gif"}
|
||||||
MAX_AVATAR_BYTES = 2 * 1024 * 1024
|
MAX_AVATAR_BYTES = 2 * 1024 * 1024
|
||||||
@@ -54,6 +54,19 @@ def _avatar_dir() -> Path:
|
|||||||
|
|
||||||
|
|
||||||
def _audit(conn, action: str, detail: str = "", severity: str = "info") -> None:
|
def _audit(conn, action: str, detail: str = "", severity: str = "info") -> None:
|
||||||
|
"""Protokolliert eine Aenderung am **eigenen** Konto.
|
||||||
|
|
||||||
|
Bewusst sparsam benutzt. Das Aenderungsprotokoll beantwortet die Frage
|
||||||
|
"wer hat woran etwas geaendert" -- und wer sein eigenes Passwort setzt,
|
||||||
|
ein Profilbild tauscht oder seine Anschrift korrigiert, aendert nichts,
|
||||||
|
was jemand anderen betrifft. Solche Zeilen fuellten das Protokoll und
|
||||||
|
schoben die Eintraege aus dem Blick, um die es geht.
|
||||||
|
|
||||||
|
Was hier trotzdem stehen bleibt: alles rund um den zweiten Faktor. Ob ein
|
||||||
|
Konto mit oder ohne zweiten Faktor geschuetzt ist, aendert die Staerke der
|
||||||
|
Anmeldung -- das ist die eine Selbstbedienung, nach der man nach einem
|
||||||
|
Vorfall sucht.
|
||||||
|
"""
|
||||||
audit.log(
|
audit.log(
|
||||||
conn,
|
conn,
|
||||||
actor=current_user.username,
|
actor=current_user.username,
|
||||||
@@ -80,7 +93,7 @@ def overview():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/stammdaten")
|
@bp.post("/profile")
|
||||||
@login_required
|
@login_required
|
||||||
def update_profile():
|
def update_profile():
|
||||||
if current_user.is_directory_account:
|
if current_user.is_directory_account:
|
||||||
@@ -101,12 +114,11 @@ def update_profile():
|
|||||||
current_user.id,
|
current_user.id,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
_audit(conn, "account.profile_updated")
|
|
||||||
flash("Stammdaten gespeichert.", "success")
|
flash("Stammdaten gespeichert.", "success")
|
||||||
return redirect(url_for("account.overview"))
|
return redirect(url_for("account.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/profilbild")
|
@bp.post("/avatar")
|
||||||
@login_required
|
@login_required
|
||||||
def upload_avatar():
|
def upload_avatar():
|
||||||
upload = request.files.get("avatar")
|
upload = request.files.get("avatar")
|
||||||
@@ -142,14 +154,13 @@ def upload_avatar():
|
|||||||
"UPDATE users SET avatar_filename=?, updated_at=? WHERE id=?",
|
"UPDATE users SET avatar_filename=?, updated_at=? WHERE id=?",
|
||||||
(target.name, datetime.now(timezone.utc).isoformat(timespec="seconds"), current_user.id),
|
(target.name, datetime.now(timezone.utc).isoformat(timespec="seconds"), current_user.id),
|
||||||
)
|
)
|
||||||
_audit(conn, "account.avatar_updated")
|
|
||||||
if previous:
|
if previous:
|
||||||
(_avatar_dir() / str(previous)).unlink(missing_ok=True)
|
(_avatar_dir() / str(previous)).unlink(missing_ok=True)
|
||||||
flash("Profilbild aktualisiert.", "success")
|
flash("Profilbild aktualisiert.", "success")
|
||||||
return redirect(url_for("account.overview"))
|
return redirect(url_for("account.overview"))
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/profilbild/<path:filename>")
|
@bp.get("/avatar/<path:filename>")
|
||||||
@login_required
|
@login_required
|
||||||
def avatar(filename: str):
|
def avatar(filename: str):
|
||||||
safe = secure_filename(filename)
|
safe = secure_filename(filename)
|
||||||
@@ -163,7 +174,7 @@ def avatar(filename: str):
|
|||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/sicherheit")
|
@bp.get("/security")
|
||||||
@login_required
|
@login_required
|
||||||
def security():
|
def security():
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -199,7 +210,7 @@ def security():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/passwort")
|
@bp.post("/password")
|
||||||
@login_required
|
@login_required
|
||||||
def change_password():
|
def change_password():
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -229,21 +240,15 @@ def change_password():
|
|||||||
revoked = session_store.revoke_all_for_user(
|
revoked = session_store.revoke_all_for_user(
|
||||||
conn, current_user.id, except_sid=getattr(session, "sid", ""), reason="password-change"
|
conn, current_user.id, except_sid=getattr(session, "sid", ""), reason="password-change"
|
||||||
)
|
)
|
||||||
_audit(
|
|
||||||
conn,
|
|
||||||
"account.password_changed",
|
|
||||||
f"{revoked} weitere Sitzungen beendet",
|
|
||||||
severity="notice",
|
|
||||||
)
|
|
||||||
except rbac.ValidationError as exc:
|
except rbac.ValidationError as exc:
|
||||||
flash(str(exc), "danger")
|
flash(str(exc), "danger")
|
||||||
return redirect(url_for("account.security"))
|
return redirect(url_for("account.security"))
|
||||||
|
|
||||||
flash("Passwort geaendert. Andere Sitzungen wurden beendet.", "success")
|
flash(f"Passwort geaendert. {revoked} weitere Sitzung(en) wurden beendet.", "success")
|
||||||
return redirect(url_for("account.security"))
|
return redirect(url_for("account.security"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/zwei-faktor/starten")
|
@bp.post("/two-factor/start")
|
||||||
@login_required
|
@login_required
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def totp_start():
|
def totp_start():
|
||||||
@@ -252,7 +257,7 @@ def totp_start():
|
|||||||
return redirect(url_for("account.security"))
|
return redirect(url_for("account.security"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/zwei-faktor/bestaetigen")
|
@bp.post("/two-factor/confirm")
|
||||||
@login_required
|
@login_required
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def totp_confirm():
|
def totp_confirm():
|
||||||
@@ -295,7 +300,7 @@ def totp_confirm():
|
|||||||
return redirect(url_for("account.security"))
|
return redirect(url_for("account.security"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/zwei-faktor/deaktivieren")
|
@bp.post("/two-factor/disable")
|
||||||
@login_required
|
@login_required
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def totp_disable():
|
def totp_disable():
|
||||||
@@ -317,7 +322,7 @@ def totp_disable():
|
|||||||
return redirect(url_for("account.security"))
|
return redirect(url_for("account.security"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/zwei-faktor/codes-erneuern")
|
@bp.post("/two-factor/recovery-codes")
|
||||||
@login_required
|
@login_required
|
||||||
@reauth_required
|
@reauth_required
|
||||||
def recovery_codes():
|
def recovery_codes():
|
||||||
@@ -341,7 +346,7 @@ def recovery_codes():
|
|||||||
return redirect(url_for("account.security"))
|
return redirect(url_for("account.security"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/sitzungen/<sid>/beenden")
|
@bp.post("/sessions/<sid>/end")
|
||||||
@login_required
|
@login_required
|
||||||
def revoke_session(sid: str):
|
def revoke_session(sid: str):
|
||||||
conn = db()
|
conn = db()
|
||||||
@@ -350,18 +355,16 @@ def revoke_session(sid: str):
|
|||||||
abort(404)
|
abort(404)
|
||||||
with transaction():
|
with transaction():
|
||||||
session_store.revoke(conn, sid, reason="self")
|
session_store.revoke(conn, sid, reason="self")
|
||||||
_audit(conn, "account.session_revoked", sid[:12])
|
|
||||||
flash("Sitzung beendet.", "success")
|
flash("Sitzung beendet.", "success")
|
||||||
return redirect(url_for("account.security"))
|
return redirect(url_for("account.security"))
|
||||||
|
|
||||||
|
|
||||||
@bp.post("/sitzungen/alle-beenden")
|
@bp.post("/sessions/end-all")
|
||||||
@login_required
|
@login_required
|
||||||
def revoke_other_sessions():
|
def revoke_other_sessions():
|
||||||
with transaction() as conn:
|
with transaction() as conn:
|
||||||
count = session_store.revoke_all_for_user(
|
count = session_store.revoke_all_for_user(
|
||||||
conn, current_user.id, except_sid=getattr(session, "sid", ""), reason="self"
|
conn, current_user.id, except_sid=getattr(session, "sid", ""), reason="self"
|
||||||
)
|
)
|
||||||
_audit(conn, "account.sessions_revoked", f"{count} Sitzungen")
|
|
||||||
flash(f"{count} weitere Sitzung(en) beendet.", "success")
|
flash(f"{count} weitere Sitzung(en) beendet.", "success")
|
||||||
return redirect(url_for("account.security"))
|
return redirect(url_for("account.security"))
|
||||||