keyboardModifiersGet.

This commit is contained in:
Miroslav Šedivý 2021-01-12 23:35:46 +01:00
parent 8a9dceafec
commit 4844225a0b
2 changed files with 14 additions and 3 deletions

View File

@ -42,9 +42,11 @@ func (h *RoomHandler) Route(r chi.Router) {
r.Post("/", h.clipboardWrite) r.Post("/", h.clipboardWrite)
}) })
r.With(auth.HostsOnly).Route("/keyboard", func(r chi.Router) { r.Route("/keyboard", func(r chi.Router) {
r.Post("/layout", h.keyboardLayoutSet) r.With(auth.HostsOnly).Post("/layout", h.keyboardLayoutSet)
r.Post("/modifiers", h.keyboardModifiersSet)
r.Get("/modifiers", h.keyboardModifiersGet)
r.With(auth.HostsOnly).Post("/modifiers", h.keyboardModifiersSet)
}) })
r.Route("/control", func(r chi.Router) { r.Route("/control", func(r chi.Router) {

View File

@ -39,3 +39,12 @@ func (h *RoomHandler) keyboardModifiersSet(w http.ResponseWriter, r *http.Reques
}) })
utils.HttpSuccess(w) utils.HttpSuccess(w)
} }
func (h *RoomHandler) keyboardModifiersGet(w http.ResponseWriter, r *http.Request) {
data := h.desktop.GetKeyboardModifiers()
utils.HttpSuccess(w, KeyboardModifiersData{
NumLock: data.NumLock,
CapsLock: data.CapsLock,
})
}