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)
}