admin: add a page to view resolution video

This commit is contained in:
nemunaire 2019-01-19 01:02:10 +01:00
parent 4ee70a8781
commit 2ac205bf83
4 changed files with 24 additions and 0 deletions

View file

@ -6,6 +6,7 @@ import (
"strings"
"srs.epita.fr/fic-server/admin/api"
"srs.epita.fr/fic-server/admin/sync"
"srs.epita.fr/fic-server/libfic"
"github.com/julienschmidt/httprouter"
@ -62,6 +63,13 @@ func init() {
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("/vids/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
if importer, ok := sync.GlobalImporter.(sync.LocalImporter); ok {
http.ServeFile(w, r, path.Join(importer.Base, strings.TrimPrefix(r.URL.Path, "/vids")))
} else {
http.Error(w, "Only available with local importer.", 400)
}
})
api.Router().GET("/check_import.html", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
http.ServeFile(w, r, path.Join(StaticDir, "check_import.html"))