feat: 限制创建网站使用 default 代号 (#4869)

Refs https://github.com/1Panel-dev/1Panel/issues/4868
This commit is contained in:
zhengkunwang 2024-05-06 13:53:56 +08:00 committed by GitHub
parent 7684066689
commit 4f6a443b13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 0 deletions

View File

@ -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 {

View File

@ -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"

View File

@ -93,6 +93,7 @@ ErrPHPResource: '本地運行環境不支持切換!'
ErrPathPermission: 'index 目錄下偵測到非 1000:1000 權限資料夾,可能導致網站存取 Access denied 錯誤,請點擊上方儲存按鈕'
ErrDomainIsUsed: "域名已被網站【{{ .name }}】使用"
ErrDomainFormat: "{{ .name }} 域名格式不正確"
ErrDefaultAlias: "default 為保留代號,請使用其他代號"
#ssl
ErrSSLCannotDelete: "{{ .name }} 證書正在被網站使用,無法刪除"

View File

@ -93,6 +93,7 @@ ErrPHPResource: '本地运行环境不支持切换!'
ErrPathPermission: 'index 目录下检测到非 1000:1000 权限文件夹,可能导致网站访问 Access denied 错误,请点击上方保存按钮'
ErrDomainIsUsed: "域名已被网站【{{ .name }}】使用"
ErrDomainFormat: "{{ .name }} 域名格式不正确"
ErrDefaultAlias: "default 为保留代号,请使用其他代号"
#ssl
ErrSSLCannotDelete: "{{ .name }} 证书正在被网站使用,无法删除"