diff --git a/Dockerfile b/Dockerfile index 216ddbd..5b62769 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,9 @@ RUN ["apk", "add", "--no-cache", "--repository", "https://dl-cdn.alpinelinux.org RUN ["mkdir", "/app"] COPY ["stream.py", "/app/stream.py"] COPY ["sources.py", "/app/sources.py"] -COPY ["index.html", "/app/index.html"] -COPY ["script.js", "/app/script.js"] +COPY ["frontend/index.html", "/app/index.html"] +COPY ["frontend/script.js", "/app/script.js"] +COPY ["frontend/style.css", "/app/style.css"] RUN ["chmod", "-R", "755", "/app"] COPY ["tv.json", "/app/tv.json"] RUN ["python3", "/app/sources.py"] diff --git a/index.html b/frontend/index.html similarity index 84% rename from index.html rename to frontend/index.html index 645905a..f3e82a5 100644 --- a/index.html +++ b/frontend/index.html @@ -1,13 +1,12 @@ - - + diff --git a/script.js b/frontend/script.js similarity index 100% rename from script.js rename to frontend/script.js diff --git a/frontend/style.css b/frontend/style.css new file mode 100644 index 0000000..086722b --- /dev/null +++ b/frontend/style.css @@ -0,0 +1,6 @@ +body { + margin: 0px; +} +.vjs-control-bar { + font-size: 1rem; +} diff --git a/sources.py b/sources.py index 709d6d5..3077575 100755 --- a/sources.py +++ b/sources.py @@ -35,12 +35,12 @@ if playlist is not None: try: resp = requests.get("https://api.cdnjs.com/libraries/castjs?fields=version") data = json.loads(resp.text) - castjs_version = data["version"] + chromecast_version = data["version"] except Exception as e: print(e) else: - with open("/app/castjs-version.txt", "w") as f: - f.write(castjs_version) + with open("/app/chromecast-version.txt", "w") as f: + f.write(chromecast_version) try: resp = requests.get("https://api.cdnjs.com/libraries/video.js?fields=version") data = json.loads(resp.text) diff --git a/stream.py b/stream.py index 0cf9f29..c98f002 100755 --- a/stream.py +++ b/stream.py @@ -74,6 +74,7 @@ template_html = None template_js = None videojs_version = None castjs_version = None +custom_style = None try: with open("/app/index.html", "r") as f: template_html = tornado.template.Template(f.read().strip()) @@ -81,8 +82,12 @@ try: template_js = tornado.template.Template(f.read().strip()) with open("/app/videojs-version.txt", "r") as f: videojs_version = f.read().strip() - with open("/app/castjs-version.txt", "r") as f: - castjs_version = f.read().strip() + with open("/app/chromecast-version.txt", "r") as f: + chromecast_version = f.read().strip() + with open("/app/style.css", "r") as f: + custom_style_raw = bytes(f.read().strip(), "utf-8") + b64 = str(base64.b64encode(custom_style_raw), "ascii") + custom_style = f'data:text/css;charset=utf-8;base64,{b64}' except Exception as e: logger.info(e) @@ -170,8 +175,8 @@ class MainHandler(tornado.web.RequestHandler): stream_path = f'{self.request.path}?provider={provider}' rendered_js = template_js.generate(stream=stream_path); b64 = str(base64.b64encode(rendered_js), "ascii") - script = f'data:text/javascript;charset=utf8;base64,{b64}' - rendered_html = template_html.generate(script=script, videojs_version=videojs_version, castjs_version=castjs_version) + script = f'data:text/javascript;charset=utf-8;base64,{b64}' + rendered_html = template_html.generate(script=script, videojs_version=videojs_version, chromecast_version=chromecast_version, custom_style=custom_style) self.write(rendered_html) else: self.set_status(404)