mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 21:26:15 -08:00
27 lines
670 B
TypeScript
27 lines
670 B
TypeScript
import { Channel } from 'shared-interfaces';
|
|
|
|
export function buildExternalPlayerPayload(
|
|
activeChannel: Channel | undefined | null,
|
|
playbackUrl: string
|
|
):
|
|
| {
|
|
url: string;
|
|
title: string;
|
|
'user-agent': string | undefined;
|
|
referer: string | undefined;
|
|
origin: string | undefined;
|
|
}
|
|
| null {
|
|
if (!playbackUrl || !activeChannel) {
|
|
return null;
|
|
}
|
|
|
|
return {
|
|
url: playbackUrl,
|
|
title: activeChannel.name ?? '',
|
|
'user-agent': activeChannel.http?.['user-agent'],
|
|
referer: activeChannel.http?.referrer,
|
|
origin: activeChannel.http?.origin,
|
|
};
|
|
}
|