Files
Marco Piovanello 143cc28a97 Server v4 (#370)
* refactoring-1

introduced pipelines and abstracted download process.go in Downloader interface

* migrated to boltdb from sqlite + session files

* refactoring: config struct & pipelines

* added js runtime for yt-dlp

* updated dockerfile

* added external js runtime, metadata scraping refactor

* updated Dockerfile

* fixed env propagation in docker

* updated package name to v4

* updated readme and cd
2026-06-29 19:01:53 +02:00

42 lines
1.1 KiB
Go

package rest
import (
"github.com/go-chi/chi/v5"
"github.com/marcopiovanello/yt-dlp-web-ui/v4/server/config"
middlewares "github.com/marcopiovanello/yt-dlp-web-ui/v4/server/middleware"
"github.com/marcopiovanello/yt-dlp-web-ui/v4/server/openid"
)
func Container(args *ContainerArgs) *Handler {
var (
service = ProvideService(args)
handler = ProvideHandler(service)
)
return handler
}
func ApplyRouter(args *ContainerArgs) func(chi.Router) {
h := Container(args)
return func(r chi.Router) {
if config.Instance().Authentication.RequireAuth {
r.Use(middlewares.Authenticated)
}
if config.Instance().OpenId.UseOpenId {
r.Use(openid.Middleware)
}
r.Post("/exec", h.Exec())
r.Post("/execPlaylist", h.ExecPlaylist())
r.Post("/execLivestream", h.ExecLivestream())
r.Get("/running", h.Running())
r.Get("/version", h.GetVersion())
r.Get("/cookies", h.GetCookies())
r.Post("/cookies", h.SetCookies())
r.Delete("/cookies", h.DeleteCookies())
r.Post("/template", h.AddTemplate())
r.Patch("/template", h.UpdateTemplate())
r.Get("/template/all", h.GetTemplates())
r.Delete("/template/{id}", h.DeleteTemplate())
}
}