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

@ -11,7 +11,7 @@ import (
)
// Get thread edit page.
func Get(ctx *aero.Context) string {
func Get(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)

View File

@ -3,16 +3,17 @@ package thread
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, thread *arn.Thread) *arn.OpenGraph {
func getOpenGraph(ctx aero.Context, thread *arn.Thread) *arn.OpenGraph {
openGraph := &arn.OpenGraph{
Tags: map[string]string{
"og:title": thread.Title,
"og:description": utils.CutLongDescription(thread.Text),
"og:url": "https://" + ctx.App.Config.Domain + thread.Link(),
"og:site_name": ctx.App.Config.Domain,
"og:url": "https://" + assets.Domain + thread.Link(),
"og:site_name": assets.Domain,
"og:type": "article",
},
}

View File

@ -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)
thread, err := arn.GetThread(id)

View File

@ -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 thread.
func Get(ctx *aero.Context) string {
func Get(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
@ -21,6 +22,7 @@ func Get(ctx *aero.Context) string {
return ctx.Error(http.StatusNotFound, "Thread not found", err)
}
ctx.Data = getOpenGraph(ctx, thread)
customCtx := ctx.(*middleware.OpenGraphContext)
customCtx.OpenGraph = getOpenGraph(ctx, thread)
return ctx.HTML(components.Thread(thread, user))
}