Version: v2.1.0+incompatible Latest Latest

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

Go to latest
Published: Mar 19, 2018 License: MIT Imports: 13 Imported by: 0



Package plugins

Provide API to access plugins information




View Source
const PLUGINS_CONFIG_FILENAME string = "plugins.json"
View Source
const PLUGINS_CONFIG_PATH string = "data"
View Source
const PLUGINS_FOLDER string = "plugins"
View Source
const PLUGINS_TEMPORARY_FOLDER string = "uploadedfiles"


This section is empty.


func CheckExtension

func CheckExtension(filename string) (string, error)

Return extension of the file or an error if the extension is not supported by this program

func UncompressFile

func UncompressFile(src, dest string) error

func UploadFile

func UploadFile(r *http.Request) (string, string, error)


type Backend

type Backend struct {
	Dockerimage string                 `json:"dockerimage"`
	Port        int                    `json:"port"`
	Props       map[string]interface{} `json:"props"`

func NewBackend

func NewBackend() *Backend

type Configuration

type Configuration struct {
	Plugins []Plugin `json:"plugins"`

PluginsConfiguration encapsulates all configuration data


func NewConfiguration

func NewConfiguration() *Configuration

type Frontend

type Frontend struct {
	Cols  int     `json:"cols"`
	Rows  int     `json:"rows"`
	Props []Props `json:"props"`

func NewFrontend

func NewFrontend() *Frontend

type Manager

type Manager struct {
	ConfigPath     string
	ConfigFileName string
	ConfigFullpath string
	Config         *Configuration

func NewManager

func NewManager(configPath, configFilename string) *Manager

func (*Manager) Add

func (m *Manager) Add(plugin *Plugin)

Save plugin information.

func (*Manager) Commit

func (m *Manager) Commit() error

Commit Save all plugins in DB. Here DB is a JSON file

func (*Manager) Get

func (m *Manager) Get(eltName string) (*Plugin, error)

GetPlugin Return the plugin with its eltName

func (*Manager) GetAll

func (m *Manager) GetAll() []Plugin

func (*Manager) GetConfig

func (m *Manager) GetConfig() interface{}

func (*Manager) GetConfiguration

func (m *Manager) GetConfiguration() *Configuration

func (*Manager) GetPosition

func (m *Manager) GetPosition(plugin *Plugin) int

GetPluginPosition Return position of a plugin in the list

func (*Manager) GetSaveFilePath

func (m *Manager) GetSaveFilePath() (string, string, string)

func (*Manager) LoadFromDB

func (m *Manager) LoadFromDB()

LoadPlugins loads plugins configuration from DB and store it in memory

func (*Manager) RemoveFromDB

func (m *Manager) RemoveFromDB(plugin *Plugin)

RemovePlugin Remove plugin from memory and commit

type Plugin

type Plugin struct {
	EltName     string   `json:"eltName"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Frontend    Frontend `json:"frontend"`
	Backend     Backend  `json:"backend"`

Plugin represents a plugin configuration


func NewPlugin

func NewPlugin() *Plugin

type Props

type Props struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Value       string `json:"value"`

type Service

type Service struct {
	Manager *Manager

func NewService

func NewService() *Service

func (*Service) AddHandler

func (s *Service) AddHandler(w http.ResponseWriter, r *http.Request)

func (*Service) GetAllHandler

func (m *Service) GetAllHandler(w http.ResponseWriter, r *http.Request)

swagger:route GET /plugins GetAllHandler

Gets information of all plugins

- application/json

Schemes: http, https

func (*Service) GetConfigHandler

func (s *Service) GetConfigHandler(w http.ResponseWriter, r *http.Request)

swagger:route GET /plugins/config GetConfigHandler

Gets information of all plugins

- application/json

Schemes: http, https

func (*Service) GetHandler

func (s *Service) GetHandler(w http.ResponseWriter, r *http.Request)

swagger:route GET /plugins/{idMedia} GetHandler

Gets information of a plugin

- application/json

Schemes: http, https

swagger:parameters idPlugin

func (*Service) GetManager

func (s *Service) GetManager() *Manager

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL