perf: 支持公告

pull/6973/head
ibuler 3 years ago
parent a558ee2ac0
commit 0533b77b1b

@ -144,6 +144,10 @@ class Config(dict):
'GLOBAL_ORG_DISPLAY_NAME': '',
'SITE_URL': 'http://localhost:8080',
'USER_GUIDE_URL': '',
'ANNOUNCEMENT_ENABLED': True,
'ANNOUNCEMENT': {},
'CAPTCHA_TEST_MODE': None,
'TOKEN_EXPIRATION': 3600 * 24,
'DISPLAY_PER_PAGE': 25,

@ -149,3 +149,7 @@ TENCENT_SECRET_ID = CONFIG.TENCENT_SECRET_ID
TENCENT_SECRET_KEY = CONFIG.TENCENT_SECRET_KEY
TENCENT_SDKAPPID = CONFIG.TENCENT_SDKAPPID
TENCENT_SMS_SIGN_AND_TEMPLATES = CONFIG.TENCENT_SMS_SIGN_AND_TEMPLATES
# 公告
ANNOUNCEMENT_ENABLED = CONFIG.ANNOUNCEMENT_ENABLED
ANNOUNCEMENT = CONFIG.ANNOUNCEMENT

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-23 11:11+0800\n"
"POT-Creation-Date: 2021-09-28 16:34+0800\n"
"PO-Revision-Date: 2021-05-20 10:54+0800\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\n"
@ -658,7 +658,8 @@ msgstr "复核"
msgid "Filter"
msgstr "过滤器"
#: assets/models/cmd_filter.py:56 xpack/plugins/license/models.py:29
#: assets/models/cmd_filter.py:56 settings/serializers/basic.py:7
#: xpack/plugins/license/models.py:29
msgid "Content"
msgstr "内容"
@ -1131,7 +1132,7 @@ msgstr "修改者"
msgid "Disabled"
msgstr "禁用"
#: audits/models.py:96 settings/models.py:33
#: audits/models.py:96 settings/models.py:33 settings/serializers/basic.py:12
msgid "Enabled"
msgstr "启用"
@ -2544,7 +2545,7 @@ msgstr "测试手机号 该字段是必填项。"
msgid "Test success"
msgstr "测试成功"
#: settings/api/email.py:21
#: settings/api/email.py:22
msgid "Test mail sent to {}, please check"
msgstr "邮件已经发送{}, 请检查"
@ -2605,7 +2606,7 @@ msgstr "企业微信 认证"
msgid "SSO Auth"
msgstr "SSO Token 认证"
#: settings/serializers/auth/base.py:19 settings/serializers/basic.py:15
#: settings/serializers/auth/base.py:19 settings/serializers/basic.py:30
msgid "Forgot password url"
msgstr "忘记密码 URL"
@ -2818,7 +2819,7 @@ msgid "SMS provider"
msgstr "短信服务商"
#: settings/serializers/auth/sms.py:17 settings/serializers/auth/sms.py:35
#: settings/serializers/auth/sms.py:43 settings/serializers/email.py:69
#: settings/serializers/auth/sms.py:43 settings/serializers/email.py:63
msgid "Signature"
msgstr "签名"
@ -2851,23 +2852,31 @@ msgstr "单位: 秒"
msgid "Enable WeCom Auth"
msgstr "启用企业微信认证"
#: settings/serializers/basic.py:7
#: settings/serializers/basic.py:6
msgid "Subject"
msgstr "主题"
#: settings/serializers/basic.py:10
msgid "More url"
msgstr "更多信息链接"
#: settings/serializers/basic.py:22
msgid "Site url"
msgstr "当前站点URL"
#: settings/serializers/basic.py:8
#: settings/serializers/basic.py:23
msgid "eg: http://dev.jumpserver.org:8080"
msgstr "如: http://dev.jumpserver.org:8080"
#: settings/serializers/basic.py:11
#: settings/serializers/basic.py:26
msgid "User guide url"
msgstr "用户向导URL"
#: settings/serializers/basic.py:12
#: settings/serializers/basic.py:27
msgid "User first login update profile done redirect to it"
msgstr "用户第一次登录修改profile后重定向到地址, 可以是 wiki 或 其他说明文档"
#: settings/serializers/basic.py:16
#: settings/serializers/basic.py:31
msgid ""
"The forgot password url on login page, If you use ldap or cas external "
"authentication, you can set it"
@ -2875,14 +2884,22 @@ msgstr ""
"登录页面忘记密码URL, 如果使用了 LDAP, OPENID 等外部认证系统,可以自定义用户重"
"置密码访问的地址"
#: settings/serializers/basic.py:20
#: settings/serializers/basic.py:35
msgid "Global organization name"
msgstr "全局组织名"
#: settings/serializers/basic.py:21
#: settings/serializers/basic.py:36
msgid "The name of global organization to display"
msgstr "全局组织的显示名称,默认为 全局组织"
#: settings/serializers/basic.py:38
msgid "Announcement enabled"
msgstr "启用公告"
#: settings/serializers/basic.py:39
msgid "Announcement"
msgstr "公告"
#: settings/serializers/cleaning.py:10
msgid "Login log keep days"
msgstr "登录日志"
@ -2909,89 +2926,89 @@ msgstr "上传下载"
msgid "Cloud sync record keep days"
msgstr "云同步记录"
#: settings/serializers/email.py:24
#: settings/serializers/email.py:18
msgid "SMTP host"
msgstr "SMTP 主机"
#: settings/serializers/email.py:25
#: settings/serializers/email.py:19
msgid "SMTP port"
msgstr "SMTP 端口"
#: settings/serializers/email.py:26
#: settings/serializers/email.py:20
msgid "SMTP account"
msgstr "SMTP 账号"
#: settings/serializers/email.py:28
#: settings/serializers/email.py:22
msgid "SMTP password"
msgstr "SMTP 密码"
#: settings/serializers/email.py:29
#: settings/serializers/email.py:23
msgid "Tips: Some provider use token except password"
msgstr "提示:一些邮件提供商需要输入的是授权码"
#: settings/serializers/email.py:32
#: settings/serializers/email.py:26
msgid "Send user"
msgstr "发件人"
#: settings/serializers/email.py:33
#: settings/serializers/email.py:27
msgid "Tips: Send mail account, default SMTP account as the send account"
msgstr "提示:发送邮件账号,默认使用 SMTP 账号作为发送账号"
#: settings/serializers/email.py:36
#: settings/serializers/email.py:30
msgid "Test recipient"
msgstr "测试收件人"
#: settings/serializers/email.py:37
#: settings/serializers/email.py:31
msgid "Tips: Used only as a test mail recipient"
msgstr "提示:仅用来作为测试邮件收件人"
#: settings/serializers/email.py:40
#: settings/serializers/email.py:34
msgid "Use SSL"
msgstr "使用 SSL"
#: settings/serializers/email.py:41
#: settings/serializers/email.py:35
msgid "If SMTP port is 465, may be select"
msgstr "如果SMTP端口是465通常需要启用 SSL"
#: settings/serializers/email.py:44
#: settings/serializers/email.py:38
msgid "Use TLS"
msgstr "使用 TLS"
#: settings/serializers/email.py:45
#: settings/serializers/email.py:39
msgid "If SMTP port is 587, may be select"
msgstr "如果SMTP端口是587通常需要启用 TLS"
#: settings/serializers/email.py:48
#: settings/serializers/email.py:42
msgid "Subject prefix"
msgstr "主题前缀"
#: settings/serializers/email.py:55
#: settings/serializers/email.py:49
msgid "Create user email subject"
msgstr "邮件主题"
#: settings/serializers/email.py:56
#: settings/serializers/email.py:50
msgid ""
"Tips: When creating a user, send the subject of the email (eg:Create account "
"successfully)"
msgstr "提示: 创建用户时,发送设置密码邮件的主题 (例如: 创建用户成功)"
#: settings/serializers/email.py:60
#: settings/serializers/email.py:54
msgid "Create user honorific"
msgstr "邮件的敬语"
#: settings/serializers/email.py:61
#: settings/serializers/email.py:55
msgid "Tips: When creating a user, send the honorific of the email (eg:Hello)"
msgstr "提示: 创建用户时,发送设置密码邮件的敬语 (例如: 您好)"
#: settings/serializers/email.py:65
#: settings/serializers/email.py:59
msgid "Create user email content"
msgstr "邮件的内容"
#: settings/serializers/email.py:66
#: settings/serializers/email.py:60
msgid "Tips:When creating a user, send the content of the email"
msgstr "提示: 创建用户时,发送设置密码邮件的内容"
#: settings/serializers/email.py:70
#: settings/serializers/email.py:64
msgid "Tips: Email signature (eg:jumpserver)"
msgstr "邮件署名 (如:jumpserver)"
@ -3872,7 +3889,7 @@ msgstr "测试成功"
msgid "Test failure: Account invalid"
msgstr "测试失败: 账户无效"
#: terminal/api/terminal.py:39
#: terminal/api/terminal.py:41
msgid "Have online sessions"
msgstr "有在线会话"
@ -4265,7 +4282,7 @@ msgstr "文档类型"
msgid "Ignore Certificate Verification"
msgstr "忽略证书认证"
#: terminal/serializers/terminal.py:78 terminal/serializers/terminal.py:86
#: terminal/serializers/terminal.py:80 terminal/serializers/terminal.py:88
msgid "Not found"
msgstr "没有发现"
@ -5676,7 +5693,7 @@ msgstr "* 新密码不能是最近 {} 次的密码"
msgid "Reset password success, return to login page"
msgstr "重置密码成功,返回到登录页面"
#: xpack/plugins/change_auth_plan/api/app.py:113
#: xpack/plugins/change_auth_plan/api/app.py:112
#: xpack/plugins/change_auth_plan/api/asset.py:100
msgid "The parameter 'action' must be [{}]"
msgstr "参数 'action' 必须是 [{}]"
@ -6061,68 +6078,50 @@ msgid "AF-Johannesburg"
msgstr "非洲-约翰内斯堡"
#: xpack/plugins/cloud/providers/huaweicloud.py:36
msgid "CN North-Beijing4"
msgstr "华北-北京4"
msgid "AP-Bangkok"
msgstr "亚太-曼谷"
#: xpack/plugins/cloud/providers/huaweicloud.py:37
msgid "CN North-Beijing1"
msgstr "华北-北京1"
#, fuzzy
#| msgid "CN-Hong Kong"
msgid "AP-Hong Kong"
msgstr "中国-香港"
#: xpack/plugins/cloud/providers/huaweicloud.py:38
msgid "CN East-Shanghai2"
msgstr "华东-上海2"
msgid "AP-Singapore"
msgstr "亚太-新加坡"
#: xpack/plugins/cloud/providers/huaweicloud.py:39
msgid "CN East-Shanghai1"
msgstr "华东-上海1"
#: xpack/plugins/cloud/providers/huaweicloud.py:40
msgid "CN South-Guangzhou"
msgstr "华南-广州"
msgid "CN East-Shanghai2"
msgstr "华东-上海2"
#: xpack/plugins/cloud/providers/huaweicloud.py:41
msgid "LA-Mexico City1"
msgstr "拉美-墨西哥城一"
msgid "CN North-Beijing1"
msgstr "华北-北京1"
#: xpack/plugins/cloud/providers/huaweicloud.py:42
msgid "LA-Santiago"
msgstr "拉美-圣地亚哥"
msgid "CN North-Beijing4"
msgstr "华北-北京4"
#: xpack/plugins/cloud/providers/huaweicloud.py:43
msgid "LA-Sao Paulo1"
msgstr "拉美-圣保罗一"
msgid "CN Northeast-Dalian"
msgstr "华北-大连"
#: xpack/plugins/cloud/providers/huaweicloud.py:44
msgid "EU-Paris"
msgstr "欧洲-巴黎"
msgid "CN South-Guangzhou"
msgstr "华南-广州"
#: xpack/plugins/cloud/providers/huaweicloud.py:45
msgid "CN Southwest-Guiyang1"
msgstr "西南-贵阳1"
#: xpack/plugins/cloud/providers/huaweicloud.py:46
msgid "AP-Bangkok"
msgstr "亚太-曼谷"
#: xpack/plugins/cloud/providers/huaweicloud.py:47
msgid "AP-Singapore"
msgstr "亚太-新加坡"
#: xpack/plugins/cloud/providers/huaweicloud.py:48
msgid "CN-Hong Kong"
msgstr "中国-香港"
#: xpack/plugins/cloud/providers/huaweicloud.py:50
msgid "CN Northeast-Dalian"
msgstr "华北-大连"
#: xpack/plugins/cloud/providers/huaweicloud.py:51
msgid "CN North-Ulanqab1"
msgstr "华北-乌兰察布一"
#: xpack/plugins/cloud/providers/huaweicloud.py:52
msgid "CN South-Guangzhou-InvitationOnly"
msgstr "华南-广州-友好用户环境"
msgid "EU-Paris"
msgstr "欧洲-巴黎"
#: xpack/plugins/cloud/serializers/account_attrs.py:13
msgid "AccessKey ID"
@ -6144,16 +6143,16 @@ msgstr "租户 ID"
msgid "Subscription ID"
msgstr "订阅 ID"
#: xpack/plugins/cloud/serializers/account_attrs.py:87
#: xpack/plugins/cloud/serializers/account_attrs.py:92
#: xpack/plugins/cloud/serializers/account_attrs.py:81
#: xpack/plugins/cloud/serializers/account_attrs.py:86
msgid "API Endpoint"
msgstr "API 端点"
#: xpack/plugins/cloud/serializers/account_attrs.py:98
#: xpack/plugins/cloud/serializers/account_attrs.py:92
msgid "Service account key"
msgstr "账户密钥"
#: xpack/plugins/cloud/serializers/account_attrs.py:99
#: xpack/plugins/cloud/serializers/account_attrs.py:93
msgid "The file is in JSON format"
msgstr "JSON 格式的文件"
@ -6262,6 +6261,21 @@ msgstr "旗舰版"
msgid "Community edition"
msgstr "社区版"
#~ msgid "LA-Mexico City1"
#~ msgstr "拉美-墨西哥城一"
#~ msgid "LA-Santiago"
#~ msgstr "拉美-圣地亚哥"
#~ msgid "LA-Sao Paulo1"
#~ msgstr "拉美-圣保罗一"
#~ msgid "CN North-Ulanqab1"
#~ msgstr "华北-乌兰察布一"
#~ msgid "CN South-Guangzhou-InvitationOnly"
#~ msgstr "华南-广州-友好用户环境"
#~ msgid "OpenID"
#~ msgstr "OpenID"

@ -75,6 +75,8 @@ class PublicSettingApi(generics.RetrieveAPIView):
'SECURITY_WATERMARK_ENABLED': settings.SECURITY_WATERMARK_ENABLED,
'SECURITY_SESSION_SHARE': settings.SECURITY_SESSION_SHARE,
"XRDP_ENABLED": settings.XRDP_ENABLED,
"ANNOUNCEMENT_ENABLED": settings.ANNOUNCEMENT_ENABLED,
"ANNOUNCEMENT": settings.ANNOUNCEMENT,
}
}
return instance

@ -2,6 +2,20 @@ from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class AnnouncementSerializer(serializers.Serializer):
SUBJECT = serializers.CharField(required=True, max_length=1024, label=_("Subject"))
CONTENT = serializers.CharField(label=_("Content"))
LINK = serializers.URLField(
required=False, allow_null=True, allow_blank=True,
label=_("More url"), default='',
)
def to_representation(self, instance):
defaults = {'SUBJECT': '', 'CONTENT': '', 'LINK': '', 'ENABLED': False}
data = {**defaults, **instance}
return super().to_representation(data)
class BasicSettingSerializer(serializers.Serializer):
SITE_URL = serializers.URLField(
required=True, label=_("Site url"),
@ -20,3 +34,6 @@ class BasicSettingSerializer(serializers.Serializer):
required=False, max_length=1024, allow_blank=True, allow_null=True, label=_("Global organization name"),
help_text=_('The name of global organization to display')
)
TICKETS_ENABLED = serializers.BooleanField(required=False, default=True, label=_("Enable tickets"))
ANNOUNCEMENT_ENABLED = serializers.BooleanField(label=_('Announcement enabled'), default=True)
ANNOUNCEMENT = AnnouncementSerializer(label=_("Announcement"))

@ -7,7 +7,6 @@ class OtherSettingSerializer(serializers.Serializer):
required=False, max_length=1024, label=_("Email suffix"),
help_text=_('This is used by default if no email is returned during SSO authentication')
)
TICKETS_ENABLED = serializers.BooleanField(required=False, default=True, label=_("Enable tickets"))
OTP_ISSUER_NAME = serializers.CharField(
required=False, max_length=1024, label=_('OTP issuer name'),

Loading…
Cancel
Save