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

@ -7,7 +7,9 @@ import (
"github.com/aerogo/aero"
"github.com/akyoto/color"
"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"
)
@ -16,7 +18,7 @@ const (
)
// Get character.
func Get(ctx *aero.Context) string {
func Get(ctx aero.Context) error {
user := utils.GetUser(ctx)
id := ctx.Get("id")
character, err := arn.GetCharacter(id)
@ -101,11 +103,12 @@ func Get(ctx *aero.Context) string {
// Set OpenGraph attributes
description := utils.CutLongDescription(character.Description)
ctx.Data = &arn.OpenGraph{
customCtx := ctx.(*middleware.OpenGraphContext)
customCtx.OpenGraph = &arn.OpenGraph{
Tags: map[string]string{
"og:title": character.Name.Canonical,
"og:image": "https:" + character.ImageLink("large"),
"og:url": "https://" + ctx.App.Config.Domain + character.Link(),
"og:url": "https://" + assets.Domain + character.Link(),
"og:site_name": "notify.moe",
"og:description": description,

View File

@ -11,7 +11,7 @@ import (
)
// Edit character.
func Edit(ctx *aero.Context) string {
func Edit(ctx aero.Context) error {
id := ctx.Get("id")
character, err := arn.GetCharacter(id)
user := utils.GetUser(ctx)
@ -24,7 +24,7 @@ func Edit(ctx *aero.Context) string {
}
// EditImages renders the form to edit the character images.
func EditImages(ctx *aero.Context) string {
func EditImages(ctx aero.Context) error {
id := ctx.Get("id")
character, err := arn.GetCharacter(id)
user := utils.GetUser(ctx)

View File

@ -8,7 +8,7 @@ import (
)
// Ranking returns the ranking information for the character via the API.
func Ranking(ctx *aero.Context) string {
func Ranking(ctx aero.Context) error {
// Check character ID
id := ctx.Get("id")
_, err := arn.GetCharacter(id)
@ -35,7 +35,7 @@ func Ranking(ctx *aero.Context) string {
arn.SortCharactersByLikes(characters)
// Allow CORS
ctx.Response().Header().Set("Access-Control-Allow-Origin", "*")
ctx.Response().SetHeader("Access-Control-Allow-Origin", "*")
// Return ranking
for index, character := range characters {