show ramdom background image

This commit is contained in:
2025-08-28 15:23:01 +08:00
parent 3dd042a752
commit 488a91e651
3 changed files with 25 additions and 2 deletions

View File

@@ -157,9 +157,11 @@ func serveIndexHtml(c fiber.Ctx) error {
}
} else if path == "/" || path == "" {
pinned, err := service.GetPinnedResources()
if err == nil {
random, err1 := service.RandomCover()
if err == nil && err1 == nil {
preFetchDataJson, _ := json.Marshal(map[string]interface{}{
"pinned": pinned,
"pinned": pinned,
"background": random,
})
preFetchData = url.PathEscape(string(preFetchDataJson))
}