From a55c455fcc77c7cb39698c671c9f50faed4c48b1 Mon Sep 17 00:00:00 2001 From: bytedream Date: Sat, 18 Jun 2022 01:29:47 +0200 Subject: [PATCH] Refactor, complete past changes & change manifest back to version 2 --- src/index.ts | 5 ++--- src/manifest.json | 27 +++++++++++++-------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8e75ab8..be14a37 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,10 +5,9 @@ async function main() { if (await getAllDisabled()) { return } - const disabled = await getDisabled() for (const match of matches) { - if (disabled.some((v) => v == match) || !match.domains.some((v) => window.location.host.indexOf(v) !== -1)) { + if (!match.domains.some((v) => window.location.host.indexOf(v) !== -1) || ((await getDisabled()).some((v) => v === match))) { continue } @@ -18,7 +17,7 @@ async function main() { } const url = await match.match(re) - location.assign(url.indexOf('.m3u8', url.length - 5) === -1 ? url : chrome.runtime.getURL(`ui/hls/hls.html?id=${match.id}&url=${encodeURIComponent(url)}`)) + location.assign(chrome.runtime.getURL(`ui/player/player.html?id=${match.id}&url=${encodeURIComponent(url)}`)) } } diff --git a/src/manifest.json b/src/manifest.json index 4fee811..c4aae8d 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,5 +1,5 @@ { - "manifest_version": 3, + "manifest_version": 2, "name": "Stream Bypass", "author": "ByteDream", "description": "A multi-browser addon / extension for multiple streaming providers which redirects directly to the source video.", @@ -34,25 +34,24 @@ "run_at": "document_end" } ], + "background": { + "scripts": [ + "background.js" + ] + }, "permissions": [ "storage" ], - "action": { - "default_icon": "icons/stream-bypass.png", + "browser_action": { + "default_icon": { + "48": "icons/logo_48.png", + "128": "icons/logo_128.png" + }, "default_title": "Stream Bypass", "default_popup": "ui/popup/popup.html" }, - "web_accessible_resources": [ - { - "resources": [ - "ui/hls/*" - ], - "matches": [ - "" - ] - } - ], "icons": { - "128": "icons/stream-bypass.png" + "48": "icons/logo_48.png", + "128": "icons/logo_128.png" } } \ No newline at end of file