diff --git a/assets/views/fragments/pixivisionArticles.jet.html b/assets/views/fragments/pixivisionArticles.jet.html
new file mode 100644
index 0000000..fa31b56
--- /dev/null
+++ b/assets/views/fragments/pixivisionArticles.jet.html
@@ -0,0 +1,35 @@
+{{- range _, article := . }}
+
{{- Mode := isset(Queries.mode) ? Queries.mode : "all" }}
diff --git a/assets/views/pixivisionIndex.jet.html b/assets/views/pixivisionIndex.jet.html
index 1d535fd..8916252 100644
--- a/assets/views/pixivisionIndex.jet.html
+++ b/assets/views/pixivisionIndex.jet.html
@@ -5,41 +5,8 @@
- {{- range _, article := .Data }}
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
- {{parseTimeCustomFormat(article.Date, "2006-01-02")}}
-
-
-
-
-
- {{- end }}
+
+ {{- include "fragments/pixivisionArticles" .Data }}
diff --git a/core/index.go b/core/index.go
index db96586..f3ff470 100644
--- a/core/index.go
+++ b/core/index.go
@@ -29,14 +29,19 @@ type LandingArtworks struct {
Newest []ArtworkBrief
Rankings []ArtworkBrief
Users []ArtworkBrief
- Pixivision []Pixivision
+ // NOTE: a Pixivision field *does* exist in the GetLandingURL response, but it is incomplete,
+ // containing only the id, title, thumbnailUrl, and url fields
+ // As such, we need to retrieve the full-fat Pixivision field by calling PixivisionGetHomepage
+ // Pixivision []Pixivision
+ Pixivision []PixivisionArticle
RecommendByTags []RecommendedTags
}
func GetLanding(r *http.Request, mode string) (*LandingArtworks, error) {
var pages struct {
- Pixivision []Pixivision `json:"pixivision"`
- Follow []int `json:"follow"`
+ // NOTE: commented out for the reason above
+ // Pixivision []Pixivision `json:"pixivision"`
+ Follow []int `json:"follow"`
Recommended struct {
IDs []string `json:"ids"`
} `json:"recommend"`
@@ -95,7 +100,20 @@ func GetLanding(r *http.Request, mode string) (*LandingArtworks, error) {
}
// Parse everything
- landing.Pixivision = pages.Pixivision
+ // Fetch full pixivision data
+ pixivisionArticles, err := PixivisionGetHomepage(r, "1") // Fetch the first page
+ if err != nil {
+ return &landing, err
+ }
+
+ // Apply ProxyImageUrl to each Thumbnail
+ for i := range pixivisionArticles {
+ pixivisionArticles[i].Thumbnail = session.ProxyImageUrl(r, pixivisionArticles[i].Thumbnail)
+ }
+
+ // Assign the fetched pixivision articles to the landing struct
+ landing.Pixivision = pixivisionArticles
+ fmt.Println("Pixivision JSON:", gjson.Get(pagesStr, "pixivision"))
landing.Following = make([]ArtworkBrief, len(pages.Follow))
for _, i := range pages.Follow {