[MM-16376] Allow server to download and install a plugin from… (#11372)
* Initial implementation of plugin remote source * Implement API route * Test API route * Add i18n * Handle different error cases in API route * Include missing i18n translation * Include AllowInsecureDownloadUrl in telemetry capture * Updates from PR feedback * Use HTTPService instead of http.Get * Remove InstallPluginFromUrlForced from client4 * Use net/url library to inspect url scheme * remove PluginDownloadUrl from web/params.go * Allow plugin downloads from internal sources
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
44b9fe3110
Коммит
8cdf5ffe67
@@ -4263,6 +4263,21 @@ func (c *Client4) uploadPlugin(file io.Reader, force bool) (*Manifest, *Response
|
||||
return ManifestFromJson(rp.Body), BuildResponse(rp)
|
||||
}
|
||||
|
||||
func (c *Client4) InstallPluginFromUrl(downloadUrl string, force bool) (*Manifest, *Response) {
|
||||
forceStr := "false"
|
||||
if force {
|
||||
forceStr = "true"
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("%s?plugin_download_url=%s&force=%s", c.GetPluginsRoute()+"/install_from_url", url.QueryEscape(downloadUrl), forceStr)
|
||||
r, err := c.DoApiPost(url, "")
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
}
|
||||
defer closeBody(r)
|
||||
return ManifestFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// GetPlugins will return a list of plugin manifests for currently active plugins.
|
||||
// WARNING: PLUGINS ARE STILL EXPERIMENTAL. THIS FUNCTION IS SUBJECT TO CHANGE.
|
||||
func (c *Client4) GetPlugins() (*PluginsResponse, *Response) {
|
||||
|
||||
Ссылка в новой задаче
Block a user