X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fclient-html.ts;h=1d8a08ed0bfc59a891dab5cfa8aea0031baf4284;hb=7738273b808f0ff1494f18c4cc13553505e6ac6d;hp=e5950561445015452d4d0ea8e7dc45bdcda5aa87;hpb=c08579e14fe712cb2264a25daea956e682574335;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index e59505614..1d8a08ed0 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts @@ -26,7 +26,9 @@ export class ClientHtml { } static async getDefaultHTMLPage (req: express.Request, res: express.Response, paramLang?: string) { - const html = await ClientHtml.getIndexHTML(req, res, paramLang) + const html = paramLang + ? await ClientHtml.getIndexHTML(req, res, paramLang) + : await ClientHtml.getIndexHTML(req, res) let customHtml = ClientHtml.addTitleTag(html) customHtml = ClientHtml.addDescriptionTag(customHtml) @@ -98,6 +100,7 @@ export class ClientHtml { let html = buffer.toString() + if (paramLang) html = ClientHtml.addHtmlLang(html, paramLang) html = ClientHtml.addCustomCSS(html) html = await ClientHtml.addAsyncPluginCSS(html) @@ -106,7 +109,7 @@ export class ClientHtml { return html } - private static getIndexPath (req: express.Request, res: express.Response, paramLang?: string) { + private static getIndexPath (req: express.Request, res: express.Response, paramLang: string) { let lang: string // Check param lang validity @@ -129,6 +132,10 @@ export class ClientHtml { return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html') } + private static addHtmlLang (htmlStringPage: string, paramLang: string) { + return htmlStringPage.replace('', ``) + } + private static addTitleTag (htmlStringPage: string, title?: string) { let text = title || CONFIG.INSTANCE.NAME if (title) text += ` - ${CONFIG.INSTANCE.NAME}`