From 12103fab59b9e4e35a2ee55bad519ceb22e3da29 Mon Sep 17 00:00:00 2001 From: VnPower Date: Thu, 29 Jun 2023 21:38:29 +0700 Subject: [PATCH] Enable landing page if you set the token --- handler/top.go | 1 - template/css/style.css | 1 + template/css/style.scss | 1 + template/index.html | 29 ----------------------------- template/index.jet.html | 5 +++++ views/pages.go | 16 +++++----------- 6 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 template/index.html diff --git a/handler/top.go b/handler/top.go index a9d06c3..2be594b 100644 --- a/handler/top.go +++ b/handler/top.go @@ -85,7 +85,6 @@ func (p *PixivClient) GetLandingPage(mode string) (models.LandingArtworks, error for i := 0; i < len(pages.RecommendedByTags); i++ { temp := pages.RecommendedByTags[i] - temp.Artworks = artworks.Artworks[count : count+Min(len(temp.Ids), 18)] context.RecommendByTags = append(context.RecommendByTags, temp.LandingRecommendByTags) diff --git a/template/css/style.css b/template/css/style.css index 4c5cde9..a43489e 100644 --- a/template/css/style.css +++ b/template/css/style.css @@ -267,6 +267,7 @@ body { .artwork-page { background: #262a2b; + border-radius: 8px; } .artwork-page .artwork-content { margin: 0 20px; diff --git a/template/css/style.scss b/template/css/style.scss index 6dc3cfc..cb889b6 100644 --- a/template/css/style.scss +++ b/template/css/style.scss @@ -310,6 +310,7 @@ body { .artwork-page { background: $bg-alt; + border-radius: 8px; .artwork-content { margin: 0 20px; diff --git a/template/index.html b/template/index.html deleted file mode 100644 index b355029..0000000 --- a/template/index.html +++ /dev/null @@ -1,29 +0,0 @@ -{{ template "header.html" }} -
-

Recommended works

- -
- {{ template "small-tn.html" .Recommended }} -
- -

Today's rankings

-
- {{ template "large-tn.html" .Rankings }} -
- -

Pixivision

-
- {{ range .Spotlights }} - - {{ .Title }} -
-

{{ .Title }}

-
-
- {{ end }} -
- -

Newest by all

-
{{ template "small-tn.html" .Newest }}
-
-{{ template "footer.html" }} diff --git a/template/index.jet.html b/template/index.jet.html index 03bf120..5a18834 100644 --- a/template/index.jet.html +++ b/template/index.jet.html @@ -1,4 +1,9 @@
+
+ Filter + All + R-18 +

Newest works by users you follow

{{ include "small-tn" Artworks.Following }}

diff --git a/views/pages.go b/views/pages.go index 5ef141e..ebc9065 100644 --- a/views/pages.go +++ b/views/pages.go @@ -65,16 +65,11 @@ func index_page(c *fiber.Ctx) error { if image_proxy == nil { image_proxy = &configs.ProxyServer } - // recommended, _ := handler.GetRecommendedIllust(c) - // ranking, _ := handler.GetRankingIllust(c, "day") - // spotlight := handler.GetSpotlightArticle(c) - // newest, _ := handler.GetNewestIllust(c) - // return c.Render(http.StatusOK, "index.html", fiber.Map{ - // "Recommended": recommended, - // "Rankings": ranking, - // "Spotlights": spotlight, - // "Newest": newest, - // }) + token := get_session_value(c, "token") + if token == nil { + return c.Render("temp", fiber.Map{"Title": "Landing"}) + } + artworks, err := PC.GetLandingPage("all") if err != nil { return err @@ -90,7 +85,6 @@ func index_page(c *fiber.Ctx) error { artworks.RecommendByTags = models.ProxyRecommendedByTagsSlice(artworks.RecommendByTags, *image_proxy) return c.Render("index", fiber.Map{"Title": "Landing", "Artworks": artworks}) - // return c.Render("temp", fiber.Map{"Title": "Landing"}) } func user_page(c *fiber.Ctx) error {