Enable landing page if you set the token

This commit is contained in:
VnPower 2023-06-29 21:38:29 +07:00
parent b66a864ab7
commit 12103fab59
Signed by: vnpower
GPG key ID: 881DE3DEB966106C
6 changed files with 12 additions and 41 deletions

View file

@ -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)

View file

@ -267,6 +267,7 @@ body {
.artwork-page {
background: #262a2b;
border-radius: 8px;
}
.artwork-page .artwork-content {
margin: 0 20px;

View file

@ -310,6 +310,7 @@ body {
.artwork-page {
background: $bg-alt;
border-radius: 8px;
.artwork-content {
margin: 0 20px;

View file

@ -1,29 +0,0 @@
{{ template "header.html" }}
<div class="container">
<h1>Recommended works</h1>
<div class="thumbnail-container">
{{ template "small-tn.html" .Recommended }}
</div>
<h1>Today's rankings</h1>
<div class="thumbnail-container">
{{ template "large-tn.html" .Rankings }}
</div>
<h1>Pixivision</h1>
<div class="thumbnail-container">
{{ range .Spotlights }}
<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>
<h1>Newest by all</h1>
<div>{{ template "small-tn.html" .Newest }}</div>
</div>
{{ template "footer.html" }}

View file

@ -1,4 +1,9 @@
<div class="container">
<div class="switcher">
<span class="switch-title">Filter</span>
<a href="/?mode=all" class="switch-button">All</a>
<a href="/?mode=r18" class="switch-button">R-18</a>
</div>
<h2>Newest works by users you follow</h2>
<div class="thumbnail-container">{{ include "small-tn" Artworks.Following }}</div>
<br>

View file

@ -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 {