Skip to content

Commit

Permalink
Fix 403 Forbidden problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
madao authored and madao committed Sep 20, 2019
1 parent 8489265 commit 9e62d02
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions server/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,12 @@ func Dashboard() {
servers := new(status.Servers)
status.GetServers(servers)
c.JSON(http.StatusOK, servers)
// if c.ClientIP() == "127.0.0.1" || c.ClientIP() == "::1" || c.ClientIP() == "localhost" || c.ClientIP() == "0.0.0.0" {
// servers := new(status.Servers)
// status.GetServers(servers)
// c.JSON(http.StatusOK, servers)
// } else {
// c.String(http.StatusForbidden, "Forbidden")
// }
})
r.POST("/api/servers", func(c *gin.Context) {
if c.ClientIP() == "127.0.0.1" || c.ClientIP() == "::1" || c.ClientIP() == "localhost" || c.ClientIP() == "0.0.0.0" {
if handlePost(c) {
c.String(http.StatusOK, "success")
} else {
c.String(http.StatusOK, "fail")
}
if handlePost(c) {
c.String(http.StatusOK, "success")
} else {
c.String(http.StatusForbidden, "Forbidden")
c.String(http.StatusOK, "fail")
}
})
statikFS, err := fs.New()
Expand Down

0 comments on commit 9e62d02

Please sign in to comment.