2020-10-30 10:23:30 +13:00
|
|
|
package room
|
2020-11-19 09:53:06 +13:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2022-07-14 10:58:22 +12:00
|
|
|
"github.com/demodesk/neko/pkg/types"
|
|
|
|
"github.com/demodesk/neko/pkg/utils"
|
2020-11-19 09:53:06 +13:00
|
|
|
)
|
|
|
|
|
2021-09-17 10:58:50 +12:00
|
|
|
func (h *RoomHandler) keyboardMapSet(w http.ResponseWriter, r *http.Request) error {
|
2024-05-04 08:41:42 +12:00
|
|
|
keyboardMap := types.KeyboardMap{}
|
|
|
|
if err := utils.HttpJsonRequest(w, r, &keyboardMap); err != nil {
|
2021-09-17 10:58:50 +12:00
|
|
|
return err
|
2020-11-19 09:53:06 +13:00
|
|
|
}
|
|
|
|
|
2024-05-04 08:41:42 +12:00
|
|
|
err := h.desktop.SetKeyboardMap(keyboardMap)
|
2021-02-15 02:40:17 +13:00
|
|
|
if err != nil {
|
2021-09-17 10:58:50 +12:00
|
|
|
return utils.HttpInternalServerError().WithInternalErr(err)
|
2021-01-13 11:48:15 +13:00
|
|
|
}
|
2020-11-19 09:53:06 +13:00
|
|
|
|
2021-09-17 10:58:50 +12:00
|
|
|
return utils.HttpSuccess(w)
|
2020-11-19 09:53:06 +13:00
|
|
|
}
|
|
|
|
|
2021-09-17 10:58:50 +12:00
|
|
|
func (h *RoomHandler) keyboardMapGet(w http.ResponseWriter, r *http.Request) error {
|
2024-05-04 08:41:42 +12:00
|
|
|
keyboardMap, err := h.desktop.GetKeyboardMap()
|
2021-02-15 02:40:17 +13:00
|
|
|
if err != nil {
|
2021-09-17 10:58:50 +12:00
|
|
|
return utils.HttpInternalServerError().WithInternalErr(err)
|
2021-01-16 04:53:03 +13:00
|
|
|
}
|
|
|
|
|
2024-05-04 08:41:42 +12:00
|
|
|
return utils.HttpSuccess(w, keyboardMap)
|
2021-01-16 04:53:03 +13:00
|
|
|
}
|
|
|
|
|
2021-09-17 10:58:50 +12:00
|
|
|
func (h *RoomHandler) keyboardModifiersSet(w http.ResponseWriter, r *http.Request) error {
|
2024-05-04 08:41:42 +12:00
|
|
|
keyboardModifiers := types.KeyboardModifiers{}
|
|
|
|
if err := utils.HttpJsonRequest(w, r, &keyboardModifiers); err != nil {
|
2021-09-17 10:58:50 +12:00
|
|
|
return err
|
2020-11-19 09:53:06 +13:00
|
|
|
}
|
|
|
|
|
2024-05-04 08:41:42 +12:00
|
|
|
h.desktop.SetKeyboardModifiers(keyboardModifiers)
|
2021-09-17 10:58:50 +12:00
|
|
|
return utils.HttpSuccess(w)
|
2020-11-19 09:53:06 +13:00
|
|
|
}
|
2021-01-13 11:35:46 +13:00
|
|
|
|
2021-09-17 10:58:50 +12:00
|
|
|
func (h *RoomHandler) keyboardModifiersGet(w http.ResponseWriter, r *http.Request) error {
|
2024-05-04 08:41:42 +12:00
|
|
|
keyboardModifiers := h.desktop.GetKeyboardModifiers()
|
|
|
|
|
|
|
|
return utils.HttpSuccess(w, keyboardModifiers)
|
2021-01-13 11:35:46 +13:00
|
|
|
}
|