mirror of
https://github.com/bytedream/stream-bypass.git
synced 2026-08-04 21:10:40 +02:00
fix per domain disable not working if host is in iframe
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { BackgroundMessageType, sendBackgroundMessage } from '@/lib/communication';
|
||||
import { getHost, HostMatchType, hosts, type HostMatch } from '@/lib/host';
|
||||
import { FF2MPVSettings } from '@/lib/settings';
|
||||
import { FF2MPVSettings, PerDomainSettings } from '@/lib/settings';
|
||||
|
||||
export default defineContentScript({
|
||||
matches: [
|
||||
@@ -16,6 +17,18 @@ async function main() {
|
||||
const host = await getHost(window.location.host);
|
||||
if (!host) return;
|
||||
|
||||
// if current windows is an iframe, check if the parent has any disabled hosts
|
||||
if (window !== window.top) {
|
||||
const tabUrl = await sendBackgroundMessage(BackgroundMessageType.RequestTabUrl, undefined);
|
||||
if (tabUrl) {
|
||||
const domain = new URL(tabUrl).host;
|
||||
|
||||
const perDomainSetting = await PerDomainSettings.get(domain);
|
||||
if (perDomainSetting.allDisabled) return;
|
||||
else if (perDomainSetting.disabledHostIds.indexOf(host.id) !== -1) return;
|
||||
}
|
||||
}
|
||||
|
||||
let re = null;
|
||||
for (const regex of host.regex) {
|
||||
if ((re = document.body.innerHTML.match(regex)) !== null) {
|
||||
|
||||
Reference in New Issue
Block a user