+function getIndexPath (req: express.Request, res: express.Response, paramLang?: string) {
+ let lang: string
+
+ // Check param lang validity
+ if (paramLang && is18nLocale(paramLang)) {
+ lang = paramLang
+
+ // Save locale in cookies
+ res.cookie('clientLanguage', lang, {
+ secure: CONFIG.WEBSERVER.SCHEME === 'https',
+ sameSite: true,
+ maxAge: 1000 * 3600 * 24 * 90 // 3 months
+ })
+
+ } else if (req.cookies.clientLanguage && is18nLocale(req.cookies.clientLanguage)) {
+ lang = req.cookies.clientLanguage
+ } else {
+ lang = req.acceptsLanguages(POSSIBLE_LOCALES) || getDefaultLocale()
+ }
+
+ return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html')
+}
+
+function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) {