A webmail client. Forked from https://git.sr.ht/~migadu/alps
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

36 рядки
1.0 KiB

  1. package koushin
  2. import (
  3. "html/template"
  4. "github.com/labstack/echo/v4"
  5. )
  6. const pluginDir = "plugins"
  7. // Plugin extends koushin with additional functionality.
  8. type Plugin interface {
  9. // Name should return the plugin name.
  10. Name() string
  11. // LoadTemplate populates t with the plugin's functions and templates.
  12. LoadTemplate(t *template.Template) error
  13. // SetRoutes populates group with the plugin's routes.
  14. SetRoutes(group *echo.Group)
  15. // Inject is called prior to rendering a template. It can extend the
  16. // template data by setting new items in the Extra map.
  17. Inject(ctx *Context, name string, data RenderData) error
  18. // Close is called when the plugin is unloaded.
  19. Close() error
  20. }
  21. // PluginLoaderFunc loads plugins for the provided server.
  22. type PluginLoaderFunc func(*Server) ([]Plugin, error)
  23. var pluginLoaders []PluginLoaderFunc
  24. // RegisterPluginLoader registers a plugin loader. The loader will be called on
  25. // server start-up and reload.
  26. func RegisterPluginLoader(f PluginLoaderFunc) {
  27. pluginLoaders = append(pluginLoaders, f)
  28. }