mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
do not export REST functions.
This commit is contained in:
parent
1ae6f05c73
commit
ef03f9ec9d
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user