Splitted filler functions, added protocol settings (#17, 1h, +1h)
This commit is contained in:
parent
5afb962165
commit
050152b7b9
1 changed files with 123 additions and 35 deletions
142
server.html
142
server.html
|
@ -94,18 +94,18 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
new limit: <select id='new-limit-name'>
|
new limit: <select id='new-limit-name'>
|
||||||
<option value='kb_total'>kb_total</option>
|
<option value='kb_total'>Total bandwidth</option>
|
||||||
<option value='kbps_max'>kbps_max</option>
|
<option value='kbps_max'>Current bandwidth</option>
|
||||||
<option value='users'>users</option>
|
<option value='users'>Concurrent users</option>
|
||||||
<option value='streams'>streams</option>
|
<option value='streams'>Concurrent streams</option>
|
||||||
<option value='geo'>geo</option>
|
<option value='geo'>Geolimited</option>
|
||||||
<option value='host'>host</option>
|
<option value='host'>Hostlimited</option>
|
||||||
<option value='time'>time</option>
|
<option value='time'>Time limited</option>
|
||||||
<option value='duration'>duration</option>
|
<option value='duration'>Duration</option>
|
||||||
<option value='str_kbps_min'>str_kbps_min</option>
|
<option value='str_kbps_min'>Minimum bitrate</option>
|
||||||
<option value='str_kbps_max'>str_kbps_max</option>
|
<option value='str_kbps_max'>Maximum bitrate</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id='new-limit-type'>
|
<select id='new-limit-type'>
|
||||||
|
@ -116,6 +116,8 @@
|
||||||
<input type='text' id='new-limit-val' />
|
<input type='text' id='new-limit-val' />
|
||||||
|
|
||||||
<button id='new-limit-build'>add</button>
|
<button id='new-limit-build'>add</button>
|
||||||
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,8 +125,19 @@
|
||||||
|
|
||||||
<h2>Protocols</h2>
|
<h2>Protocols</h2>
|
||||||
|
|
||||||
|
<ul id='protocol-list'>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Not in wiki?
|
new protocol: <select id='new-protocol-name'>
|
||||||
|
<option value='HTTP'>HTTP</option>
|
||||||
|
<option value='RTMP'>RTMP</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
port: <input type='text' id='new-protocol-port' />
|
||||||
|
|
||||||
|
<button id='new-protocol-build'>add</button>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -134,9 +147,8 @@
|
||||||
|
|
||||||
<h2>Streams</h2>
|
<h2>Streams</h2>
|
||||||
|
|
||||||
<p>
|
<ul id='streams-list'>
|
||||||
TODO: streams (or not?)
|
</ul>
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -251,19 +263,19 @@
|
||||||
$('#save-config-host').click(function()
|
$('#save-config-host').click(function()
|
||||||
{
|
{
|
||||||
settings.settings.config.host = $('#config-host').val();
|
settings.settings.config.host = $('#config-host').val();
|
||||||
loadSettings(fillHTML);
|
loadSettings(fillConfig);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#save-config-name').click(function()
|
$('#save-config-name').click(function()
|
||||||
{
|
{
|
||||||
settings.settings.config.name = $('#config-name').val();
|
settings.settings.config.name = $('#config-name').val();
|
||||||
loadSettings(fillHTML);
|
loadSettings(fillConfig);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#config-status-disable').click(function()
|
$('#config-status-disable').click(function()
|
||||||
{
|
{
|
||||||
settings.settings.config.status = 'DISABLED';
|
settings.settings.config.status = 'DISABLED';
|
||||||
loadSettings(fillHTML);
|
loadSettings(fillConfig);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#new-limit-build').click(function()
|
$('#new-limit-build').click(function()
|
||||||
|
@ -274,7 +286,22 @@
|
||||||
type: $('#new-limit-type option:selected').val(),
|
type: $('#new-limit-type option:selected').val(),
|
||||||
val: $('#new-limit-val').val()
|
val: $('#new-limit-val').val()
|
||||||
});
|
});
|
||||||
loadSettings(fillHTML);
|
|
||||||
|
$('#new-limit-val').val('');
|
||||||
|
|
||||||
|
loadSettings(fillLimits);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#new-protocol-build').click(function()
|
||||||
|
{
|
||||||
|
var prot = $('#new-protocol-name option:selected').val(),
|
||||||
|
port = $('#new-protocol-port').val();
|
||||||
|
|
||||||
|
settings.settings.config.protocols[prot] = {"port": port};
|
||||||
|
|
||||||
|
$('#new-protocol-port').val('');
|
||||||
|
|
||||||
|
loadSettings(fillProtocols);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -282,6 +309,22 @@
|
||||||
|
|
||||||
|
|
||||||
function fillHTML()
|
function fillHTML()
|
||||||
|
{
|
||||||
|
//fill config
|
||||||
|
fillConfig();
|
||||||
|
|
||||||
|
// limits
|
||||||
|
fillLimits();
|
||||||
|
|
||||||
|
// protocols
|
||||||
|
fillProtocols();
|
||||||
|
|
||||||
|
// streams
|
||||||
|
fillStreams();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function fillConfig()
|
||||||
{
|
{
|
||||||
$('#config-host').val(settings.settings.config.host);
|
$('#config-host').val(settings.settings.config.host);
|
||||||
$('#config-name').val(settings.settings.config.name);
|
$('#config-name').val(settings.settings.config.name);
|
||||||
|
@ -290,10 +333,14 @@
|
||||||
$('#config-time').text('time: ' + new Date(settings.settings.config.time).toUTCString() || '');
|
$('#config-time').text('time: ' + new Date(settings.settings.config.time).toUTCString() || '');
|
||||||
|
|
||||||
$('#config-status').text('status: ' + (settings.settings.config.status || ''));
|
$('#config-status').text('status: ' + (settings.settings.config.status || ''));
|
||||||
|
}
|
||||||
|
|
||||||
var i, cur, lim, del, sfrom, len = settings.settings.config.limits.length;
|
|
||||||
|
|
||||||
// delete prev items
|
function fillLimits()
|
||||||
|
{
|
||||||
|
var i, cur, lim, del,
|
||||||
|
len = settings.settings.config.limits.length;
|
||||||
|
|
||||||
$('#limits-list').html('');
|
$('#limits-list').html('');
|
||||||
|
|
||||||
for(i = 0; i < len; i++)
|
for(i = 0; i < len; i++)
|
||||||
|
@ -302,15 +349,11 @@
|
||||||
lim = settings.settings.config.limits[i];
|
lim = settings.settings.config.limits[i];
|
||||||
del = $('<span>').click(function()
|
del = $('<span>').click(function()
|
||||||
{
|
{
|
||||||
//console.log(settings.settings.config.limits);
|
var sfrom = $(this).parent().attr('id').replace('limits-', '');
|
||||||
//console.log('slice(', $(this).parent().attr('id').replace('limits-', ''), ',1)', settings.settings.config.limits);
|
|
||||||
sfrom = $(this).parent().attr('id').replace('limits-', '');
|
|
||||||
settings.settings.config.limits.splice(sfrom, 1);
|
settings.settings.config.limits.splice(sfrom, 1);
|
||||||
$(this).parent().remove();
|
$(this).parent().remove();
|
||||||
|
|
||||||
loadSettings(fillHTML);
|
loadSettings(fillLimits);
|
||||||
|
|
||||||
//console.log('y', settings.settings.config.limits);
|
|
||||||
}).text(' <delete> ');
|
}).text(' <delete> ');
|
||||||
|
|
||||||
cur.append($('<span>').text(lim.name + ' | ' + lim.type + ' | ' + lim.val));
|
cur.append($('<span>').text(lim.name + ' | ' + lim.type + ' | ' + lim.val));
|
||||||
|
@ -321,6 +364,51 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function fillProtocols()
|
||||||
|
{
|
||||||
|
var protocol, li;
|
||||||
|
|
||||||
|
$('#protocol-list').html('');
|
||||||
|
|
||||||
|
for(protocol in settings.settings.config.protocols)
|
||||||
|
{
|
||||||
|
li = $('<li>').attr('id', 'protocol-' + protocol);
|
||||||
|
|
||||||
|
li.text(protocol + ' on port ' + settings.settings.config.protocols[protocol].port);
|
||||||
|
|
||||||
|
li.append($('<span>').click(function()
|
||||||
|
{
|
||||||
|
var prot = $(this).parent().attr('id').replace('protocol-', '');
|
||||||
|
console.log(prot);
|
||||||
|
|
||||||
|
delete settings.settings.config.protocols[prot];
|
||||||
|
|
||||||
|
$(this).parent().remove();
|
||||||
|
|
||||||
|
loadSettings(fillProtocols);
|
||||||
|
}).text('<remove>'));
|
||||||
|
|
||||||
|
$('#protocol-list').append(li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function fillStreams()
|
||||||
|
{
|
||||||
|
var stream, li;
|
||||||
|
|
||||||
|
$('#streams-list').html('');
|
||||||
|
|
||||||
|
for(stream in settings.settings.streams)
|
||||||
|
{
|
||||||
|
li = $('<li>').text(stream);
|
||||||
|
|
||||||
|
|
||||||
|
$('#streams-list').append(li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Add table
Reference in a new issue