diff --git a/.build_number b/.build_number index bdd1371..2c2c772 100644 --- a/.build_number +++ b/.build_number @@ -1 +1 @@ -251260452 \ No newline at end of file +251260501 \ No newline at end of file diff --git a/backend/app/assets/branding/favicon.ico b/backend/app/assets/branding/favicon.ico new file mode 100644 index 0000000..68b4d3d Binary files /dev/null and b/backend/app/assets/branding/favicon.ico differ diff --git a/backend/app/assets/branding/logo.png b/backend/app/assets/branding/logo.png new file mode 100644 index 0000000..d76a78a Binary files /dev/null and b/backend/app/assets/branding/logo.png differ diff --git a/backend/app/routers/branding.py b/backend/app/routers/branding.py index 7034810..225776a 100644 --- a/backend/app/routers/branding.py +++ b/backend/app/routers/branding.py @@ -11,6 +11,9 @@ router = APIRouter(prefix="/branding", tags=["branding"]) _BRANDING_DIR = os.path.join(os.getcwd(), "data", "branding") _LOGO_PATH = os.path.join(_BRANDING_DIR, "logo.png") _FAVICON_PATH = os.path.join(_BRANDING_DIR, "favicon.ico") +_BUNDLED_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "assets", "branding")) +_BUNDLED_LOGO_PATH = os.path.join(_BUNDLED_DIR, "logo.png") +_BUNDLED_FAVICON_PATH = os.path.join(_BUNDLED_DIR, "favicon.ico") def _ensure_branding_dir() -> None: @@ -41,6 +44,18 @@ def _ensure_default_branding() -> None: if os.path.exists(_LOGO_PATH) and os.path.exists(_FAVICON_PATH): return _ensure_branding_dir() + if not os.path.exists(_LOGO_PATH) and os.path.exists(_BUNDLED_LOGO_PATH): + try: + with open(_BUNDLED_LOGO_PATH, "rb") as source, open(_LOGO_PATH, "wb") as target: + target.write(source.read()) + except OSError: + pass + if not os.path.exists(_FAVICON_PATH) and os.path.exists(_BUNDLED_FAVICON_PATH): + try: + with open(_BUNDLED_FAVICON_PATH, "rb") as source, open(_FAVICON_PATH, "wb") as target: + target.write(source.read()) + except OSError: + pass if not os.path.exists(_LOGO_PATH): image = Image.new("RGBA", (300, 300), (12, 18, 28, 255)) draw = ImageDraw.Draw(image)