types.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. package routes
  2. import (
  3. "net/http"
  4. "codeberg.org/vnpower/pixivfe/v2/core"
  5. "codeberg.org/vnpower/pixivfe/v2/template"
  6. "codeberg.org/vnpower/pixivision"
  7. )
  8. func Render[T any](w http.ResponseWriter, r *http.Request, data T) error {
  9. return template.Render(w, r, data)
  10. }
  11. // Tutorial: adding new types in this file
  12. // Whenever you add new types, update `TestTemplates` in render_test.go to include the type in the test
  13. //
  14. // Warnings:
  15. // - Do not use pointer in Data_* struct. faker will insert nil.
  16. // - Do not name template file a.b.jet.html or it won't be able to be used here, since Data_a.b is not a valid identifier.
  17. type Data_about struct {
  18. Time string
  19. Version string
  20. ImageProxy string
  21. AcceptLanguage string
  22. }
  23. type Data_artwork struct {
  24. Illust core.Illust
  25. Title string
  26. MetaDescription string
  27. MetaImage string
  28. MetaAuthor string
  29. MetaAuthorID string
  30. }
  31. type Data_artworkMulti struct {
  32. Artworks []core.Illust
  33. Title string
  34. }
  35. type Data_diagnostics struct{}
  36. type Data_discovery struct {
  37. Artworks []core.ArtworkBrief
  38. Title string
  39. Queries template.PartialURL
  40. }
  41. type Data_error struct {
  42. Title string
  43. Error error
  44. }
  45. type Data_following struct {
  46. Title string
  47. Mode string
  48. Artworks []core.ArtworkBrief
  49. CurPage string
  50. Page int
  51. }
  52. type Data_index struct {
  53. Title string
  54. LoggedIn bool
  55. Data core.LandingArtworks
  56. NoTokenData core.Ranking
  57. }
  58. type Data_newest struct {
  59. Items []core.ArtworkBrief
  60. Title string
  61. }
  62. type Data_novel struct {
  63. Novel core.Novel
  64. NovelRelated []core.NovelBrief
  65. User core.UserBrief
  66. Title string
  67. FontType string
  68. ViewMode string
  69. Language string
  70. }
  71. type Data_novelDiscovery struct {
  72. Novels []core.NovelBrief
  73. Title string
  74. }
  75. type Data_pixivision_index struct {
  76. Data []pixivision.Article
  77. }
  78. type Data_pixivision_article struct {
  79. Article pixivision.Article
  80. }
  81. type Data_rank struct {
  82. Title string
  83. Page int
  84. PageLimit int
  85. Date string
  86. Data core.Ranking
  87. }
  88. type Data_rankingCalendar struct {
  89. Title string
  90. Render core.HTML
  91. Mode string
  92. Year int
  93. MonthBefore DateWrap
  94. MonthAfter DateWrap
  95. ThisMonth DateWrap
  96. }
  97. type Data_settings struct {
  98. ProxyList []string
  99. WorkingProxyList []string
  100. }
  101. type Data_tag struct {
  102. Title string
  103. Tag core.TagDetail
  104. Data core.SearchResult
  105. QueriesC template.PartialURL
  106. TrueTag string
  107. Page int
  108. }
  109. type Data_unauthorized struct{}
  110. type Data_user struct {
  111. Title string
  112. User core.User
  113. Category core.UserArtCategory
  114. PageLimit int
  115. Page int
  116. MetaImage string
  117. }
  118. type Data_userAtom struct {
  119. URL string
  120. Title string
  121. User core.User
  122. Category core.UserArtCategory
  123. Updated string
  124. PageLimit int
  125. Page int
  126. // MetaImage string
  127. }