mirror of https://github.com/jumpserver/jumpserver
commit
3f4814a392
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 5.6 KiB |
|
@ -87,6 +87,7 @@ class DownloadUploadMixin:
|
|||
class AppletViewSet(DownloadUploadMixin, JMSBulkModelViewSet):
|
||||
queryset = Applet.objects.all()
|
||||
serializer_class = serializers.AppletSerializer
|
||||
filterset_fields = ['name', 'version', 'builtin', 'is_active']
|
||||
search_fields = ['name', 'display_name', 'author']
|
||||
rbac_perms = {
|
||||
'upload': 'terminal.add_applet',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
## Navicat Premium
|
||||
|
||||
- 需要先手动导入License激活
|
||||
|
|
|
@ -11,6 +11,7 @@ from django.utils.translation import gettext_lazy as _
|
|||
from rest_framework.serializers import ValidationError
|
||||
|
||||
from common.db.models import JMSBaseModel
|
||||
from common.utils import lazyproperty
|
||||
|
||||
__all__ = ['Applet', 'AppletPublication']
|
||||
|
||||
|
@ -48,6 +49,14 @@ class Applet(JMSBaseModel):
|
|||
else:
|
||||
return default_storage.path('applets/{}'.format(self.name))
|
||||
|
||||
@lazyproperty
|
||||
def readme(self):
|
||||
readme_file = os.path.join(self.path, 'README.md')
|
||||
if os.path.isfile(readme_file):
|
||||
with open(readme_file, 'r') as f:
|
||||
return f.read()
|
||||
return ''
|
||||
|
||||
@property
|
||||
def manifest(self):
|
||||
path = os.path.join(self.path, 'manifest.yml')
|
||||
|
|
|
@ -31,7 +31,7 @@ class AppletSerializer(serializers.ModelSerializer):
|
|||
model = Applet
|
||||
fields_mini = ['id', 'name', 'display_name', 'is_active']
|
||||
read_only_fields = [
|
||||
'icon', 'date_created', 'date_updated',
|
||||
'icon', 'readme', 'date_created', 'date_updated',
|
||||
]
|
||||
fields = fields_mini + [
|
||||
'version', 'author', 'type', 'protocols',
|
||||
|
|
Loading…
Reference in New Issue