diff --git a/CHANGELOG.md b/CHANGELOG.md index fa7d5fbc..7243fe6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,9 @@ If you don't want the chat server to be active, just uninstall the plugin ### New Features -* +* Removed deprecated modes, only keeping «Prosody server controlled by Peertube». +* BOSH proxy optimization + enabling websocket. +* BOSH path without plugin version, so it can be optimized in the nginx configuration. ## 5.7.1 diff --git a/server/lib/helpers.ts b/server/lib/helpers.ts index 684b7b02..7eef5e54 100644 --- a/server/lib/helpers.ts +++ b/server/lib/helpers.ts @@ -19,6 +19,16 @@ function getBaseRouterRoute (options: RegisterServerOptions): string { return options.peertubeHelpers.plugin.getBaseRouterRoute() } +/** + * Returns the base router route, but without the plugin version. + * @param options server options + */ +function getBaseRouterCanonicalRoute (options: RegisterServerOptions): string { + let route = getBaseRouterRoute(options) + route = route.replace(pluginShortName + '/' + version + '/', pluginShortName + '/') + return route +} + function getBaseStaticRoute (options: RegisterServerOptions): string { if (!options.peertubeHelpers.plugin) { throw new Error('Missing peertubeHelpers.plugin, have you the correct Peertube version?') @@ -62,6 +72,7 @@ async function getUserNickname (options: RegisterServerOptions, user: AuthUserFi export { getBaseRouterRoute, + getBaseRouterCanonicalRoute, getBaseStaticRoute, isUserAdmin, getUserNickname, diff --git a/server/lib/routers/webchat.ts b/server/lib/routers/webchat.ts index 23363b52..4e085b3a 100644 --- a/server/lib/routers/webchat.ts +++ b/server/lib/routers/webchat.ts @@ -4,7 +4,7 @@ import type { ProxyOptions } from 'express-http-proxy' import type { ProsodyListRoomsResult, ProsodyListRoomsResultRoom } from '../../../shared/lib/types' -import { getBaseRouterRoute, getBaseStaticRoute, isUserAdmin } from '../helpers' +import { getBaseRouterRoute, getBaseRouterCanonicalRoute, getBaseStaticRoute, isUserAdmin } from '../helpers' import { asyncMiddleware } from '../middlewares/async' import { getProsodyDomain } from '../prosody/config/domain' import { getAPIKey } from '../apikey' @@ -76,7 +76,7 @@ async function initWebchatRouter (options: RegisterServerOptions): Promise