mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-12 03:56:15 -08:00
feat(player): enhance video player IPC events with origin and referrer support
This commit is contained in:
1 parent
50df27f5ee
commit
c2459f3dcc
3 files changed
+33
-18
No files matched your search
@@ -81,6 +81,7 @@ export class HtmlVideoPlayerComponent implements OnInit, OnChanges, OnDestroy {
|
||||
.sendIpcEvent(CHANNEL_SET_USER_AGENT, {
|
||||
userAgent: channel.http?.['user-agent'] ?? '',
|
||||
referer: channel.http?.referrer ?? '',
|
||||
origin: channel.http?.origin ?? '',
|
||||
})
|
||||
.then(() => {
|
||||
if (
|
||||
|
||||
@@ -46,14 +46,15 @@ export class TauriService extends DataService {
|
||||
}
|
||||
);
|
||||
} else if (type === 'OPEN_MPV_PLAYER') {
|
||||
const data = payload as any;
|
||||
return invoke('open_in_mpv', {
|
||||
url: (payload as any).url,
|
||||
path: (payload as any).mpvPlayerPath || '',
|
||||
title: (payload as any).title ?? '',
|
||||
thumbnail: (payload as any).thumbnail ?? '',
|
||||
userAgent: (payload as any).http?.['user-agent'] ?? '',
|
||||
referer: (payload as any).http?.referrer ?? '',
|
||||
origin: (payload as any).http?.origin ?? '',
|
||||
url: data.url,
|
||||
path: data.mpvPlayerPath || '',
|
||||
title: data.title ?? '',
|
||||
thumbnail: data.thumbnail ?? '',
|
||||
userAgent: data['user-agent'] ?? undefined,
|
||||
referer: data.referer ?? undefined,
|
||||
origin: data.origin ?? undefined,
|
||||
}).catch((error) => {
|
||||
window.postMessage({
|
||||
type: ERROR,
|
||||
@@ -62,9 +63,13 @@ export class TauriService extends DataService {
|
||||
throw error;
|
||||
});
|
||||
} else if (type === 'OPEN_VLC_PLAYER') {
|
||||
const data = payload as any;
|
||||
return invoke('open_in_vlc', {
|
||||
url: (payload as any).url,
|
||||
path: (payload as any).vlcPlayerPath || '',
|
||||
url: data.url,
|
||||
path: data.vlcPlayerPath || '',
|
||||
userAgent: data['user-agent'] ?? undefined,
|
||||
referer: data.referer ?? undefined,
|
||||
origin: data.origin ?? undefined,
|
||||
}).catch((error) => {
|
||||
window.postMessage({
|
||||
type: ERROR,
|
||||
|
||||
@@ -32,7 +32,6 @@ import {
|
||||
selectActivePlaylistId,
|
||||
selectChannels,
|
||||
selectFavorites,
|
||||
selectIsEpgAvailable,
|
||||
} from './selectors';
|
||||
|
||||
@Injectable({ providedIn: 'any' })
|
||||
@@ -47,7 +46,14 @@ export class PlaylistEffects {
|
||||
),
|
||||
switchMap(([, favorites, playlistId]) =>
|
||||
this.playlistsService.updateFavorites(playlistId, favorites)
|
||||
)
|
||||
),
|
||||
tap(() => {
|
||||
this.snackBar.open(
|
||||
this.translate.instant('CHANNELS.FAVORITES_UPDATED'),
|
||||
null,
|
||||
{ duration: 2000 }
|
||||
);
|
||||
})
|
||||
);
|
||||
},
|
||||
{ dispatch: false }
|
||||
@@ -112,18 +118,16 @@ export class PlaylistEffects {
|
||||
setActiveChannel$ = createEffect(() => {
|
||||
return this.actions$.pipe(
|
||||
ofType(PlaylistActions.setActiveChannel),
|
||||
combineLatestWith(this.store.select(selectIsEpgAvailable)),
|
||||
map(([action, isEpgAvailable]) => {
|
||||
map((action) => {
|
||||
const { channel } = action;
|
||||
if (isEpgAvailable) {
|
||||
this.dataService.sendIpcEvent(EPG_GET_PROGRAM, {
|
||||
channel,
|
||||
});
|
||||
}
|
||||
this.dataService.sendIpcEvent(EPG_GET_PROGRAM, {
|
||||
channel,
|
||||
});
|
||||
if (channel.http['user-agent']) {
|
||||
this.dataService.sendIpcEvent(CHANNEL_SET_USER_AGENT, {
|
||||
referer: channel.http.referrer,
|
||||
userAgent: channel.http['user-agent'],
|
||||
origin: channel.http.origin,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -137,6 +141,10 @@ export class PlaylistEffects {
|
||||
) {
|
||||
this.dataService.sendIpcEvent(OPEN_MPV_PLAYER, {
|
||||
url: channel.url,
|
||||
mpvPlayerPath: settings?.mpvPlayerPath,
|
||||
referer: channel.http.referrer,
|
||||
userAgent: channel.http['user-agent'],
|
||||
origin: channel.http.origin,
|
||||
});
|
||||
} else if (
|
||||
settings &&
|
||||
@@ -146,6 +154,7 @@ export class PlaylistEffects {
|
||||
)
|
||||
this.dataService.sendIpcEvent(OPEN_VLC_PLAYER, {
|
||||
url: channel.url,
|
||||
vlcPlayerPath: settings?.vlcPlayerPath,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user