From f9a25c73826f3d039b8def72b21b218d8a1325f1 Mon Sep 17 00:00:00 2001 From: paulosf0 Date: Tue, 18 Feb 2025 11:14:50 -0300 Subject: [PATCH] refactor: add null value to chiper and tls options --- .../domains-services/v4/create-domain-service.js | 5 +++-- .../domains-services/v4/edit-domain-service.js | 5 +++-- .../domains-services/v4/load-domain-service.js | 4 ++-- .../Domains/FormFields/FormFieldsCreateDomains.vue | 4 ++-- src/views/Domains/FormFields/FormFieldsEditDomains.vue | 10 ++++++++-- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/services/domains-services/v4/create-domain-service.js b/src/services/domains-services/v4/create-domain-service.js index 6dc6cf66a..42fdd43dd 100644 --- a/src/services/domains-services/v4/create-domain-service.js +++ b/src/services/domains-services/v4/create-domain-service.js @@ -59,10 +59,11 @@ const adapt = (payload) => { dataRequest.tls.certificate = payload.edgeCertificate } if (payload.supportedCiphers && payload.useHttps) { - dataRequest.tls.ciphers = payload.supportedCiphers === 'all' ? null : payload.supportedCiphers + dataRequest.tls.ciphers = payload.supportedCiphers === 'null' ? null : payload.supportedCiphers } if (payload.minimumTlsVersion && payload.useHttps) { - dataRequest.tls.minimum_version = payload.minimumTlsVersion + dataRequest.tls.minimum_version = + payload.minimumTlsVersion === 'null' ? null : payload.minimumTlsVersion } return dataRequest diff --git a/src/services/domains-services/v4/edit-domain-service.js b/src/services/domains-services/v4/edit-domain-service.js index ab780f9f5..74d137b76 100644 --- a/src/services/domains-services/v4/edit-domain-service.js +++ b/src/services/domains-services/v4/edit-domain-service.js @@ -60,10 +60,11 @@ const adapt = (payload) => { dataRequest.tls.certificate = payload.edgeCertificate } if (payload.supportedCiphers && payload.useHttps) { - dataRequest.tls.ciphers = payload.supportedCiphers === 'all' ? null : payload.supportedCiphers + dataRequest.tls.ciphers = payload.supportedCiphers === 'null' ? null : payload.supportedCiphers } if (payload.minimumTlsVersion && payload.useHttps) { - dataRequest.tls.minimum_version = payload.minimumTlsVersion + dataRequest.tls.minimum_version = + payload.minimumTlsVersion === 'null' ? null : payload.minimumTlsVersion } return dataRequest diff --git a/src/services/domains-services/v4/load-domain-service.js b/src/services/domains-services/v4/load-domain-service.js index 0e7e01e59..b030e387a 100644 --- a/src/services/domains-services/v4/load-domain-service.js +++ b/src/services/domains-services/v4/load-domain-service.js @@ -69,8 +69,8 @@ const adapt = (httpResponse) => { httpsPort: handlerHttp(body.protocols.http.https_ports, HTTPS_PORT_LIST_OPTIONS), quicPort: handlerHttp(body.protocols.http.quic_ports, HTTP3_PORT_LIST_OPTIONS), httpPort: handlerHttp(body.protocols.http.http_ports, HTTP_PORT_LIST_OPTIONS), - supportedCiphers: body.tls.ciphers, - minimumTlsVersion: body.tls.minimum_version + supportedCiphers: String(body.tls.ciphers), + minimumTlsVersion: String(body.tls.minimum_version) } return { diff --git a/src/views/Domains/FormFields/FormFieldsCreateDomains.vue b/src/views/Domains/FormFields/FormFieldsCreateDomains.vue index d1638c66a..542b6c834 100644 --- a/src/views/Domains/FormFields/FormFieldsCreateDomains.vue +++ b/src/views/Domains/FormFields/FormFieldsCreateDomains.vue @@ -97,14 +97,14 @@ { name: '8090', value: 8090 } ] const TLS_VERSIONS_OPTIONS = [ - { label: 'None', value: 'none' }, + { label: 'None', value: 'null' }, { label: 'TLS 1.0', value: 'tls_1_0' }, { label: 'TLS 1.1', value: 'tls_1_1' }, { label: 'TLS 1.2', value: 'tls_1_2' }, { label: 'TLS 1.3', value: 'tls_1_3' } ] const SUPPORTED_CIPHERS_LIST_OPTIONS = [ - { label: 'All', value: 'all' }, + { label: 'All', value: 'null' }, { label: 'TLSv1.2_2018', value: 'TLSv1.2_2018' }, { label: 'TLSv1.2_2019', value: 'TLSv1.2_2019' }, { label: 'TLSv1.2_2021', value: 'TLSv1.2_2021' }, diff --git a/src/views/Domains/FormFields/FormFieldsEditDomains.vue b/src/views/Domains/FormFields/FormFieldsEditDomains.vue index cdf4405e3..f26a1e062 100644 --- a/src/views/Domains/FormFields/FormFieldsEditDomains.vue +++ b/src/views/Domains/FormFields/FormFieldsEditDomains.vue @@ -80,14 +80,14 @@ { name: '8090', value: 8090 } ] const TLS_VERSIONS_OPTIONS = [ - { label: 'None', value: 'none' }, + { label: 'None', value: 'null' }, { label: 'TLS 1.0', value: 'tls_1_0' }, { label: 'TLS 1.1', value: 'tls_1_1' }, { label: 'TLS 1.2', value: 'tls_1_2' }, { label: 'TLS 1.3', value: 'tls_1_3' } ] const SUPPORTED_CIPHERS_LIST_OPTIONS = [ - { label: 'All', value: 'all' }, + { label: 'All', value: 'null' }, { label: 'TLSv1.2_2018', value: 'TLSv1.2_2018' }, { label: 'TLSv1.2_2019', value: 'TLSv1.2_2019' }, { label: 'TLSv1.2_2021', value: 'TLSv1.2_2021' }, @@ -155,6 +155,12 @@ } }) + watch(useHttps, (newValue) => { + if (newValue && !httpsPort.value) { + httpsPort.value = [HTTPS_PORT_LIST_OPTIONS[0]] + } + }) + const digitalCertificateDrawerRef = ref('') const openDigitalCertificateDrawer = () => { digitalCertificateDrawerRef.value.openCreateDrawer()