chore: allow upgrade ui in embed mode (#1692)
Some checks failed
Trigger CMFA Update / trigger-CMFA-update (push) Failing after 11s

This commit is contained in:
hingbong 2024-12-04 00:54:01 +00:00 committed by GitHub
parent 5a24efdabf
commit d6b496d3c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -127,10 +127,10 @@ func router(isDebug bool, secret string, dohServer string, cors Cors) *chi.Mux {
r.Mount("/providers/rules", ruleProviderRouter())
r.Mount("/cache", cacheRouter())
r.Mount("/dns", dnsRouter())
if !embedMode { // disallow restart and upgrade in embed mode
if !embedMode { // disallow restart in embed mode
r.Mount("/restart", restartRouter())
r.Mount("/upgrade", upgradeRouter())
}
r.Mount("/upgrade", upgradeRouter())
addExternalRouters(r)
})

View File

@ -14,9 +14,11 @@ import (
func upgradeRouter() http.Handler {
r := chi.NewRouter()
r.Post("/", upgradeCore)
r.Post("/ui", updateUI)
r.Post("/geo", updateGeoDatabases)
if !embedMode { // disallow upgrade core/geo in embed mode
r.Post("/", upgradeCore)
r.Post("/geo", updateGeoDatabases)
}
return r
}