2016-02-06 16:40:53 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2016-02-07 19:05:38 +03:00
|
|
|
"fmt"
|
2016-02-06 16:40:53 +03:00
|
|
|
"log"
|
2016-02-06 17:11:02 +03:00
|
|
|
"os"
|
2016-02-06 16:40:53 +03:00
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
2016-02-06 17:11:02 +03:00
|
|
|
var ExternalIP string
|
2016-02-07 08:24:17 +03:00
|
|
|
var AllowedIPs string
|
|
|
|
|
|
|
|
func init() {
|
2016-02-07 16:45:42 +03:00
|
|
|
AllowedIPs = "192.168.1.13,192.168.1.12,192.168.1.2"
|
2016-02-06 16:40:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2016-02-06 17:11:02 +03:00
|
|
|
if len(os.Args) == 1 {
|
|
|
|
log.Fatal("You need to specify the external IP address")
|
|
|
|
}
|
|
|
|
ExternalIP = os.Args[1]
|
2016-02-06 16:40:53 +03:00
|
|
|
Open()
|
|
|
|
defer Close()
|
2016-02-07 19:05:38 +03:00
|
|
|
|
|
|
|
// Default page
|
|
|
|
p := CowyoData{"about", about_page}
|
|
|
|
p.save()
|
|
|
|
fmt.Println(about_page)
|
|
|
|
|
2016-02-06 16:40:53 +03:00
|
|
|
r := gin.Default()
|
|
|
|
r.LoadHTMLGlob("templates/*")
|
2016-02-07 16:45:42 +03:00
|
|
|
r.GET("/", newNote)
|
|
|
|
r.GET("/:title", editNote)
|
|
|
|
r.GET("/:title/*option", everythingElse)
|
2016-02-07 19:05:38 +03:00
|
|
|
r.DELETE("/listitem", deleteListItem)
|
2016-02-06 16:40:53 +03:00
|
|
|
r.Run(":12312")
|
|
|
|
}
|