diff --git a/paskia/db/structs.py b/paskia/db/structs.py index edd35c7..591f47d 100644 --- a/paskia/db/structs.py +++ b/paskia/db/structs.py @@ -1,5 +1,6 @@ from __future__ import annotations +import hashlib import secrets from datetime import UTC, datetime from uuid import UUID @@ -9,6 +10,7 @@ import uuid7 from paskia import db from paskia.util.hostutil import normalize_host +from paskia.util.passphrase import generate as generate_passphrase # Sentinel for uuid fields before they are set by create() or DB post init _UUID_UNSET = UUID(int=0) @@ -373,10 +375,6 @@ class ResetToken(msgspec.Struct, dict=True): Tuple of (token, passphrase) where passphrase is the human-readable code to give to the user. """ - import hashlib - - from paskia.util.passphrase import generate as generate_passphrase - if passphrase is None: passphrase = generate_passphrase() key = hashlib.sha512(passphrase.encode()).digest()[:9] diff --git a/paskia/util/startupbox.py b/paskia/util/startupbox.py index ca71727..01313e8 100644 --- a/paskia/util/startupbox.py +++ b/paskia/util/startupbox.py @@ -45,24 +45,24 @@ def bottom() -> str: def print_startup_config(config: "PaskiaConfig") -> None: """Print server configuration on startup.""" # Key graphic with yellow shading (bright for highlights, dark for body) - Y = YELLOW # Dark yellow for main body - B = BRIGHT_YELLOW # Bright yellow for highlights/edges - W = BRIGHT_WHITE # Bold white for URL - R = RESET + y = YELLOW # Dark yellow for main body + b = BRIGHT_YELLOW # Bright yellow for highlights/edges + w = BRIGHT_WHITE # Bold white for URL + r = RESET lines = [top()] - lines.append(line(f" {B}▄▄▄▄▄{R}")) - lines.append(line(f"{B}█{Y} {B}█{R} Paskia " + __version__)) - lines.append(line(f"{B}█{Y} {B}█{Y}▄▄▄▄▄▄▄▄▄▄▄▄{R}")) + lines.append(line(f" {b}▄▄▄▄▄{r}")) + lines.append(line(f"{b}█{y} {b}█{r} Paskia " + __version__)) + lines.append(line(f"{b}█{y} {b}█{y}▄▄▄▄▄▄▄▄▄▄▄▄{r}")) lines.append( line( - f"{B}█{Y} {B}█{Y}▀▀▀▀{B}█{Y}▀▀{B}█{Y}▀▀{B}█{R} {W}" + f"{b}█{y} {b}█{y}▀▀▀▀{b}█{y}▀▀{b}█{y}▀▀{b}█{r} {w}" + config.site_url + config.site_path - + R + + r ) ) - lines.append(line(f" {Y}▀▀▀▀▀{R}")) + lines.append(line(f" {y}▀▀▀▀▀{r}")) # Format auth host section if config.auth_host: