Skip to content

Commit

Permalink
chore: allow upgrade ui in embed mode (#1692)
Browse files Browse the repository at this point in the history
  • Loading branch information
hingbong authored Dec 4, 2024
1 parent 5a24efd commit d6b496d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hub/route/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

})
Expand Down
6 changes: 4 additions & 2 deletions hub/route/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit d6b496d

Please # to comment.