mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-05-09 20:25:14 +02:00
Optimize redirect functionality
This commit is contained in:
parent
382d8b1268
commit
f9a0656d4d
@ -4,20 +4,20 @@ import {Match, matches} from "./match/matches";
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
let match: Match;
|
let match: Match;
|
||||||
|
let redirect = false;
|
||||||
if ((match = await getMatch(window.location.host)) === undefined) {
|
if ((match = await getMatch(window.location.host)) === undefined) {
|
||||||
let id: string
|
let id: string
|
||||||
if ((id = await storageGet('redirect')) !== undefined) {
|
if ((id = await storageGet('redirect')) !== undefined) {
|
||||||
|
redirect = true
|
||||||
match = matches.find(m => m.id === id)
|
match = matches.find(m => m.id === id)
|
||||||
await storageDelete('redirect')
|
|
||||||
} else {
|
} else {
|
||||||
return
|
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
|
if (redirect) await storageDelete('redirect')
|
||||||
}
|
|
||||||
|
|
||||||
const url = await match.match(re)
|
const url = await match.match(re)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user