Browse Source

feat: 创建网站-其他域名增加端口校验 (#2807)

pull/2816/head
zhengkunwang 1 year ago committed by GitHub
parent
commit
e43de97890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      backend/app/service/website_utils.go
  2. 2
      backend/i18n/lang/en.yaml
  3. 2
      backend/i18n/lang/zh-Hant.yaml
  4. 2
      backend/i18n/lang/zh.yaml

5
backend/app/service/website_utils.go

@ -40,7 +40,10 @@ func getDomain(domainStr string, defaultPort int) (model.WebsiteDomain, error) {
portStr := domainArray[1]
portN, err := strconv.Atoi(portStr)
if err != nil {
return model.WebsiteDomain{}, err
return model.WebsiteDomain{}, buserr.New("ErrTypePort")
}
if portN <= 0 || portN > 65535 {
return model.WebsiteDomain{}, buserr.New("ErrTypePortRange")
}
domain.Port = portN
return domain, nil

2
backend/i18n/lang/en.yaml

@ -18,6 +18,8 @@ ErrPortExist: '{{ .port }} port is already occupied by {{ .type }} [{{ .name }}]
TYPE_APP: "Application"
TYPE_RUNTIME: "Runtime environment"
TYPE_DOMAIN: "Domain name"
ErrTypePort: 'Port {{name}} format error'
ErrTypePortRange: 'Port range needs to be between 1-65535'
#app
ErrPortInUsed: "{{ .detail }} port already in use"

2
backend/i18n/lang/zh-Hant.yaml

@ -18,6 +18,8 @@ ErrPortExist: '{{ .port }} 埠已被 {{ .type }} [{{ .name }}] 佔用'
TYPE_APP: "應用"
TYPE_RUNTIME: "運作環境"
TYPE_DOMAIN: "網域名稱"
ErrTypePort: '埠 {{name}} 格式錯誤'
ErrTypePortRange: '連接埠範圍需要在 1-65535 之間'
#app
ErrPortInUsed: "{{ .detail }} 端口已被佔用!"

2
backend/i18n/lang/zh.yaml

@ -18,6 +18,8 @@ ErrPortExist: '{{ .port }} 端口已被 {{ .type }} [{{ .name }}] 占用'
TYPE_APP: "应用"
TYPE_RUNTIME: "运行环境"
TYPE_DOMAIN: "域名"
ErrTypePort: '端口 {{name}} 格式错误'
ErrTypePortRange: '端口范围需要在 1-65535 之间'
#app
ErrPortInUsed: "{{ .detail }} 端口已被占用!"

Loading…
Cancel
Save