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

This commit is contained in:
Deforest6342 committed 2026-06-16 16:22:51 +03:00
1 parent 15efab81a4
commit 483abc80dc
23 files changed
+44 -29

No files matched your search

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