Add header Vary Accept-Language (#4588)

* nginx: add header Vary Accept-Language

solves #3647

* Revert "nginx: add header Vary Accept-Language"

This reverts commit 90dccf5324.

* add resp header Vary Accept-Language

solves #3647

* don't add vary header to embed page
This commit is contained in:
kontrollanten 2021-12-02 09:14:54 +01:00 committed by GitHub
parent decbd0b63b
commit 5fc44b57f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View File

@ -138,31 +138,31 @@ async function generateEmbedHtmlPage (req: express.Request, res: express.Respons
async function generateWatchHtmlPage (req: express.Request, res: express.Response) {
const html = await ClientHtml.getWatchHTMLPage(req.params.id + '', req, res)
return sendHTML(html, res)
return sendHTML(html, res, true)
}
async function generateWatchPlaylistHtmlPage (req: express.Request, res: express.Response) {
const html = await ClientHtml.getWatchPlaylistHTMLPage(req.params.id + '', req, res)
return sendHTML(html, res)
return sendHTML(html, res, true)
}
async function generateAccountHtmlPage (req: express.Request, res: express.Response) {
const html = await ClientHtml.getAccountHTMLPage(req.params.nameWithHost, req, res)
return sendHTML(html, res)
return sendHTML(html, res, true)
}
async function generateVideoChannelHtmlPage (req: express.Request, res: express.Response) {
const html = await ClientHtml.getVideoChannelHTMLPage(req.params.nameWithHost, req, res)
return sendHTML(html, res)
return sendHTML(html, res, true)
}
async function generateActorHtmlPage (req: express.Request, res: express.Response) {
const html = await ClientHtml.getActorHTMLPage(req.params.nameWithHost, req, res)
return sendHTML(html, res)
return sendHTML(html, res, true)
}
async function generateManifest (req: express.Request, res: express.Response) {

View File

@ -555,9 +555,13 @@ class ClientHtml {
}
}
function sendHTML (html: string, res: express.Response) {
function sendHTML (html: string, res: express.Response, localizedHTML: boolean = false) {
res.set('Content-Type', 'text/html; charset=UTF-8')
if (localizedHTML) {
res.set('Vary', 'Accept-Language')
}
return res.send(html)
}
@ -586,5 +590,5 @@ export {
async function generateHTMLPage (req: express.Request, res: express.Response, paramLang?: string) {
const html = await ClientHtml.getDefaultHTMLPage(req, res, paramLang)
return sendHTML(html, res)
return sendHTML(html, res, true)
}