diff --git a/backend/app/api/v1/website_ssl.go b/backend/app/api/v1/website_ssl.go
index cd8d72490..c3d34d435 100644
--- a/backend/app/api/v1/website_ssl.go
+++ b/backend/app/api/v1/website_ssl.go
@@ -35,7 +35,7 @@ func (b *BaseApi) PageWebsiteSSL(c *gin.Context) {
Items: accounts,
})
} else {
- list, err := websiteSSLService.Search()
+ list, err := websiteSSLService.Search(req)
if err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
return
diff --git a/backend/app/dto/request/website_ssl.go b/backend/app/dto/request/website_ssl.go
index b385006ca..10da74394 100644
--- a/backend/app/dto/request/website_ssl.go
+++ b/backend/app/dto/request/website_ssl.go
@@ -4,6 +4,7 @@ import "github.com/1Panel-dev/1Panel/backend/app/dto"
type WebsiteSSLSearch struct {
dto.PageInfo
+ AcmeAccountID uint `json:"acmeAccountId"`
}
type WebsiteSSLCreate struct {
diff --git a/backend/app/service/website_ssl.go b/backend/app/service/website_ssl.go
index 2be4ec514..189908add 100644
--- a/backend/app/service/website_ssl.go
+++ b/backend/app/service/website_ssl.go
@@ -7,6 +7,7 @@ import (
"github.com/1Panel-dev/1Panel/backend/app/dto/request"
"github.com/1Panel-dev/1Panel/backend/app/dto/response"
"github.com/1Panel-dev/1Panel/backend/app/model"
+ "github.com/1Panel-dev/1Panel/backend/app/repo"
"github.com/1Panel-dev/1Panel/backend/buserr"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
@@ -21,7 +22,7 @@ type WebsiteSSLService struct {
type IWebsiteSSLService interface {
Page(search request.WebsiteSSLSearch) (int64, []response.WebsiteSSLDTO, error)
GetSSL(id uint) (*response.WebsiteSSLDTO, error)
- Search() ([]response.WebsiteSSLDTO, error)
+ Search(req request.WebsiteSSLSearch) ([]response.WebsiteSSLDTO, error)
Create(create request.WebsiteSSLCreate) (request.WebsiteSSLCreate, error)
Renew(sslId uint) error
GetDNSResolve(req request.WebsiteDNSReq) ([]response.WebsiteDNSRes, error)
@@ -35,17 +36,19 @@ func NewIWebsiteSSLService() IWebsiteSSLService {
}
func (w WebsiteSSLService) Page(search request.WebsiteSSLSearch) (int64, []response.WebsiteSSLDTO, error) {
+ var (
+ result []response.WebsiteSSLDTO
+ )
total, sslList, err := websiteSSLRepo.Page(search.Page, search.PageSize, commonRepo.WithOrderBy("created_at desc"))
if err != nil {
return 0, nil, err
}
- var sslDTOs []response.WebsiteSSLDTO
- for _, ssl := range sslList {
- sslDTOs = append(sslDTOs, response.WebsiteSSLDTO{
- WebsiteSSL: ssl,
+ for _, sslModel := range sslList {
+ result = append(result, response.WebsiteSSLDTO{
+ WebsiteSSL: sslModel,
})
}
- return total, sslDTOs, err
+ return total, result, err
}
func (w WebsiteSSLService) GetSSL(id uint) (*response.WebsiteSSLDTO, error) {
@@ -58,18 +61,25 @@ func (w WebsiteSSLService) GetSSL(id uint) (*response.WebsiteSSLDTO, error) {
return &res, nil
}
-func (w WebsiteSSLService) Search() ([]response.WebsiteSSLDTO, error) {
- sslList, err := websiteSSLRepo.List()
+func (w WebsiteSSLService) Search(search request.WebsiteSSLSearch) ([]response.WebsiteSSLDTO, error) {
+ var (
+ opts []repo.DBOption
+ result []response.WebsiteSSLDTO
+ )
+ opts = append(opts, commonRepo.WithOrderBy("created_at desc"))
+ if search.AcmeAccountID >= 0 {
+ opts = append(opts, websiteSSLRepo.WithByAcmeAccountId(search.AcmeAccountID))
+ }
+ sslList, err := websiteSSLRepo.List(opts...)
if err != nil {
return nil, err
}
- var sslDTOs []response.WebsiteSSLDTO
- for _, ssl := range sslList {
- sslDTOs = append(sslDTOs, response.WebsiteSSLDTO{
- WebsiteSSL: ssl,
+ for _, sslModel := range sslList {
+ result = append(result, response.WebsiteSSLDTO{
+ WebsiteSSL: sslModel,
})
}
- return sslDTOs, err
+ return result, err
}
func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.WebsiteSSLCreate, error) {
diff --git a/frontend/src/api/interface/website.ts b/frontend/src/api/interface/website.ts
index de59e711f..cd5e58278 100644
--- a/frontend/src/api/interface/website.ts
+++ b/frontend/src/api/interface/website.ts
@@ -160,6 +160,7 @@ export namespace Website {
provider: string;
websites?: Website.Website[];
autoRenew: boolean;
+ acmeAccountId?: number;
}
export interface SSLCreate {
@@ -207,6 +208,7 @@ export namespace Website {
export interface SSLReq {
name?: string;
+ acmeAccountID?: number;
}
export interface HTTPSReq {
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index 18c62cfeb..b4c0e77ae 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -1412,6 +1412,8 @@ const message = {
disableLeech: 'Disable anti-leech',
ipv6: 'Listen IPV6',
leechReturnError: 'Please fill in the HTTP status code',
+ selectAcme: 'Select Acme account',
+ localSSL: 'Imported',
},
php: {
short_open_tag: 'Short tag support',
diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts
index ecfcb1d5f..4a849a5c5 100644
--- a/frontend/src/lang/modules/tw.ts
+++ b/frontend/src/lang/modules/tw.ts
@@ -1339,6 +1339,8 @@ const message = {
disableLeech: '禁用防盜鏈',
ipv6: '監聽 IPV6 端口',
leechReturnError: '請填寫 HTTP 狀態碼',
+ selectAcme: '選擇 Acme 賬號',
+ localSSL: '已導入',
},
php: {
short_open_tag: '短標簽支持',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index e10d7669d..5b231308e 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -1345,6 +1345,8 @@ const message = {
disableLeech: '禁用防盗链',
ipv6: '监听 IPV6 端口',
leechReturnError: '请填写 HTTP 状态码',
+ selectAcme: '选择 acme 账号',
+ localSSL: '已导入',
},
php: {
short_open_tag: '短标签支持',
diff --git a/frontend/src/views/website/website/config/basic/https/index.vue b/frontend/src/views/website/website/config/basic/https/index.vue
index ebc99271a..429717b6e 100644
--- a/frontend/src/views/website/website/config/basic/https/index.vue
+++ b/frontend/src/views/website/website/config/basic/https/index.vue
@@ -27,25 +27,37 @@