mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 23:17:21 +08:00
fix: 解决网站手动导入证书错误的问题 (#3284)
This commit is contained in:
parent
72d8825db0
commit
9bfc159e9e
1 changed files with 8 additions and 7 deletions
|
@ -646,7 +646,7 @@ func (w WebsiteService) OpWebsiteHTTPS(ctx context.Context, req request.WebsiteH
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
res response.WebsiteHTTPS
|
res response.WebsiteHTTPS
|
||||||
websiteSSL *model.WebsiteSSL
|
websiteSSL model.WebsiteSSL
|
||||||
)
|
)
|
||||||
res.Enable = req.Enable
|
res.Enable = req.Enable
|
||||||
res.SSLProtocol = req.SSLProtocol
|
res.SSLProtocol = req.SSLProtocol
|
||||||
|
@ -691,12 +691,13 @@ func (w WebsiteService) OpWebsiteHTTPS(ctx context.Context, req request.WebsiteH
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.Type == constant.SSLExisted {
|
if req.Type == constant.SSLExisted {
|
||||||
websiteSSL, err = websiteSSLRepo.GetFirst(commonRepo.WithByID(req.WebsiteSSLID))
|
websiteModel, err := websiteSSLRepo.GetFirst(commonRepo.WithByID(req.WebsiteSSLID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
website.WebsiteSSLID = websiteSSL.ID
|
website.WebsiteSSLID = websiteModel.ID
|
||||||
res.SSL = *websiteSSL
|
res.SSL = *websiteModel
|
||||||
|
websiteSSL = *websiteModel
|
||||||
}
|
}
|
||||||
if req.Type == constant.SSLManual {
|
if req.Type == constant.SSLManual {
|
||||||
var (
|
var (
|
||||||
|
@ -756,16 +757,16 @@ func (w WebsiteService) OpWebsiteHTTPS(ctx context.Context, req request.WebsiteH
|
||||||
websiteSSL.PrivateKey = privateKey
|
websiteSSL.PrivateKey = privateKey
|
||||||
websiteSSL.Pem = certificate
|
websiteSSL.Pem = certificate
|
||||||
|
|
||||||
res.SSL = *websiteSSL
|
res.SSL = websiteSSL
|
||||||
}
|
}
|
||||||
website.Protocol = constant.ProtocolHTTPS
|
website.Protocol = constant.ProtocolHTTPS
|
||||||
if err := applySSL(website, *websiteSSL, req); err != nil {
|
if err := applySSL(website, websiteSSL, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
website.HttpConfig = req.HttpConfig
|
website.HttpConfig = req.HttpConfig
|
||||||
|
|
||||||
if websiteSSL.ID == 0 {
|
if websiteSSL.ID == 0 {
|
||||||
if err := websiteSSLRepo.Create(ctx, websiteSSL); err != nil {
|
if err := websiteSSLRepo.Create(ctx, &websiteSSL); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
website.WebsiteSSLID = websiteSSL.ID
|
website.WebsiteSSLID = websiteSSL.ID
|
||||||
|
|
Loading…
Add table
Reference in a new issue