Upgraded to latest aero version
This commit is contained in:
@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// Get post edit page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
func Get(ctx aero.Context) error {
|
||||
id := ctx.Get("id")
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
|
@ -3,16 +3,17 @@ package post
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
func getOpenGraph(ctx *aero.Context, post *arn.Post) *arn.OpenGraph {
|
||||
func getOpenGraph(ctx aero.Context, post *arn.Post) *arn.OpenGraph {
|
||||
openGraph := &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": post.TitleByUser(nil),
|
||||
"og:description": utils.CutLongDescription(post.Text),
|
||||
"og:url": "https://" + ctx.App.Config.Domain + post.Link(),
|
||||
"og:site_name": ctx.App.Config.Domain,
|
||||
"og:url": "https://" + assets.Domain + post.Link(),
|
||||
"og:site_name": assets.Domain,
|
||||
"og:type": "article",
|
||||
},
|
||||
}
|
||||
|
@ -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 post.
|
||||
func Get(ctx *aero.Context) string {
|
||||
func Get(ctx aero.Context) error {
|
||||
id := ctx.Get("id")
|
||||
user := utils.GetUser(ctx)
|
||||
post, err := arn.GetPost(id)
|
||||
@ -19,6 +20,7 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "Post not found", err)
|
||||
}
|
||||
|
||||
ctx.Data = getOpenGraph(ctx, post)
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, post)
|
||||
return ctx.HTML(components.Post(post, user))
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// ReplyUI renders a new post area.
|
||||
func ReplyUI(ctx *aero.Context) string {
|
||||
func ReplyUI(ctx aero.Context) error {
|
||||
id := ctx.Get("id")
|
||||
user := utils.GetUser(ctx)
|
||||
post, err := arn.GetPost(id)
|
||||
|
Reference in New Issue
Block a user