mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
2174edd471
Former-commit-id: a9b40f31f0753157af8500353395274b474642a2 [formerly 57875519283c5bfbfa6d852a27d72dc091157faa] [formerly bc0dde2306cf0e189d69349f344dffda393de1cc [formerly aecad9ba02f4aa09f9aef5add7df035e91e4b1a3 [formerly19aaf7bb44
]]] Former-commit-id: eb77f04e333250fef6799da788b460b77468dddf [formerly c3ddbc51302fbb8fc89410f114013b3a19f33cb8] Former-commit-id: 814d1b257f6529e8ec45ba7acfa7269967900397 Former-commit-id:6f445a7668
39 lines
630 B
Go
39 lines
630 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
var ExternalIP string
|
|
var AllowedIPs string
|
|
|
|
func init() {
|
|
AllowedIPs = "192.168.1.13,192.168.1.12,192.168.1.2"
|
|
}
|
|
|
|
func main() {
|
|
if len(os.Args) == 1 {
|
|
log.Fatal("You need to specify the external IP address")
|
|
}
|
|
ExternalIP = os.Args[1]
|
|
Open()
|
|
defer Close()
|
|
|
|
// Default page
|
|
p := CowyoData{"about", about_page}
|
|
p.save()
|
|
fmt.Println(about_page)
|
|
|
|
r := gin.Default()
|
|
r.LoadHTMLGlob("templates/*")
|
|
r.GET("/", newNote)
|
|
r.GET("/:title", editNote)
|
|
r.GET("/:title/*option", everythingElse)
|
|
r.DELETE("/listitem", deleteListItem)
|
|
r.Run(":12312")
|
|
}
|