dashboard: some improvements

This commit is contained in:
nemunaire 2019-01-19 03:08:07 +01:00
parent 8190bbfdc0
commit 196f10dc9f
5 changed files with 43 additions and 4 deletions

View file

@ -4,9 +4,11 @@ import (
"fmt"
"net/http"
"path"
"strings"
"time"
"srs.epita.fr/fic-server/dashboard/api"
"srs.epita.fr/fic-server/libfic"
"srs.epita.fr/fic-server/settings"
"github.com/julienschmidt/httprouter"
@ -33,6 +35,10 @@ func init() {
http.ServeFile(w, r, path.Join(StaticDir, r.URL.Path))
})
api.Router().GET("/files/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
http.ServeFile(w, r, path.Join(fic.FilesDir, strings.TrimPrefix(r.URL.Path, "/files")))
})
api.Router().GET("/events.json", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
w.Header().Set("Cache-Control", "no-cache")
http.ServeFile(w, r, path.Join(TeamsDir, "events.json"))