25 lines
463 B
Go
25 lines
463 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 {
|
|
ctx = &OpenGraphContext{
|
|
Context: ctx,
|
|
OpenGraph: nil,
|
|
}
|
|
|
|
return next(ctx)
|
|
}
|
|
}
|