fix(all) Добавил раздачу картинок через бекенд

This commit is contained in:
2026-06-16 16:22:51 +03:00
parent 15efab81a4
commit 483abc80dc
23 changed files with 44 additions and 29 deletions
+15
View File
@@ -1,6 +1,7 @@
package handlers
import (
"fmt"
"net/http"
"github.com/gin-gonic/gin"
@@ -19,6 +20,12 @@ func GetItem(c *gin.Context) {
return
}
if item.AvatarURL != "" {
item.AvatarURL = fmt.Sprintf("/static/items/%s", item.AvatarURL)
} else {
item.AvatarURL = fmt.Sprintf("/static/items/background.png")
}
c.JSON(http.StatusOK, item)
}
@@ -30,6 +37,14 @@ func GetAllItems(c *gin.Context) {
return
}
for i := range items {
if items[i].AvatarURL != "" {
items[i].AvatarURL = fmt.Sprintf("/static/items/%s", items[i].AvatarURL)
} else {
items[i].AvatarURL = fmt.Sprintf("/static/items/background.png")
}
}
c.JSON(http.StatusOK, items)
}