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

@ -5,12 +5,14 @@ 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"
)
// Get quote.
func Get(ctx *aero.Context) string {
func Get(ctx aero.Context) error {
user := utils.GetUser(ctx)
id := ctx.Get("id")
quote, err := arn.GetQuote(id)
@ -23,7 +25,7 @@ func Get(ctx *aero.Context) string {
Tags: map[string]string{
"og:title": "Quote",
"og:description": quote.Text.English,
"og:url": "https://" + ctx.App.Config.Domain + quote.Link(),
"og:url": "https://" + assets.Domain + quote.Link(),
"og:site_name": "notify.moe",
"og:type": "article",
},
@ -36,6 +38,7 @@ func Get(ctx *aero.Context) string {
openGraph.Tags["og:image"] = "https:" + character.ImageLink("large")
}
ctx.Data = openGraph
customCtx := ctx.(*middleware.OpenGraphContext)
customCtx.OpenGraph = openGraph
return ctx.HTML(components.QuotePage(quote, character, user))
}