shot.jpg.

This commit is contained in:
Miroslav Šedivý 2021-01-23 15:23:10 +01:00
parent fdd98377b3
commit 1ffbe337d4
2 changed files with 3 additions and 2 deletions

View File

@ -62,7 +62,7 @@ func (h *RoomHandler) Route(r chi.Router) {
r.Route("/screen", func(r chi.Router) {
r.With(auth.CanWatchOnly).Get("/", h.screenConfiguration)
r.With(auth.CanWatchOnly).Get("/image", h.screenImageGet)
r.With(auth.CanWatchOnly).Get("/shot.jpg", h.screenShotGet)
r.With(auth.CanWatchOnly).Get("/cast.jpg", h.screenCastGet)
r.With(auth.AdminsOnly).Post("/", h.screenConfigurationChange)

View File

@ -76,7 +76,7 @@ func (h *RoomHandler) screenConfigurationsList(w http.ResponseWriter, r *http.Re
utils.HttpSuccess(w, list)
}
func (h *RoomHandler) screenImageGet(w http.ResponseWriter, r *http.Request) {
func (h *RoomHandler) screenShotGet(w http.ResponseWriter, r *http.Request) {
var options *jpeg.Options
if quality, err := strconv.Atoi(r.URL.Query().Get("quality")); err == nil {
options = &jpeg.Options{ quality }
@ -92,6 +92,7 @@ func (h *RoomHandler) screenImageGet(w http.ResponseWriter, r *http.Request) {
return
}
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Header().Set("Content-Type", "image/jpeg")
w.Write(out.Bytes())
}