mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-01-05 17:13:32 +08:00
Fix: allow access to external-ui without authentication (#75)
This commit is contained in:
parent
ef6260282f
commit
551ab68c1e
@ -47,19 +47,23 @@ func Start(addr string, secret string) {
|
||||
MaxAge: 300,
|
||||
})
|
||||
|
||||
r.Use(cors.Handler, authentication)
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Use(cors.Handler, authentication)
|
||||
|
||||
r.With(jsonContentType).Get("/traffic", traffic)
|
||||
r.With(jsonContentType).Get("/logs", getLogs)
|
||||
r.Mount("/configs", configRouter())
|
||||
r.Mount("/proxies", proxyRouter())
|
||||
r.Mount("/rules", ruleRouter())
|
||||
r.With(jsonContentType).Get("/traffic", traffic)
|
||||
r.With(jsonContentType).Get("/logs", getLogs)
|
||||
r.Mount("/configs", configRouter())
|
||||
r.Mount("/proxies", proxyRouter())
|
||||
r.Mount("/rules", ruleRouter())
|
||||
})
|
||||
|
||||
if uiPath != "" {
|
||||
fs := http.StripPrefix("/ui", http.FileServer(http.Dir(uiPath)))
|
||||
r.Get("/ui", http.RedirectHandler("/ui/", 301).ServeHTTP)
|
||||
r.Get("/ui/*", func(w http.ResponseWriter, r *http.Request) {
|
||||
fs.ServeHTTP(w, r)
|
||||
r.Group(func(r chi.Router) {
|
||||
fs := http.StripPrefix("/ui", http.FileServer(http.Dir(uiPath)))
|
||||
r.Get("/ui", http.RedirectHandler("/ui/", 301).ServeHTTP)
|
||||
r.Get("/ui/*", func(w http.ResponseWriter, r *http.Request) {
|
||||
fs.ServeHTTP(w, r)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user