From 8f02be793f3b9c4ee1dc20eea08cd48c0bff0f20 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Thu, 9 Jul 2026 23:15:47 -0400 Subject: [PATCH] Updated streamType enum to change hls to livehls --- src/app/channel/media/queue.js | 35 +++++++++++-------- src/schemas/channel/channelSchema.js | 2 +- src/validators/channelValidator.js | 2 +- .../partial/channelSettings/settings.ejs | 4 +-- www/js/channelSettings.js | 2 +- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/app/channel/media/queue.js b/src/app/channel/media/queue.js index ac2eb75..de77df4 100644 --- a/src/app/channel/media/queue.js +++ b/src/app/channel/media/queue.js @@ -329,7 +329,10 @@ class queue{ */ async goLive(socket, data){ try{ + //Define and/or declare required variables let title = "Livestream"; + let filename; + let streamURL; if(data != null && data.title != null){ //If the title is too long @@ -383,24 +386,26 @@ class queue{ //Kill schedule timers to prevent items from starting during the stream await this.stopScheduleTimers(); - //Syntatic sugar because I'm lazy :P - const streamURL = chanDB.settings.streamURL; + if(chanDB.settings.streamType == "livehls"){ + //Syntatic sugar because I'm lazy :P + streamURL = chanDB.settings.streamURL; - if(streamURL == ''){ - throw loggerUtils.exceptionSmith('This channel\'s HLS Livestream Source has not been set!', 'queue'); - } + if(streamURL == ''){ + throw loggerUtils.exceptionSmith('This channel\'s HLS Livestream Source has not been set!', 'queue'); + } - //Pull filename from streamURL - let filename = streamURL.match(/^.+\..+\/(.+)$/); + //Pull filename from streamURL + filename = streamURL.match(/^.+\..+\/(.+)$/); - //If we're streaming from the root of the domain - if(filename == null){ - //Set filename to root - filename = '/'; - }else{ - //Otherwise, hand over the filename - filename = filename[1]; + //If we're streaming from the root of the domain + if(filename == null){ + //Set filename to root + filename = '/'; + }else{ + //Otherwise, hand over the filename + filename = filename[1]; + } } //Create queued media object from stream URL and set it to nowPlaying @@ -409,7 +414,7 @@ class queue{ filename, streamURL, streamURL, - "livehls", + chanDB.settings.streamType, 0, streamURL, new Date().getTime() diff --git a/src/schemas/channel/channelSchema.js b/src/schemas/channel/channelSchema.js index 8bfa484..bd02fe0 100644 --- a/src/schemas/channel/channelSchema.js +++ b/src/schemas/channel/channelSchema.js @@ -38,7 +38,7 @@ const { exceptionHandler, errorHandler } = require('../../utils/loggerUtils'); /** * "Enum" for emote type property */ -const streamMethodEnum = ["webrtc","hls"]; +const streamMethodEnum = ["webrtc","livehls"]; /** * DB Schema for Documents containing de-hydrated representations of Canopy Stream/Chat Channels diff --git a/src/validators/channelValidator.js b/src/validators/channelValidator.js index 9c87f55..0e9be56 100644 --- a/src/validators/channelValidator.js +++ b/src/validators/channelValidator.js @@ -85,7 +85,7 @@ module.exports.settingsMap = function(){ optional: true, errorMessage: "Invalid Stream Type", matches: { - options: [/\b(?:webrtc|hls)\b/] + options: [/\b(?:webrtc|livehls)\b/] } } }) diff --git a/src/views/partial/channelSettings/settings.ejs b/src/views/partial/channelSettings/settings.ejs index d8dd2ea..feb30c4 100644 --- a/src/views/partial/channelSettings/settings.ejs +++ b/src/views/partial/channelSettings/settings.ejs @@ -42,10 +42,10 @@ along with this program. If not, see . %> - checked <% }%> > + checked <% }%> > - disabled <%}%> id="channel-preference-list-stream-url" placeholder="Stream URL" value="<%= channel.settings["streamURL"] %>"> + disabled <%}%> id="channel-preference-list-stream-url" placeholder="Stream URL" value="<%= channel.settings["streamURL"] %>"> diff --git a/www/js/channelSettings.js b/www/js/channelSettings.js index 74bbe49..15fb613 100644 --- a/www/js/channelSettings.js +++ b/www/js/channelSettings.js @@ -412,7 +412,7 @@ class livestreamPreferences{ handleTypeUpdate(data){ //If the stream type is HLS - if(data.streamType == "hls"){ + if(data.streamType == "livehls"){ //Ensure the hls button is checked this.hlsButton.checked = true; //Ensure the stream url input is enabled