Added frontpage and Google login
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/pages/frontpage"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
@ -13,21 +14,21 @@ const maxPosts = 5
|
||||
func Get(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user != nil {
|
||||
posts, err := arn.GetPosts()
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(500, "Error fetching posts", err)
|
||||
}
|
||||
|
||||
arn.SortPostsLatestFirst(posts)
|
||||
|
||||
if len(posts) > maxPosts {
|
||||
posts = posts[:maxPosts]
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Dashboard(posts))
|
||||
if user == nil {
|
||||
return frontpage.Get(ctx)
|
||||
}
|
||||
|
||||
return ctx.HTML("ARN 4.0 is currently under construction.<br><a href='https://paypal.me/blitzprog' target='_blank' rel='noopener'>Support the development</a><br><a href='/auth/google'>Login via Google</a>")
|
||||
posts, err := arn.GetPosts()
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(500, "Error fetching posts", err)
|
||||
}
|
||||
|
||||
arn.SortPostsLatestFirst(posts)
|
||||
|
||||
if len(posts) > maxPosts {
|
||||
posts = posts[:maxPosts]
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Dashboard(posts))
|
||||
}
|
||||
|
11
pages/frontpage/frontpage.go
Normal file
11
pages/frontpage/frontpage.go
Normal file
@ -0,0 +1,11 @@
|
||||
package frontpage
|
||||
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
)
|
||||
|
||||
// Get ...
|
||||
func Get(ctx *aero.Context) string {
|
||||
return ctx.HTML(components.FrontPage())
|
||||
}
|
8
pages/frontpage/frontpage.pixy
Normal file
8
pages/frontpage/frontpage.pixy
Normal file
@ -0,0 +1,8 @@
|
||||
component FrontPage
|
||||
p Anime Notifier 4.0 is currently under construction.
|
||||
p
|
||||
a(href="https://paypal.me/blitzprog", rel="noopener") Support the development
|
||||
|
||||
.login-buttons
|
||||
a.login-button(href="/auth/google")
|
||||
img.login-button-image(src="/images/login/google", alt="Google Login", title="Login with your Google account")
|
11
pages/frontpage/frontpage.scarlet
Normal file
11
pages/frontpage/frontpage.scarlet
Normal file
@ -0,0 +1,11 @@
|
||||
.login-buttons
|
||||
horizontal-wrap
|
||||
width 100%
|
||||
justify-content center
|
||||
|
||||
.login-button
|
||||
//
|
||||
|
||||
.login-button-image
|
||||
max-width 236px
|
||||
max-height 44px
|
Reference in New Issue
Block a user