diff --git a/frontend/index.html b/frontend/index.html index e239efc..1070809 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,7 +1,7 @@ - + diff --git a/stream.py b/stream.py index a0b57d5..8e9e8db 100755 --- a/stream.py +++ b/stream.py @@ -72,7 +72,7 @@ if icecast_server is not None and stream_server is not None: template_html = None template_js = None -template_embed = tornado.template.Template('') +template_embed = tornado.template.Template('') videojs_version = None castjs_version = None @@ -174,21 +174,26 @@ class MainHandler(tornado.web.RequestHandler): def handle_render(self, provider): if template_js is not None and template_html is not None: - stream_path = f'{self.request.path}?provider={provider}' + origin = self.request.path + if stream_path is not None: + origin = f'{stream_server}{self.request.path}' + stream_path = f'{stream_server}{self.request.path}?provider={provider}' rendered_js = template_js.generate(stream=stream_path); b64_js = str(base64.b64encode(rendered_js), "ascii") script = f'data:text/javascript;charset=utf-8;base64,{b64_js}' - rendered_html = template_html.generate(script=script, videojs_version=videojs_version, chromecast_version=chromecast_version, custom_style=custom_style, provider=provider, path=self.request.path) + rendered_html = template_html.generate(script=script, videojs_version=videojs_version, chromecast_version=chromecast_version, custom_style=custom_style, provider=provider, origin=origin) self.write(rendered_html) else: self.set_status(404) self.write("HTML template missing.") def handle_embed(self, provider): + origin = self.request.path + if stream_path is not None: + origin = f'{stream_server}{self.request.path}' embed_json = {} embed_json["version"] = "1.0" embed_json["type"] = "video" - embed_json["html"] = f'' - embed_json["html"] = str(template_embed.generate(origin=stream_server, path=self.request.path, provider=provider), "utf-8") + embed_json["html"] = str(template_embed.generate(origin=origin, provider=provider), "utf-8") self.set_header("Content-Type", "application/json+oembed; charset=utf-8") self.write(json.dumps(embed_json))