mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-06-28 02:50:32 +02:00
Fix linting errors
This commit is contained in:
@ -5,11 +5,13 @@ import { storageDelete, storageGet, storageSet } 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({
|
||||
details.requestHeaders!.push({
|
||||
name: 'Referer',
|
||||
value: `https://${referer.domain}/`
|
||||
});
|
||||
@ -26,8 +28,8 @@ 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) {
|
||||
let match: Match | null;
|
||||
if ((match = await getMatch(new URL(details.url).hostname)) !== null) {
|
||||
await storageSet('redirect', match.id);
|
||||
}
|
||||
} else {
|
||||
|
@ -3,7 +3,7 @@ import { getMatch } from '~/lib/match';
|
||||
import { Other, Redirect } from '~/lib/settings';
|
||||
|
||||
async function main() {
|
||||
let match: Match;
|
||||
let match: Match | null;
|
||||
let redirect = false;
|
||||
if ((match = await getMatch(window.location.host)) === null) {
|
||||
if ((match = await Redirect.get()) === null) {
|
||||
@ -20,7 +20,12 @@ async function main() {
|
||||
await Redirect.delete();
|
||||
}
|
||||
|
||||
const url = await match.match(re);
|
||||
let url: string;
|
||||
try {
|
||||
url = await match.match(re);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
// send the url to the ff2mpv (https://github.com/woodruffw/ff2mpv) application
|
||||
if (await Other.getFf2mpv()) {
|
||||
|
@ -22,9 +22,9 @@ async function playHls(url: string, videoElem: HTMLVideoElement) {
|
||||
|
||||
export async function play(videoElem: HTMLVideoElement) {
|
||||
const urlQuery = new URLSearchParams(window.location.search);
|
||||
const id = urlQuery.get('id');
|
||||
const url = decodeURIComponent(urlQuery.get('url'));
|
||||
const domain = urlQuery.get('domain');
|
||||
const id = urlQuery.get('id') as string;
|
||||
const url = decodeURIComponent(urlQuery.get('url') as string);
|
||||
const domain = urlQuery.get('domain') as string;
|
||||
|
||||
const match = matches[id];
|
||||
if (match === undefined) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import App from './Popup.svelte';
|
||||
|
||||
new App({
|
||||
target: document.getElementById('app')
|
||||
target: document.getElementById('app') as Element
|
||||
});
|
||||
|
Reference in New Issue
Block a user