mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
Fix ranking calendar images #57
This commit is contained in:
@@ -34,6 +34,14 @@ func ProxyImageUrl(c *fiber.Ctx, s string) string {
|
||||
return s
|
||||
}
|
||||
|
||||
func ProxyImageUrlNoEscape(c *fiber.Ctx, s string) string {
|
||||
proxy := GetImageProxy(c)
|
||||
s = strings.ReplaceAll(s, `https://i.pximg.net`, "https://"+proxy)
|
||||
// s = strings.ReplaceAll(s, `https:\/\/i.pximg.net`, "/proxy/i.pximg.net")
|
||||
s = strings.ReplaceAll(s, `https://s.pximg.net`, "/proxy/s.pximg.net")
|
||||
return s
|
||||
}
|
||||
|
||||
func GetImageProxy(c *fiber.Ctx) string {
|
||||
sess, err := Store.Get(c)
|
||||
if err != nil {
|
||||
|
||||
@@ -64,7 +64,7 @@ func GetRankingCalendar(c *fiber.Ctx, mode string, year, month int) (template.HT
|
||||
for _, a := range n.Attr {
|
||||
if a.Key == "data-src" {
|
||||
// adds a new link entry when the attribute matches
|
||||
links = append(links, session.ProxyImageUrl(c, a.Val))
|
||||
links = append(links, session.ProxyImageUrlNoEscape(c, a.Val))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user