mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
fix: home page 404
Some checks are pending
CodeQL / Analyze (go) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
Contributors / contributors (push) Waiting to run
Sync / sync-to-jihulab (push) Waiting to run
Run Tests / tests (macos) (push) Waiting to run
Run Tests / tests (ubuntu) (push) Waiting to run
Run Tests / tests (windows) (push) Waiting to run
Some checks are pending
CodeQL / Analyze (go) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
Contributors / contributors (push) Waiting to run
Sync / sync-to-jihulab (push) Waiting to run
Run Tests / tests (macos) (push) Waiting to run
Run Tests / tests (ubuntu) (push) Waiting to run
Run Tests / tests (windows) (push) Waiting to run
This commit is contained in:
parent
5df4c6266e
commit
953fa153cc
@ -309,11 +309,13 @@ func fallbackToFrontend(frontendDist fs.FS) func(*gin.Context) {
|
|||||||
if strings.HasPrefix(c.Request.URL.Path, "/dashboard") {
|
if strings.HasPrefix(c.Request.URL.Path, "/dashboard") {
|
||||||
stripPath := strings.TrimPrefix(c.Request.URL.Path, "/dashboard")
|
stripPath := strings.TrimPrefix(c.Request.URL.Path, "/dashboard")
|
||||||
localFilePath := path.Join(singleton.Conf.AdminTemplate, stripPath)
|
localFilePath := path.Join(singleton.Conf.AdminTemplate, stripPath)
|
||||||
|
if stripPath == "/" {
|
||||||
|
c.Status(http.StatusOK)
|
||||||
|
}
|
||||||
if checkLocalFileOrFs(c, frontendDist, localFilePath) {
|
if checkLocalFileOrFs(c, frontendDist, localFilePath) {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
c.Status(http.StatusNotFound)
|
c.Status(http.StatusNotFound)
|
||||||
c.Writer.WriteHeaderNow();
|
|
||||||
}
|
}
|
||||||
if !checkLocalFileOrFs(c, frontendDist, singleton.Conf.AdminTemplate+"/index.html") {
|
if !checkLocalFileOrFs(c, frontendDist, singleton.Conf.AdminTemplate+"/index.html") {
|
||||||
c.JSON(http.StatusNotFound, newErrorResponse(errors.New("404 Not Found")))
|
c.JSON(http.StatusNotFound, newErrorResponse(errors.New("404 Not Found")))
|
||||||
@ -321,11 +323,13 @@ func fallbackToFrontend(frontendDist fs.FS) func(*gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
localFilePath := path.Join(singleton.Conf.UserTemplate, c.Request.URL.Path)
|
localFilePath := path.Join(singleton.Conf.UserTemplate, c.Request.URL.Path)
|
||||||
|
if c.Request.URL.Path == "/" {
|
||||||
|
c.Status(http.StatusOK)
|
||||||
|
}
|
||||||
if checkLocalFileOrFs(c, frontendDist, localFilePath) {
|
if checkLocalFileOrFs(c, frontendDist, localFilePath) {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
c.Status(http.StatusNotFound)
|
c.Status(http.StatusNotFound)
|
||||||
c.Writer.WriteHeaderNow();
|
|
||||||
}
|
}
|
||||||
if !checkLocalFileOrFs(c, frontendDist, singleton.Conf.UserTemplate+"/index.html") {
|
if !checkLocalFileOrFs(c, frontendDist, singleton.Conf.UserTemplate+"/index.html") {
|
||||||
c.JSON(http.StatusNotFound, newErrorResponse(errors.New("404 Not Found")))
|
c.JSON(http.StatusNotFound, newErrorResponse(errors.New("404 Not Found")))
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name: "OfficialAdmin"
|
name: "OfficialAdmin"
|
||||||
repository: "https://github.com/nezhahq/admin-frontend"
|
repository: "https://github.com/nezhahq/admin-frontend"
|
||||||
author: "nezhahq"
|
author: "nezhahq"
|
||||||
version: "v1.5.0"
|
version: "v1.5.1"
|
||||||
isadmin: true
|
isadmin: true
|
||||||
isofficial: true
|
isofficial: true
|
||||||
- path: "user-dist"
|
- path: "user-dist"
|
||||||
|
Loading…
Reference in New Issue
Block a user