Cleanup
This commit is contained in:
parent
22f75038f5
commit
3a7a9dea65
@ -12,6 +12,14 @@ import (
|
||||
"golang.org/x/oauth2/google"
|
||||
)
|
||||
|
||||
// APIKeys ...
|
||||
type APIKeys struct {
|
||||
Google struct {
|
||||
ID string `json:"id"`
|
||||
Secret string `json:"secret"`
|
||||
} `json:"google"`
|
||||
}
|
||||
|
||||
// GoogleUser is the user data we receive from Google
|
||||
type GoogleUser struct {
|
||||
Sub string `json:"sub"`
|
||||
|
19
login.go
Normal file
19
login.go
Normal file
@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import "github.com/aerogo/aero"
|
||||
|
||||
func init() {
|
||||
// Authentication
|
||||
EnableGoogleLogin(app)
|
||||
|
||||
// Session middleware
|
||||
app.Use(func(ctx *aero.Context, next func()) {
|
||||
// Handle the request first
|
||||
next()
|
||||
|
||||
// Update session if it has been modified
|
||||
if ctx.HasSession() && ctx.Session().Modified() {
|
||||
app.Sessions.Store.Set(ctx.Session().ID(), ctx.Session())
|
||||
}
|
||||
})
|
||||
}
|
60
main.go
60
main.go
@ -19,35 +19,16 @@ import (
|
||||
|
||||
var app = aero.New()
|
||||
|
||||
// APIKeys ...
|
||||
type APIKeys struct {
|
||||
Google struct {
|
||||
ID string `json:"id"`
|
||||
Secret string `json:"secret"`
|
||||
} `json:"google"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
// CSS
|
||||
app.SetStyle(components.CSS())
|
||||
|
||||
// HTTPS
|
||||
app.Security.Load("security/fullchain.pem", "security/privkey.pem")
|
||||
|
||||
// CSS
|
||||
app.SetStyle(components.CSS())
|
||||
|
||||
// Session store
|
||||
app.Sessions.Store = arn.NewAerospikeStore("Session")
|
||||
|
||||
// Session middleware
|
||||
app.Use(func(ctx *aero.Context, next func()) {
|
||||
// Handle the request first
|
||||
next()
|
||||
|
||||
// Update session if it has been modified
|
||||
if ctx.HasSession() && ctx.Session().Modified() {
|
||||
app.Sessions.Store.Set(ctx.Session().ID(), ctx.Session())
|
||||
}
|
||||
})
|
||||
|
||||
// Layout
|
||||
app.Layout = func(ctx *aero.Context, content string) string {
|
||||
return components.Layout(content)
|
||||
@ -57,8 +38,6 @@ func main() {
|
||||
app.Ajax("/", dashboard.Get)
|
||||
app.Ajax("/anime", search.Get)
|
||||
app.Ajax("/anime/:id", anime.Get)
|
||||
// app.Ajax("/genres", genres.Get)
|
||||
// app.Ajax("/genres/:name", genre.Get)
|
||||
app.Ajax("/forum", forums.Get)
|
||||
app.Ajax("/forum/:tag", forum.Get)
|
||||
app.Ajax("/threads/:id", threads.Get)
|
||||
@ -68,9 +47,25 @@ func main() {
|
||||
app.Ajax("/users", users.Get)
|
||||
app.Ajax("/airing", airing.Get)
|
||||
app.Ajax("/awards", awards.Get)
|
||||
// app.Ajax("/genres", genres.Get)
|
||||
// app.Ajax("/genres/:name", genre.Get)
|
||||
|
||||
EnableGoogleLogin(app)
|
||||
// Favicon
|
||||
app.Get("/favicon.ico", func(ctx *aero.Context) string {
|
||||
return ctx.File("images/icons/favicon.ico")
|
||||
})
|
||||
|
||||
// Scripts
|
||||
app.Get("/scripts.js", func(ctx *aero.Context) string {
|
||||
return ctx.File("temp/scripts.js")
|
||||
})
|
||||
|
||||
// Web manifest
|
||||
app.Get("/manifest.json", func(ctx *aero.Context) string {
|
||||
return ctx.JSON(app.Config.Manifest)
|
||||
})
|
||||
|
||||
// Cover image
|
||||
app.Get("/images/cover/:file", func(ctx *aero.Context) string {
|
||||
format := ".jpg"
|
||||
|
||||
@ -81,21 +76,6 @@ func main() {
|
||||
return ctx.File("images/cover/" + ctx.Get("file") + format)
|
||||
})
|
||||
|
||||
// Favicon
|
||||
app.Get("/favicon.ico", func(ctx *aero.Context) string {
|
||||
return ctx.File("images/icons/favicon.ico")
|
||||
})
|
||||
|
||||
// Web manifest
|
||||
app.Get("/manifest.json", func(ctx *aero.Context) string {
|
||||
return ctx.JSON(app.Config.Manifest)
|
||||
})
|
||||
|
||||
// Scripts
|
||||
app.Get("/scripts.js", func(ctx *aero.Context) string {
|
||||
return ctx.File("temp/scripts.js")
|
||||
})
|
||||
|
||||
// For benchmarks
|
||||
app.Get("/hello", func(ctx *aero.Context) string {
|
||||
return ctx.Text("Hello World")
|
||||
|
@ -124,6 +124,12 @@ component Anime(anime *arn.Anime)
|
||||
//- if providers.Nyaa && providers.Nyaa.episodes !== undefined
|
||||
//- span(class=providers.Nyaa.episodes === 0 ? "entry-error" : "entry-ok")= providers.Nyaa.episodes + " eps"
|
||||
|
||||
h3.anime-section-name Tracks
|
||||
p Coming soon.
|
||||
|
||||
h3.anime-section-name Artwork
|
||||
p Coming soon.
|
||||
|
||||
h3.anime-section-name Reviews
|
||||
p Coming soon.
|
||||
|
||||
|
@ -52,27 +52,27 @@ component Dashboard(posts []*arn.Post)
|
||||
.dashboard-widget
|
||||
h3 Follow
|
||||
|
||||
a.dashboard-event(href="https://discord.gg/0kimAmMCeXGXuzNF")
|
||||
a.dashboard-event(href="https://discord.gg/0kimAmMCeXGXuzNF", target="_blank", rel="noopener")
|
||||
.dashboard-event-text
|
||||
Icon("microphone")
|
||||
span Discord
|
||||
|
||||
a.dashboard-event(href="https://www.facebook.com/animenotifier")
|
||||
a.dashboard-event(href="https://www.facebook.com/animenotifier", target="_blank", rel="noopener")
|
||||
.dashboard-event-text
|
||||
Icon("facebook")
|
||||
span Facebook
|
||||
|
||||
a.dashboard-event(href="https://twitter.com/animenotifier")
|
||||
a.dashboard-event(href="https://twitter.com/animenotifier", target="_blank", rel="noopener")
|
||||
.dashboard-event-text
|
||||
Icon("twitter")
|
||||
span Twitter
|
||||
|
||||
a.dashboard-event(href="https://plus.google.com/+AnimeReleaseNotifierOfficial")
|
||||
a.dashboard-event(href="https://plus.google.com/+AnimeReleaseNotifierOfficial", target="_blank", rel="noopener")
|
||||
.dashboard-event-text
|
||||
Icon("google-plus")
|
||||
span Google+
|
||||
|
||||
a.dashboard-event(href="https://github.com/animenotifier/notify.moe")
|
||||
a.dashboard-event(href="https://github.com/animenotifier/notify.moe", target="_blank", rel="noopener")
|
||||
.dashboard-event-text
|
||||
Icon("github")
|
||||
span GitHub
|
@ -22,7 +22,7 @@ func Get(ctx *aero.Context) string {
|
||||
var threads []*arn.Thread
|
||||
var animeList *arn.AnimeList
|
||||
|
||||
aero.Async(func() {
|
||||
aero.Parallel(func() {
|
||||
user = utils.GetUser(ctx)
|
||||
}, func() {
|
||||
animeList = viewUser.AnimeList()
|
||||
|
@ -60,7 +60,6 @@ animation cover-animation
|
||||
filter brightness(35%) blur(0)
|
||||
|
||||
.profile-image
|
||||
border-radius 3px
|
||||
object-fit cover
|
||||
width 100%
|
||||
height auto
|
||||
@ -68,6 +67,9 @@ animation cover-animation
|
||||
.image-container
|
||||
flex 1
|
||||
max-width 275px
|
||||
max-height 275px
|
||||
border-radius 3px
|
||||
overflow hidden
|
||||
|
||||
.intro-container
|
||||
vertical
|
||||
|
Loading…
Reference in New Issue
Block a user