25 lines
482 B
Go
25 lines
482 B
Go
package middleware
|
|
|
|
import (
|
|
"github.com/aerogo/aero"
|
|
"github.com/animenotifier/arn"
|
|
)
|
|
|
|
// 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 {
|
|
openGraphCtx := &OpenGraphContext{
|
|
Context: ctx,
|
|
OpenGraph: nil,
|
|
}
|
|
|
|
return next(openGraphCtx)
|
|
}
|
|
}
|