aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/client-html.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-01-10 19:50:48 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-01-21 10:08:10 +0100
commit7738273b808f0ff1494f18c4cc13553505e6ac6d (patch)
treee751a2282ffb9d5f1f4e556ca865e06ed4426710 /server/lib/client-html.ts
parentaa0f19635ae4632e286de1599fc24f95f32a108c (diff)
downloadPeerTube-7738273b808f0ff1494f18c4cc13553505e6ac6d.tar.gz
PeerTube-7738273b808f0ff1494f18c4cc13553505e6ac6d.tar.zst
PeerTube-7738273b808f0ff1494f18c4cc13553505e6ac6d.zip
Accessibility fixes for #2149
Diffstat (limited to 'server/lib/client-html.ts')
-rw-r--r--server/lib/client-html.ts11
1 files changed, 9 insertions, 2 deletions
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 {
26 } 26 }
27 27
28 static async getDefaultHTMLPage (req: express.Request, res: express.Response, paramLang?: string) { 28 static async getDefaultHTMLPage (req: express.Request, res: express.Response, paramLang?: string) {
29 const html = await ClientHtml.getIndexHTML(req, res, paramLang) 29 const html = paramLang
30 ? await ClientHtml.getIndexHTML(req, res, paramLang)
31 : await ClientHtml.getIndexHTML(req, res)
30 32
31 let customHtml = ClientHtml.addTitleTag(html) 33 let customHtml = ClientHtml.addTitleTag(html)
32 customHtml = ClientHtml.addDescriptionTag(customHtml) 34 customHtml = ClientHtml.addDescriptionTag(customHtml)
@@ -98,6 +100,7 @@ export class ClientHtml {
98 100
99 let html = buffer.toString() 101 let html = buffer.toString()
100 102
103 if (paramLang) html = ClientHtml.addHtmlLang(html, paramLang)
101 html = ClientHtml.addCustomCSS(html) 104 html = ClientHtml.addCustomCSS(html)
102 html = await ClientHtml.addAsyncPluginCSS(html) 105 html = await ClientHtml.addAsyncPluginCSS(html)
103 106
@@ -106,7 +109,7 @@ export class ClientHtml {
106 return html 109 return html
107 } 110 }
108 111
109 private static getIndexPath (req: express.Request, res: express.Response, paramLang?: string) { 112 private static getIndexPath (req: express.Request, res: express.Response, paramLang: string) {
110 let lang: string 113 let lang: string
111 114
112 // Check param lang validity 115 // Check param lang validity
@@ -129,6 +132,10 @@ export class ClientHtml {
129 return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html') 132 return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html')
130 } 133 }
131 134
135 private static addHtmlLang (htmlStringPage: string, paramLang: string) {
136 return htmlStringPage.replace('<html>', `<html lang="${paramLang}">`)
137 }
138
132 private static addTitleTag (htmlStringPage: string, title?: string) { 139 private static addTitleTag (htmlStringPage: string, title?: string) {
133 let text = title || CONFIG.INSTANCE.NAME 140 let text = title || CONFIG.INSTANCE.NAME
134 if (title) text += ` - ${CONFIG.INSTANCE.NAME}` 141 if (title) text += ` - ${CONFIG.INSTANCE.NAME}`