Finished streamType Configuration backend

This commit is contained in:
rainbow napkin 2026-07-06 23:30:54 -04:00
parent e3507b00f8
commit a819d14861
3 changed files with 80 additions and 15 deletions

View file

@ -20,15 +20,6 @@ const { checkSchema, checkExact } = require('express-validator');
//local imports
const accountValidator = require('./accountValidator');
module.exports = {
settingsMap: () => checkExact(checkSchema({
'settingsMap.hidden': {
optional: true,
isBoolean: true,
} }))
}
module.exports.name = function(field = 'name'){
return checkSchema({
[field]: {
@ -89,6 +80,13 @@ module.exports.settingsMap = function(){
}
},
errorMessage: "Invalid Stream URL"
},
'settingsMap.streamType': {
optional: true,
errorMessage: "Invalid Stream Type",
matches: {
options: [/\b(?:webrtc|hls)\b/]
}
}
})
);

View file

@ -37,15 +37,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. %>
<span class="admin-list-field-container">
<p>Livestream Type:</p>
<span id="channel-preference-list-stream-settings-grid">
<span >
<input type="radio" name="streamType" id="webrtc" value="webrtc">
<label for="webrtc">Peer-to-Peer (WebRTC/STUN)</label>
<span>
<input type="radio" name="streamType" id="channel-preference-list-stream-type-webrtc" value="webrtc" <% if(channel.settings["streamType"] == "webrtc"){ %> checked <% }%> >
<label for="channel-preference-list-stream-type-webrtc">Peer-to-Peer (WebRTC/STUN)</label>
</span>
<span>
<input type="radio" name="streamType" id="hls" value="hls">
<label for="hls">Self-Hosted (HLS)</label>
<input type="radio" name="streamType" id="channel-preference-list-stream-type-hls" value="hls" <% if(channel.settings["streamType"] == "hls"){ %> checked <% }%> >
<label for="channel-preference-list-stream-type-hls">Self-Hosted (HLS)</label>
</span>
<input disabled id="channel-preference-list-stream-url" placeholder="Stream URL" value="<%= channel.settings["streamURL"] %>">
<input <% if(channel.settings["streamType"] != "hls"){ %> disabled <%}%> id="channel-preference-list-stream-url" placeholder="Stream URL" value="<%= channel.settings["streamURL"] %>">
</span>
</span>