Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 31 additions & 29 deletions agent/app/model/website_ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,37 @@ import (

type WebsiteSSL struct {
BaseModel
PrimaryDomain string `json:"primaryDomain"`
PrivateKey string `json:"privateKey"`
Pem string `json:"pem"`
Domains string `json:"domains"`
CertURL string `json:"certURL"`
Type string `json:"type"`
Provider string `json:"provider"`
Organization string `json:"organization"`
DnsAccountID uint `json:"dnsAccountId"`
AcmeAccountID uint `gorm:"column:acme_account_id" json:"acmeAccountId" `
CaID uint `json:"caId"`
AutoRenew bool `json:"autoRenew"`
ExpireDate time.Time `json:"expireDate"`
StartDate time.Time `json:"startDate"`
Status string `json:"status"`
Message string `json:"message"`
KeyType string `json:"keyType"`
PushDir bool `json:"pushDir"`
Dir string `json:"dir"`
Description string `json:"description"`
SkipDNS bool `json:"skipDNS"`
Nameserver1 string `json:"nameserver1"`
Nameserver2 string `json:"nameserver2"`
DisableCNAME bool `json:"disableCNAME"`
ExecShell bool `json:"execShell"`
Shell string `json:"shell"`
MasterSSLID uint `json:"masterSslId"`
Nodes string `json:"nodes"`
PushNode bool `json:"pushNode"`
PrimaryDomain string `json:"primaryDomain"`
PrivateKey string `json:"privateKey"`
Pem string `json:"pem"`
Domains string `json:"domains"`
CertURL string `json:"certURL"`
Type string `json:"type"`
Provider string `json:"provider"`
Organization string `json:"organization"`
DnsAccountID uint `json:"dnsAccountId"`
AcmeAccountID uint `gorm:"column:acme_account_id" json:"acmeAccountId" `
CaID uint `json:"caId"`
AutoRenew bool `json:"autoRenew"`
ExpireDate time.Time `json:"expireDate"`
StartDate time.Time `json:"startDate"`
Status string `json:"status"`
Message string `json:"message"`
KeyType string `json:"keyType"`
PushDir bool `json:"pushDir"`
Dir string `json:"dir"`
Description string `json:"description"`
SkipDNS bool `json:"skipDNS"`
Nameserver1 string `json:"nameserver1"`
Nameserver2 string `json:"nameserver2"`
DisableCNAME bool `json:"disableCNAME"`
ExecShell bool `json:"execShell"`
Shell string `json:"shell"`
MasterSSLID uint `json:"masterSslId"`
Nodes string `json:"nodes"`
PushNode bool `json:"pushNode"`
PrivateKeyPath string `json:"privateKeyPath"`
CertPath string `json:"certPath"`

AcmeAccount WebsiteAcmeAccount `json:"acmeAccount" gorm:"-:migration"`
DnsAccount WebsiteDnsAccount `json:"dnsAccount" gorm:"-:migration"`
Expand Down
4 changes: 4 additions & 0 deletions agent/app/service/website_ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,13 @@ func (w WebsiteSSLService) Upload(req request.WebsiteSSLUpload) error {
} else {
websiteSSL.Pem = string(content)
}
websiteSSL.CertPath = req.CertificatePath
websiteSSL.PrivateKeyPath = req.PrivateKeyPath
} else {
websiteSSL.PrivateKey = req.PrivateKey
websiteSSL.Pem = req.Certificate
websiteSSL.CertPath = ""
websiteSSL.PrivateKeyPath = ""
}

privateKeyCertBlock, _ := pem.Decode([]byte(websiteSSL.PrivateKey))
Expand Down
3 changes: 2 additions & 1 deletion agent/init/migration/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ func InitAgentDB() {
migrations.InitRecordStatus,
migrations.AddShowNameForQuickJump,
migrations.AddTimeoutForClam,
migrations.UpdataCronjobSpec,
migrations.UpdateCronjobSpec,
migrations.UpdateWebsiteSSLAddColumn,
})
if err := m.Migrate(); err != nil {
global.LOG.Error(err)
Expand Down
12 changes: 11 additions & 1 deletion agent/init/migration/migrations/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ var AddTimeoutForClam = &gormigrate.Migration{
},
}

var UpdataCronjobSpec = &gormigrate.Migration{
var UpdateCronjobSpec = &gormigrate.Migration{
ID: "20250925-update-cronjob-spec",
Migrate: func(tx *gorm.DB) error {
var cronjobs []model.Cronjob
Expand All @@ -617,3 +617,13 @@ var UpdataCronjobSpec = &gormigrate.Migration{
return nil
},
}

var UpdateWebsiteSSLAddColumn = &gormigrate.Migration{
ID: "20250928-update-website-ssl",
Migrate: func(tx *gorm.DB) error {
if err := tx.AutoMigrate(&model.WebsiteSSL{}); err != nil {
return err
}
return nil
},
}
2 changes: 2 additions & 0 deletions frontend/src/api/interface/website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ export namespace Website {
shell: string;
pushNode: boolean;
nodes: string;
privateKeyPath: string;
certPath: string;
}

export interface SSLDTO extends SSL {
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/views/website/ssl/upload/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ const acceptParams = (websiteSSL: Website.SSLDTO) => {
if (websiteSSL && websiteSSL.id > 0) {
ssl.value.sslID = websiteSSL.id;
ssl.value.description = websiteSSL.description;
ssl.value.privateKeyPath = websiteSSL.privateKeyPath;
ssl.value.certificatePath = websiteSSL.certPath;
if (ssl.value.certificatePath != '' && ssl.value.privateKeyPath != '') {
ssl.value.type = 'local';
}
}
open.value = true;
};
Expand Down
Loading