mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-10-26 11:27:18 +00:00
home: imp code
This commit is contained in:
parent
7db3d79e25
commit
3dd2453697
@ -264,8 +264,8 @@ func (web *webAPI) handleLogout(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusFound)
|
||||
}
|
||||
|
||||
// registerAuthHandlers registers authentication handlers. web must not be nil.
|
||||
func registerAuthHandlers(web *webAPI) {
|
||||
// registerAuthHandlers registers authentication handlers.
|
||||
func (web *webAPI) registerAuthHandlers() {
|
||||
web.conf.mux.Handle(
|
||||
"/control/login",
|
||||
web.postInstallHandler(ensure(http.MethodPost, web.handleLogin)),
|
||||
|
||||
@ -171,8 +171,7 @@ func (web *webAPI) handleStatus(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// registerControlHandlers sets up HTTP handlers for various control endpoints.
|
||||
// web must not be nil.
|
||||
func registerControlHandlers(web *webAPI) {
|
||||
func (web *webAPI) registerControlHandlers() {
|
||||
mux := web.conf.mux
|
||||
|
||||
mux.Handle(
|
||||
@ -196,7 +195,8 @@ func registerControlHandlers(web *webAPI) {
|
||||
"/apple/dot.mobileconfig",
|
||||
web.postInstallHandler(http.HandlerFunc(handleMobileConfigDoT)),
|
||||
)
|
||||
registerAuthHandlers(web)
|
||||
|
||||
web.registerAuthHandlers()
|
||||
}
|
||||
|
||||
// httpRegister registers an HTTP handler.
|
||||
|
||||
@ -506,7 +506,7 @@ func (web *webAPI) finalizeInstall(
|
||||
web.conf.firstRun = false
|
||||
web.conf.BindAddr = netip.AddrPortFrom(req.Web.IP, req.Web.Port)
|
||||
|
||||
registerControlHandlers(web)
|
||||
web.registerControlHandlers()
|
||||
|
||||
aghhttp.OK(w)
|
||||
if f, ok := w.(http.Flusher); ok {
|
||||
|
||||
@ -180,7 +180,7 @@ func newWebAPI(ctx context.Context, conf *webConfig) (w *webAPI) {
|
||||
mux.Handle("/install.html", w.preInstallHandler(clientFS))
|
||||
w.registerInstallHandlers()
|
||||
} else {
|
||||
registerControlHandlers(w)
|
||||
w.registerControlHandlers()
|
||||
}
|
||||
|
||||
w.httpsServer.cond = sync.NewCond(&w.httpsServer.condLock)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user