Revert to frontend svg logo

This commit is contained in:
Oliver Walters 2026-06-24 12:02:56 +00:00
parent df66006d2a
commit ed9cc5d595
2 changed files with 17 additions and 8 deletions

View File

@ -307,7 +307,7 @@ class InfoView(APIView):
'docker_mode': settings.DOCKER,
'default_locale': settings.LANGUAGE_CODE,
'customize': {
'logo': helpers.getLogoImage(),
'logo': helpers.getLogoImage(backup=False),
'splash': helpers.getSplashScreen(),
'login_message': helpers.getCustomOption('login_message'),
'navbar_message': helpers.getCustomOption('navbar_message'),

View File

@ -262,8 +262,14 @@ def checkStaticFile(*args) -> bool:
return static_storage.exists(str(fn))
def getLogoImage(as_file=False, custom=True):
"""Return the InvenTree logo image, or a custom logo if available."""
def getLogoImage(as_file: bool = False, custom: bool = True, backup: bool = True):
"""Return the InvenTree logo image, or a custom logo if available.
Arguments:
as_file: Return a file path instead of a URL (default = False)
custom: Use a custom logo if available (default = True)
backup: Use a backup logo if available (default = True)
"""
if custom and settings.CUSTOM_LOGO:
static_storage = StaticFilesStorage()
@ -279,11 +285,14 @@ def getLogoImage(as_file=False, custom=True):
return f'file://{storage.path(settings.CUSTOM_LOGO)}'
return storage.url(settings.CUSTOM_LOGO)
# If we have got to this point, return the default logo
if as_file:
path = settings.STATIC_ROOT.joinpath('img/inventree.png')
return f'file://{path}'
return getStaticUrl('img/inventree.png')
# If we have got to this point, return the default logo (if requested)
if backup:
if as_file:
path = settings.STATIC_ROOT.joinpath('img/inventree.png')
return f'file://{path}'
return getStaticUrl('img/inventree.png')
return None
def getSplashScreen(custom=True):