mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 13:16:16 -08:00
feat: add support of specific user-agent and referer on channel level
This commit closes #57
This commit is contained in:
6 files changed
+56
-17
No files matched your search
@@ -25,6 +25,10 @@ export interface Channel {
|
||||
source?: string;
|
||||
days?: string;
|
||||
};
|
||||
http: {
|
||||
referrer: string;
|
||||
'user-agent': string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,5 +43,6 @@ export function createChannel(params: Partial<Channel>): Channel {
|
||||
url: params.url,
|
||||
tvg: params.tvg,
|
||||
timeshift: params.timeshift,
|
||||
http: params.http,
|
||||
} as Channel;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { EntityState, EntityStore, StoreConfig } from '@datorama/akita';
|
||||
import { EPG_GET_PROGRAM } from '../../../ipc-commands';
|
||||
import { CHANNEL_SET_USER_AGENT, EPG_GET_PROGRAM } from '../../../ipc-commands';
|
||||
import { ElectronService } from '../services/electron.service';
|
||||
import { Channel } from './channel.model';
|
||||
import * as moment from 'moment';
|
||||
@@ -61,6 +61,15 @@ export class ChannelStore extends EntityStore<ChannelState> {
|
||||
this.electronService.ipcRenderer.send(EPG_GET_PROGRAM, {
|
||||
channelName: channel.name,
|
||||
});
|
||||
if (channel.http['user-agent']) {
|
||||
this.electronService.ipcRenderer.send(
|
||||
CHANNEL_SET_USER_AGENT,
|
||||
{
|
||||
referer: channel.http.referrer,
|
||||
userAgent: channel.http['user-agent'],
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
return {
|
||||
...store,
|
||||
|
||||
Reference in new issue
Block a user