mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-10 04:58:12 +08:00
修复ui路径404的问题
This commit is contained in:
@@ -56,7 +56,7 @@ func authMiddleware(next http.Handler) http.Handler {
|
||||
route := mux.CurrentRoute(r)
|
||||
name := route.GetName()
|
||||
// fmt.Println("bb", r.URL.Path, name)
|
||||
if name == "login" || name == "static" {
|
||||
if utils.InArrStr([]string{"login", "index", "static"}, name) {
|
||||
// 不进行鉴权
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
|
@@ -15,13 +15,12 @@ func StartAdmin() {
|
||||
r := mux.NewRouter()
|
||||
r.Use(authMiddleware)
|
||||
|
||||
r.Handle("/", http.RedirectHandler("/ui/", http.StatusFound)).
|
||||
Name("static")
|
||||
r.PathPrefix("/ui/").Handler(http.FileServer(
|
||||
http.Dir(base.Cfg.UiPath),
|
||||
)).Name("static")
|
||||
|
||||
r.Handle("/", http.RedirectHandler("/ui/", http.StatusFound)).Name("index")
|
||||
r.PathPrefix("/ui/").Handler(
|
||||
http.StripPrefix("/ui/", http.FileServer(http.Dir(base.Cfg.UiPath))),
|
||||
).Name("static")
|
||||
r.HandleFunc("/base/login", Login).Name("login")
|
||||
|
||||
r.HandleFunc("/set/home", SetHome)
|
||||
r.HandleFunc("/set/system", SetSystem)
|
||||
r.HandleFunc("/set/soft", SetSoft)
|
||||
|
Reference in New Issue
Block a user