From 4f6a443b13145630ebea8d3cb0199c4864701a8c Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Mon, 6 May 2024 13:53:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=99=90=E5=88=B6=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=BD=91=E7=AB=99=E4=BD=BF=E7=94=A8=20default=20=E4=BB=A3?= =?UTF-8?q?=E5=8F=B7=20(#4869)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs https://github.com/1Panel-dev/1Panel/issues/4868 --- backend/app/service/website.go | 3 +++ backend/i18n/lang/en.yaml | 1 + backend/i18n/lang/zh-Hant.yaml | 1 + backend/i18n/lang/zh.yaml | 1 + 4 files changed, 6 insertions(+) diff --git a/backend/app/service/website.go b/backend/app/service/website.go index 126579ac4..fd37efcbe 100644 --- a/backend/app/service/website.go +++ b/backend/app/service/website.go @@ -180,6 +180,9 @@ func (w WebsiteService) GetWebsites() ([]response.WebsiteDTO, error) { func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error) { alias := create.Alias + if alias == "default" { + return buserr.New("ErrDefaultAlias") + } if common.ContainsChinese(alias) { alias, err = common.PunycodeEncode(alias) if err != nil { diff --git a/backend/i18n/lang/en.yaml b/backend/i18n/lang/en.yaml index 869ec111d..536e6344c 100644 --- a/backend/i18n/lang/en.yaml +++ b/backend/i18n/lang/en.yaml @@ -93,6 +93,7 @@ ErrPHPResource: 'The local runtime does not support switching!' ErrPathPermission: 'A folder with non-1000:1000 permissions was detected in the index directory, which may cause an Access denied error when accessing the website. Please click the save button above' ErrDomainIsUsed: "Domain is already used by website {{ .name }}" ErrDomainFormat: "{{ .name }} domain format error" +ErrDefaultAlias: "default is a reserved code name, please use another code name" #ssl ErrSSLCannotDelete: "The certificate {{ .name }} is being used by the website and cannot be removed" diff --git a/backend/i18n/lang/zh-Hant.yaml b/backend/i18n/lang/zh-Hant.yaml index 1a7116c5f..afac7a07f 100644 --- a/backend/i18n/lang/zh-Hant.yaml +++ b/backend/i18n/lang/zh-Hant.yaml @@ -93,6 +93,7 @@ ErrPHPResource: '本地運行環境不支持切換!' ErrPathPermission: 'index 目錄下偵測到非 1000:1000 權限資料夾,可能導致網站存取 Access denied 錯誤,請點擊上方儲存按鈕' ErrDomainIsUsed: "域名已被網站【{{ .name }}】使用" ErrDomainFormat: "{{ .name }} 域名格式不正確" +ErrDefaultAlias: "default 為保留代號,請使用其他代號" #ssl ErrSSLCannotDelete: "{{ .name }} 證書正在被網站使用,無法刪除" diff --git a/backend/i18n/lang/zh.yaml b/backend/i18n/lang/zh.yaml index c0b489cf4..5b72f9dca 100644 --- a/backend/i18n/lang/zh.yaml +++ b/backend/i18n/lang/zh.yaml @@ -93,6 +93,7 @@ ErrPHPResource: '本地运行环境不支持切换!' ErrPathPermission: 'index 目录下检测到非 1000:1000 权限文件夹,可能导致网站访问 Access denied 错误,请点击上方保存按钮' ErrDomainIsUsed: "域名已被网站【{{ .name }}】使用" ErrDomainFormat: "{{ .name }} 域名格式不正确" +ErrDefaultAlias: "default 为保留代号,请使用其他代号" #ssl ErrSSLCannotDelete: "{{ .name }} 证书正在被网站使用,无法删除"