More cleanup, more refractor, more energy, more passion, more footwork

This commit is contained in:
Mukhtar Akere
2025-02-13 02:08:18 +01:00
parent c386495d3d
commit 14341d30bc
60 changed files with 2369 additions and 1961 deletions

34
pkg/web/routes.go Normal file
View File

@@ -0,0 +1,34 @@
package web
import (
"github.com/go-chi/chi/v5"
"net/http"
)
func (ui *Handler) Routes() http.Handler {
r := chi.NewRouter()
r.Get("/login", ui.LoginHandler)
r.Post("/login", ui.LoginHandler)
r.Get("/setup", ui.SetupHandler)
r.Post("/setup", ui.SetupHandler)
r.Group(func(r chi.Router) {
r.Use(ui.authMiddleware)
r.Get("/", ui.IndexHandler)
r.Get("/download", ui.DownloadHandler)
r.Get("/repair", ui.RepairHandler)
r.Get("/config", ui.ConfigHandler)
r.Route("/internal", func(r chi.Router) {
r.Get("/arrs", ui.handleGetArrs)
r.Post("/add", ui.handleAddContent)
r.Post("/repair", ui.handleRepairMedia)
r.Get("/torrents", ui.handleGetTorrents)
r.Delete("/torrents/{hash}", ui.handleDeleteTorrent)
r.Get("/config", ui.handleGetConfig)
r.Get("/version", ui.handleGetVersion)
})
})
return r
}