plugin

package
v0.0.0-...-7b0100a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	DB      *gorm.DB
	Plugins map[string]Plugin
}

Handler holds all the needed information for plugins to function in Beubo

func Load

func Load(pluginHandler Handler) Handler

Load is a function that loads any available plugins in the plugins/ folder

func (Handler) AfterRequest

func (p Handler) AfterRequest(w http.ResponseWriter, r *http.Request)

AfterRequest is called by Beubo at the last possible place in the request stack before returning the response writer

func (Handler) BeforeRequest

func (p Handler) BeforeRequest(w http.ResponseWriter, r *http.Request)

BeforeRequest is called by Beubo as early as possible in the request stack after other middlewares have executed

func (Handler) PageData

func (p Handler) PageData(r *http.Request, pd structs.PageData) structs.PageData

PageData allows the modification of page data before it is passed to the execute function of the template handler

func (Handler) PageHandler

func (p Handler) PageHandler(w http.ResponseWriter, r *http.Request) (handled bool)

PageHandler is called when a non-default route is called in Beubo, returning true will prevent any other handler from executing

type Plugin

type Plugin struct {
	Plugin     *plugin.Plugin
	Definition string
	Data       map[string]string
}

Plugin represents data for a single plugin in Beubo

type PluginSite

type PluginSite struct {
	gorm.Model
	Site             structs.Site
	SiteID           uint
	PluginIdentifier string
	Active           bool
}

PluginSite defines which site a plugin is activated for

func FetchPluginSites

func FetchPluginSites(db *gorm.DB, plugin string) (ps []PluginSite)

FetchPluginSites gets a PluginSite definition based on the specified plugin identifier

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL