Merge branch 'dev' of github.com:jumpserver/jumpserver into dev

pull/4090/head
ibuler 2020-06-09 15:16:01 +08:00
commit 820186c6d0
3 changed files with 27 additions and 2 deletions

View File

@ -16,6 +16,7 @@ import json
import yaml import yaml
from importlib import import_module from importlib import import_module
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.contrib.staticfiles.templatetags.staticfiles import static
from urllib.parse import urljoin, urlparse from urllib.parse import urljoin, urlparse
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@ -446,6 +447,29 @@ class DynamicConfig:
except: except:
return False return False
def LOGO_URLS(self):
logo_urls = {'logo_logout': static('img/logo.png'),
'logo_index': static('img/logo_text.png'),
'login_image': static('img/login_image.png'),
'favicon': static('img/facio.ico')}
if not HAS_XPACK:
return logo_urls
try:
from xpack.plugins.interface.models import Interface
obj = Interface.interface()
if obj:
if obj.logo_logout:
logo_urls.update({'logo_logout': obj.logo_logout.url})
if obj.logo_index:
logo_urls.update({'logo_index': obj.logo_index.url})
if obj.login_image:
logo_urls.update({'login_image': obj.login_image.url})
if obj.favicon:
logo_urls.update({'favicon': obj.favicon.url})
except:
pass
return logo_urls
def get_from_db(self, item): def get_from_db(self, item):
if self.db_setting is not None: if self.db_setting is not None:
value = self.db_setting.get(item) value = self.db_setting.get(item)
@ -641,4 +665,3 @@ class ConfigManager:
@classmethod @classmethod
def get_dynamic_config(cls, config): def get_dynamic_config(cls, config):
return DynamicConfig(config) return DynamicConfig(config)

View File

@ -89,3 +89,4 @@ WINDOWS_SKIP_ALL_MANUAL_PASSWORD = CONFIG.WINDOWS_SKIP_ALL_MANUAL_PASSWORD
# XPACK # XPACK
XPACK_LICENSE_IS_VALID = DYNAMIC.XPACK_LICENSE_IS_VALID XPACK_LICENSE_IS_VALID = DYNAMIC.XPACK_LICENSE_IS_VALID
LOGO_URLS = DYNAMIC.LOGO_URLS

View File

@ -274,7 +274,8 @@ class PublicSettingApi(generics.RetrieveAPIView):
"XPACK_LICENSE_IS_VALID": settings.XPACK_LICENSE_IS_VALID, "XPACK_LICENSE_IS_VALID": settings.XPACK_LICENSE_IS_VALID,
"LOGIN_CONFIRM_ENABLE": settings.LOGIN_CONFIRM_ENABLE, "LOGIN_CONFIRM_ENABLE": settings.LOGIN_CONFIRM_ENABLE,
"SECURITY_VIEW_AUTH_NEED_MFA": settings.SECURITY_VIEW_AUTH_NEED_MFA, "SECURITY_VIEW_AUTH_NEED_MFA": settings.SECURITY_VIEW_AUTH_NEED_MFA,
"SECURITY_MFA_VERIFY_TTL": settings.SECURITY_MFA_VERIFY_TTL "SECURITY_MFA_VERIFY_TTL": settings.SECURITY_MFA_VERIFY_TTL,
"LOGO_URLS": settings.LOGO_URLS
} }
} }
return instance return instance