Upgraded to latest aero version
This commit is contained in:
@ -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,
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user