diff --git a/main.go b/main.go index a3a1fd9..1db1d0b 100755 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "os" "path" "runtime" + "strings" "time" "github.com/boltdb/bolt" @@ -21,6 +22,11 @@ import ( var db *bolt.DB var open bool var ExternalIP string +var AllowedIPs string + +func init() { + AllowedIPs = "192.168.1.13,192.168.1.12" +} func Open() error { var err error @@ -128,14 +134,18 @@ func main() { }) r.GET("/:title", func(c *gin.Context) { title := c.Param("title") + fmt.Println("------") + fmt.Println("[" + c.ClientIP() + "]") + fmt.Println("------") if title == "ws" { wshandler(c.Writer, c.Request) + } else if title == "about" && strings.Contains(AllowedIPs, c.ClientIP()) != true { + c.Redirect(302, "/about/view") } else { c.HTML(http.StatusOK, "index.tmpl", gin.H{ "Title": title, "ExternalIP": ExternalIP, }) - } }) r.GET("/:title/*option", func(c *gin.Context) { diff --git a/templates/index.tmpl b/templates/index.tmpl index 2f2a915..50ccaff 100755 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -125,7 +125,7 @@ border: none; overflow: auto; outline: none; - font-size: x-large; + font-size: large; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;