Implement experimental REST API endpoints for plugins (#7279)
* Implement experimental REST API endpoints for plugins * Updates per feedback and rebase * Update tests * Further updates * Update extraction of plugins * Use OS temp dir for plugins instead of search path * Fail extraction on paths that attempt to traverse upward * Update pluginenv ActivePlugins()
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
74b5e52c4e
Коммит
899ab31fff
@@ -3,6 +3,7 @@ package pluginenv
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mattermost/platform/model"
|
||||
"github.com/mattermost/platform/plugin"
|
||||
"github.com/mattermost/platform/plugin/rpcplugin"
|
||||
)
|
||||
@@ -29,14 +30,21 @@ func SearchPath(path string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WebappPath specifies the static directory serving the webapp.
|
||||
func WebappPath(path string) Option {
|
||||
return func(env *Environment) {
|
||||
env.webappPath = path
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultSupervisorProvider chooses a supervisor based on the plugin's manifest contents. E.g. if
|
||||
// the manifest specifies a backend executable, it will be given an rpcplugin.Supervisor.
|
||||
func DefaultSupervisorProvider(bundle *plugin.BundleInfo) (plugin.Supervisor, error) {
|
||||
func DefaultSupervisorProvider(bundle *model.BundleInfo) (plugin.Supervisor, error) {
|
||||
if bundle.Manifest == nil {
|
||||
return nil, fmt.Errorf("a manifest is required")
|
||||
}
|
||||
if bundle.Manifest.Backend == nil {
|
||||
return nil, fmt.Errorf("invalid manifest: at this time, only backend plugins are supported")
|
||||
return nil, fmt.Errorf("invalid manifest: missing backend plugin")
|
||||
}
|
||||
return rpcplugin.SupervisorProvider(bundle)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user