26 lines
602 B
Go
Raw Normal View History

2017-10-02 06:29:58 +02:00
package soundtrack
2017-06-28 00:16:45 +02:00
import (
"net/http"
"github.com/aerogo/aero"
2019-06-03 18:32:43 +09:00
"github.com/animenotifier/notify.moe/arn"
2017-06-28 00:16:45 +02:00
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/server/middleware"
2017-06-28 00:16:45 +02:00
)
2017-07-13 08:23:20 +02:00
// Get track.
2019-06-01 13:55:49 +09:00
func Get(ctx aero.Context) error {
2017-06-28 00:16:45 +02:00
id := ctx.Get("id")
track, err := arn.GetSoundTrack(id)
2019-11-17 16:59:34 +09:00
user := arn.GetUserFromContext(ctx)
2017-06-28 00:16:45 +02:00
if err != nil {
return ctx.Error(http.StatusNotFound, "Track not found", err)
}
2019-06-01 13:55:49 +09:00
customCtx := ctx.(*middleware.OpenGraphContext)
2019-06-05 16:18:04 +09:00
customCtx.OpenGraph = getOpenGraph(track)
2018-10-29 11:56:45 +09:00
return ctx.HTML(components.SoundTrackPage(track, user))
2018-04-13 12:20:13 +02:00
}