From 39b66212ffa9a6ea6701e729bfc99a40bf359ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=99=BB=E5=B1=B1?= Date: Thu, 29 Jan 2026 11:17:09 +0800 Subject: [PATCH] style: set default protocol rustfs/rustfs#1641 --- components/replication/new-form.vue | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/components/replication/new-form.vue b/components/replication/new-form.vue index 9970d1a..28925d0 100644 --- a/components/replication/new-form.vue +++ b/components/replication/new-form.vue @@ -166,7 +166,7 @@ import { Icon } from '#components' import { Field, FieldContent, FieldLabel } from '@/components/ui/field' import { Switch } from '@/components/ui/switch' import { getBytes } from '@/utils/functions' -import { computed, reactive, ref } from 'vue' +import { computed, reactive, ref, watch } from 'vue' import { useI18n } from 'vue-i18n' import Modal from '~/components/modal.vue' import Selector from '~/components/selector.vue' @@ -188,7 +188,7 @@ const submitting = ref(false) const formData = reactive({ level: '1', - endpoint: '', + endpoint: 'http://', tls: false, accesskey: '', secrretkey: '', @@ -205,6 +205,25 @@ const formData = reactive({ expiredDeleteMark: true, }) +watch( + () => formData.tls, + val => { + if (val) { + if (formData.endpoint.startsWith('http://')) { + formData.endpoint = formData.endpoint.replace('http://', 'https://') + } else if (!formData.endpoint.startsWith('https://')) { + formData.endpoint = 'https://' + formData.endpoint + } + } else { + if (formData.endpoint.startsWith('https://')) { + formData.endpoint = formData.endpoint.replace('https://', 'http://') + } else if (!formData.endpoint.startsWith('http://')) { + formData.endpoint = 'http://' + formData.endpoint + } + } + } +) + const modeOptions = computed(() => [ { label: t('Asynchronous'), value: 'async' }, { label: t('Synchronous'), value: 'sync' }, @@ -227,7 +246,7 @@ const removeTag = (index: number) => { const resetForm = () => { formData.level = '1' - formData.endpoint = '' + formData.endpoint = 'http://' formData.tls = false formData.accesskey = '' formData.secrretkey = ''