mirror of https://github.com/jumpserver/jumpserver
perf: 优化 url
parent
f466904a1c
commit
8ed8d6f01c
|
@ -106,15 +106,15 @@ class Account(AbsConnectivity, BaseAccount):
|
||||||
def get_anonymous_account(cls):
|
def get_anonymous_account(cls):
|
||||||
return cls(name=AliasAccount.ANON.label, username=AliasAccount.ANON.value, secret=None)
|
return cls(name=AliasAccount.ANON.label, username=AliasAccount.ANON.value, secret=None)
|
||||||
|
|
||||||
@lazyproperty
|
|
||||||
def versions(self):
|
|
||||||
return self.history.count()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_user_account(cls):
|
def get_user_account(cls):
|
||||||
""" @USER 动态用户的账号(self) """
|
""" @USER 动态用户的账号(self) """
|
||||||
return cls(name=AliasAccount.USER.label, username=AliasAccount.USER.value, secret=None)
|
return cls(name=AliasAccount.USER.label, username=AliasAccount.USER.value, secret=None)
|
||||||
|
|
||||||
|
@lazyproperty
|
||||||
|
def versions(self):
|
||||||
|
return self.history.count()
|
||||||
|
|
||||||
def get_su_from_accounts(self):
|
def get_su_from_accounts(self):
|
||||||
""" 排除自己和以自己为 su-from 的账号 """
|
""" 排除自己和以自己为 su-from 的账号 """
|
||||||
return self.asset.accounts.exclude(id=self.id).exclude(su_from=self)
|
return self.asset.accounts.exclude(id=self.id).exclude(su_from=self)
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
from django.db.models import TextChoices
|
from django.db.models import TextChoices
|
||||||
from .utils import ServicesUtil
|
|
||||||
from .hands import *
|
from .hands import *
|
||||||
|
from .utils import ServicesUtil
|
||||||
|
|
||||||
|
|
||||||
class Services(TextChoices):
|
class Services(TextChoices):
|
||||||
|
@ -97,7 +99,7 @@ class BaseActionCommand(BaseCommand):
|
||||||
cores = multiprocessing.cpu_count() * 2 + 1
|
cores = multiprocessing.cpu_count() * 2 + 1
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'services', nargs='+', choices=Services.export_services_values(), help='Service',
|
'services', nargs='+', choices=Services.export_services_values(), help='Service',
|
||||||
)
|
)
|
||||||
parser.add_argument('-d', '--daemon', nargs="?", const=True)
|
parser.add_argument('-d', '--daemon', nargs="?", const=True)
|
||||||
parser.add_argument('-w', '--worker', type=int, nargs="?", default=cores)
|
parser.add_argument('-w', '--worker', type=int, nargs="?", default=cores)
|
||||||
|
|
|
@ -49,13 +49,11 @@ if settings.XPACK_ENABLED:
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.IndexView.as_view(), name='index'),
|
path('', views.IndexView.as_view(), name='index'),
|
||||||
path('api/v1/', include(api_v1)),
|
path('api/v1/', include(api_v1)),
|
||||||
re_path('api/(?P<app>\w+)/(?P<version>v\d)/.*', views.redirect_format_api),
|
|
||||||
path('api/health/', api.HealthCheckView.as_view(), name="health"),
|
path('api/health/', api.HealthCheckView.as_view(), name="health"),
|
||||||
path('api/v1/health/', api.HealthCheckView.as_view(), name="health_v1"),
|
path('api/v1/health/', api.HealthCheckView.as_view(), name="health_v1"),
|
||||||
# External apps url
|
# External apps url
|
||||||
path('core/auth/captcha/', include('captcha.urls')),
|
path('core/auth/captcha/', include('captcha.urls')),
|
||||||
path('core/', include(app_view_patterns)),
|
path('core/', include(app_view_patterns)),
|
||||||
path('ui/', views.UIView.as_view()),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# 静态文件处理路由
|
# 静态文件处理路由
|
||||||
|
@ -66,7 +64,9 @@ urlpatterns += [
|
||||||
]
|
]
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
urlpatterns += static('/luna/', document_root=(settings.DATA_DIR + '/luna'))
|
urlpatterns += static('/luna/', document_root=(settings.DATA_DIR + '/luna'))
|
||||||
urlpatterns += static('/lina/', document_root=(settings.DATA_DIR + '/lina'))
|
urlpatterns += static('/ui/', document_root=(settings.DATA_DIR + '/lina'))
|
||||||
|
else:
|
||||||
|
urlpatterns += path('ui/', views.UIView.as_view()),
|
||||||
|
|
||||||
# js i18n 路由文件
|
# js i18n 路由文件
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
|
|
Loading…
Reference in New Issue