mirror of
https://github.com/1f349/violet.git
synced 2024-11-24 04:11:32 +00:00
Add domains compile after put and delete api call
This commit is contained in:
parent
629057edc3
commit
92fa325fd5
@ -38,6 +38,7 @@ func NewApiServer(conf *Conf, compileTarget utils.MultiCompilable) *http.Server
|
||||
// add domain with active state
|
||||
q := req.URL.Query()
|
||||
conf.Domains.Put(params.ByName("domain"), q.Get("active") == "1")
|
||||
conf.Domains.Compile()
|
||||
})
|
||||
r.DELETE("/domain/:domain", func(rw http.ResponseWriter, req *http.Request, params httprouter.Params) {
|
||||
if !hasPerms(conf.Verify, req, "violet:domains") {
|
||||
@ -48,6 +49,7 @@ func NewApiServer(conf *Conf, compileTarget utils.MultiCompilable) *http.Server
|
||||
// add domain with active state
|
||||
q := req.URL.Query()
|
||||
conf.Domains.Put(params.ByName("domain"), q.Get("active") == "1")
|
||||
conf.Domains.Compile()
|
||||
})
|
||||
|
||||
// Endpoint for acme-challenge
|
||||
|
@ -29,6 +29,7 @@ type DomainProvider interface {
|
||||
IsValid(host string) bool
|
||||
Put(domain string, active bool)
|
||||
Delete(domain string)
|
||||
Compile()
|
||||
}
|
||||
|
||||
type AcmeChallengeProvider interface {
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
|
||||
// RespondHttpStatus outputs the status code and text using http.Error()
|
||||
func RespondHttpStatus(rw http.ResponseWriter, status int) {
|
||||
http.Error(rw, fmt.Sprintf("%d %s\n", status, http.StatusText(status)), status)
|
||||
http.Error(rw, fmt.Sprintf("%d %s", status, http.StatusText(status)), status)
|
||||
}
|
||||
|
||||
func RespondVioletError(rw http.ResponseWriter, status int, msg string) {
|
||||
|
Loading…
Reference in New Issue
Block a user