Fixed some small bugs. Frontend is now included in the docker image

This commit is contained in:
2026-06-13 11:26:52 +02:00
parent 6d4a034753
commit c6a07e69e7
7 changed files with 610 additions and 103 deletions
+8 -1
View File
@@ -2,6 +2,7 @@ package server
import (
"net/http"
"os"
"github.com/labstack/echo/v5"
"music-server/internal/backend"
@@ -38,5 +39,11 @@ func (c *CharacterHandler) GetCharacterList(ctx *echo.Context) error {
// @Router /character [get]
func (c *CharacterHandler) GetCharacter(ctx *echo.Context) error {
character := ctx.QueryParam("name")
return ctx.File(backend.GetCharacter(character))
characterPath := backend.GetCharacter(character)
file, err := os.Open(characterPath)
if err != nil {
return echo.NewHTTPError(http.StatusNotFound, err.Error())
}
defer file.Close()
return ctx.Stream(http.StatusOK, "image/png", file)
}
+2
View File
@@ -49,6 +49,7 @@ func (s *SyncHandler) SyncGamesNewOnlyChanges(ctx *echo.Context) error {
return ctx.JSON(http.StatusLocked, "Syncing is in progress")
}
logging.GetLogger().Info("Starting sync with only changes")
backend.Syncing = true
go backend.SyncGamesNewOnlyChanges()
return ctx.JSON(http.StatusOK, "Start syncing games")
}
@@ -68,6 +69,7 @@ func (s *SyncHandler) SyncGamesNewFull(ctx *echo.Context) error {
return ctx.JSON(http.StatusLocked, "Syncing is in progress")
}
logging.GetLogger().Info("Starting full sync")
backend.Syncing = true
go backend.SyncGamesNewFull()
return ctx.JSON(http.StatusOK, "Start syncing games full")
}