Added channel preference UI for WebRTC Streaming

This commit is contained in:
rainbow napkin 2026-07-06 21:28:55 -04:00
parent a07edfc842
commit e3507b00f8
3 changed files with 42 additions and 2 deletions

View file

@ -35,6 +35,11 @@ const chatSchema = require('./chatSchema');
//Utils //Utils
const { exceptionHandler, errorHandler } = require('../../utils/loggerUtils'); const { exceptionHandler, errorHandler } = require('../../utils/loggerUtils');
/**
* "Enum" for emote type property
*/
const streamMethodEnum = ["webrtc","hls"];
/** /**
* DB Schema for Documents containing de-hydrated representations of Canopy Stream/Chat Channels * DB Schema for Documents containing de-hydrated representations of Canopy Stream/Chat Channels
*/ */
@ -71,6 +76,12 @@ const channelSchema = new mongoose.Schema({
streamURL: { streamURL: {
type: mongoose.SchemaTypes.String, type: mongoose.SchemaTypes.String,
default: '' default: ''
},
streamType: {
type: mongoose.SchemaTypes.String,
enum: streamMethodEnum,
default: streamMethodEnum[0]
} }
}, },
permissions: { permissions: {

View file

@ -17,7 +17,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. %>
<h3>Channel Preferences:</h3> <h3>Channel Preferences:</h3>
<div class="dynamic-container"> <div class="dynamic-container">
<form action="javascript:" class="admin-list-field"> <form action="javascript:" class="admin-list-field">
<% Object.keys(channel.settings).forEach((key) => { %> <% for(key of Object.keys(channel.settings)){
//Ignore keys w/ custom HTML
if(key == "streamURL" || key == "streamType"){
break;
}%>
<span class="admin-list-field-container"> <span class="admin-list-field-container">
<label class="admin-list-label"><%= key %>:</label> <label class="admin-list-label"><%= key %>:</label>
<% switch(typeof channel.settings[key]){ <% switch(typeof channel.settings[key]){
@ -29,7 +33,22 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. %>
<% break; <% break;
} %> } %>
</span> </span>
<% }); %> <% }; %>
<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>
<span>
<input type="radio" name="streamType" id="hls" value="hls">
<label for="hls">Self-Hosted (HLS)</label>
</span>
<input disabled id="channel-preference-list-stream-url" placeholder="Stream URL" value="<%= channel.settings["streamURL"] %>">
</span>
</span>
</form> </form>
</div> </div>
</div> </div>

View file

@ -139,6 +139,16 @@ img.admin-list-entry-item{
width: 8em; width: 8em;
} }
#channel-preference-list-stream-settings-grid{
display: grid;
grid-template-columns: auto auto;
row-gap: 0.5em;
}
#channel-preference-list-stream-url {
grid-column: 2;
}
div.toke-command-list{ div.toke-command-list{
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(15em, 1fr)); grid-template-columns: repeat(auto-fit, minmax(15em, 1fr));