mirror of
https://github.com/gabehf/Koito.git
synced 2026-04-22 20:11:50 -07:00
feat: add server=side cfg and default theme
This commit is contained in:
parent
b1b8498eab
commit
a436bf5c2f
8 changed files with 84 additions and 26 deletions
18
engine/handlers/server_cfg.go
Normal file
18
engine/handlers/server_cfg.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gabehf/koito/internal/cfg"
|
||||
"github.com/gabehf/koito/internal/utils"
|
||||
)
|
||||
|
||||
type ServerConfig struct {
|
||||
DefaultTheme string `json:"default_theme"`
|
||||
}
|
||||
|
||||
func GetCfgHandler() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
utils.WriteJSON(w, http.StatusOK, ServerConfig{DefaultTheme: cfg.DefaultTheme()})
|
||||
}
|
||||
}
|
||||
|
|
@ -35,6 +35,7 @@ func bindRoutes(
|
|||
Get("/images/{size}/{filename}", handlers.ImageHandler(db))
|
||||
|
||||
r.Route("/apis/web/v1", func(r chi.Router) {
|
||||
r.Get("/config", handlers.GetCfgHandler())
|
||||
r.Get("/artist", handlers.GetArtistHandler(db))
|
||||
r.Get("/artists", handlers.GetArtistsForItemHandler(db))
|
||||
r.Get("/album", handlers.GetAlbumHandler(db))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue