25 lines
493 B
Go
Raw Normal View History

2019-06-01 04:55:49 +00:00
package middleware
import (
"github.com/aerogo/aero"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
2019-06-01 04:55:49 +00:00
)
// OpenGraphContext is a context with open graph data.
type OpenGraphContext struct {
aero.Context
*arn.OpenGraph
}
// OpenGraph middleware modifies the context to be an OpenGraphContext.
func OpenGraph(next aero.Handler) aero.Handler {
return func(ctx aero.Context) error {
2019-06-01 15:28:22 +00:00
openGraphCtx := &OpenGraphContext{
2019-06-01 04:55:49 +00:00
Context: ctx,
OpenGraph: nil,
}
2019-06-01 15:28:22 +00:00
return next(openGraphCtx)
2019-06-01 04:55:49 +00:00
}
}