X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Froot-helpers%2Fplugins.ts;h=10c111a8c4c593d12d6588bb66e4edce17fde923;hb=520bf885c5e75914f85196b8350970f51c3e1976;hp=5344c046833282623d28026b8f0384b2e2b28483;hpb=4024c44f9027a32809931de0692d40d001df721c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/root-helpers/plugins.ts b/client/src/root-helpers/plugins.ts index 5344c0468..10c111a8c 100644 --- a/client/src/root-helpers/plugins.ts +++ b/client/src/root-helpers/plugins.ts @@ -1,17 +1,18 @@ import { RegisterClientHelpers } from 'src/types/register-client-option.model' import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' -import { RegisterClientFormFieldOptions, RegisterClientVideoFieldOptions } from '@shared/models/plugins/register-client-form-field.model' import { ClientHookName, clientHookObject, ClientScript, PluginType, + RegisterClientFormFieldOptions, RegisterClientHookOptions, - ServerConfigPlugin, - RegisterClientSettingsScript + RegisterClientSettingsScript, + RegisterClientVideoFieldOptions, + ServerConfigPlugin } from '../../../shared/models' +import { environment } from '../environments/environment' import { ClientScript as ClientScriptModule } from '../types/client-script.model' -import { importModule } from './utils' interface HookStructValue extends RegisterClientHookOptions { plugin: ServerConfigPlugin @@ -100,7 +101,8 @@ function loadPlugin (options: { console.log('Loading script %s of plugin %s.', clientScript.script, plugin.name) - return importModule(clientScript.script) + const absURL = (environment.apiUrl || window.location.origin) + clientScript.script + return import(/* webpackIgnore: true */ absURL) .then((script: ClientScriptModule) => script.register({ registerHook, registerVideoField, registerSettingsScript, peertubeHelpers })) .then(() => sortHooksByPriority(hooks)) .catch(err => console.error('Cannot import or register plugin %s.', pluginInfo.plugin.name, err))