2021-05-22 22:24:28 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-05-22 23:53:00 +08:00
|
|
|
"html/template"
|
2021-05-22 22:24:28 +08:00
|
|
|
"net/http"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
var globalStore store
|
|
|
|
|
|
|
|
func setupHandlers() {
|
|
|
|
var err error
|
|
|
|
globalStore, err = newRedisStore(os.Getenv("REDIS_CONNECTION"))
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-22 23:53:00 +08:00
|
|
|
/* templates */
|
2021-05-22 22:24:28 +08:00
|
|
|
|
2021-05-22 23:53:00 +08:00
|
|
|
var tmpl = template.Must(template.ParseFS(assets, "web/*.tmpl"))
|
2021-05-22 22:24:28 +08:00
|
|
|
|
2021-05-22 23:53:00 +08:00
|
|
|
/* upload template */
|
2021-05-22 22:24:28 +08:00
|
|
|
|
2021-05-22 23:53:00 +08:00
|
|
|
func handleUpload(w http.ResponseWriter, req *http.Request) {
|
|
|
|
tmpl.ExecuteTemplate(w, "upload.tmpl", nil)
|
2021-05-22 22:24:28 +08:00
|
|
|
}
|