jwt in headers+localstorage instead of httpOnly cookie (#117)
This commit is contained in:
@@ -2,6 +2,7 @@ package rpc
|
||||
|
||||
import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
||||
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
||||
)
|
||||
@@ -17,8 +18,18 @@ func Container(db *internal.MemoryDB, mq *internal.MessageQueue) *Service {
|
||||
// RPC service must be registered before applying this router!
|
||||
func ApplyRouter() func(chi.Router) {
|
||||
return func(r chi.Router) {
|
||||
r.Use(middlewares.Authenticated)
|
||||
r.Get("/ws", WebSocket)
|
||||
r.Post("/http", Post)
|
||||
r.Route("/ws", func(r chi.Router) {
|
||||
if config.Instance().RequireAuth {
|
||||
r.Use(middlewares.WebSocketAuthentication)
|
||||
}
|
||||
r.Get("/", WebSocket)
|
||||
})
|
||||
|
||||
r.Route("/http", func(r chi.Router) {
|
||||
if config.Instance().RequireAuth {
|
||||
r.Use(middlewares.Authenticated)
|
||||
}
|
||||
r.Post("/", Post)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user