diff --git a/backend/utils/ssl/client.go b/backend/utils/ssl/client.go index 52dfdd889..69a5d5a70 100644 --- a/backend/utils/ssl/client.go +++ b/backend/utils/ssl/client.go @@ -78,7 +78,6 @@ type DNSParam struct { } func (c *AcmeClient) UseDns(dnsType DnsType, params string) error { - var param DNSParam if err := json.Unmarshal([]byte(params), ¶m); err != nil { return err @@ -148,7 +147,6 @@ func (c *AcmeClient) UseHTTP(path string) error { } func (c *AcmeClient) ObtainSSL(domains []string) (certificate.Resource, error) { - request := certificate.ObtainRequest{ Domains: domains, Bundle: true, @@ -163,7 +161,6 @@ func (c *AcmeClient) ObtainSSL(domains []string) (certificate.Resource, error) { } func (c *AcmeClient) RenewSSL(certUrl string) (certificate.Resource, error) { - certificates, err := c.Client.Certificate.Get(certUrl, true) if err != nil { return certificate.Resource{}, err diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 8895060d2..427ff5ac8 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -116,6 +116,7 @@ export default { selectHelper: '请选择正确的 {0} 文件', domain: '域名格式错误', databaseName: '支持英文、数字、_,长度1-30', + ipErr: 'IP [{0}] 格式错误,请检查', }, res: { paramError: '请求失败,请稍后重试!', @@ -942,6 +943,10 @@ export default { notSecurity: ' 不安全', encryptHelper: "Let's Encrypt 签发证书有频率限制,但足以满足正常需求,过于频繁操作会导致签发失败。具体限制请看 官方文档 ", + ipValue: 'IP值', + ext: '文件扩展名', + wafInputHelper: '按行输入数据,一行一个', + data: '数据', }, nginx: { serverNamesHashBucketSizeHelper: '服务器名字的hash表大小', diff --git a/frontend/src/views/website/website/config/basic/https/index.vue b/frontend/src/views/website/website/config/basic/https/index.vue index 851289ea2..bcf161153 100644 --- a/frontend/src/views/website/website/config/basic/https/index.vue +++ b/frontend/src/views/website/website/config/basic/https/index.vue @@ -70,9 +70,11 @@ {{ $t('website.SSLProConfig') }} + {{ 'TLS 1.3' }} {{ 'TLS 1.2' }} {{ 'TLS 1.1' }} {{ 'TLS 1.0' }} +
{{ 'SSL V3' + $t('website.notSecurity') }} @@ -134,7 +136,7 @@ let form = reactive({ httpConfig: 'HTTPToHTTPS', algorithm: 'EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5', - SSLProtocol: ['TLSv1.2', 'TLSv1.1', 'TLSv1'], + SSLProtocol: ['TLSv1.3', 'TLSv1.2', 'TLSv1.1', 'TLSv1'], }); let loading = ref(false); const ssls = ref(); diff --git a/frontend/src/views/website/website/config/safety/file-block-list/index.vue b/frontend/src/views/website/website/config/safety/file-block-list/index.vue index d763f5827..28fca7a49 100644 --- a/frontend/src/views/website/website/config/safety/file-block-list/index.vue +++ b/frontend/src/views/website/website/config/safety/file-block-list/index.vue @@ -4,21 +4,21 @@ + + + - - - + -
- -
- - {{ $t('commons.button.save') }} - @@ -71,6 +65,7 @@ let enableUpdate = ref({ key: '$fileExtDeny', enable: false, }); +let exts = ref(); const get = async () => { data.value = []; @@ -80,11 +75,9 @@ const get = async () => { if (res.data.content != '') { const ipList = JSON.parse(res.data.content); - ipList.forEach((value) => { + ipList.forEach((value: string) => { data.value.push({ file: value, - eidt: false, - error: '', }); }); } @@ -95,24 +88,30 @@ const get = async () => { const remove = (index: number) => { data.value.splice(index, 1); + const extArray = []; + data.value.forEach((d) => { + extArray.push(d.file); + }); + submit(extArray); }; const openCreate = () => { - data.value.unshift({ file: '', edit: true, error: '' }); + const extArray = exts.value.split('\n'); + if (extArray.length === 0) { + return; + } + data.value.forEach((d) => { + extArray.push(d.file); + }); + submit(extArray); }; -const submit = async () => { - let fileArray = []; - data.value.forEach((row) => { - if (row.file != '') { - fileArray.push(row.file); - } - }); - - fileUpdate.content = JSON.stringify(fileArray); +const submit = async (extArray: string[]) => { + fileUpdate.content = JSON.stringify(extArray); loading.value = true; SaveFileContent(fileUpdate) .then(() => { + exts.value = ''; ElMessage.success(i18n.global.t('commons.msg.updateSuccess')); get(); }) diff --git a/frontend/src/views/website/website/config/safety/ip-list/index.vue b/frontend/src/views/website/website/config/safety/ip-list/index.vue index 2fe83a1c3..b25e2136a 100644 --- a/frontend/src/views/website/website/config/safety/ip-list/index.vue +++ b/frontend/src/views/website/website/config/safety/ip-list/index.vue @@ -4,21 +4,21 @@ + + + - - - + -
- -
- - {{ $t('commons.button.save') }} - @@ -86,6 +80,7 @@ let enableUpdate = ref({ key: '$ipWhiteAllow', enable: false, }); +let ips = ref(); const get = async () => { data.value = []; @@ -95,11 +90,9 @@ const get = async () => { if (res.data.content != '') { const ipList = JSON.parse(res.data.content); - ipList.forEach((value) => { + ipList.forEach((ip: string) => { data.value.push({ - ip: value, - eidt: false, - error: '', + ip: ip, }); }); } @@ -109,32 +102,39 @@ const get = async () => { const removeIp = (index: number) => { data.value.splice(index, 1); + let ipArray = []; + data.value.forEach((d) => { + ipArray.push(d.ip); + }); + submit(ipArray); }; const openCreate = () => { - data.value.unshift({ ip: '', edit: true, error: '' }); -}; - -const submit = async () => { - let canCommit = true; - for (const row of data.value) { - if (row.ip != '' && row.error != '') { - row.edit = true; - canCommit = false; - } - } - if (!canCommit) { + console.log(ips.value); + const ipArray = ips.value.split('\n'); + if (ipArray.length == 0) { return; } - let ipArray = []; - data.value.forEach((row) => { - ipArray.push(row.ip); - }); + for (const id in ipArray) { + if (checkIp(ipArray[id])) { + ElMessage.error(i18n.global.t('commons.rule.ipErr', [ipArray[id]])); + return; + } + } - fileUpdate.content = JSON.stringify(ipArray); + data.value.forEach((d) => { + ipArray.push(d.ip); + }); + submit(ipArray); +}; + +const submit = async (ipList: string[]) => { + fileUpdate.content = JSON.stringify(ipList); loading.value = true; SaveFileContent(fileUpdate) .then(() => { + ips.value = ''; + get(); ElMessage.success(i18n.global.t('commons.msg.updateSuccess')); }) .finally(() => { @@ -149,14 +149,6 @@ const updateEnable = async (enable: boolean) => { loading.value = false; }; -const checkIpRule = (row: any) => { - if (checkIp(row.ip)) { - row.error = i18n.global.t('commons.rule.ip'); - } else { - row.error = ''; - } -}; - onMounted(() => { req.value.websiteId = id.value; req.value.rule = rule.value; diff --git a/frontend/src/views/website/website/config/safety/value-list/index.vue b/frontend/src/views/website/website/config/safety/value-list/index.vue index afd7c7ff3..5802d15d8 100644 --- a/frontend/src/views/website/website/config/safety/value-list/index.vue +++ b/frontend/src/views/website/website/config/safety/value-list/index.vue @@ -4,26 +4,21 @@ + + + - - - + -
- -
- - {{ $t('commons.button.save') }} - @@ -90,6 +79,7 @@ let enableUpdate = ref({ key: '$UrlDeny', enable: false, }); +let add = ref(); const get = async () => { data.value = []; @@ -103,22 +93,31 @@ const get = async () => { if (value != '') { data.value.push({ value: value, - eidt: false, - error: '', }); } }); } - fileUpdate.path = res.data.filePath; }; const remove = (index: number) => { data.value.splice(index, 1); + const addArray = []; + data.value.forEach((d) => { + addArray.push(d.value); + }); + submit(addArray); }; const openCreate = () => { - data.value.unshift({ value: '', edit: true, error: '' }); + const addArray = add.value.split('\n'); + if (addArray.length == 0) { + return; + } + data.value.forEach((d) => { + addArray.push(d.value); + }); + submit(addArray); }; const updateEnable = async (enable: boolean) => { @@ -128,18 +127,17 @@ const updateEnable = async (enable: boolean) => { loading.value = false; }; -const submit = async () => { +const submit = async (addArray: string[]) => { let urlList = ''; - data.value.forEach((row) => { - if (row.value != '') { - urlList = urlList + row.value + '\n'; - } + addArray.forEach((row) => { + urlList = urlList + row + '\n'; }); fileUpdate.content = urlList; loading.value = true; SaveFileContent(fileUpdate) .then(() => { + add.value = ''; ElMessage.success(i18n.global.t('commons.msg.updateSuccess')); get(); })