diff --git a/src/entrypoint/declare.ts b/src/entrypoint/declare.ts index fab7bad..ad1098b 100644 --- a/src/entrypoint/declare.ts +++ b/src/entrypoint/declare.ts @@ -24,7 +24,11 @@ export interface ProviderMakerOptions { } export function makeProviders(ops: ProviderMakerOptions) { - const features = getTargetFeatures(ops.proxyStreams ? 'any' : ops.target, ops.consistentIpForRequests ?? false); + const features = getTargetFeatures( + ops.proxyStreams ? 'any' : ops.target, + ops.consistentIpForRequests ?? false, + ops.proxyStreams ?? false, + ); const list = getProviders(features, { embeds: getBuiltinEmbeds(), sources: getBuiltinSources(), diff --git a/src/entrypoint/utils/targets.ts b/src/entrypoint/utils/targets.ts index 80988a4..94b724a 100644 --- a/src/entrypoint/utils/targets.ts +++ b/src/entrypoint/utils/targets.ts @@ -9,6 +9,10 @@ export const flags = { // The source/embed is blocking cloudflare ip's // This flag is not compatible with a proxy hosted on cloudflare CF_BLOCKED: 'cf-blocked', + + // Streams and sources with this flag wont be proxied + // And will be exclusive to the extension + PROXY_BLOCKED: 'proxy-blocked', } as const; export type Flags = (typeof flags)[keyof typeof flags]; @@ -53,9 +57,14 @@ export const targetToFeatures: Record = { }, }; -export function getTargetFeatures(target: Targets, consistentIpForRequests: boolean): FeatureMap { +export function getTargetFeatures( + target: Targets, + consistentIpForRequests: boolean, + proxyStreams: boolean, +): FeatureMap { const features = targetToFeatures[target]; if (!consistentIpForRequests) features.disallowed.push(flags.IP_LOCKED); + if (proxyStreams) features.disallowed.push(flags.PROXY_BLOCKED); return features; } diff --git a/src/utils/proxy.ts b/src/utils/proxy.ts index b97aa53..e57f74a 100644 --- a/src/utils/proxy.ts +++ b/src/utils/proxy.ts @@ -14,11 +14,11 @@ export function setupProxy(stream: Stream): Stream { : null; if (stream.type === 'hls') - stream.playlist = `https://swallow.prawnhub.ru/${encodeURIComponent(stream.playlist)}/${headers}`; + stream.playlist = `https://proxy.nsbx.ru/hls/${encodeURIComponent(stream.playlist)}/${headers}`; if (stream.type === 'file') Object.entries(stream.qualities).forEach((entry) => { - entry[1].url = `https://mp4proxy.nsbxru.workers.dev/proxy/${encodeURIComponent(entry[1].url)}/${headers}`; + entry[1].url = `https://proxy.nsbx.ru/mp4/${encodeURIComponent(entry[1].url)}/${headers}`; }); stream.headers = {};