This commit is contained in:
Ante Brähler
2025-01-11 02:05:06 +01:00
3 changed files with 9 additions and 13 deletions

View File

@@ -41,11 +41,16 @@ module.exports = {
return;
}
const proxyBaseUrl = '/proxy/';
const rewrittenBody = ProxyHelperService.rewriteUrls(body, proxyBaseUrl, headers, targetUrl).join('\n');
try {
const proxyBaseUrl = '/proxy/';
const rewrittenBody = ProxyHelperService.rewriteUrls(body, proxyBaseUrl, headers, targetUrl).join('\n');
res.send(rewrittenBody);
} catch (e) {
console.error('Failed to rewrite URLs:', e);
res.status(500).json({ error: 'Failed to parse m3uo file. Not a valid HLS stream.' });
}
//res.set('Content-Type', 'application/vnd.apple.mpegurl');
res.send(rewrittenBody);
}).on('error', (err) => {
console.error('Unhandled error:', err);
if (!res.headersSent) {

View File

@@ -100,14 +100,7 @@ class ChannelService {
const [deletedChannel] = this.channels.splice(channelIndex, 1);
if (this.currentChannel.id === id) {
if (deletedChannel.restream()) {
streamController.stop(deletedChannel);
}
this.currentChannel = this.channels.length > 0 ? this.channels[0] : null;
if (this.currentChannel?.restream()) {
await streamController.start(this.currentChannel);
}
await this.setCurrentChannel(0);
}

View File

@@ -37,7 +37,6 @@ function ChannelModal({ onClose, channel }: ChannelModalProps) {
setPlaylistUrl(channel.playlist);
setIsEditMode(true);
setType('channel'); // Default to "channel" if a channel object exists
console.log("NOT");
} else {
setName('');
setUrl('');
@@ -47,7 +46,6 @@ function ChannelModal({ onClose, channel }: ChannelModalProps) {
setPlaylistName('');
setPlaylistUrl('');
setIsEditMode(false);
console.log("CLEAR");
setType('channel'); // Default to "channel" if a channel object exists
}
}, [channel]);