mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 18:16:26 +00:00
Certificates Renewal + SSE
- Certificate renewal is just a re-request as it's forced already - Rejig the routes for readability - Added Server Side Events so that the UI would invalidate the cache when changes happen on the backend, such as certs being provided or failing - Added a SSE Token, which has the same shelf life as normal token but can't be used interchangeably. The reason for this is, the SSE endpoint needs a token for auth as a Query param, so it would be stored in log files. If someone where to get a hold of that, it's pretty useless as it can't be used to change anything, only to listen for events until it expires - Added test endpoint for SSE testing only availabe in debug mode
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"npm/internal/entity/dnsprovider"
|
||||
"npm/internal/entity/user"
|
||||
"npm/internal/logger"
|
||||
"npm/internal/serverevents"
|
||||
"npm/internal/types"
|
||||
"npm/internal/util"
|
||||
|
||||
@ -123,6 +124,9 @@ func (m *Model) Delete() bool {
|
||||
if err := m.Save(); err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// todo: delete from acme.sh as well
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -239,6 +243,7 @@ func (m *Model) GetCertificateLocations() (string, string, string) {
|
||||
// Request makes a certificate request
|
||||
func (m *Model) Request() error {
|
||||
logger.Info("Requesting certificate for: #%d %v", m.ID, m.Name)
|
||||
serverevents.SendChange("certificates")
|
||||
|
||||
// nolint: errcheck, gosec
|
||||
m.Expand([]string{"certificate-authority", "dns-provider"})
|
||||
@ -283,6 +288,7 @@ func (m *Model) Request() error {
|
||||
return err
|
||||
}
|
||||
|
||||
serverevents.SendChange("certificates")
|
||||
logger.Info("Request for certificate for: #%d %v was completed", m.ID, m.Name)
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user