Upgraded to latest aero version

This commit is contained in:
2019-06-01 13:55:49 +09:00
parent ae591e5e7e
commit 28db818c37
196 changed files with 645 additions and 593 deletions

View File

@ -6,7 +6,9 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/assets"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/middleware"
"github.com/animenotifier/notify.moe/utils"
)
@ -18,7 +20,7 @@ const (
)
// Get anime page.
func Get(ctx *aero.Context) string {
func Get(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
anime, err := arn.GetAnime(id)
@ -120,12 +122,13 @@ func Get(ctx *aero.Context) string {
})
// Open Graph
ctx.Data = getOpenGraph(ctx, anime)
customCtx := ctx.(*middleware.OpenGraphContext)
customCtx.OpenGraph = getOpenGraph(ctx, anime)
return ctx.HTML(components.Anime(anime, animeListItem, tracks, amvs, amvAppearances, episodes, friends, friendsAnimeListItems, episodeToFriends, user))
}
func getOpenGraph(ctx *aero.Context, anime *arn.Anime) *arn.OpenGraph {
func getOpenGraph(ctx aero.Context, anime *arn.Anime) *arn.OpenGraph {
description := anime.Summary
if len(description) > maxDescriptionLength {
@ -136,7 +139,7 @@ func getOpenGraph(ctx *aero.Context, anime *arn.Anime) *arn.OpenGraph {
Tags: map[string]string{
"og:title": anime.Title.Canonical,
"og:image": "https:" + anime.ImageLink("large"),
"og:url": "https://" + ctx.App.Config.Domain + anime.Link(),
"og:url": "https://" + assets.Domain + anime.Link(),
"og:site_name": "notify.moe",
"og:description": description,
},

View File

@ -12,7 +12,7 @@ import (
)
// Characters ...
func Characters(ctx *aero.Context) string {
func Characters(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
anime, err := arn.GetAnime(id)

View File

@ -11,7 +11,7 @@ import (
)
// Comments ...
func Comments(ctx *aero.Context) string {
func Comments(ctx aero.Context) error {
user := utils.GetUser(ctx)
id := ctx.Get("id")
anime, err := arn.GetAnime(id)

View File

@ -11,7 +11,7 @@ import (
)
// Main anime edit page.
func Main(ctx *aero.Context) string {
func Main(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
@ -29,7 +29,7 @@ func Main(ctx *aero.Context) string {
}
// Images anime images edit page.
func Images(ctx *aero.Context) string {
func Images(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
@ -47,7 +47,7 @@ func Images(ctx *aero.Context) string {
}
// Characters anime characters edit page.
func Characters(ctx *aero.Context) string {
func Characters(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
@ -71,7 +71,7 @@ func Characters(ctx *aero.Context) string {
}
// Relations anime relations edit page.
func Relations(ctx *aero.Context) string {
func Relations(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
@ -95,7 +95,7 @@ func Relations(ctx *aero.Context) string {
}
// Episodes anime episodes edit page.
func Episodes(ctx *aero.Context) string {
func Episodes(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)

View File

@ -11,7 +11,7 @@ import (
)
// Episodes ...
func Episodes(ctx *aero.Context) string {
func Episodes(ctx aero.Context) error {
user := utils.GetUser(ctx)
id := ctx.Get("id")
anime, err := arn.GetAnime(id)

View File

@ -9,8 +9,8 @@ import (
)
// RedirectByMapping redirects to the anime with the given mapping ID.
func RedirectByMapping(mappingName string) func(*aero.Context) string {
return func(ctx *aero.Context) string {
func RedirectByMapping(mappingName string) func(aero.Context) error {
return func(ctx aero.Context) error {
id := ctx.Get("id")
finder := arn.NewAnimeFinder(mappingName)
anime := finder.GetAnime(id)

View File

@ -10,7 +10,7 @@ import (
)
// Relations ...
func Relations(ctx *aero.Context) string {
func Relations(ctx aero.Context) error {
user := utils.GetUser(ctx)
id := ctx.Get("id")

View File

@ -12,7 +12,7 @@ import (
)
// Tracks ...
func Tracks(ctx *aero.Context) string {
func Tracks(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)