mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-06-27 18:40:31 +02:00
Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
696ec22471 | |||
e379113aa4 | |||
84605ceb30 | |||
67c492db47 | |||
ae2f196b06 | |||
298e9308ce | |||
3cd4c6b6b7 | |||
6286acf85c | |||
94eee79218 | |||
2f186bda07 | |||
1c9f95cebc | |||
c57cd03407 | |||
64cf565da3 | |||
bf8a7eb602 | |||
c643a39e2d | |||
fcfbc41fdb | |||
1251f079f5 | |||
ccfc77167b | |||
a10066458f | |||
6a8c705b06 | |||
76a5bac7fd | |||
3aca863a4b | |||
fe14edc0ef | |||
fffe23638c |
@ -28,6 +28,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/no-explicit-any': 'off'
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'no-undef': 'off'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
31
README.md
31
README.md
@ -3,21 +3,21 @@
|
|||||||
A multi-browser addon / extension for multiple streaming providers which redirects directly to the source video.
|
A multi-browser addon / extension for multiple streaming providers which redirects directly to the source video.
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/ByteDream/stream-bypass/releases/latest">
|
<a href="https://github.com/bytedream/stream-bypass/releases/latest">
|
||||||
<img src="https://img.shields.io/github/v/release/ByteDream/stream-bypass?label=Version&style=flat-square" alt="Version">
|
<img src="https://img.shields.io/github/v/release/ByteDream/stream-bypass?label=Version&style=flat-square" alt="Version">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://addons.mozilla.org/de/firefox/addon/stream-bypass/">
|
<a href="https://addons.mozilla.org/de/firefox/addon/stream-bypass/">
|
||||||
<img src="https://img.shields.io/amo/users/stream-bypass?label=Firefox%20Store%20Downloads&style=flat-square" alt="Firefox Addon Store">
|
<img src="https://img.shields.io/amo/users/stream-bypass?label=Firefox%20Users&style=flat-square" alt="Firefox Addon Store">
|
||||||
|
</a>
|
||||||
|
<a href="https://chromewebstore.google.com/detail/ddfpfjomnakfckhmilacnbokdaknamdb">
|
||||||
|
<img src="https://img.shields.io/chrome-web-store/users/ddfpfjomnakfckhmilacnbokdaknamdb?style=flat-square&label=Chrome%20Users" alt="Chrome Store">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://addons.mozilla.org/de/firefox/addon/stream-bypass/">
|
<a href="https://addons.mozilla.org/de/firefox/addon/stream-bypass/">
|
||||||
<img src="https://img.shields.io/amo/stars/stream-bypass?label=Firefox%20Store%20Stars&style=flat-square" alt="Firefox Addon Stars">
|
<img src="https://img.shields.io/amo/stars/stream-bypass?label=Firefox%20Store%20Stars&style=flat-square" alt="Firefox Addon Stars">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/ByteDream/stream-bypass/releases/latest">
|
<a href="https://github.com/bytedream/stream-bypass/releases/latest">
|
||||||
<img src="https://img.shields.io/github/downloads/ByteDream/stream-bypass/total?label=GitHub%20Downloads&style=flat-square" alt="GitHub Downloads">
|
<img src="https://img.shields.io/github/downloads/ByteDream/stream-bypass/total?label=GitHub%20Downloads&style=flat-square" alt="GitHub Downloads">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://discord.gg/gUWwekeNNg">
|
|
||||||
<img src="https://img.shields.io/discord/915659846836162561?label=Discord&style=flat-square" alt="Discord">
|
|
||||||
</a>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@ -52,6 +52,7 @@ Additionally, this enables you to download the video by right-clicking it and ju
|
|||||||
The best way to install the extension are the official browser extension stores:
|
The best way to install the extension are the official browser extension stores:
|
||||||
|
|
||||||
- [Firefox Addon Store](https://addons.mozilla.org/de/firefox/addon/stream-bypass/)
|
- [Firefox Addon Store](https://addons.mozilla.org/de/firefox/addon/stream-bypass/)
|
||||||
|
- [Chrome Web Store](https://chromewebstore.google.com/detail/ddfpfjomnakfckhmilacnbokdaknamdb)
|
||||||
|
|
||||||
### Manual installation
|
### Manual installation
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ The best way to install the extension are the official browser extension stores:
|
|||||||
- Click the `Load Temporary Add-on...` button and choose the `manifest.json` file in the unzipped directory
|
- Click the `Load Temporary Add-on...` button and choose the `manifest.json` file in the unzipped directory
|
||||||
- Chromium / Google Chrome
|
- Chromium / Google Chrome
|
||||||
> As nearly every browser other than Firefox is based on Chromium, this should be the same for most of them
|
> As nearly every browser other than Firefox is based on Chromium, this should be the same for most of them
|
||||||
- Download `enhance-crunchyroll-<version>-mv3.zip` from the [latest release](https://github.com/ByteDream/stream-bypass/releases/latest) and unzip it (with [7zip](https://www.7-zip.org/) or something like that)
|
- Download `stream-bypass-<version>-mv3.zip` from the [latest release](https://github.com/ByteDream/stream-bypass/releases/latest) and unzip it (with [7zip](https://www.7-zip.org/) or something like that)
|
||||||
- Go into your browser and type `chrome://extensions` in the address bar
|
- Go into your browser and type `chrome://extensions` in the address bar
|
||||||
- Turn on the developer mode by checking the switch in the top right corner
|
- Turn on the developer mode by checking the switch in the top right corner
|
||||||
- Click `Load unpacked` and choose the unzipped directory
|
- Click `Load unpacked` and choose the unzipped directory
|
||||||
@ -70,24 +71,26 @@ The best way to install the extension are the official browser extension stores:
|
|||||||
|
|
||||||
| Site | Supported | Note |
|
| Site | Supported | Note |
|
||||||
| --------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------ |
|
| --------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| [dropload.io](https://dropload.io) | ✔ | |
|
||||||
| [doodstream.com](doodstream.com) / [dood.pm](https://dood.pm) | ✔️ | |
|
| [doodstream.com](doodstream.com) / [dood.pm](https://dood.pm) | ✔️ | |
|
||||||
| [filemoon.sx](https://filemoon.sx) | ✔ | |
|
| [filemoon.sx](https://filemoon.sx) | ✔ | |
|
||||||
|
| [goodstream.uno](https://goodstream.uno) | ✔ | |
|
||||||
| [mcloud.to](https://mcloud.to/) | ❌ | Reverse engineering the site costs too much time ([#5](https://github.com/ByteDream/stream-bypass/issues/5)) |
|
| [mcloud.to](https://mcloud.to/) | ❌ | Reverse engineering the site costs too much time ([#5](https://github.com/ByteDream/stream-bypass/issues/5)) |
|
||||||
| [mixdrop.co](https://mixdrop.co) | ✔ ️ | |
|
| [mixdrop.co](https://mixdrop.co) | ✔ ️ | |
|
||||||
| [mp4upload.com](https://mp4upload.com) | ✔ | |
|
| [mp4upload.com](https://mp4upload.com) | ✔ | |
|
||||||
| [newgrounds.com](https://newgrounds.com) | ✔ | |
|
| [newgrounds.com](https://newgrounds.com) | ✔ | |
|
||||||
|
| [streama2s.com](https://streama2z.com) | ✔ |
|
||||||
| [streamtape.com](https://streamtape.com) | ✔ | |
|
| [streamtape.com](https://streamtape.com) | ✔ | |
|
||||||
| [streamzz.to](https://streamzz.to) / [streamz.ws](https://streamz.ws) | ✔ | |
|
| [streamzz.to](https://streamzz.to) / [streamz.ws](https://streamz.ws) | ✔ | |
|
||||||
|
| [supervideo.tv](https://supervideo.tv) | ✔ | |
|
||||||
| [upstream.to](https://upstream.to) | ✔ | |
|
| [upstream.to](https://upstream.to) | ✔ | |
|
||||||
| [videovard.sx](https://videovard.sx) | ❌ | Reverse engineering the site costs too much time |
|
| [videovard.sx](https://videovard.sx) | ❌ | Reverse engineering the site costs too much time |
|
||||||
|
| [vidmoly.me](https://vidmoly.me) | ✔ | |
|
||||||
| [vidoza.net](https://vidoza.net) | ✔ | |
|
| [vidoza.net](https://vidoza.net) | ✔ | |
|
||||||
| [vidstream.pro](https://vidstream.pro) | ❌ | Reverse engineering the site costs too much time ([#5](https://github.com/ByteDream/stream-bypass/issues/5)) |
|
| [vidstream.pro](https://vidstream.pro) | ❌ | Reverse engineering the site costs too much time ([#5](https://github.com/ByteDream/stream-bypass/issues/5)) |
|
||||||
| [voe.sx](https://voe.sx) | ✔ | |
|
| [voe.sx](https://voe.sx) | ✔ | |
|
||||||
| [vupload.com](https://vupload.com) | ✔ | |
|
| [vupload.com](https://vupload.com) | ✔ | |
|
||||||
| [kwik.cx](https://kwik.cx) | ✔ | |
|
| [kwik.cx](https://kwik.cx) | ✔ | |
|
||||||
| [dropload.io](https://dropload.io) | ✔ | |
|
|
||||||
| [supervideo.tv](https://supervideo.tv) | ✔ | |
|
|
||||||
| [goodstream.uno](https://goodstream.uno) | ✔ | |
|
|
||||||
|
|
||||||
- ✔️: Everything ok.
|
- ✔️: Everything ok.
|
||||||
- ⚠: Included in the addon but will probably not work. See `Note` in this case, an explanation why will stand there in the most cases.
|
- ⚠: Included in the addon but will probably not work. See `Note` in this case, an explanation why will stand there in the most cases.
|
||||||
@ -119,16 +122,16 @@ If the requirements are satisfied, you can continue with the following commands:
|
|||||||
# install all dependencies
|
# install all dependencies
|
||||||
$ npm install
|
$ npm install
|
||||||
|
|
||||||
# build the extension source to a build/ directory
|
# build the extension source to the dist/ directory
|
||||||
$ npm run build
|
$ npm run build
|
||||||
|
|
||||||
# same as build + create a bundle zipfile at dist/
|
# same as build + more optimizations and browser specific settings at release/
|
||||||
$ npm run bundle
|
$ npm run release:firefox # or "release:chrome" to create a release for chromium based browsers
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Install
|
##### Install
|
||||||
|
|
||||||
If you want to use the addon in Chromium or any browser which is based on it (almost every other, Google Chrome, Opera, ...), follow the steps in [installation](#-installation).
|
If you want to use the addon in Chromium or any browser which is based on it, follow the steps in [installation](#-installation).
|
||||||
When using firefox, use the following:
|
When using firefox, use the following:
|
||||||
|
|
||||||
1. Type `about:debugging` in the browser's address bar.
|
1. Type `about:debugging` in the browser's address bar.
|
||||||
|
4089
package-lock.json
generated
4089
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
51
package.json
51
package.json
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "stream-bypass",
|
"name": "stream-bypass",
|
||||||
"version": "3.0.0",
|
"version": "3.1.0",
|
||||||
"displayName": "Stream Bypass",
|
"displayName": "Stream Bypass",
|
||||||
"author": "ByteDream",
|
"author": "bytedream",
|
||||||
"description": "Multi-browser addon for multiple streaming providers which redirects directly to the source video",
|
"description": "Multi-browser addon for multiple streaming providers which redirects directly to the source video",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
@ -19,34 +19,33 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/ByteDream/stream-bypass.git"
|
"url": "git+https://github.com/bytedream/stream-bypass.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/ByteDream/stream-bypass/issues"
|
"url": "https://github.com/bytedream/stream-bypass/issues"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@samrum/vite-plugin-web-extension": "^5.0.0",
|
"@samrum/vite-plugin-web-extension": "^5.1.0",
|
||||||
"@sveltejs/vite-plugin-svelte": "^2.1.1",
|
"@sveltejs/vite-plugin-svelte": "^2.5.3",
|
||||||
"@tsconfig/svelte": "^4.0.1",
|
"@tsconfig/svelte": "^5.0.4",
|
||||||
"@types/chrome": "^0.0.228",
|
"@types/chrome": "^0.0.269",
|
||||||
"@types/webextension-polyfill": "^0.10.0",
|
"@types/firefox-webext-browser": "^120.0.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
||||||
"@typescript-eslint/parser": "^6.10.0",
|
"@typescript-eslint/parser": "^7.17.0",
|
||||||
"eslint": "^8.53.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-prettier": "^9.0.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-svelte": "^2.35.0",
|
"eslint-plugin-svelte": "^2.43.0",
|
||||||
"hls.js": "^1.4.12",
|
"hls.js": "^1.5.13",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.3.3",
|
||||||
"prettier-plugin-svelte": "^3.1.0",
|
"prettier-plugin-svelte": "^3.2.6",
|
||||||
"sass": "^1.69.5",
|
"sass": "^1.77.8",
|
||||||
"svelte": "^3.58.0",
|
"svelte": "^4.2.18",
|
||||||
"svelte-check": "^3.2.0",
|
"svelte-check": "^3.8.4",
|
||||||
"svelte-preprocess": "^5.0.3",
|
"svelte-preprocess": "^6.0.2",
|
||||||
"tslib": "^2.5.0",
|
"tslib": "^2.6.3",
|
||||||
"typescript": "^5.0.4",
|
"typescript": "^5.5.4",
|
||||||
"vite": "~4.3.3",
|
"vite": "^4.5.3",
|
||||||
"web-ext": "^7.6.2",
|
"web-ext": "^8.2.0"
|
||||||
"webextension-polyfill": "^0.10.0"
|
|
||||||
},
|
},
|
||||||
"type": "module"
|
"type": "module"
|
||||||
}
|
}
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
import type { Match } from '~/lib/match';
|
|
||||||
import { storageDelete, storageGet, storageSet } from '~/lib/settings';
|
|
||||||
import { getMatch } from '~/lib/match';
|
|
||||||
|
|
||||||
chrome.runtime.onMessage.addListener(async (message) => {
|
|
||||||
if (message.action == 'ff2mpv') {
|
|
||||||
await chrome.runtime.sendNativeMessage('ff2mpv', { url: message.url });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
chrome.webRequest.onBeforeRedirect.addListener(
|
|
||||||
async (details) => {
|
|
||||||
// check if redirects origins from a previous redirect
|
|
||||||
if ((await storageGet('redirect')) === undefined) {
|
|
||||||
let match: Match;
|
|
||||||
if ((match = await getMatch(new URL(details.url).hostname)) !== undefined) {
|
|
||||||
await storageSet('redirect', match.id);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
await storageDelete('redirect');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ urls: ['<all_urls>'], types: ['main_frame', 'sub_frame'] }
|
|
||||||
);
|
|
40
src/entries/background/mv2.ts
Normal file
40
src/entries/background/mv2.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import './shared';
|
||||||
|
|
||||||
|
import type { Match } from '~/lib/match';
|
||||||
|
import { Redirect, storageDelete, storageGet } from '~/lib/settings';
|
||||||
|
import { getMatch } from '~/lib/match';
|
||||||
|
|
||||||
|
chrome.webRequest.onBeforeSendHeaders.addListener(
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
async (details) => {
|
||||||
|
const referer: { domain: string } | undefined = await storageGet('referer');
|
||||||
|
if (referer === undefined) return;
|
||||||
|
|
||||||
|
details.requestHeaders!.push({
|
||||||
|
name: 'Referer',
|
||||||
|
value: `https://${referer.domain}/`
|
||||||
|
});
|
||||||
|
|
||||||
|
await storageDelete('referer');
|
||||||
|
|
||||||
|
return { requestHeaders: details.requestHeaders };
|
||||||
|
},
|
||||||
|
{ urls: ['<all_urls>'], types: ['xmlhttprequest'] },
|
||||||
|
['blocking', 'requestHeaders']
|
||||||
|
);
|
||||||
|
|
||||||
|
chrome.webRequest.onBeforeRedirect.addListener(
|
||||||
|
async (details) => {
|
||||||
|
// check if redirects origins from a previous redirect
|
||||||
|
if ((await Redirect.get()) == null) {
|
||||||
|
let match: Match | null;
|
||||||
|
if ((match = await getMatch(new URL(details.url).hostname)) !== null) {
|
||||||
|
await Redirect.set(match);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await Redirect.delete();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ urls: ['<all_urls>'], types: ['main_frame', 'sub_frame'] }
|
||||||
|
);
|
1
src/entries/background/mv3.ts
Normal file
1
src/entries/background/mv3.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
import './shared';
|
5
src/entries/background/shared.ts
Normal file
5
src/entries/background/shared.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
chrome.runtime.onMessage.addListener(async (message) => {
|
||||||
|
if (message.action == 'ff2mpv') {
|
||||||
|
await chrome.runtime.sendNativeMessage('ff2mpv', { url: message.url });
|
||||||
|
}
|
||||||
|
});
|
@ -1,10 +1,9 @@
|
|||||||
import type { Match } from '~/lib/match';
|
import type { Match } from '~/lib/match';
|
||||||
import { getMatch } from '~/lib/match';
|
import { getMatch } from '~/lib/match';
|
||||||
import { Other, Redirect } from '~/lib/settings';
|
import { Other, Redirect } from '~/lib/settings';
|
||||||
import browser from 'webextension-polyfill';
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
let match: Match;
|
let match: Match | null;
|
||||||
let redirect = false;
|
let redirect = false;
|
||||||
if ((match = await getMatch(window.location.host)) === null) {
|
if ((match = await getMatch(window.location.host)) === null) {
|
||||||
if ((match = await Redirect.get()) === null) {
|
if ((match = await Redirect.get()) === null) {
|
||||||
@ -13,6 +12,14 @@ async function main() {
|
|||||||
redirect = true;
|
redirect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some sites have a javascript based redirect, e.g. example.com redirects to example.org by changing
|
||||||
|
// window.location.href instead of a 3XX http redirect. an empty body is a sign that such a javascript redirect
|
||||||
|
// occurred
|
||||||
|
if (document.body == null) {
|
||||||
|
await Redirect.set(match);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const re = document.body.innerHTML.match(match.regex);
|
const re = document.body.innerHTML.match(match.regex);
|
||||||
if (re === null) {
|
if (re === null) {
|
||||||
return;
|
return;
|
||||||
@ -21,25 +28,49 @@ async function main() {
|
|||||||
await Redirect.delete();
|
await Redirect.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = await match.match(re);
|
let url: string | null;
|
||||||
|
try {
|
||||||
|
url = await match.match(re);
|
||||||
|
} catch (e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// send the url to the ff2mpv (https://github.com/woodruffw/ff2mpv) application
|
// send the url to the ff2mpv (https://github.com/woodruffw/ff2mpv) application
|
||||||
if (await Other.getFf2mpv()) {
|
if (await Other.getFf2mpv()) {
|
||||||
await browser.runtime.sendMessage({ action: 'ff2mpv', url: url });
|
await chrome.runtime.sendMessage({ action: 'ff2mpv', url: url });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match.replace && !url.includes('.m3u8')) {
|
if (match.replace && !url.includes('.m3u8')) {
|
||||||
|
// this destroys all intervals that may spawn popups or events
|
||||||
|
let intervalId = window.setInterval(() => {}, 0);
|
||||||
|
while (intervalId--) {
|
||||||
|
clearInterval(intervalId);
|
||||||
|
}
|
||||||
|
let timeoutId = window.setTimeout(() => {}, 0);
|
||||||
|
while (timeoutId--) {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clear completed document
|
||||||
|
document.documentElement.innerHTML = '';
|
||||||
|
|
||||||
|
// video player
|
||||||
const player = document.createElement('video');
|
const player = document.createElement('video');
|
||||||
player.style.width = '100%';
|
player.style.width = '100%';
|
||||||
player.style.height = '100%';
|
player.style.height = '100%';
|
||||||
player.controls = true;
|
player.controls = true;
|
||||||
player.src = url;
|
player.src = url;
|
||||||
|
|
||||||
document.body.innerHTML = '';
|
// add video player to document body
|
||||||
|
document.body.style.margin = '0';
|
||||||
document.body.append(player);
|
document.body.append(player);
|
||||||
} else {
|
} else {
|
||||||
window.location.assign(
|
window.location.assign(
|
||||||
browser.runtime.getURL(
|
chrome.runtime.getURL(
|
||||||
`src/entries/player/player.html?id=${match.id}&url=${encodeURIComponent(url)}&domain=${
|
`src/entries/player/player.html?id=${match.id}&url=${encodeURIComponent(url)}&domain=${
|
||||||
window.location.hostname
|
window.location.hostname
|
||||||
}`
|
}`
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { matches } from '~/lib/match';
|
import { matches } from '~/lib/match';
|
||||||
import Hls from 'hls.js';
|
import Hls from 'hls.js';
|
||||||
|
import { storageSet } from '~/lib/settings';
|
||||||
|
|
||||||
async function playNative(url: string, videoElem: HTMLVideoElement) {
|
async function playNative(url: string, videoElem: HTMLVideoElement) {
|
||||||
videoElem.src = url;
|
videoElem.src = url;
|
||||||
@ -21,9 +22,9 @@ async function playHls(url: string, videoElem: HTMLVideoElement) {
|
|||||||
|
|
||||||
export async function play(videoElem: HTMLVideoElement) {
|
export async function play(videoElem: HTMLVideoElement) {
|
||||||
const urlQuery = new URLSearchParams(window.location.search);
|
const urlQuery = new URLSearchParams(window.location.search);
|
||||||
const id = urlQuery.get('id');
|
const id = urlQuery.get('id') as string;
|
||||||
const url = decodeURIComponent(urlQuery.get('url'));
|
const url = decodeURIComponent(urlQuery.get('url') as string);
|
||||||
const domain = urlQuery.get('domain');
|
const domain = urlQuery.get('domain') as string;
|
||||||
|
|
||||||
const match = matches[id];
|
const match = matches[id];
|
||||||
if (match === undefined) {
|
if (match === undefined) {
|
||||||
@ -31,6 +32,8 @@ export async function play(videoElem: HTMLVideoElement) {
|
|||||||
}
|
}
|
||||||
document.title = `Stream Bypass (${domain})`;
|
document.title = `Stream Bypass (${domain})`;
|
||||||
|
|
||||||
|
await storageSet('referer', { domain: domain });
|
||||||
|
|
||||||
if (new URL(url).pathname.endsWith('.m3u8')) {
|
if (new URL(url).pathname.endsWith('.m3u8')) {
|
||||||
await playHls(url, videoElem);
|
await playHls(url, videoElem);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,123 +1,97 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { matches, Reliability } from '~/lib/match';
|
import { type Match, matches } from '~/lib/match';
|
||||||
import { Hosters, Other } from '~/lib/settings';
|
import { Hosters, Other } from '~/lib/settings';
|
||||||
|
import Toggle from './toggle.svelte';
|
||||||
|
|
||||||
let hostersEnabled: boolean;
|
let hostersEnabled: boolean;
|
||||||
let hosters = [];
|
let hosters: (Match & { active: boolean; disabled: boolean })[] = [];
|
||||||
(async () => {
|
(async () => {
|
||||||
hostersEnabled = !(await Hosters.getAllDisabled());
|
hostersEnabled = !(await Hosters.getAllDisabled());
|
||||||
|
|
||||||
const disabled = await Hosters.getDisabled();
|
const disabled = await Hosters.getDisabled();
|
||||||
hosters = Object.values(matches).map((m) => {
|
hosters = Object.values(matches).map((m: any) => {
|
||||||
m['active'] = disabled.findIndex((p) => p.id == m.id) == -1;
|
m['active'] = disabled.findIndex((p) => p.id == m.id) == -1;
|
||||||
m['disabled'] = !hostersEnabled;
|
|
||||||
return m;
|
return m;
|
||||||
});
|
}) as typeof hosters;
|
||||||
|
})();
|
||||||
|
|
||||||
|
let isMobile: boolean;
|
||||||
|
(async () => {
|
||||||
|
isMobile = (await browser.runtime.getPlatformInfo()).os === 'android';
|
||||||
})();
|
})();
|
||||||
|
|
||||||
let ff2mpvEnabled: boolean;
|
let ff2mpvEnabled: boolean;
|
||||||
(async () => {
|
(async () => {
|
||||||
ff2mpvEnabled = await Other.getFf2mpv();
|
ff2mpvEnabled = (await Other.getFf2mpv()) as boolean;
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<main
|
||||||
|
style={isMobile
|
||||||
|
? 'height: 100vh; display: flex; flex-direction: column; align-items: center'
|
||||||
|
: 'height: 500px'}
|
||||||
|
>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Hoster</legend>
|
||||||
|
<div class="setting-container" style={isMobile ? 'grid-column-gap: 5rem' : ''}>
|
||||||
|
<label for="hosters-enabled">Enabled</label>
|
||||||
<div>
|
<div>
|
||||||
<h3 class="header">Hosters</h3>
|
<Toggle
|
||||||
<div class="buttons super-buttons">
|
bind:checked={hostersEnabled}
|
||||||
<button
|
id="hosters-enabled"
|
||||||
class:active={hostersEnabled}
|
on:change={() => Hosters.setAll(hostersEnabled)}
|
||||||
on:click={async () => {
|
/>
|
||||||
await Hosters.enableAll();
|
|
||||||
hostersEnabled = true;
|
|
||||||
hosters = hosters.map((m) => {
|
|
||||||
m['disabled'] = false;
|
|
||||||
return m;
|
|
||||||
});
|
|
||||||
}}>On</button
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class:active={!hostersEnabled}
|
|
||||||
on:click={async () => {
|
|
||||||
await Hosters.disableAll();
|
|
||||||
hostersEnabled = false;
|
|
||||||
hosters = hosters.map((m) => {
|
|
||||||
m['disabled'] = true;
|
|
||||||
return m;
|
|
||||||
});
|
|
||||||
}}>Off</button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<table class="setting-table">
|
<hr />
|
||||||
{#each hosters as hoster}
|
{#each hosters as hoster, i}
|
||||||
<tr>
|
<label for="hoster-{i}" style="cursor: {hostersEnabled ? 'pointer' : 'default'}"
|
||||||
<td class="setting-name">
|
>{hoster.name}</label
|
||||||
<p
|
|
||||||
class:reliability-low={hoster.reliability === Reliability.LOW}
|
|
||||||
class:reliability-normal={hoster.reliability === Reliability.NORMAL}
|
|
||||||
class:reliability-high={hoster.reliability === Reliability.HIGH}
|
|
||||||
>
|
>
|
||||||
{hoster.name}
|
<div>
|
||||||
</p>
|
<Toggle
|
||||||
</td>
|
bind:checked={hoster.active}
|
||||||
<td class="buttons">
|
disabled={!hostersEnabled}
|
||||||
<button
|
id="hoster-{i}"
|
||||||
class:disabled={hoster.disabled}
|
on:change={async () => {
|
||||||
class:active={hoster.active}
|
if (hoster.active) {
|
||||||
on:click={async () => {
|
|
||||||
if (hoster.disabled) return;
|
|
||||||
await Hosters.enable(hoster);
|
await Hosters.enable(hoster);
|
||||||
hoster.active = true;
|
} else {
|
||||||
}}>On</button
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class:disabled={hoster.disabled}
|
|
||||||
class:active={!hoster.active}
|
|
||||||
on:click={async () => {
|
|
||||||
if (hoster.disabled) return;
|
|
||||||
await Hosters.disable(hoster);
|
await Hosters.disable(hoster);
|
||||||
hoster.active = false;
|
}
|
||||||
}}>Off</button
|
}}
|
||||||
>
|
></Toggle>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
|
||||||
{/each}
|
{/each}
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
</fieldset>
|
||||||
|
{#if !isMobile}
|
||||||
|
<fieldset>
|
||||||
|
<legend>Other</legend>
|
||||||
|
<div class="setting-container">
|
||||||
|
<label for="ff2mpv">ff2mpv</label>
|
||||||
<div>
|
<div>
|
||||||
<h3 class="header">Other</h3>
|
<Toggle
|
||||||
<table>
|
bind:checked={ff2mpvEnabled}
|
||||||
<tr>
|
id="ff2mpv"
|
||||||
<td class="setting-name">
|
on:change={async () => {
|
||||||
<p>ff2mpv</p>
|
ff2mpvEnabled = !ff2mpvEnabled;
|
||||||
</td>
|
if (await browser.permissions.request({ permissions: ['nativeMessaging'] })) {
|
||||||
<td class="buttons">
|
await Other.setFf2mpv(ff2mpvEnabled);
|
||||||
<button
|
ff2mpvEnabled = !ff2mpvEnabled;
|
||||||
class:active={ff2mpvEnabled}
|
}
|
||||||
on:click={async () => {
|
}}
|
||||||
await Other.setFf2mpv(true);
|
></Toggle>
|
||||||
ff2mpvEnabled = true;
|
|
||||||
}}>On</button
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class:active={!ff2mpvEnabled}
|
|
||||||
on:click={async () => {
|
|
||||||
await Other.setFf2mpv(false);
|
|
||||||
ff2mpvEnabled = false;
|
|
||||||
}}>Off</button
|
|
||||||
>
|
|
||||||
<a
|
<a
|
||||||
|
class="info-questionmark"
|
||||||
href="https://github.com/ByteDream/stream-bypass/tree/master#ff2mpv-use-mpv-to-directly-play-streams"
|
href="https://github.com/ByteDream/stream-bypass/tree/master#ff2mpv-use-mpv-to-directly-play-streams"
|
||||||
>🛈</a
|
>?</a
|
||||||
>
|
>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
</div>
|
||||||
<a id="bug-notice" href="https://github.com/ByteDream/stream-bypass/issues"
|
</fieldset>
|
||||||
>Something does not work</a
|
{/if}
|
||||||
|
<a id="report-notice" href="https://github.com/ByteDream/stream-bypass/issues"
|
||||||
|
>Report issues or requests</a
|
||||||
>
|
>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
@ -127,11 +101,16 @@
|
|||||||
background-color: #2b2a33;
|
background-color: #2b2a33;
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
overflow-x: hidden;
|
margin: 0;
|
||||||
overflow-y: auto;
|
padding: 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#bug-notice {
|
fieldset {
|
||||||
|
border-radius: 5px;
|
||||||
|
border-color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
#report-notice {
|
||||||
border: none;
|
border: none;
|
||||||
color: white;
|
color: white;
|
||||||
display: block;
|
display: block;
|
||||||
@ -154,65 +133,33 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.setting-table {
|
.setting-container {
|
||||||
border-collapse: collapse;
|
display: grid;
|
||||||
border-spacing: 0;
|
grid-template-columns: auto auto;
|
||||||
}
|
grid-column-gap: 5px;
|
||||||
|
grid-row-gap: 4px;
|
||||||
.setting-name {
|
align-items: end;
|
||||||
height: 34px;
|
width: 100%;
|
||||||
|
|
||||||
p {
|
& > label {
|
||||||
margin: 0;
|
height: 34px;
|
||||||
cursor: default;
|
margin: 0;
|
||||||
}
|
user-select: none;
|
||||||
}
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
.buttons {
|
align-items: center;
|
||||||
display: flex;
|
}
|
||||||
flex-direction: row;
|
|
||||||
height: 34px;
|
& > hr {
|
||||||
|
grid-column: 1 / span 2;
|
||||||
button,
|
|
||||||
a {
|
|
||||||
border: 1px solid #281515;
|
|
||||||
background-color: transparent;
|
|
||||||
color: white;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 5px 8px;
|
|
||||||
margin: 0;
|
|
||||||
text-decoration: none;
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background-color: rgba(255, 65, 65, 0.74);
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.disabled {
|
|
||||||
background-color: gray;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.super-buttons {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 4px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.reliability-low {
|
.info-questionmark {
|
||||||
text-decoration: underline;
|
display: inline-block;
|
||||||
text-decoration-color: red;
|
transform: translateX(-40%) translateY(-100%);
|
||||||
}
|
color: black;
|
||||||
.reliability-normal {
|
text-decoration: none;
|
||||||
text-decoration: underline;
|
|
||||||
text-decoration-color: yellow;
|
|
||||||
}
|
|
||||||
.reliability-high {
|
|
||||||
text-decoration: underline;
|
|
||||||
text-decoration-color: #00ff00;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html style="overflow-y: hidden" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Stream Bypass</title>
|
<title>Stream Bypass</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="width: fit-content; height: 500px">
|
<body style="overflow-y: scroll">
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import Popup from '~/entries/popup/Popup.svelte';
|
import Popup from '~/entries/popup/Popup.svelte';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import App from './Popup.svelte';
|
import App from './Popup.svelte';
|
||||||
|
|
||||||
new App({
|
new App({
|
||||||
target: document.getElementById('app')
|
target: document.getElementById('app') as Element
|
||||||
});
|
});
|
||||||
|
65
src/entries/popup/toggle.svelte
Normal file
65
src/entries/popup/toggle.svelte
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<!-- https://flowbite.com/docs/forms/toggle/ -->
|
||||||
|
<script lang="ts">
|
||||||
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
|
export let checked = false;
|
||||||
|
export let disabled = false;
|
||||||
|
export let id: string | null = null;
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<label class="toggle">
|
||||||
|
<slot />
|
||||||
|
<input type="checkbox" {id} bind:checked {disabled} on:change={(e) => dispatch('change', e)} />
|
||||||
|
<span />
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<style lang="scss" global>
|
||||||
|
.toggle {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
input {
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
&:checked + span {
|
||||||
|
background: limegreen;
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
transform: translateX(100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled + span {
|
||||||
|
background: gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
position: relative;
|
||||||
|
width: 2.75rem;
|
||||||
|
height: 1.5rem;
|
||||||
|
background: #cf0000;
|
||||||
|
border-radius: 9999px;
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
inset-inline-start: 2px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 9999px;
|
||||||
|
height: 1.25rem;
|
||||||
|
width: 1.25rem;
|
||||||
|
transition: all 0.15s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:has(input:disabled) {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,28 +1,20 @@
|
|||||||
import { unpack } from '~/lib/utils';
|
import { unpack } from './utils';
|
||||||
import { Hosters } from '~/lib/settings';
|
import { Hosters, Redirect } from './settings';
|
||||||
|
|
||||||
export enum Reliability {
|
|
||||||
HIGH,
|
|
||||||
NORMAL,
|
|
||||||
LOW
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Match {
|
export interface Match {
|
||||||
name: string;
|
name: string;
|
||||||
id: string;
|
id: string;
|
||||||
reliability: Reliability;
|
|
||||||
domains: string[];
|
domains: string[];
|
||||||
replace?: boolean;
|
replace?: boolean;
|
||||||
regex: RegExp;
|
regex: RegExp;
|
||||||
notice?: string;
|
notice?: string;
|
||||||
|
|
||||||
match(match: RegExpMatchArray): Promise<string>;
|
match(match: RegExpMatchArray): Promise<string | null>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Doodstream: Match = {
|
export const Doodstream: Match = {
|
||||||
name: 'Doodstream',
|
name: 'Doodstream',
|
||||||
id: 'doodstream',
|
id: 'doodstream',
|
||||||
reliability: Reliability.NORMAL,
|
|
||||||
domains: [
|
domains: [
|
||||||
'doodstream.com',
|
'doodstream.com',
|
||||||
'dood.pm',
|
'dood.pm',
|
||||||
@ -34,10 +26,13 @@ export const Doodstream: Match = {
|
|||||||
'dood.to',
|
'dood.to',
|
||||||
'dood.so',
|
'dood.so',
|
||||||
'dood.la',
|
'dood.la',
|
||||||
|
'dood.li',
|
||||||
'dood.re',
|
'dood.re',
|
||||||
'dood.yt',
|
'dood.yt',
|
||||||
|
'doods.pro',
|
||||||
'ds2play.com',
|
'ds2play.com',
|
||||||
'dooood.com'
|
'dooood.com',
|
||||||
|
'd000d.com'
|
||||||
],
|
],
|
||||||
replace: true,
|
replace: true,
|
||||||
regex: /(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)/s,
|
regex: /(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)/s,
|
||||||
@ -58,33 +53,30 @@ export const Doodstream: Match = {
|
|||||||
export const DropLoad: Match = {
|
export const DropLoad: Match = {
|
||||||
name: 'Dropload',
|
name: 'Dropload',
|
||||||
id: 'dropload',
|
id: 'dropload',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['dropload.ui'],
|
domains: ['dropload.ui'],
|
||||||
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
const unpacked = await unpack(match[0]);
|
const unpacked = await unpack(match[0]);
|
||||||
return unpacked.match(/(?<=file:").*(?=")/)[0];
|
return unpacked.match(/(?<=file:").*(?=")/)![0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Filemoon: Match = {
|
export const Filemoon: Match = {
|
||||||
name: 'Filemoon',
|
name: 'Filemoon',
|
||||||
id: 'filemoon',
|
id: 'filemoon',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['filemoon.sx', 'filemoon.in'],
|
domains: ['filemoon.sx', 'filemoon.in'],
|
||||||
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
const unpacked = await unpack(match[0]);
|
const unpacked = await unpack(match[0]);
|
||||||
return unpacked.match(/(?<=file:").*(?=")/)[0];
|
return unpacked.match(/(?<=file:").*(?=")/)![0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const GoodStream: Match = {
|
export const GoodStream: Match = {
|
||||||
name: 'Goodstream',
|
name: 'Goodstream',
|
||||||
id: 'goodstream',
|
id: 'goodstream',
|
||||||
reliability: Reliability.NORMAL,
|
|
||||||
domains: ['goodstream.uno'],
|
domains: ['goodstream.uno'],
|
||||||
regex: /(?<=file:\s+").*(?=")/g,
|
regex: /(?<=file:\s+").*(?=")/g,
|
||||||
|
|
||||||
@ -96,26 +88,24 @@ export const GoodStream: Match = {
|
|||||||
export const Kwik: Match = {
|
export const Kwik: Match = {
|
||||||
name: 'Kwik',
|
name: 'Kwik',
|
||||||
id: 'kwik',
|
id: 'kwik',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['kwik.cx'],
|
domains: ['kwik.cx'],
|
||||||
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
const unpacked = await unpack(match[0]);
|
const unpacked = await unpack(match[0]);
|
||||||
return unpacked.match(/(?<=source=').*(?=')/)[0];
|
return unpacked.match(/(?<=source=').*(?=')/)![0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Mixdrop: Match = {
|
export const Mixdrop: Match = {
|
||||||
name: 'Mixdrop',
|
name: 'Mixdrop',
|
||||||
id: 'mixdrop',
|
id: 'mixdrop',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['mixdrop.co', 'mixdrop.to', 'mixdrop.ch', 'mixdrop.bz', 'mixdrop.gl'],
|
domains: ['mixdrop.co', 'mixdrop.to', 'mixdrop.ch', 'mixdrop.bz', 'mixdrop.gl'],
|
||||||
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
const unpacked = await unpack(match[0]);
|
const unpacked = await unpack(match[0]);
|
||||||
const url = unpacked.match(/(?<=MDCore.wurl=").*(?=")/)[0];
|
const url = unpacked.match(/(?<=MDCore.wurl=").*(?=")/)![0];
|
||||||
return `https:${url}`;
|
return `https:${url}`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -123,21 +113,19 @@ export const Mixdrop: Match = {
|
|||||||
export const Mp4Upload: Match = {
|
export const Mp4Upload: Match = {
|
||||||
name: 'Mp4Upload',
|
name: 'Mp4Upload',
|
||||||
id: 'mp4upload',
|
id: 'mp4upload',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['mp4upload.com'],
|
domains: ['mp4upload.com'],
|
||||||
replace: true,
|
replace: true,
|
||||||
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
const unpacked = await unpack(match[0]);
|
const unpacked = await unpack(match[0]);
|
||||||
return unpacked.match(/(?<=player.src\(").*(?=")/)[0];
|
return unpacked.match(/(?<=player.src\(").*(?=")/)![0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Newgrounds: Match = {
|
export const Newgrounds: Match = {
|
||||||
name: 'Newgrounds',
|
name: 'Newgrounds',
|
||||||
id: 'newgrounds',
|
id: 'newgrounds',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['newgrounds.com'],
|
domains: ['newgrounds.com'],
|
||||||
regex: /.*/gm,
|
regex: /.*/gm,
|
||||||
|
|
||||||
@ -153,10 +141,24 @@ export const Newgrounds: Match = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const StreamA2z: Match = {
|
||||||
|
name: 'Stream2Az',
|
||||||
|
id: 'stream2az',
|
||||||
|
domains: ['streama2z.com', 'streama2z.xyz'],
|
||||||
|
regex: /https?:\/\/\S*m3u8.+(?=['"])/gm,
|
||||||
|
|
||||||
|
match: async (match: RegExpMatchArray) => {
|
||||||
|
if (StreamA2z.domains.indexOf(window.location.hostname) !== -1) {
|
||||||
|
await Redirect.set(StreamA2z);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return match[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const Streamtape: Match = {
|
export const Streamtape: Match = {
|
||||||
name: 'Streamtape',
|
name: 'Streamtape',
|
||||||
id: 'streamtape',
|
id: 'streamtape',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['streamtape.com', 'streamtape.net', 'shavetape.cash'],
|
domains: ['streamtape.com', 'streamtape.net', 'shavetape.cash'],
|
||||||
regex: /id=.*(?=')/gm,
|
regex: /id=.*(?=')/gm,
|
||||||
|
|
||||||
@ -176,7 +178,6 @@ export const Streamtape: Match = {
|
|||||||
export const Streamzz: Match = {
|
export const Streamzz: Match = {
|
||||||
name: 'Streamzz',
|
name: 'Streamzz',
|
||||||
id: 'streamzz',
|
id: 'streamzz',
|
||||||
reliability: Reliability.LOW,
|
|
||||||
domains: ['streamzz.to', 'streamz.ws'],
|
domains: ['streamzz.to', 'streamz.ws'],
|
||||||
regex: /(?<=\|)\w{2,}/gm,
|
regex: /(?<=\|)\w{2,}/gm,
|
||||||
|
|
||||||
@ -190,35 +191,45 @@ export const Streamzz: Match = {
|
|||||||
export const SuperVideo: Match = {
|
export const SuperVideo: Match = {
|
||||||
name: 'Supervideo',
|
name: 'Supervideo',
|
||||||
id: 'supervideo',
|
id: 'supervideo',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['supervideo.tv'],
|
domains: ['supervideo.tv'],
|
||||||
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
const unpacked = await unpack(match[0]);
|
const unpacked = await unpack(match[0]);
|
||||||
return unpacked.match(/(?<=file:").*(?=")/)[0];
|
return unpacked.match(/(?<=file:").*(?=")/)![0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Upstream: Match = {
|
export const Upstream: Match = {
|
||||||
name: 'Upstream',
|
name: 'Upstream',
|
||||||
id: 'upstream',
|
id: 'upstream',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['upstream.to'],
|
domains: ['upstream.to'],
|
||||||
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
const unpacked = await unpack(match[0]);
|
const unpacked = await unpack(match[0]);
|
||||||
return unpacked.match(/(?<=file:").*(?=")/)[0];
|
return unpacked.match(/(?<=file:").*(?=")/)![0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Vidmoly: Match = {
|
||||||
|
name: 'Vidmoly',
|
||||||
|
id: 'vidmoly',
|
||||||
|
domains: ['vidmoly.me', 'vidmoly.to'],
|
||||||
|
regex: /(?<=file:").+\.m3u8/gm,
|
||||||
|
|
||||||
|
match: async (match: RegExpMatchArray) => {
|
||||||
|
alert('a');
|
||||||
|
return match[0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Vidoza: Match = {
|
export const Vidoza: Match = {
|
||||||
name: 'Vidoza',
|
name: 'Vidoza',
|
||||||
id: 'vidoza',
|
id: 'vidoza',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['vidoza.net'],
|
domains: ['vidoza.net'],
|
||||||
regex: /(?<=src:\s?").+?(?=")/gm,
|
regex: /(?<=src:\s?").+?(?=")/gm,
|
||||||
|
replace: true,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
return match[0];
|
return match[0];
|
||||||
@ -228,9 +239,8 @@ export const Vidoza: Match = {
|
|||||||
export const Voe: Match = {
|
export const Voe: Match = {
|
||||||
name: 'Voe',
|
name: 'Voe',
|
||||||
id: 'voe',
|
id: 'voe',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['voe.sx'],
|
domains: ['voe.sx'],
|
||||||
regex: /https?:\/\/\S*m3u8.+(?=')/gm,
|
regex: /https?:\/\/\S*m3u8.+(?=['"])/gm,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
return match[0];
|
return match[0];
|
||||||
@ -240,7 +250,6 @@ export const Voe: Match = {
|
|||||||
export const Vupload: Match = {
|
export const Vupload: Match = {
|
||||||
name: 'Vupload',
|
name: 'Vupload',
|
||||||
id: 'vupload',
|
id: 'vupload',
|
||||||
reliability: Reliability.HIGH,
|
|
||||||
domains: ['vupload.com'],
|
domains: ['vupload.com'],
|
||||||
regex: /(?<=src:\s?").+?(?=")/gm,
|
regex: /(?<=src:\s?").+?(?=")/gm,
|
||||||
|
|
||||||
@ -258,10 +267,12 @@ export const matches = {
|
|||||||
[Mixdrop.id]: Mixdrop,
|
[Mixdrop.id]: Mixdrop,
|
||||||
[Mp4Upload.id]: Mp4Upload,
|
[Mp4Upload.id]: Mp4Upload,
|
||||||
[Newgrounds.id]: Newgrounds,
|
[Newgrounds.id]: Newgrounds,
|
||||||
|
[StreamA2z.id]: StreamA2z,
|
||||||
[Streamtape.id]: Streamtape,
|
[Streamtape.id]: Streamtape,
|
||||||
[Streamzz.id]: Streamzz,
|
[Streamzz.id]: Streamzz,
|
||||||
[SuperVideo.id]: SuperVideo,
|
[SuperVideo.id]: SuperVideo,
|
||||||
[Upstream.id]: Upstream,
|
[Upstream.id]: Upstream,
|
||||||
|
[Vidmoly.id]: Vidmoly,
|
||||||
[Vidoza.id]: Vidoza,
|
[Vidoza.id]: Vidoza,
|
||||||
[Voe.id]: Voe,
|
[Voe.id]: Voe,
|
||||||
[Vupload.id]: Vupload
|
[Vupload.id]: Vupload
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import browser from 'webextension-polyfill';
|
import type { Match } from './match';
|
||||||
import type { Match } from '~/lib/match';
|
import { matches } from './match';
|
||||||
import { matches } from '~/lib/match';
|
|
||||||
|
|
||||||
export const Hosters = {
|
export const Hosters = {
|
||||||
getDisabled: async () => {
|
getDisabled: async () => {
|
||||||
const disabled = await storageGet<string[]>('hosters.disabled', []);
|
const disabled = (await storageGet('hosters.disabled', [])) as string[];
|
||||||
return disabled.map((id) => matches[id]).filter((m) => m !== undefined);
|
return disabled.map((id) => matches[id]).filter((m) => m !== undefined);
|
||||||
},
|
},
|
||||||
disable: async (match: Match) => {
|
disable: async (match: Match) => {
|
||||||
const disabled = await storageGet('hosters.disabled', []);
|
const disabled = (await storageGet('hosters.disabled', [])) as string[];
|
||||||
const index = disabled.indexOf(match.id);
|
const index = disabled.indexOf(match.id);
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
disabled.push(match.id);
|
disabled.push(match.id);
|
||||||
@ -16,7 +15,7 @@ export const Hosters = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
enable: async (match: Match) => {
|
enable: async (match: Match) => {
|
||||||
const disabled = await storageGet('hosters.disabled', []);
|
const disabled = (await storageGet('hosters.disabled', [])) as string[];
|
||||||
const index = disabled.indexOf(match.id);
|
const index = disabled.indexOf(match.id);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
disabled.splice(index, 1);
|
disabled.splice(index, 1);
|
||||||
@ -26,17 +25,14 @@ export const Hosters = {
|
|||||||
getAllDisabled: async () => {
|
getAllDisabled: async () => {
|
||||||
return await storageGet<boolean>('hosters.allDisabled', false);
|
return await storageGet<boolean>('hosters.allDisabled', false);
|
||||||
},
|
},
|
||||||
disableAll: async () => {
|
setAll: async (enable: boolean) => {
|
||||||
await storageSet('hosters.allDisabled', true);
|
await storageSet('hosters.allDisabled', !enable);
|
||||||
},
|
|
||||||
enableAll: async () => {
|
|
||||||
await storageSet('hosters.allDisabled', false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Redirect = {
|
export const Redirect = {
|
||||||
get: async (): Promise<Match | null> => {
|
get: async (): Promise<Match | null> => {
|
||||||
return matches[await storageGet<string>('redirect')] || null;
|
return matches[(await storageGet('redirect')) as string] || null;
|
||||||
},
|
},
|
||||||
set: async (match: Match) => {
|
set: async (match: Match) => {
|
||||||
await storageSet('redirect', match.id);
|
await storageSet('redirect', match.id);
|
||||||
@ -48,7 +44,7 @@ export const Redirect = {
|
|||||||
|
|
||||||
export const Other = {
|
export const Other = {
|
||||||
getFf2mpv: async () => {
|
getFf2mpv: async () => {
|
||||||
return await storageGet('other.ff2mpv', true);
|
return await storageGet('other.ff2mpv', false);
|
||||||
},
|
},
|
||||||
setFf2mpv: async (enable: boolean) => {
|
setFf2mpv: async (enable: boolean) => {
|
||||||
await storageSet('other.ff2mpv', enable);
|
await storageSet('other.ff2mpv', enable);
|
||||||
@ -56,18 +52,34 @@ export const Other = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function storageGet<T>(key: string, defaultValue?: T): Promise<T | undefined> {
|
export async function storageGet<T>(key: string, defaultValue?: T): Promise<T | undefined> {
|
||||||
const entry = await browser.storage.local.get(key);
|
let resolve: (value: T | undefined) => void;
|
||||||
|
const promise = new Promise<T | undefined>((r) => (resolve = r));
|
||||||
|
|
||||||
|
chrome.storage.local.get(key, (entry) => {
|
||||||
const value = entry[key];
|
const value = entry[key];
|
||||||
return value === undefined ? defaultValue : value;
|
resolve(value === undefined ? defaultValue : value);
|
||||||
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function storageSet<T>(key: string, value: T) {
|
export async function storageSet<T>(key: string, value: T) {
|
||||||
|
let resolve: () => void;
|
||||||
|
const promise = new Promise<void>((r) => (resolve = r));
|
||||||
|
|
||||||
const obj = {
|
const obj = {
|
||||||
[key]: value
|
[key]: value
|
||||||
};
|
};
|
||||||
await browser.storage.local.set(obj);
|
chrome.storage.local.set(obj, () => resolve());
|
||||||
|
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function storageDelete(key: string) {
|
export async function storageDelete(key: string) {
|
||||||
await browser.storage.local.remove(key);
|
let resolve: () => void;
|
||||||
|
const promise = new Promise<void>((r) => (resolve = r));
|
||||||
|
|
||||||
|
chrome.storage.local.remove(key, () => resolve());
|
||||||
|
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ export async function unpack(packed: string): Promise<string> {
|
|||||||
}'
|
}'
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const res: string = await runInPageContext(toExecute);
|
const res = (await runInPageContext(toExecute)) as string;
|
||||||
return res
|
return res
|
||||||
.replace(/;/g, ';\n')
|
.replace(/;/g, ';\n')
|
||||||
.replace(/{/g, '\n{\n')
|
.replace(/{/g, '\n{\n')
|
||||||
@ -29,7 +29,7 @@ export async function unpack(packed: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adapted from: https://github.com/arikw/extension-page-context
|
// Adapted from: https://github.com/arikw/extension-page-context
|
||||||
async function runInPageContext<T>(toExecute: string): Promise<T> {
|
async function runInPageContext<T>(toExecute: string): Promise<T | null> {
|
||||||
// test that we are running with the allow-scripts permission
|
// test that we are running with the allow-scripts permission
|
||||||
try {
|
try {
|
||||||
window.sessionStorage;
|
window.sessionStorage;
|
||||||
@ -44,7 +44,8 @@ async function runInPageContext<T>(toExecute: string): Promise<T> {
|
|||||||
const scriptElm = document.createElement('script');
|
const scriptElm = document.createElement('script');
|
||||||
scriptElm.setAttribute('type', 'application/javascript');
|
scriptElm.setAttribute('type', 'application/javascript');
|
||||||
|
|
||||||
const code = `
|
// inject the script
|
||||||
|
scriptElm.textContent = `
|
||||||
(
|
(
|
||||||
async function () {
|
async function () {
|
||||||
|
|
||||||
@ -63,9 +64,6 @@ async function runInPageContext<T>(toExecute: string): Promise<T> {
|
|||||||
)();
|
)();
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// inject the script
|
|
||||||
scriptElm.textContent = code;
|
|
||||||
|
|
||||||
// run the script
|
// run the script
|
||||||
document.documentElement.appendChild(scriptElm);
|
document.documentElement.appendChild(scriptElm);
|
||||||
|
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
import pkg from '../package.json';
|
import pkg from '../package.json';
|
||||||
|
import { matches } from './lib/match';
|
||||||
|
|
||||||
const sharedManifest: Partial<chrome.runtime.ManifestBase> = {
|
const sharedManifest: Partial<chrome.runtime.ManifestBase> = {
|
||||||
browser_specific_settings: {
|
browser_specific_settings: {
|
||||||
gecko: {
|
gecko: {
|
||||||
id: '{55dd42e8-3dd9-455a-b4fe-86664881b10c}'
|
id: '{55dd42e8-3dd9-455a-b4fe-86664881b10c}'
|
||||||
}
|
},
|
||||||
|
gecko_android: {}
|
||||||
},
|
},
|
||||||
content_scripts: [
|
content_scripts: [
|
||||||
{
|
{
|
||||||
all_frames: true,
|
all_frames: true,
|
||||||
matches: ['<all_urls>'],
|
matches: Object.values(matches).flatMap((m) => m.domains.map((d) => `*://${d}/*`)),
|
||||||
js: ['src/entries/contentScript/main.ts'],
|
js: ['src/entries/contentScript/main.ts'],
|
||||||
run_at: 'document_end'
|
run_at: 'document_end'
|
||||||
}
|
}
|
||||||
@ -21,7 +23,8 @@ const sharedManifest: Partial<chrome.runtime.ManifestBase> = {
|
|||||||
96: 'icons/stream-bypass@96px.png',
|
96: 'icons/stream-bypass@96px.png',
|
||||||
128: 'icons/stream-bypass@128px.png'
|
128: 'icons/stream-bypass@128px.png'
|
||||||
},
|
},
|
||||||
permissions: ['storage', 'webRequest', 'nativeMessaging', '<all_urls>']
|
permissions: ['storage'],
|
||||||
|
optional_permissions: ['nativeMessaging']
|
||||||
};
|
};
|
||||||
|
|
||||||
const browserAction = {
|
const browserAction = {
|
||||||
@ -35,18 +38,19 @@ const browserAction = {
|
|||||||
const ManifestV2 = {
|
const ManifestV2 = {
|
||||||
...sharedManifest,
|
...sharedManifest,
|
||||||
background: {
|
background: {
|
||||||
scripts: ['src/entries/background/main.ts'],
|
scripts: ['src/entries/background/mv2.ts'],
|
||||||
persistent: true
|
persistent: true
|
||||||
},
|
},
|
||||||
|
content_scripts: [{ ...sharedManifest.content_scripts![0], matches: ['<all_urls>'] }],
|
||||||
browser_action: browserAction,
|
browser_action: browserAction,
|
||||||
permissions: [...sharedManifest.permissions]
|
permissions: [...sharedManifest.permissions, 'webRequest', 'webRequestBlocking', '<all_urls>']
|
||||||
};
|
};
|
||||||
|
|
||||||
const ManifestV3 = {
|
const ManifestV3 = {
|
||||||
...sharedManifest,
|
...sharedManifest,
|
||||||
action: browserAction,
|
action: browserAction,
|
||||||
background: {
|
background: {
|
||||||
service_worker: 'src/entries/background/main.ts'
|
service_worker: 'src/entries/background/mv3.ts'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,15 +69,18 @@ export function getManifest(
|
|||||||
...manifest,
|
...manifest,
|
||||||
...ManifestV2,
|
...ManifestV2,
|
||||||
manifest_version: manifestVersion
|
manifest_version: manifestVersion
|
||||||
};
|
} as chrome.runtime.ManifestV2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manifestVersion === 3) {
|
if (manifestVersion === 3) {
|
||||||
return {
|
return {
|
||||||
...manifest,
|
...manifest,
|
||||||
|
// just like all the adblockers which are unable to fully work under MV3, we need access to every website
|
||||||
|
// the user enters in order to work correctly, which is forbidden when using MV3
|
||||||
|
name: `${manifest.name} Lite`,
|
||||||
...ManifestV3,
|
...ManifestV3,
|
||||||
manifest_version: manifestVersion
|
manifest_version: manifestVersion
|
||||||
};
|
} as chrome.runtime.ManifestV3;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Missing manifest definition for manifestVersion ${manifestVersion}`);
|
throw new Error(`Missing manifest definition for manifestVersion ${manifestVersion}`);
|
||||||
|
@ -3,6 +3,7 @@ import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|||||||
import webExtension from '@samrum/vite-plugin-web-extension';
|
import webExtension from '@samrum/vite-plugin-web-extension';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { getManifest } from './src/manifest';
|
import { getManifest } from './src/manifest';
|
||||||
|
import { matches } from './src/lib/match';
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
@ -18,8 +19,10 @@ export default defineConfig(({ mode }) => {
|
|||||||
{
|
{
|
||||||
fileName: 'src/entries/player/player.html',
|
fileName: 'src/entries/player/player.html',
|
||||||
webAccessible: {
|
webAccessible: {
|
||||||
matches: ['<all_urls>'],
|
matches:
|
||||||
excludeEntryFile: true
|
Number(env.MANIFEST_VERSION) === 3
|
||||||
|
? Object.values(matches).flatMap((m) => m.domains.map((d) => `*://${d}/*`))
|
||||||
|
: ['<all_urls>']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user