diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/client-html.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 6bc48b5df..9f668dedb 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts | |||
@@ -171,6 +171,23 @@ export class ClientHtml { | |||
171 | return this.getAccountOrChannelHTMLPage(() => VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost), req, res) | 171 | return this.getAccountOrChannelHTMLPage(() => VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost), req, res) |
172 | } | 172 | } |
173 | 173 | ||
174 | static async getEmbedHTML () { | ||
175 | const path = ClientHtml.getEmbedPath() | ||
176 | console.log('coucu') | ||
177 | console.log(path) | ||
178 | |||
179 | if (ClientHtml.htmlCache[path]) return ClientHtml.htmlCache[path] | ||
180 | |||
181 | const buffer = await readFile(path) | ||
182 | |||
183 | let html = buffer.toString() | ||
184 | html = await ClientHtml.addAsyncPluginCSS(html) | ||
185 | |||
186 | ClientHtml.htmlCache[path] = html | ||
187 | |||
188 | return html | ||
189 | } | ||
190 | |||
174 | private static async getAccountOrChannelHTMLPage ( | 191 | private static async getAccountOrChannelHTMLPage ( |
175 | loader: () => Bluebird<MAccountActor | MChannelActor>, | 192 | loader: () => Bluebird<MAccountActor | MChannelActor>, |
176 | req: express.Request, | 193 | req: express.Request, |
@@ -252,6 +269,10 @@ export class ClientHtml { | |||
252 | return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html') | 269 | return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html') |
253 | } | 270 | } |
254 | 271 | ||
272 | private static getEmbedPath () { | ||
273 | return join(__dirname, '../../../client/dist/standalone/videos/embed.html') | ||
274 | } | ||
275 | |||
255 | private static addHtmlLang (htmlStringPage: string, paramLang: string) { | 276 | private static addHtmlLang (htmlStringPage: string, paramLang: string) { |
256 | return htmlStringPage.replace('<html>', `<html lang="${paramLang}">`) | 277 | return htmlStringPage.replace('<html>', `<html lang="${paramLang}">`) |
257 | } | 278 | } |