refactor(cert): introducing new management page

1. User can now view the latest renew logs of the certain certificate.

2. Add manually renew button in certificate modify page for managed certificate (auto cert)
This commit is contained in:
0xJacky 2023-12-04 22:14:37 +08:00
parent 7c47f08a72
commit ac68fd05c9
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
36 changed files with 1908 additions and 1286 deletions

43
internal/cert/issue.go Normal file
View file

@ -0,0 +1,43 @@
package cert
import (
"crypto"
"github.com/go-acme/lego/v4/registration"
)
type ChannelWriter struct {
Ch chan []byte
}
func NewChannelWriter() *ChannelWriter {
return &ChannelWriter{
Ch: make(chan []byte, 1024),
}
}
func (cw *ChannelWriter) Write(p []byte) (n int, err error) {
n = len(p)
temp := make([]byte, n)
copy(temp, p)
cw.Ch <- temp
return n, nil
}
// User You'll need a user or account type that implements acme.User
type User struct {
Email string
Registration *registration.Resource
Key crypto.PrivateKey
}
func (u *User) GetEmail() string {
return u.Email
}
func (u *User) GetRegistration() *registration.Resource {
return u.Registration
}
func (u *User) GetPrivateKey() crypto.PrivateKey {
return u.Key
}