26 lines
595 B
Go
Raw Normal View History

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