mirror of https://github.com/jumpserver/jumpserver
parent
a1ded0c737
commit
f504413d7f
|
@ -19,10 +19,10 @@ from common.utils.timezone import local_now, local_zero_hour
|
|||
from ops.const import JobStatus
|
||||
from orgs.caches import OrgResourceStatisticsCache
|
||||
from orgs.utils import current_org
|
||||
from terminal.const import RiskLevelChoices
|
||||
from terminal.models import Session, Command
|
||||
from terminal.utils import ComponentsPrometheusMetricsUtil
|
||||
from users.models import User
|
||||
from terminal.const import RiskLevelChoices
|
||||
|
||||
__all__ = ['IndexApi']
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
from django.conf import settings
|
||||
from rest_framework import generics
|
||||
from rest_framework.permissions import AllowAny
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from common.utils import get_logger
|
||||
from jumpserver.conf import Config
|
||||
|
@ -10,6 +12,7 @@ from rbac.permissions import RBACPermission
|
|||
from .. import serializers
|
||||
from ..models import Setting
|
||||
from ..signals import category_setting_updated
|
||||
from ..utils import get_interface_setting_or_default
|
||||
|
||||
logger = get_logger(__file__)
|
||||
|
||||
|
@ -139,3 +142,19 @@ class SettingsApi(generics.RetrieveUpdateAPIView):
|
|||
if hasattr(serializer, 'post_save'):
|
||||
serializer.post_save()
|
||||
self.send_signal(serializer)
|
||||
|
||||
|
||||
class SettingsLogoApi(APIView):
|
||||
permission_classes = (AllowAny,)
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
from django.views.static import serve
|
||||
size = request.GET.get('size', 'small')
|
||||
interface_data = get_interface_setting_or_default()
|
||||
if size == 'small':
|
||||
logo_path = interface_data['logo_logout']
|
||||
else:
|
||||
logo_path = interface_data['logo_index']
|
||||
|
||||
logo_path = logo_path.replace('/static/', '/')
|
||||
return serve(request, logo_path, document_root=settings.STATIC_ROOT)
|
||||
|
|
|
@ -20,6 +20,7 @@ urlpatterns = [
|
|||
path('sms/backend/', api.SMSBackendAPI.as_view(), name='sms-backend'),
|
||||
|
||||
path('setting/', api.SettingsApi.as_view(), name='settings-setting'),
|
||||
path('logo/', api.SettingsLogoApi.as_view(), name='settings-logo'),
|
||||
path('public/', api.PublicSettingApi.as_view(), name='public-setting'),
|
||||
path('public/open/', api.OpenPublicSettingApi.as_view(), name='open-public-setting'),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue