discovery.go 711 B

1234567891011121314151617181920212223242526272829303132
  1. package routes
  2. import (
  3. "codeberg.org/vnpower/pixivfe/v2/core"
  4. "codeberg.org/vnpower/pixivfe/v2/utils"
  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 := utils.PartialURL{Path: "discovery", Query: map[string]string{"mode": mode}}
  14. return Render(c, Data_discovery{Artworks: works, Title: "Discovery", Queries: urlc})
  15. }
  16. func NovelDiscoveryPage(c *fiber.Ctx) error {
  17. mode := c.Query("mode", "safe")
  18. works, err := core.GetDiscoveryNovels(c, mode)
  19. if err != nil {
  20. return err
  21. }
  22. return Render(c, Data_novelDiscovery{Novels: works, Title: "Discovery"})
  23. }