Cleanup
This commit is contained in:
parent
22f75038f5
commit
3a7a9dea65
@ -12,6 +12,14 @@ import (
|
|||||||
"golang.org/x/oauth2/google"
|
"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
|
// GoogleUser is the user data we receive from Google
|
||||||
type GoogleUser struct {
|
type GoogleUser struct {
|
||||||
Sub string `json:"sub"`
|
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()
|
var app = aero.New()
|
||||||
|
|
||||||
// APIKeys ...
|
|
||||||
type APIKeys struct {
|
|
||||||
Google struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
} `json:"google"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// CSS
|
|
||||||
app.SetStyle(components.CSS())
|
|
||||||
|
|
||||||
// HTTPS
|
// HTTPS
|
||||||
app.Security.Load("security/fullchain.pem", "security/privkey.pem")
|
app.Security.Load("security/fullchain.pem", "security/privkey.pem")
|
||||||
|
|
||||||
|
// CSS
|
||||||
|
app.SetStyle(components.CSS())
|
||||||
|
|
||||||
// Session store
|
// Session store
|
||||||
app.Sessions.Store = arn.NewAerospikeStore("Session")
|
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
|
// Layout
|
||||||
app.Layout = func(ctx *aero.Context, content string) string {
|
app.Layout = func(ctx *aero.Context, content string) string {
|
||||||
return components.Layout(content)
|
return components.Layout(content)
|
||||||
@ -57,8 +38,6 @@ func main() {
|
|||||||
app.Ajax("/", dashboard.Get)
|
app.Ajax("/", dashboard.Get)
|
||||||
app.Ajax("/anime", search.Get)
|
app.Ajax("/anime", search.Get)
|
||||||
app.Ajax("/anime/:id", anime.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", forums.Get)
|
||||||
app.Ajax("/forum/:tag", forum.Get)
|
app.Ajax("/forum/:tag", forum.Get)
|
||||||
app.Ajax("/threads/:id", threads.Get)
|
app.Ajax("/threads/:id", threads.Get)
|
||||||
@ -68,9 +47,25 @@ func main() {
|
|||||||
app.Ajax("/users", users.Get)
|
app.Ajax("/users", users.Get)
|
||||||
app.Ajax("/airing", airing.Get)
|
app.Ajax("/airing", airing.Get)
|
||||||
app.Ajax("/awards", awards.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 {
|
app.Get("/images/cover/:file", func(ctx *aero.Context) string {
|
||||||
format := ".jpg"
|
format := ".jpg"
|
||||||
|
|
||||||
@ -81,21 +76,6 @@ func main() {
|
|||||||
return ctx.File("images/cover/" + ctx.Get("file") + format)
|
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
|
// For benchmarks
|
||||||
app.Get("/hello", func(ctx *aero.Context) string {
|
app.Get("/hello", func(ctx *aero.Context) string {
|
||||||
return ctx.Text("Hello World")
|
return ctx.Text("Hello World")
|
||||||
|
@ -124,6 +124,12 @@ component Anime(anime *arn.Anime)
|
|||||||
//- if providers.Nyaa && providers.Nyaa.episodes !== undefined
|
//- if providers.Nyaa && providers.Nyaa.episodes !== undefined
|
||||||
//- span(class=providers.Nyaa.episodes === 0 ? "entry-error" : "entry-ok")= providers.Nyaa.episodes + " eps"
|
//- 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
|
h3.anime-section-name Reviews
|
||||||
p Coming soon.
|
p Coming soon.
|
||||||
|
|
||||||
|
@ -52,27 +52,27 @@ component Dashboard(posts []*arn.Post)
|
|||||||
.dashboard-widget
|
.dashboard-widget
|
||||||
h3 Follow
|
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
|
.dashboard-event-text
|
||||||
Icon("microphone")
|
Icon("microphone")
|
||||||
span Discord
|
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
|
.dashboard-event-text
|
||||||
Icon("facebook")
|
Icon("facebook")
|
||||||
span 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
|
.dashboard-event-text
|
||||||
Icon("twitter")
|
Icon("twitter")
|
||||||
span 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
|
.dashboard-event-text
|
||||||
Icon("google-plus")
|
Icon("google-plus")
|
||||||
span Google+
|
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
|
.dashboard-event-text
|
||||||
Icon("github")
|
Icon("github")
|
||||||
span GitHub
|
span GitHub
|
@ -22,7 +22,7 @@ func Get(ctx *aero.Context) string {
|
|||||||
var threads []*arn.Thread
|
var threads []*arn.Thread
|
||||||
var animeList *arn.AnimeList
|
var animeList *arn.AnimeList
|
||||||
|
|
||||||
aero.Async(func() {
|
aero.Parallel(func() {
|
||||||
user = utils.GetUser(ctx)
|
user = utils.GetUser(ctx)
|
||||||
}, func() {
|
}, func() {
|
||||||
animeList = viewUser.AnimeList()
|
animeList = viewUser.AnimeList()
|
||||||
|
@ -60,7 +60,6 @@ animation cover-animation
|
|||||||
filter brightness(35%) blur(0)
|
filter brightness(35%) blur(0)
|
||||||
|
|
||||||
.profile-image
|
.profile-image
|
||||||
border-radius 3px
|
|
||||||
object-fit cover
|
object-fit cover
|
||||||
width 100%
|
width 100%
|
||||||
height auto
|
height auto
|
||||||
@ -68,6 +67,9 @@ animation cover-animation
|
|||||||
.image-container
|
.image-container
|
||||||
flex 1
|
flex 1
|
||||||
max-width 275px
|
max-width 275px
|
||||||
|
max-height 275px
|
||||||
|
border-radius 3px
|
||||||
|
overflow hidden
|
||||||
|
|
||||||
.intro-container
|
.intro-container
|
||||||
vertical
|
vertical
|
||||||
|
Loading…
Reference in New Issue
Block a user