diff --git a/client/@types/peertube.d.ts b/client/@types/peertube.d.ts index 30445e8c..c701f0fe 100644 --- a/client/@types/peertube.d.ts +++ b/client/@types/peertube.d.ts @@ -8,6 +8,8 @@ interface RegisterClientHookOptions { interface RegisterClientHelpers { getBaseStaticRoute: () => string + // NB: getBaseRouterRoute will come with Peertube > 3.2.1 (3.3.0?) + getBaseRouterRoute?: () => string isLoggedIn: () => boolean getSettings: () => Promise<{ [ name: string ]: string }> notifier: { diff --git a/client/videowatch-client-plugin.ts b/client/videowatch-client-plugin.ts index a4d6ebfc..55790851 100644 --- a/client/videowatch-client-plugin.ts +++ b/client/videowatch-client-plugin.ts @@ -17,7 +17,10 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void { let settings: any = {} function getBaseRoute (): string { - // FIXME: should be provided by PeertubeHelpers (does not exists for now) + // NB: this will come with Peertube > 3.2.1 (3.3.0?) + if (peertubeHelpers.getBaseRouterRoute) { + return peertubeHelpers.getBaseRouterRoute() + } // We are guessing the route with the correct plugin version with this trick: const staticBase = peertubeHelpers.getBaseStaticRoute() // we can't use '/plugins/livechat/router', because the loaded html page needs correct relative paths.