Feature: index page now have some content

This commit is contained in:
VnPower
2023-07-26 17:30:26 +07:00
parent 6b01c53dd1
commit 1079360d9a
6 changed files with 54 additions and 24 deletions
+5 -4
View File
@@ -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;
+5 -4
View File
@@ -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;
}
}
}
}
+39
View File
@@ -1,4 +1,5 @@
<div class="container">
{{ if Token }}
<div class="switcher">
<span class="switch-title">Filter</span>
<a href="/?mode=all" class="switch-button">All</a>
@@ -62,4 +63,42 @@
{{ end }}
<h2>Newest works</h2>
<div class="thumbnail-container">{{ include "small-tn" Artworks.Newest }}</div>
{{ else }}
<p><a href="/login">Login</a> to access more features!</p>
<h2>Daily rankings</h2>
<div class="thumbnail-container">
{{ range rank := Artworks.Rankings }}
<div class="artwork-thumbnail-large artwork-thumbnail">
<div class="artwork-rank-circle">{{ rank + 1 }}</div>
{{ if toInt(.Pages) > 1 }}
<div class="artwork-page-count"><span>&boxbox; {{ .Pages }}</span></div>
{{ end }}
<a href="/artworks/{{ .ID }}">
<img src="{{ .Thumbnail }}" alt="{{ .Title }}" class="artwork-master-image" />
</a>
<a class="artwork-thumbnail-title" href="/artworks/{{ .ID }}">
<h3 class="no-margin">{{ .Title }}</h3>
</a>
<a href="/users/{{ .ArtistID }}" class="artwork-thumbnail-artist flex"><img src="{{ .ArtistAvatar }}"
alt="{{ .ArtistName }}" class="artwork-thumbnail-artist-avatar border-rounded" />
{{ .ArtistName }}</a>
</div>
{{ end }}
</div>
<br />
<h2>Pixivision</h2>
<div class="thumbnail-container">
{{ range Artworks.Pixivision }}
<a href="{{ .URL }}" class="spotlight-thumbnail">
<img src="{{ .Thumbnail }}" alt="{{ .Title }}" class="spotlight-master-image" />
<div class="spotlight-title-wrapper">
<h2 class="spotlight-title">{{ .Title }}</h2>
</div>
</a>
{{ end }}
</div>
<br />
{{ end }}
</div>
+1 -1
View File
@@ -1,6 +1,6 @@
<div class="container">
<h2>Login with your account</h2>
<p>In order to enable the landing page and other features, such as bookmarking or following, you will have to login.
<p>In order to enable the landing page and other features, you will have to login.
</p>
<p>You can only login using your account's cookie, check out <a
href="https://codeberg.org/VnPower/pixivfe/wiki/How-to-get-the-cookie-%28PIXIVFE_TOKEN%29">this page</a> to
-13
View File
@@ -1,13 +0,0 @@
<div class="container" style="
display: flex;
align-items: center;
justify-content: center;
flex-flow: column wrap;
">
<h2>Welcome to PixivFE!</h2>
<p>
The landing page will be available after you set your account's token in the settings page.
</p>
<p>If you wish not to login, you can try out other pages as well!</p>
<small>Have fun!</small>
</div>
+4 -2
View File
@@ -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 {