mirror of
https://github.com/sussy-code/providers.git
synced 2026-04-19 15:42:05 +00:00
Add proxyDepth option for hls
This commit is contained in:
parent
c8b3a151ff
commit
70127b8588
2 changed files with 9 additions and 2 deletions
|
|
@ -30,6 +30,7 @@ export type FileBasedStream = StreamCommon & {
|
|||
export type HlsBasedStream = StreamCommon & {
|
||||
type: 'hls';
|
||||
playlist: string;
|
||||
proxyDepth?: 0 | 1 | 2;
|
||||
};
|
||||
|
||||
export type Stream = FileBasedStream | HlsBasedStream;
|
||||
|
|
|
|||
|
|
@ -13,12 +13,18 @@ export function setupProxy(stream: Stream): Stream {
|
|||
? encodeURIComponent(JSON.stringify(stream.headers))
|
||||
: null;
|
||||
|
||||
const options = encodeURIComponent(
|
||||
JSON.stringify({
|
||||
...(stream.type === 'hls' && { depth: stream.proxyDepth ?? 0 }),
|
||||
}),
|
||||
);
|
||||
|
||||
if (stream.type === 'hls')
|
||||
stream.playlist = `https://proxy.nsbx.ru/hls/${encodeURIComponent(stream.playlist)}/${headers}`;
|
||||
stream.playlist = `https://proxy.nsbx.ru/hls/${encodeURIComponent(stream.playlist)}/${headers}/${options}`;
|
||||
|
||||
if (stream.type === 'file')
|
||||
Object.entries(stream.qualities).forEach((entry) => {
|
||||
entry[1].url = `https://proxy.nsbx.ru/mp4/${encodeURIComponent(entry[1].url)}/${headers}`;
|
||||
entry[1].url = `https://proxy.nsbx.ru/mp4/${encodeURIComponent(entry[1].url)}/${headers}/${options}`;
|
||||
});
|
||||
|
||||
stream.headers = {};
|
||||
|
|
|
|||
Loading…
Reference in a new issue