Upgraded to latest aero version
This commit is contained in:
@ -6,11 +6,12 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/middleware"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Get a single AMV.
|
||||
func Get(ctx *aero.Context) string {
|
||||
func Get(ctx aero.Context) error {
|
||||
id := ctx.Get("id")
|
||||
amv, err := arn.GetAMV(id)
|
||||
user := utils.GetUser(ctx)
|
||||
@ -19,6 +20,7 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "AMV not found", err)
|
||||
}
|
||||
|
||||
ctx.Data = getOpenGraph(ctx, amv)
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, amv)
|
||||
return ctx.HTML(components.AMVPage(amv, user))
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// Edit track.
|
||||
func Edit(ctx *aero.Context) string {
|
||||
func Edit(ctx aero.Context) error {
|
||||
id := ctx.Get("id")
|
||||
amv, err := arn.GetAMV(id)
|
||||
user := utils.GetUser(ctx)
|
||||
|
@ -5,14 +5,15 @@ import (
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
)
|
||||
|
||||
func getOpenGraph(ctx *aero.Context, amv *arn.AMV) *arn.OpenGraph {
|
||||
func getOpenGraph(ctx aero.Context, amv *arn.AMV) *arn.OpenGraph {
|
||||
openGraph := &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": amv.Title.ByUser(nil) + " (AMV)",
|
||||
"og:url": "https://" + ctx.App.Config.Domain + amv.Link(),
|
||||
"og:site_name": ctx.App.Config.Domain,
|
||||
"og:url": "https://" + assets.Domain + amv.Link(),
|
||||
"og:site_name": assets.Domain,
|
||||
"og:type": "video.other",
|
||||
},
|
||||
Meta: map[string]string{},
|
||||
@ -21,7 +22,7 @@ func getOpenGraph(ctx *aero.Context, amv *arn.AMV) *arn.OpenGraph {
|
||||
openGraph.Tags["og:description"] = strings.Join(amv.Tags, ", ")
|
||||
|
||||
if amv.File != "" {
|
||||
openGraph.Tags["og:video"] = "https://" + ctx.App.Config.Domain + "/videos/amvs/" + amv.File
|
||||
openGraph.Tags["og:video"] = "https://" + assets.Domain + "/videos/amvs/" + amv.File
|
||||
openGraph.Tags["og:video:type"] = "video/webm"
|
||||
openGraph.Tags["og:video:width"] = "640"
|
||||
openGraph.Tags["og:video:height"] = "360"
|
||||
|
Reference in New Issue
Block a user