diff --git a/internal/api/room/broadcast.go b/internal/api/room/broadcast.go index 1423953c..e4cae0e8 100644 --- a/internal/api/room/broadcast.go +++ b/internal/api/room/broadcast.go @@ -13,14 +13,14 @@ type BroadcastStatusPayload struct { IsActive bool `json:"is_active"` } -func (h *RoomHandler) BroadcastStatus(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) broadcastStatus(w http.ResponseWriter, r *http.Request) { utils.HttpSuccess(w, BroadcastStatusPayload{ IsActive: h.capture.BroadcastEnabled(), URL: h.capture.BroadcastUrl(), }) } -func (h *RoomHandler) BoradcastStart(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) boradcastStart(w http.ResponseWriter, r *http.Request) { data := &BroadcastStatusPayload{} if !utils.HttpJsonRequest(w, r, data) { return @@ -51,7 +51,7 @@ func (h *RoomHandler) BoradcastStart(w http.ResponseWriter, r *http.Request) { utils.HttpSuccess(w) } -func (h *RoomHandler) BoradcastStop(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) boradcastStop(w http.ResponseWriter, r *http.Request) { if !h.capture.BroadcastEnabled() { utils.HttpBadRequest(w, "Server is not broadcasting.") return diff --git a/internal/api/room/clipboard.go b/internal/api/room/clipboard.go index 0396d9c5..c952ac9d 100644 --- a/internal/api/room/clipboard.go +++ b/internal/api/room/clipboard.go @@ -10,7 +10,7 @@ type ClipboardPayload struct { Text string `json:"text"` } -func (h *RoomHandler) ClipboardRead(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) clipboardRead(w http.ResponseWriter, r *http.Request) { // TODO: error check? text := h.desktop.ReadClipboard() @@ -19,7 +19,7 @@ func (h *RoomHandler) ClipboardRead(w http.ResponseWriter, r *http.Request) { }) } -func (h *RoomHandler) ClipboardWrite(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) clipboardWrite(w http.ResponseWriter, r *http.Request) { data := &ClipboardPayload{} if !utils.HttpJsonRequest(w, r, data) { return diff --git a/internal/api/room/control.go b/internal/api/room/control.go index 44c6f71b..d5cc4017 100644 --- a/internal/api/room/control.go +++ b/internal/api/room/control.go @@ -13,7 +13,7 @@ type ControlGivePayload struct { ID string `json:"id"` } -func (h *RoomHandler) ControlRequest(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) controlRequest(w http.ResponseWriter, r *http.Request) { session := auth.GetSession(r) if session.IsHost() { utils.HttpBadRequest(w, "User is already host.") @@ -37,7 +37,7 @@ func (h *RoomHandler) ControlRequest(w http.ResponseWriter, r *http.Request) { utils.HttpSuccess(w) } -func (h *RoomHandler) ControlRelease(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) controlRelease(w http.ResponseWriter, r *http.Request) { session := auth.GetSession(r) if !session.IsHost() { utils.HttpBadRequest(w, "User is not the host.") @@ -55,7 +55,7 @@ func (h *RoomHandler) ControlRelease(w http.ResponseWriter, r *http.Request) { utils.HttpSuccess(w) } -func (h *RoomHandler) ControlTake(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) controlTake(w http.ResponseWriter, r *http.Request) { session := auth.GetSession(r) h.sessions.SetHost(session) @@ -69,7 +69,7 @@ func (h *RoomHandler) ControlTake(w http.ResponseWriter, r *http.Request) { utils.HttpSuccess(w) } -func (h *RoomHandler) ControlGive(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) controlGive(w http.ResponseWriter, r *http.Request) { data := &ControlGivePayload{} if !utils.HttpJsonRequest(w, r, data) { return diff --git a/internal/api/room/handler.go b/internal/api/room/handler.go index fa202188..e2cc2a0f 100644 --- a/internal/api/room/handler.go +++ b/internal/api/room/handler.go @@ -36,33 +36,33 @@ func New( func (h *RoomHandler) Route(r chi.Router) { r.With(auth.AdminsOnly).Route("/broadcast", func(r chi.Router) { - r.Get("/", h.BroadcastStatus) - r.Post("/start", h.BoradcastStart) - r.Post("/stop", h.BoradcastStop) + r.Get("/", h.broadcastStatus) + r.Post("/start", h.boradcastStart) + r.Post("/stop", h.boradcastStop) }) r.With(auth.HostsOnly).Route("/clipboard", func(r chi.Router) { - r.Get("/", h.ClipboardRead) - r.Post("/", h.ClipboardWrite) + r.Get("/", h.clipboardRead) + r.Post("/", h.clipboardWrite) }) r.With(auth.HostsOnly).Route("/keyboard", func(r chi.Router) { - r.Post("/layout", h.KeyboardLayoutSet) - r.Post("/modifiers", h.KeyboardModifiersSet) + r.Post("/layout", h.keyboardLayoutSet) + r.Post("/modifiers", h.keyboardModifiersSet) }) r.Route("/control", func(r chi.Router) { - r.Post("/request", h.ControlRequest) - r.Post("/release", h.ControlRelease) + r.Post("/request", h.controlRequest) + r.Post("/release", h.controlRelease) - r.With(auth.AdminsOnly).Post("/take", h.ControlTake) - r.With(auth.AdminsOnly).Post("/give", h.ControlGive) + r.With(auth.AdminsOnly).Post("/take", h.controlTake) + r.With(auth.AdminsOnly).Post("/give", h.controlGive) }) r.Route("/screen", func(r chi.Router) { - r.Get("/", h.ScreenConfiguration) + r.Get("/", h.screenConfiguration) - r.With(auth.AdminsOnly).Post("/", h.ScreenConfigurationChange) - r.With(auth.AdminsOnly).Get("/configurations", h.ScreenConfigurationsList) + r.With(auth.AdminsOnly).Post("/", h.screenConfigurationChange) + r.With(auth.AdminsOnly).Get("/configurations", h.screenConfigurationsList) }) } diff --git a/internal/api/room/keyboard.go b/internal/api/room/keyboard.go index 9568b743..1fd25b5c 100644 --- a/internal/api/room/keyboard.go +++ b/internal/api/room/keyboard.go @@ -16,7 +16,7 @@ type KeyboardModifiersData struct { ScrollLock *bool `json:"scrollock"` } -func (h *RoomHandler) KeyboardLayoutSet(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) keyboardLayoutSet(w http.ResponseWriter, r *http.Request) { data := &KeyboardLayoutData{} if !utils.HttpJsonRequest(w, r, data) { return @@ -27,7 +27,7 @@ func (h *RoomHandler) KeyboardLayoutSet(w http.ResponseWriter, r *http.Request) utils.HttpSuccess(w) } -func (h *RoomHandler) KeyboardModifiersSet(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) keyboardModifiersSet(w http.ResponseWriter, r *http.Request) { data := &KeyboardModifiersData{} if !utils.HttpJsonRequest(w, r, data) { return diff --git a/internal/api/room/screen.go b/internal/api/room/screen.go index a54fd4eb..315c6e76 100644 --- a/internal/api/room/screen.go +++ b/internal/api/room/screen.go @@ -15,7 +15,7 @@ type ScreenConfigurationPayload struct { Rate int `json:"rate"` } -func (h *RoomHandler) ScreenConfiguration(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) screenConfiguration(w http.ResponseWriter, r *http.Request) { size := h.desktop.GetScreenSize() if size == nil { @@ -30,7 +30,7 @@ func (h *RoomHandler) ScreenConfiguration(w http.ResponseWriter, r *http.Request }) } -func (h *RoomHandler) ScreenConfigurationChange(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) screenConfigurationChange(w http.ResponseWriter, r *http.Request) { data := &ScreenConfigurationPayload{} if !utils.HttpJsonRequest(w, r, data) { return @@ -55,7 +55,7 @@ func (h *RoomHandler) ScreenConfigurationChange(w http.ResponseWriter, r *http.R utils.HttpSuccess(w, data) } -func (h *RoomHandler) ScreenConfigurationsList(w http.ResponseWriter, r *http.Request) { +func (h *RoomHandler) screenConfigurationsList(w http.ResponseWriter, r *http.Request) { list := []ScreenConfigurationPayload{} ScreenConfigurations := h.desktop.ScreenConfigurations()