Compare commits
1 Commits
251260452
...
57a4883931
| Author | SHA1 | Date | |
|---|---|---|---|
| 57a4883931 |
@@ -1 +1 @@
|
|||||||
251260452
|
251260501
|
||||||
BIN
backend/app/assets/branding/favicon.ico
Normal file
BIN
backend/app/assets/branding/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
BIN
backend/app/assets/branding/logo.png
Normal file
BIN
backend/app/assets/branding/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -11,6 +11,9 @@ router = APIRouter(prefix="/branding", tags=["branding"])
|
|||||||
_BRANDING_DIR = os.path.join(os.getcwd(), "data", "branding")
|
_BRANDING_DIR = os.path.join(os.getcwd(), "data", "branding")
|
||||||
_LOGO_PATH = os.path.join(_BRANDING_DIR, "logo.png")
|
_LOGO_PATH = os.path.join(_BRANDING_DIR, "logo.png")
|
||||||
_FAVICON_PATH = os.path.join(_BRANDING_DIR, "favicon.ico")
|
_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:
|
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):
|
if os.path.exists(_LOGO_PATH) and os.path.exists(_FAVICON_PATH):
|
||||||
return
|
return
|
||||||
_ensure_branding_dir()
|
_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):
|
if not os.path.exists(_LOGO_PATH):
|
||||||
image = Image.new("RGBA", (300, 300), (12, 18, 28, 255))
|
image = Image.new("RGBA", (300, 300), (12, 18, 28, 255))
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image)
|
||||||
|
|||||||
Reference in New Issue
Block a user