77 "github.com/0xJacky/Nginx-UI/model"
88 "github.com/0xJacky/Nginx-UI/query"
99 "github.com/gin-gonic/gin"
10+ "github.com/go-acme/lego/v4/certcrypto"
1011 "github.com/spf13/cast"
1112 "net/http"
1213 "os"
@@ -76,13 +77,14 @@ func GetCert(c *gin.Context) {
7677}
7778
7879type certJson struct {
79- Name string `json:"name" binding:"required"`
80- SSLCertificatePath string `json:"ssl_certificate_path" binding:"required,certificate_path"`
81- SSLCertificateKeyPath string `json:"ssl_certificate_key_path" binding:"required,privatekey_path"`
82- SSLCertificate string `json:"ssl_certificate" binding:"omitempty,certificate"`
83- SSLCertificateKey string `json:"ssl_certificate_key" binding:"omitempty,privatekey"`
84- ChallengeMethod string `json:"challenge_method"`
85- DnsCredentialID int `json:"dns_credential_id"`
80+ Name string `json:"name" binding:"required"`
81+ SSLCertificatePath string `json:"ssl_certificate_path" binding:"required,certificate_path"`
82+ SSLCertificateKeyPath string `json:"ssl_certificate_key_path" binding:"required,privatekey_path"`
83+ SSLCertificate string `json:"ssl_certificate" binding:"omitempty,certificate"`
84+ SSLCertificateKey string `json:"ssl_certificate_key" binding:"omitempty,privatekey"`
85+ KeyType certcrypto.KeyType `json:"key_type" binding:"omitempty,auto_cert_key_type"`
86+ ChallengeMethod string `json:"challenge_method"`
87+ DnsCredentialID int `json:"dns_credential_id"`
8688}
8789
8890func AddCert (c * gin.Context ) {
@@ -96,6 +98,7 @@ func AddCert(c *gin.Context) {
9698 Name : json .Name ,
9799 SSLCertificatePath : json .SSLCertificatePath ,
98100 SSLCertificateKeyPath : json .SSLCertificateKeyPath ,
101+ KeyType : json .KeyType ,
99102 ChallengeMethod : json .ChallengeMethod ,
100103 DnsCredentialID : json .DnsCredentialID ,
101104 }
@@ -146,6 +149,7 @@ func ModifyCert(c *gin.Context) {
146149 SSLCertificatePath : json .SSLCertificatePath ,
147150 SSLCertificateKeyPath : json .SSLCertificateKeyPath ,
148151 ChallengeMethod : json .ChallengeMethod ,
152+ KeyType : json .KeyType ,
149153 DnsCredentialID : json .DnsCredentialID ,
150154 })
151155
0 commit comments