From 1079360d9affc6be179e88248720cf50edb4bfdd Mon Sep 17 00:00:00 2001 From: VnPower Date: Wed, 26 Jul 2023 17:30:26 +0700 Subject: [PATCH] Feature: index page now have some content --- template/css/style.css | 9 +++++---- template/css/style.scss | 9 +++++---- template/index.jet.html | 39 +++++++++++++++++++++++++++++++++++++++ template/login.jet.html | 2 +- template/temp.jet.html | 13 ------------- views/pages.go | 6 ++++-- 6 files changed, 54 insertions(+), 24 deletions(-) delete mode 100644 template/temp.jet.html diff --git a/template/css/style.css b/template/css/style.css index 37f1adf..f639648 100644 --- a/template/css/style.css +++ b/template/css/style.css @@ -2,6 +2,11 @@ box-sizing: border-box; } +a { + color: #7aa2f7; + text-decoration: none; +} + body { top: 0; margin: 0; @@ -380,10 +385,6 @@ body { .user-page .user-details .user-comment { font-size: 0.9em; } -.user-page .user-details .user-comment a { - color: #7aa2f7; - text-decoration: none; -} .tag-header { display: flex; diff --git a/template/css/style.scss b/template/css/style.scss index c6b7339..7ee20fd 100644 --- a/template/css/style.scss +++ b/template/css/style.scss @@ -17,6 +17,11 @@ $red: #f7768e; box-sizing: border-box; } +a { + color: $blue; + text-decoration: none; +} + body { top: 0; margin: 0; @@ -450,10 +455,6 @@ body { .user-comment { font-size: 0.9em; - a { - color: $blue; - text-decoration: none; - } } } } diff --git a/template/index.jet.html b/template/index.jet.html index 5a18834..6a3dcd6 100644 --- a/template/index.jet.html +++ b/template/index.jet.html @@ -1,4 +1,5 @@
+ {{ if Token }}
Filter All @@ -62,4 +63,42 @@ {{ end }}

Newest works

{{ include "small-tn" Artworks.Newest }}
+ {{ else }} +

Login to access more features!

+

Daily rankings

+
+ {{ range rank := Artworks.Rankings }} +
+
{{ rank + 1 }}
+ {{ if toInt(.Pages) > 1 }} +
⧉ {{ .Pages }}
+ {{ end }} + + {{ .Title }} + + + +

{{ .Title }}

+
+ {{ .ArtistName }} + {{ .ArtistName }} +
+ {{ end }} +
+
+ +

Pixivision

+
+ {{ range Artworks.Pixivision }} + + {{ .Title }} +
+

{{ .Title }}

+
+
+ {{ end }} +
+
+ {{ end }}
diff --git a/template/login.jet.html b/template/login.jet.html index 6a463ff..fb54b2b 100644 --- a/template/login.jet.html +++ b/template/login.jet.html @@ -1,6 +1,6 @@

Login with your account

-

In order to enable the landing page and other features, such as bookmarking or following, you will have to login. +

In order to enable the landing page and other features, you will have to login.

You can only login using your account's cookie, check out this page to diff --git a/template/temp.jet.html b/template/temp.jet.html deleted file mode 100644 index 760cc1e..0000000 --- a/template/temp.jet.html +++ /dev/null @@ -1,13 +0,0 @@ -

-

Welcome to PixivFE!

-

- The landing page will be available after you set your account's token in the settings page. -

-

If you wish not to login, you can try out other pages as well!

- Have fun! -
diff --git a/views/pages.go b/views/pages.go index ec4f347..d9b144b 100644 --- a/views/pages.go +++ b/views/pages.go @@ -62,13 +62,15 @@ func artwork_page(c *fiber.Ctx) error { } func index_page(c *fiber.Ctx) error { + had_token := true image_proxy := get_session_value(c, "image-proxy") if image_proxy == nil { image_proxy = &configs.ProxyServer } token := get_session_value(c, "token") if token == nil { - return c.Render("temp", fiber.Map{"Title": "Landing"}) + had_token = false + token = &configs.Token } PC := NewPixivClient(5000) @@ -91,7 +93,7 @@ func index_page(c *fiber.Ctx) error { artworks.Pixivision = models.ProxyPixivisionSlice(artworks.Pixivision, *image_proxy) artworks.RecommendByTags = models.ProxyRecommendedByTagsSlice(artworks.RecommendByTags, *image_proxy) - return c.Render("index", fiber.Map{"Title": "Landing", "Artworks": artworks}) + return c.Render("index", fiber.Map{"Title": "Landing", "Artworks": artworks, "Token": had_token}) } func user_page(c *fiber.Ctx) error {