From d93a5ea784a49b993ec02aab23b0624ce55bbed5 Mon Sep 17 00:00:00 2001 From: bytedream Date: Thu, 18 Nov 2021 20:34:22 +0100 Subject: [PATCH] Static 3rd party library version --- README.md | 4 ++-- build.py | 29 +++++++++++++---------------- src/manifest.json | 4 ++-- src/popup/popup.html | 5 ++--- src/res/hls.html | 4 ++-- 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 6480d66..712a66f 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,10 @@ Supported streaming providers (for a complete list of all supported websites, se The addon was tested on -- Firefox (94.0b9) +- Firefox (95.0b8) - Ungoogled Chromium (94.0) - Vivaldi (4.3) -- Opera (80.0) +- Opera (81.0) ## Installing diff --git a/build.py b/build.py index c0cf3aa..93e6d18 100644 --- a/build.py +++ b/build.py @@ -1,9 +1,11 @@ #!/usr/bin/python3 import argparse +import io import json import sys import urllib.request +import zipfile from pathlib import Path import re import shutil @@ -36,13 +38,6 @@ def write_manifest(): for content_script in manifest['content_scripts']: content_script['matches'] = [f'*://{match}/*' for match in matches] - domains = [] - for match in matches: - toplevel = match.split('.')[-1] - if toplevel not in domains: - domains.append(toplevel) - manifest['content_security_policy'] = f"script-src 'self' blob: https://cdn.jsdelivr.net https://unpkg.com {' '.join(f'*.{toplevel}' for toplevel in domains)}; object-src 'self'" - json.dump(manifest, open('src/manifest.json', 'w'), indent=2) @@ -118,15 +113,17 @@ def copy_built(): ext_path = Path('build', 'ext') if not ext_path.is_dir(): ext_path.mkdir() - for name, url in { - 'hls.js': 'https://cdn.jsdelivr.net/npm/hls.js@latest', - 'popper.js': 'https://unpkg.com/@popperjs/core@2', - 'tippy.js': 'https://unpkg.com/tippy.js@6' - }.items(): - with open(ext_path.joinpath(name), 'wb') as f: - ext_js = urllib.request.urlopen(url) - f.write(ext_js.read()) - f.close() + + # download hls.js (version 1.1.1) + with zipfile.ZipFile(io.BytesIO(urllib.request.urlopen('https://github.com/video-dev/hls.js/releases/download/v1.1.1/release.zip').read())) as z: + open(ext_path.joinpath('hls.light.min.js'), 'wb').write(z.read('dist/hls.light.min.js')) + z.close() + + # download popperjs core (version 2.10.2) + open(ext_path.joinpath('popper.min.js'), 'wb').write(urllib.request.urlopen('https://unpkg.com/@popperjs/core@2.10.2/dist/umd/popper.min.js').read()) + + # download tippy.js (version 6.3.7) + open(ext_path.joinpath('tippy-bundle.umd.min.js'), 'wb').write(urllib.request.urlopen('https://unpkg.com/tippy.js@6.3.7/dist/tippy-bundle.umd.min.js').read()) def clean_build(): diff --git a/src/manifest.json b/src/manifest.json index 9a7ae94..7c312db 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -3,7 +3,7 @@ "name": "Stream Bypass", "author": "ByteDream", "description": "A multi-browser addon / extension for multiple streaming providers which redirects directly to the source video.", - "version": "1.3.0", + "version": "1.4.0", "homepage_url": "https://github.com/ByteDream/stream-bypass", "browser_specific_settings": { "gecko": { @@ -39,7 +39,7 @@ "permissions": [ "storage" ], - "content_security_policy": "script-src 'self' blob: https://cdn.jsdelivr.net https://unpkg.com *.io *.to *.co *.com *.me *.pro *.net *.st *.sx; object-src 'self'", + "content_security_policy": "script-src 'self' blob:; object-src 'self'", "browser_action": { "default_icon": "icons/stream-bypass.png", "default_title": "Stream Bypass", diff --git a/src/popup/popup.html b/src/popup/popup.html index 05c9091..a409ba6 100644 --- a/src/popup/popup.html +++ b/src/popup/popup.html @@ -4,9 +4,8 @@ Title - - - + + diff --git a/src/res/hls.html b/src/res/hls.html index ca97c0c..0191af6 100644 --- a/src/res/hls.html +++ b/src/res/hls.html @@ -3,11 +3,11 @@ m3u8 - + - + \ No newline at end of file