Using getBaseStaticRoute for index.html urls.

This commit is contained in:
John Livingston
2021-05-18 18:17:13 +02:00
parent 2a8df1dc3c
commit d4b8c8b2e2
2 changed files with 7 additions and 8 deletions

View File

@ -1,6 +1,6 @@
import type { Router, RequestHandler, Request, Response, NextFunction } from 'express'
import type { ProxyOptions } from 'express-http-proxy'
import { getBaseRouterRoute } from '../helpers'
import { getBaseRouterRoute, getBaseStaticRoute } from '../helpers'
import { asyncMiddleware } from '../middlewares/async'
import { getProsodyDomain } from '../prosody/config/domain'
import * as path from 'path'
@ -72,9 +72,8 @@ async function initWebchatRouter (options: RegisterServerOptions): Promise<Route
}
let page = '' + (converseJSIndex as string)
// FIXME: Peertube should provide the static folder path. For now:
const staticRelative = '../../../static'
page = page.replace(/{{BASE_STATIC_URL}}/g, staticRelative)
const baseStaticUrl = getBaseStaticRoute(options)
page = page.replace(/{{BASE_STATIC_URL}}/g, baseStaticUrl)
page = page.replace(/{{JID}}/g, server)
room = room.replace(/{{VIDEO_UUID}}/g, video.uuid)
page = page.replace(/{{ROOM}}/g, room)