mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add control reset.
This commit is contained in:
parent
179a22476c
commit
f9b62073ef
@ -106,3 +106,21 @@ func (h *RoomHandler) controlGive(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
utils.HttpSuccess(w)
|
||||
}
|
||||
|
||||
func (h *RoomHandler) controlReset(w http.ResponseWriter, r *http.Request) {
|
||||
host := h.sessions.GetHost()
|
||||
if host == nil {
|
||||
utils.HttpSuccess(w)
|
||||
return
|
||||
}
|
||||
|
||||
h.sessions.ClearHost()
|
||||
|
||||
h.sessions.Broadcast(
|
||||
message.Control{
|
||||
Event: event.CONTROL_RELEASE,
|
||||
ID: host.ID(),
|
||||
}, nil)
|
||||
|
||||
utils.HttpSuccess(w)
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ func (h *RoomHandler) Route(r chi.Router) {
|
||||
|
||||
r.With(auth.AdminsOnly).Post("/take", h.controlTake)
|
||||
r.With(auth.AdminsOnly).Post("/give", h.controlGive)
|
||||
r.With(auth.AdminsOnly).Post("/reset", h.controlReset)
|
||||
})
|
||||
|
||||
r.Route("/screen", func(r chi.Router) {
|
||||
|
Loading…
Reference in New Issue
Block a user