mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 20:27:23 +00:00
Fix image meta
This commit is contained in:
@@ -46,9 +46,10 @@ func serveIndexHtml(c fiber.Ctx) error {
|
|||||||
url := serverBaseURL + c.Path()
|
url := serverBaseURL + c.Path()
|
||||||
cfTurnstileSiteKey := config.CloudflareTurnstileSiteKey()
|
cfTurnstileSiteKey := config.CloudflareTurnstileSiteKey()
|
||||||
siteInfo := config.SiteInfo()
|
siteInfo := config.SiteInfo()
|
||||||
|
path := c.Path()
|
||||||
|
|
||||||
if strings.HasPrefix(url, "/resources/") {
|
if strings.HasPrefix(path, "/resources/") {
|
||||||
idStr := strings.TrimPrefix(url, "/resources/")
|
idStr := strings.TrimPrefix(path, "/resources/")
|
||||||
id, err := strconv.Atoi(idStr)
|
id, err := strconv.Atoi(idStr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
r, err := service.GetResource(uint(id))
|
r, err := service.GetResource(uint(id))
|
||||||
@@ -60,8 +61,8 @@ func serveIndexHtml(c fiber.Ctx) error {
|
|||||||
description = getResourceDescription(r.Article)
|
description = getResourceDescription(r.Article)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if strings.HasPrefix(url, "/user/") {
|
} else if strings.HasPrefix(path, "/user/") {
|
||||||
username := strings.TrimPrefix(url, "/user/")
|
username := strings.TrimPrefix(path, "/user/")
|
||||||
u, err := service.GetUserByUsername(username)
|
u, err := service.GetUserByUsername(username)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
preview = fmt.Sprintf("/avatar/%d", u.ID)
|
preview = fmt.Sprintf("/avatar/%d", u.ID)
|
||||||
|
Reference in New Issue
Block a user