template test

This commit is contained in:
Roy Olav Purser 2021-05-12 09:54:38 +02:00
parent d18364f4cd
commit e0d77d0cb5
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -154,13 +154,13 @@ class MainHandler(tornado.web.RequestHandler):
self.write("Stream not found.") self.write("Stream not found.")
def handle_render(self, provider, write): def handle_render(self, provider, write):
if template is not None: if template_js is not None and template_html is not None:
stream_path = f'{self.request.path}?provider={provider}' stream_path = f'{self.request.path}?provider={provider}'
rendered_js = template_js.generate(stream=stream_path); rendered_js = template_js.generate(stream=stream_path);
b64 = str(base64.b64encode(rendered_js), "ascii") b64 = str(base64.b64encode(rendered_js), "ascii")
script = f'data:text/javascript;charset=utf8;base64,{b64}' script = f'data:text/javascript;charset=utf8;base64,{b64}'
rendered_html = template_html.generate(script=script, videojs_version=videojs_version) rendered_html = template_html.generate(script=script, videojs_version=videojs_version)
self.write(rendered) self.write(rendered_html)
else: else:
self.set_status(404) self.set_status(404)
self.write("HTML template missing.") self.write("HTML template missing.")