0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Allowed to load AdminX apps from custom url

ref https://linear.app/tryghost/issue/AP-438

This is going to allow us to load the activitypub package from the jsdelivr
cdn, which means we can release new versions without releasing the admin.
This commit is contained in:
Fabien O'Carroll 2024-09-26 13:49:43 +07:00 committed by Fabien 'egg' O'Carroll
parent d9a2b0e3a6
commit 9884e2bb2c

View file

@ -58,7 +58,12 @@ export const importComponent = async (packageName) => {
}
const baseUrl = (config.cdnUrl ? `${config.cdnUrl}assets/` : ghostPaths().assetRootWithHost);
const url = new URL(`${baseUrl}${relativePath}/${config[`${configKey}Filename`]}?v=${config[`${configKey}Hash`]}`);
let url = new URL(`${baseUrl}${relativePath}/${config[`${configKey}Filename`]}?v=${config[`${configKey}Hash`]}`);
const customUrl = config[`${configKey}CustomUrl`];
if (customUrl) {
url = new URL(customUrl);
}
if (url.protocol === 'http:') {
window[packageName] = await import(`http://${url.host}${url.pathname}${url.search}`);