discovery.go 769 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package pages
  2. import (
  3. site "codeberg.org/vnpower/pixivfe/v2/core/http"
  4. core "codeberg.org/vnpower/pixivfe/v2/core/webapi"
  5. "github.com/gofiber/fiber/v2"
  6. )
  7. func DiscoveryPage(c *fiber.Ctx) error {
  8. mode := c.Query("mode", "safe")
  9. works, err := core.GetDiscoveryArtwork(c, mode)
  10. if err != nil {
  11. return err
  12. }
  13. urlc := site.NewURLConstruct("discovery", map[string]string{"mode": mode})
  14. return c.Render("discovery", fiber.Map{
  15. "Artworks": works,
  16. "Title": "Discovery",
  17. "Queries": urlc,
  18. })
  19. }
  20. func NovelDiscoveryPage(c *fiber.Ctx) error {
  21. mode := c.Query("mode", "safe")
  22. works, err := core.GetDiscoveryNovels(c, mode)
  23. if err != nil {
  24. return err
  25. }
  26. return c.Render("novelDiscovery", fiber.Map{
  27. "Novels": works,
  28. "Title": "Discovery",
  29. })
  30. }