discovery.go 775 B

123456789101112131415161718192021222324252627282930313233
  1. package routes
  2. import (
  3. "net/http"
  4. "codeberg.org/vnpower/pixivfe/v2/core"
  5. "codeberg.org/vnpower/pixivfe/v2/template"
  6. )
  7. func DiscoveryPage(w http.ResponseWriter, r *http.Request) error {
  8. mode := GetQueryParam(r, "mode", "safe")
  9. works, err := core.GetDiscoveryArtwork(r, mode)
  10. if err != nil {
  11. return err
  12. }
  13. urlc := template.PartialURL{Path: "discovery", Query: map[string]string{"mode": mode}}
  14. return Render(w, r, Data_discovery{Artworks: works, Title: "Discovery", Queries: urlc})
  15. }
  16. func NovelDiscoveryPage(w http.ResponseWriter, r *http.Request) error {
  17. mode := GetQueryParam(r, "mode", "safe")
  18. works, err := core.GetDiscoveryNovels(r, mode)
  19. if err != nil {
  20. return err
  21. }
  22. return Render(w, r, Data_novelDiscovery{Novels: works, Title: "Discovery"})
  23. }