mirror of
https://github.com/m1k1o/neko.git
synced 2025-07-30 06:50:55 +02:00
use websocket authentication & refactor.
This commit is contained in:
parent
f136a31b03
commit
a18482b54e
9 changed files with 124 additions and 242 deletions
|
@ -3,7 +3,6 @@ package room
|
|||
import (
|
||||
"github.com/go-chi/chi"
|
||||
|
||||
"demodesk/neko/internal/api/utils"
|
||||
"demodesk/neko/internal/types"
|
||||
)
|
||||
|
||||
|
@ -27,20 +26,18 @@ func New(
|
|||
}
|
||||
}
|
||||
|
||||
func (h *RoomHandler) Router(
|
||||
usersOnly utils.HttpMiddleware,
|
||||
adminsOnly utils.HttpMiddleware,
|
||||
) *chi.Mux {
|
||||
func (h *RoomHandler) Router() *chi.Mux {
|
||||
r := chi.NewRouter()
|
||||
|
||||
|
||||
// TODO: Authorizaton.
|
||||
r.Route("/screen", func(r chi.Router) {
|
||||
r.With(usersOnly).Get("/", h.ScreenConfiguration)
|
||||
r.With(adminsOnly).Post("/", h.ScreenConfigurationChange)
|
||||
r.Get("/", h.ScreenConfiguration)
|
||||
r.Post("/", h.ScreenConfigurationChange)
|
||||
|
||||
r.With(adminsOnly).Get("/configurations", h.ScreenConfigurationsList)
|
||||
r.Get("/configurations", h.ScreenConfigurationsList)
|
||||
})
|
||||
|
||||
r.With(adminsOnly).Route("/clipboard", func(r chi.Router) {
|
||||
r.Route("/clipboard", func(r chi.Router) {
|
||||
r.Get("/", h.ClipboardRead)
|
||||
r.Post("/", h.ClipboardWrite)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue