neko/internal/api/room/handler.go

43 lines
795 B
Go
Raw Normal View History

2020-10-30 18:16:21 +01:00
package room
import (
"github.com/go-chi/chi"
"demodesk/neko/internal/types"
)
type RoomHandler struct {
2020-11-01 16:54:06 +01:00
sessions types.SessionManager
desktop types.DesktopManager
capture types.CaptureManager
2020-10-30 18:16:21 +01:00
}
func New(
sessions types.SessionManager,
2020-11-01 16:54:06 +01:00
desktop types.DesktopManager,
capture types.CaptureManager,
2020-10-30 18:16:21 +01:00
) *RoomHandler {
// Init
return &RoomHandler{
2020-11-01 16:54:06 +01:00
sessions: sessions,
desktop: desktop,
capture: capture,
2020-10-30 18:16:21 +01:00
}
}
2020-11-14 18:16:25 +01:00
func (h *RoomHandler) Route(r chi.Router) {
// TODO: Authorizaton.
2020-10-31 12:27:55 +01:00
r.Route("/screen", func(r chi.Router) {
r.Get("/", h.ScreenConfiguration)
r.Post("/", h.ScreenConfigurationChange)
2020-10-31 12:27:55 +01:00
r.Get("/configurations", h.ScreenConfigurationsList)
2020-10-31 10:48:24 +01:00
})
2020-10-30 18:16:21 +01:00
r.Route("/clipboard", func(r chi.Router) {
2020-10-31 12:35:02 +01:00
r.Get("/", h.ClipboardRead)
r.Post("/", h.ClipboardWrite)
})
2020-10-30 18:16:21 +01:00
}