diff --git a/google.go b/google.go index 8b971149..519e8584 100644 --- a/google.go +++ b/google.go @@ -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"` diff --git a/login.go b/login.go new file mode 100644 index 00000000..6619f7de --- /dev/null +++ b/login.go @@ -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()) + } + }) +} diff --git a/main.go b/main.go index 6128679a..40282074 100644 --- a/main.go +++ b/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") diff --git a/pages/anime/anime.pixy b/pages/anime/anime.pixy index 6e43520f..4d613707 100644 --- a/pages/anime/anime.pixy +++ b/pages/anime/anime.pixy @@ -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. diff --git a/pages/dashboard/dashboard.pixy b/pages/dashboard/dashboard.pixy index 79f12719..20218c97 100644 --- a/pages/dashboard/dashboard.pixy +++ b/pages/dashboard/dashboard.pixy @@ -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 \ No newline at end of file diff --git a/pages/profile/profile.go b/pages/profile/profile.go index a7346e2c..0ff355fa 100644 --- a/pages/profile/profile.go +++ b/pages/profile/profile.go @@ -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() diff --git a/pages/profile/profile.scarlet b/pages/profile/profile.scarlet index acfc4d23..d9450565 100644 --- a/pages/profile/profile.scarlet +++ b/pages/profile/profile.scarlet @@ -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