mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-06-27 10:30:31 +02:00
27 lines
765 B
TypeScript
27 lines
765 B
TypeScript
import {getMatch} from "./match/match";
|
|
import {storageDelete, storageGet} from "./store/store";
|
|
import {Match, matches} from "./match/matches";
|
|
|
|
async function main() {
|
|
let match: Match;
|
|
if ((match = await getMatch(window.location.host)) === undefined) {
|
|
let id: string
|
|
if ((id = await storageGet('redirect')) !== undefined) {
|
|
match = matches.find(m => m.id === id)
|
|
await storageDelete('redirect')
|
|
} else {
|
|
return
|
|
}
|
|
}
|
|
|
|
const re = document.body.innerHTML.match(match.regex)
|
|
if (re === null) {
|
|
return
|
|
}
|
|
|
|
const url = await match.match(re)
|
|
location.assign(chrome.runtime.getURL(`ui/player/player.html?id=${match.id}&url=${encodeURIComponent(url)}`))
|
|
}
|
|
|
|
main()
|