12345678910111213141516171819202122232425262728293031323334353637383940 |
- package routes
- import (
- "codeberg.org/vnpower/pixivfe/v2/session"
- "codeberg.org/vnpower/pixivision"
- "github.com/gofiber/fiber/v2"
- )
- func PixivisionHomePage(c *fiber.Ctx) error {
- // Note: don't process images here?
- data, err := pixivision.GetHomepage()
- if err != nil {
- return err
- }
- for i := range data {
- data[i].Thumbnail = session.ProxyImageUrlNoEscape(c, data[i].Thumbnail)
- }
- return Render(c, Data_pixivision_index{Data: data})
- }
- func PixivisionArticlePage(c *fiber.Ctx) error {
- // Note: don't process images here?
- id := c.Params("id")
- data, err := pixivision.GetArticle(id)
- if err != nil {
- return err
- }
- data.Thumbnail = session.ProxyImageUrlNoEscape(c, data.Thumbnail)
- for i := range data.Items {
- data.Items[i].Image = session.ProxyImageUrlNoEscape(c, data.Items[i].Image)
- data.Items[i].Avatar = session.ProxyImageUrlNoEscape(c, data.Items[i].Avatar)
- }
- return Render(c, Data_pixivision_article{Article: data})
- }
|