[v9.4.x] Plugins: Fix plugins CDN not working when plugins are not in domain's root path (#63729)

Plugins: Fix plugins CDN not working when plugins are not in domain's root path (#63202)

* Plugins CDN: Add support for different CDN root path

* Plugins CDN: Make frontendsettings return the correct CDN base path

* Update comments

* Fix version detection

* Undo frontend changes

* Fix system.js asset path construction

* fix(plugins): translate all plugin css asset paths loaded via cdn

* refactor(plugins): rename extractPluginNameVersionFromUrl and add comments

* Fix typo in comment

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>

* Hardcode CDN URL structure

/{id}/{version}/public/plugins/{id}/{assetPath} is not required anymore in the cdn url template config

---------

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
(cherry picked from commit 966bcd3545)

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2023-02-24 08:50:29 -05:00
committed by GitHub
co-authored by Giuseppe Guerra
parent 65c2b4fea2
commit ae94a60981
8 changed files with 153 additions and 99 deletions
+1 -1
View File
@@ -411,7 +411,7 @@ func TestLoader_Load(t *testing.T) {
name: "Load CDN plugin",
class: plugins.External,
cfg: &config.Cfg{
PluginsCDNURLTemplate: "https://cdn.example.com/{id}/{version}/public/plugins/{id}/{assetPath}",
PluginsCDNURLTemplate: "https://cdn.example.com",
PluginSettings: setting.PluginSettings{
"grafana-worldmap-panel": {"cdn": "true"},
},