|
|
@ -1,15 +1,18 @@
|
|
|
|
package main
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"html/template"
|
|
|
|
|
|
|
|
"log"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"regexp"
|
|
|
|
"regexp"
|
|
|
|
|
|
|
|
"text/template"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Template caching
|
|
|
|
// Template caching
|
|
|
|
var templates = template.Must(template.ParseFiles("edit.html", "view.html"))
|
|
|
|
// var templates = template.Must(template.ParseFiles("edit.html", "view.html"))
|
|
|
|
|
|
|
|
var templates = template.Must(template.ParseGlob("./tmpl/*.html"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var templates = template.Must(template.ParseFiles("edit.html", "view.html"))
|
|
|
|
|
|
|
|
|
|
|
|
// Validation to prevent abitrary paths
|
|
|
|
// Validation to prevent abitrary paths
|
|
|
|
var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
|
|
|
|
var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
|
|
|
|