feat: add support of specific user-agent and referer on channel level

This commit closes #57
This commit is contained in:
4gray committed 2021-06-27 11:25:24 +02:00
1 parent f7689539c8
commit a55f741a32
6 files changed
+56 -17

No files matched your search

+5
View File
@@ -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;
}
+10 -1
View File
@@ -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,