mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Made koenig-react async import protocol agnostic
no issue - when running locally with local development version of koenig-react without any proxies we were previously forcing `https://` even if the specific url in config was `http://` meaning a proxy was required - switched to allowing both http and https urls in config
This commit is contained in:
parent
bac8f4b8db
commit
03c5201d51
1 changed files with 8 additions and 3 deletions
|
@ -30,12 +30,17 @@ const fetchKoenig = function () {
|
|||
return window.koenigEditor.default;
|
||||
}
|
||||
|
||||
// the removal of `https://` and it's manual addition to the import template string is
|
||||
// the manual specification of the protocol in the import template string is
|
||||
// required to work around ember-auto-import complaining about an unknown dynamic import
|
||||
// during the build step
|
||||
const GhostAdmin = window.Ember.Namespace.NAMESPACES.find(ns => ns.name === 'ghost-admin');
|
||||
const url = GhostAdmin.__container__.lookup('service:config').get('editor.url').replace('https://', '');
|
||||
await import(`https://${url}`);
|
||||
const url = new URL(GhostAdmin.__container__.lookup('service:config').get('editor.url'));
|
||||
|
||||
if (url.protocol === 'http:') {
|
||||
await import(`http://${url.host}${url.pathname}`);
|
||||
} else {
|
||||
await import(`https://${url.host}${url.pathname}`);
|
||||
}
|
||||
|
||||
return window.koenigEditor.default;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue