mirror of
https://github.com/sussy-code/providers.git
synced 2026-03-30 22:49:17 +00:00
Complete setup proxy function
This commit is contained in:
parent
0f95ed0b20
commit
78dbbf7520
1 changed files with 13 additions and 2 deletions
|
|
@ -8,9 +8,20 @@ export function requiresProxy(stream: Stream): boolean {
|
|||
}
|
||||
|
||||
export function setupProxy(stream: Stream): Stream {
|
||||
// todo
|
||||
const headers =
|
||||
stream.headers && Object.keys(stream.headers).length > 0
|
||||
? encodeURIComponent(JSON.stringify(stream.headers))
|
||||
: null;
|
||||
|
||||
// stream.headers = {};
|
||||
if (stream.type === 'hls')
|
||||
stream.playlist = `https://busty.prawnhub.ru/proxy/${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}`;
|
||||
});
|
||||
|
||||
stream.headers = {};
|
||||
stream.flags = [flags.CORS_ALLOWED];
|
||||
return stream;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue