Merge branch 'development' into LTS_development
# Conflicts: # lsp/minified.js # lsp/mist.js
This commit is contained in:
commit
af9acdd9e2
4 changed files with 66 additions and 46 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "bitfields.h"
|
#include "bitfields.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/// Takes a pointer, offset bitcount and data bitcount, returning the unsigned int read from the givens.
|
/// Takes a pointer, offset bitcount and data bitcount, returning the unsigned int read from the givens.
|
||||||
/// offsetBits may be > 7, in which case offsetBits / 8 is added to the pointer automatically.
|
/// offsetBits may be > 7, in which case offsetBits / 8 is added to the pointer automatically.
|
||||||
|
@ -62,3 +63,18 @@ void Bit::setMSB(char * pointer, unsigned int offsetBits, unsigned int dataBits,
|
||||||
}//Loop until we run out of dataBits, then return the result
|
}//Loop until we run out of dataBits, then return the result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Parses a string reference to a boolean.
|
||||||
|
/// Returns true if the string, with whitespace removed and converted to lowercase, prefix-matches any of: "1", "yes", "true", "cont".
|
||||||
|
/// Returns false otherwise.
|
||||||
|
bool Util::stringToBool(std::string & str){
|
||||||
|
std::string tmp;
|
||||||
|
tmp.reserve(4);
|
||||||
|
for (unsigned int i = 0; i < str.size() && tmp.size() < 4; ++i){
|
||||||
|
if (!::isspace(str[i])){
|
||||||
|
tmp.push_back((char)tolower(str[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (strncmp(tmp.c_str(), "1", 1) == 0 || strncmp(tmp.c_str(), "yes", 3) == 0 || strncmp(tmp.c_str(), "true", 4) == 0 || strncmp(tmp.c_str(), "cont", 4) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace Util{
|
||||||
|
bool stringToBool(std::string & str);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Bit{
|
namespace Bit{
|
||||||
//bitfield getters
|
//bitfield getters
|
||||||
|
|
|
@ -120,25 +120,26 @@ mist.data.config.limits[p[1]];w="For the entire server";break;case "stream":m=mi
|
||||||
"Geo limited"],["host","Host limited"]],pointer:{main:m,index:"name"},LTSonly:!0,validate:["required"],classes:["limit_type"],"function":function(){var a=$(this).getval(),b=$(this).closest(".input_container").find(".limit_value"),c=b.closest("label"),b=b.data("opts");delete b.type;delete b.min;delete b.unit;b.validate=["required"];switch(a){case "kbps_max":b.type="int";b.min=1;b.unit="bytes/s";break;case "users":b.type="int";b.min=1;break;case "geo":b.type="geolimited";break;case "host":b.type="hostlimited"}a=
|
"Geo limited"],["host","Host limited"]],pointer:{main:m,index:"name"},LTSonly:!0,validate:["required"],classes:["limit_type"],"function":function(){var a=$(this).getval(),b=$(this).closest(".input_container").find(".limit_value"),c=b.closest("label"),b=b.data("opts");delete b.type;delete b.min;delete b.unit;b.validate=["required"];switch(a){case "kbps_max":b.type="int";b.min=1;b.unit="bytes/s";break;case "users":b.type="int";b.min=1;break;case "geo":b.type="geolimited";break;case "host":b.type="hostlimited"}a=
|
||||||
UI.buildUI([b]);c.replaceWith(a.children())}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto(UI.returnTab[0],UI.returnTab[1])}},{type:"save",label:"Save","function":function(){var a={};if(k){var b=c.split("^");switch(b[0]){case "server":a={config:{limits:mist.data.config.limits}};break;case "stream":if(mist.data.LTS){a={addstream:{}};a.addstream[b[1]]=mist.data.streams[b[1]]}else a={streams:mist.data.streams}}}else{b=m.applies_to;delete m.applies_to;switch(b[0]){case "server":if(!mist.data.config.limits)mist.data.config.limits=
|
UI.buildUI([b]);c.replaceWith(a.children())}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto(UI.returnTab[0],UI.returnTab[1])}},{type:"save",label:"Save","function":function(){var a={};if(k){var b=c.split("^");switch(b[0]){case "server":a={config:{limits:mist.data.config.limits}};break;case "stream":if(mist.data.LTS){a={addstream:{}};a.addstream[b[1]]=mist.data.streams[b[1]]}else a={streams:mist.data.streams}}}else{b=m.applies_to;delete m.applies_to;switch(b[0]){case "server":if(!mist.data.config.limits)mist.data.config.limits=
|
||||||
[];mist.data.config.limits.push(m);a={config:{limits:mist.data.config.limits}};break;case "stream":if(typeof mist.data.streams[b[1]].limits=="undefined")mist.data.streams[b[1]].limits=[];mist.data.streams[b[1]].limits.push(m);if(mist.data.LTS){a={addstream:{}};a.addstream[b[1]]=mist.data.streams[b[1]]}else a={streams:mist.data.streams}}}mist.send(function(){UI.navto(UI.returnTab[0],UI.returnTab[1])},a)}}]}]),u=UI.buildUI(i);b.append(u);u.find(".limit_type").closest("label").after(u.find(".limit_value").closest("label"));
|
[];mist.data.config.limits.push(m);a={config:{limits:mist.data.config.limits}};break;case "stream":if(typeof mist.data.streams[b[1]].limits=="undefined")mist.data.streams[b[1]].limits=[];mist.data.streams[b[1]].limits.push(m);if(mist.data.LTS){a={addstream:{}};a.addstream[b[1]]=mist.data.streams[b[1]]}else a={streams:mist.data.streams}}}mist.send(function(){UI.navto(UI.returnTab[0],UI.returnTab[1])},a)}}]}]),u=UI.buildUI(i);b.append(u);u.find(".limit_type").closest("label").after(u.find(".limit_value").closest("label"));
|
||||||
u.find(".limit_type").trigger("change");break;case "Triggers":"triggers"in mist.data.config||(mist.data.config.triggers={});h=$("<tbody>");p=$("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Trigger on").attr("data-sort-type","string").addClass("sorting-asc")).append($("<th>").text("Applies to").attr("data-sort-type","string")).append($("<th>").text("Handler").attr("data-sort-type","string")).append($("<th>")))).append(h);b.append(UI.buildUI([{type:"help",help:"Balder verzin iets leuks"}])).append($("<button>").text("New trigger").click(function(){UI.navto("Edit Trigger")})).append(p);
|
u.find(".limit_type").trigger("change");break;case "Triggers":"triggers"in mist.data.config||(mist.data.config.triggers={});h=$("<tbody>");p=$("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Trigger on").attr("data-sort-type","string").addClass("sorting-asc")).append($("<th>").text("Applies to").attr("data-sort-type","string")).append($("<th>").text("Handler").attr("data-sort-type","string")).append($("<th>")))).append(h);b.append(UI.buildUI([{type:"help",help:"Triggers are the system you can use to react to events that occur inside MistServer. These allow you to block specific users, redirect streams, keep tabs on what is being pushed where, etcetera. For full documentation, please refer to the developer documentation section on the MistServer website."}])).append($("<button>").text("New trigger").click(function(){UI.navto("Edit Trigger")})).append(p);
|
||||||
p.stupidtable();i=mist.data.config.triggers;for(q in i)for(w in i[q])h.append($("<tr>").attr("data-index",q+","+w).append($("<td>").text(q)).append($("<td>").text(i[q][w][2].join(", "))).append($("<td>").text(i[q][w][0])).append($("<td>").html($("<button>").text("Edit").click(function(){UI.navto("Edit Trigger",$(this).closest("tr").attr("data-index"))}))));break;case "Edit Trigger":"triggers"in mist.data.config||(mist.data.config.triggers={});c?(c=c.split(","),i=mist.data.config.triggers[c[0]][c[1]],
|
p.stupidtable();i=mist.data.config.triggers;for(q in i)for(w in i[q])h.append($("<tr>").attr("data-index",q+","+w).append($("<td>").text(q)).append($("<td>").text(i[q][w][2].join(", "))).append($("<td>").text(i[q][w][0])).append($("<td>").html($("<button>").text("Edit").click(function(){UI.navto("Edit Trigger",$(this).closest("tr").attr("data-index"))}))));break;case "Edit Trigger":"triggers"in mist.data.config||(mist.data.config.triggers={});c?(c=c.split(","),i=mist.data.config.triggers[c[0]][c[1]],
|
||||||
m={triggeron:c[0],appliesto:i[2],url:i[0],async:i[1],"default":i[3]}):(b.html($("<h2>").text("New Trigger")),m={});b.append(UI.buildUI([{type:"help",help:"Balder verzin iets leuks"},{label:"Trigger on",pointer:{main:m,index:"triggeron"},help:"Balder verzin iets leuks",type:"select",select:[["SYSTEM_START","server boot"],["SYSTEM_STOP","server exit"],["SYSTEM_CONFIG","config changed"],["SYSTEM_LOG","log line logged"],["OUTPUT_ADD","new output configured"],["OUTPUT_CONFIG","output config changed"],
|
m={triggeron:c[0],appliesto:i[2],url:i[0],async:i[1],"default":i[3]}):(b.html($("<h2>").text("New Trigger")),m={});b.append(UI.buildUI([{type:"help",help:""},{label:"Trigger on",pointer:{main:m,index:"triggeron"},help:"For what event this trigger should activate.",type:"select",select:[["SYSTEM_START","SYSTEM_START: server boot"],["SYSTEM_STOP","SYSTEM_STOP: server exit"],["SYSTEM_CONFIG","SYSTEM_CONFIG: config changed"],["OUTPUT_ADD","OUTPUT_ADD: new output configured"],["OUTPUT_CONFIG","OUTPUT_CONFIG: output config changed"],
|
||||||
["OUTPUT_REMOVE","deleted output in config"],["STREAM_ADD","new stream configured"],["STREAM_CONFIG","stream config changed"],["STREAM_REMOVE","stream config deleted"],["STREAM_LOAD","stream input loaded in memory"],["STREAM_UNLOAD","stream input unloaded from memory"],["STREAM_TRACK_ADD","added track to stream; ie: push/multi"],["STREAM_TRACK_REMOVE","removed track from stream"],["CONN_OPEN","new connection"],["CONN_CLOSE","connection closed"],["CONN_PLAY","before play start, includes limits status"],
|
["OUTPUT_REMOVE","OUTPUT_REMOVE: deleted output in config"],["STREAM_ADD","STREAM_ADD: new stream configured"],["STREAM_CONFIG","STREAM_CONFIG: stream config changed"],["STREAM_REMOVE","STREAM_REMOVE: stream config deleted"],["STREAM_SOURCE","STREAM_SOURCE: right before stream source is loaded"],["STREAM_PRELOAD","STREAM_PRELOAD: right before stream input is loaded in memory"],["STREAM_LOAD","STREAM_LOAD: stream input loaded in memory"],["STREAM_UNLOAD","STREAM_UNLOAD: stream input unloaded from memory"],
|
||||||
["CONN_STOP","play end, but no disconnect yet"]],LTSonly:!0},{label:"Applies to",pointer:{main:m,index:"appliesto"},help:"Balder verzin iets leuks (none checked = all are checked)",type:"checklist",checklist:Object.keys(mist.data.streams),LTSonly:!0},$("<br>"),{label:"Handler (URL or executable)",help:"Balder verzin iets leuks",pointer:{main:m,index:"url"},validate:["required"],type:"str",LTSonly:!0},{label:"Asynchronous",type:"checkbox",help:"Balder verzin iets leuks",pointer:{main:m,index:"async"},
|
["STREAM_TRACK_ADD","STREAM_TRACK_ADD: added track to stream; e.g.: push received"],["STREAM_TRACK_REMOVE","STREAM_TRACK_REMOVE: removed track from stream; e.g.: push timeout"],["CONN_OPEN","CONN_OPEN: new incoming connection"],["CONN_CLOSE","CONN_CLOSE: connection closed"],["CONN_PLAY","CONN_PLAY: right before play of a new connection"]],LTSonly:!0},{label:"Applies to",pointer:{main:m,index:"appliesto"},help:"For triggers that can apply to specific streams, this value decides what streams they are triggered for. (none checked = always triggered)",
|
||||||
LTSonly:!0},{label:"Default return on error",type:"str",help:"Balder verzin iets leuks (synchronous only)",pointer:{main:m,index:"default"},LTSonly:!0},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Triggers")}},{type:"save",label:"Save","function":function(){c&&mist.data.config.triggers[c[0]].splice(c[1],1);var a=[m.url,m.async?true:false,typeof m.appliesto!="undefined"?m.appliesto:[]];typeof m["default"]!="undefined"&&a.push(m["default"]);m.triggeron in mist.data.config.triggers||
|
type:"checklist",checklist:Object.keys(mist.data.streams),LTSonly:!0},$("<br>"),{label:"Handler (URL or executable)",help:"This can be either an HTTP URL or a full path to an executable.",pointer:{main:m,index:"url"},validate:["required"],type:"str",LTSonly:!0},{label:"Blocking",type:"checkbox",help:"If checked, pauses processing and uses the response of the handler. If the response does not start with 1, true, yes or cont, further processing is aborted. If unchecked, processing is never paused and the response is not checked.",
|
||||||
(mist.data.config.triggers[m.triggeron]=[]);mist.data.config.triggers[m.triggeron].push(a);mist.send(function(){UI.navto("Triggers")},{config:mist.data.config})}}]}]));break;case "Logs":b.append(UI.buildUI([{type:"help",help:"Here you have an overview of all edited settings within MistServer and possible warnings or errors MistServer has encountered. MistServer stores up to 100 logs at a time."},{label:"Refresh every",type:"select",select:[[10,"10 seconds"],[30,"30 seconds"],[60,"minute"],[300,"5 minutes"]],
|
pointer:{main:m,index:"async"},LTSonly:!0},{label:"Default response",type:"str",help:"For blocking requests, the default response in case the handler cannot be executed for any reason.",pointer:{main:m,index:"default"},LTSonly:!0},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Triggers")}},{type:"save",label:"Save","function":function(){c&&mist.data.config.triggers[c[0]].splice(c[1],1);var a=[m.url,m.async?true:false,typeof m.appliesto!="undefined"?m.appliesto:
|
||||||
value:30,"function":function(){clearInterval(UI.interval);UI.interval.set(function(){mist.send(function(){U()})},$(this).val()*1E3)}}]));b.append($("<button>").text("Purge logs").click(function(){mist.send(function(){mist.data.log=[];UI.navto("Logs")},{clearstatlogs:true})}));h=$("<tbody>").css("font-size","0.9em");b.append($("<table>").append(h));var W=function(a){var b=$("<span>").text(a);switch(a){case "WARN":b.addClass("orange");break;case "ERROR":case "FAIL":b.addClass("red")}return b},U=function(){var a=
|
[]];typeof m["default"]!="undefined"&&a.push(m["default"]);m.triggeron in mist.data.config.triggers||(mist.data.config.triggers[m.triggeron]=[]);mist.data.config.triggers[m.triggeron].push(a);mist.send(function(){UI.navto("Triggers")},{config:mist.data.config})}}]}]));break;case "Logs":b.append(UI.buildUI([{type:"help",help:"Here you have an overview of all edited settings within MistServer and possible warnings or errors MistServer has encountered. MistServer stores up to 100 logs at a time."},{label:"Refresh every",
|
||||||
mist.data.log;if(a){a.length>=2&&a[0][0]<a[a.length-1][0]&&a.reverse();h.html("");for(var b in a)h.append($("<tr>").html($("<td>").text(UI.format.dateTime(a[b][0],"long")).css("white-space","nowrap")).append($("<td>").html(W(a[b][1])).css("text-align","center")).append($("<td>").text(a[b][2]).css("text-align","left")))}};U();break;case "Statistics":u=$("<span>").text("Loading..");b.append(u);var m={},s=mist.stored.get().graphs?$.extend(!0,{},mist.stored.get().graphs):{},z={};for(q in mist.data.streams)z[q]=
|
type:"select",select:[[10,"10 seconds"],[30,"30 seconds"],[60,"minute"],[300,"5 minutes"]],value:30,"function":function(){clearInterval(UI.interval);UI.interval.set(function(){mist.send(function(){U()})},$(this).val()*1E3)}}]));b.append($("<button>").text("Purge logs").click(function(){mist.send(function(){mist.data.log=[];UI.navto("Logs")},{clearstatlogs:true})}));h=$("<tbody>").css("font-size","0.9em");b.append($("<table>").append(h));var W=function(a){var b=$("<span>").text(a);switch(a){case "WARN":b.addClass("orange");
|
||||||
!0;for(q in mist.data.active_streams)z[mist.data.active_streams[q]]=!0;var z=Object.keys(z).sort(),M=[];for(q in mist.data.config.protocols)M.push(mist.data.config.protocols[q].connector);M.sort();mist.send(function(){UI.plot.datatype.templates.cpuload.cores=0;for(var a in mist.data.capabilities.cpu)UI.plot.datatype.templates.cpuload.cores=UI.plot.datatype.templates.cpuload.cores+mist.data.capabilities.cpu[a].cores;u.html(UI.buildUI([{type:"help",help:"Here you will find the MistServer stream statistics, you can select various categories yourself. All statistics are live: up to five minutes are saved."},
|
break;case "ERROR":case "FAIL":b.addClass("red")}return b},U=function(){var a=mist.data.log;if(a){a.length>=2&&a[0][0]<a[a.length-1][0]&&a.reverse();h.html("");for(var b in a)h.append($("<tr>").html($("<td>").text(UI.format.dateTime(a[b][0],"long")).css("white-space","nowrap")).append($("<td>").html(W(a[b][1])).css("text-align","center")).append($("<td>").text(a[b][2]).css("text-align","left")))}};U();break;case "Statistics":u=$("<span>").text("Loading..");b.append(u);var m={},s=mist.stored.get().graphs?
|
||||||
$("<h3>").text("Select the data to display"),{label:"Add to",type:"select",select:[["new","New graph"]],pointer:{main:m,index:"graph"},classes:["graph_ids"],"function":function(){if($(this).val()){var a=u.find(".graph_xaxis"),b=u.find(".graph_id");if($(this).val()=="new"){a.children("option").prop("disabled",false);b.setval("Graph "+(Object.keys(s).length+1)).closest("label").show()}else{var c=s[$(this).val()].xaxis;a.children("option").prop("disabled",true).filter('[value="'+c+'"]').prop("disabled",
|
$.extend(!0,{},mist.stored.get().graphs):{},z={};for(q in mist.data.streams)z[q]=!0;for(q in mist.data.active_streams)z[mist.data.active_streams[q]]=!0;var z=Object.keys(z).sort(),M=[];for(q in mist.data.config.protocols)M.push(mist.data.config.protocols[q].connector);M.sort();mist.send(function(){UI.plot.datatype.templates.cpuload.cores=0;for(var a in mist.data.capabilities.cpu)UI.plot.datatype.templates.cpuload.cores=UI.plot.datatype.templates.cpuload.cores+mist.data.capabilities.cpu[a].cores;u.html(UI.buildUI([{type:"help",
|
||||||
false);b.closest("label").hide()}a.children('option[value="'+a.val()+'"]:disabled').length&&a.val(a.children("option:enabled").first().val());a.trigger("change")}}},{label:"Graph id",type:"str",pointer:{main:m,index:"id"},classes:["graph_id"],validate:[function(a){return a in s?{msg:"This graph id has already been used. Please enter something else.",classes:["red"]}:false}]},{label:"Axis type",type:"select",select:[["time","Time line"],["coords","Geographical"]],pointer:{main:m,index:"xaxis"},classes:["graph_xaxis"],
|
help:"Here you will find the MistServer stream statistics, you can select various categories yourself. All statistics are live: up to five minutes are saved."},$("<h3>").text("Select the data to display"),{label:"Add to",type:"select",select:[["new","New graph"]],pointer:{main:m,index:"graph"},classes:["graph_ids"],"function":function(){if($(this).val()){var a=u.find(".graph_xaxis"),b=u.find(".graph_id");if($(this).val()=="new"){a.children("option").prop("disabled",false);b.setval("Graph "+(Object.keys(s).length+
|
||||||
"function":function(){$s=u.find(".graph_datatype");switch($(this).getval()){case "coords":$s.children("option").prop("disabled",true).filter('[value="coords"]').prop("disabled",false);break;case "time":$s.children("option").prop("disabled",false).filter('[value="coords"]').prop("disabled",true)}if(!$s.val()||$s.children('option[value="'+$s.val()+'"]:disabled').length){$s.val($s.children("option:enabled").first().val());$s.trigger("change")}}},{label:"Data type",type:"select",select:[["clients","Connections"],
|
1)).closest("label").show()}else{var c=s[$(this).val()].xaxis;a.children("option").prop("disabled",true).filter('[value="'+c+'"]').prop("disabled",false);b.closest("label").hide()}a.children('option[value="'+a.val()+'"]:disabled').length&&a.val(a.children("option:enabled").first().val());a.trigger("change")}}},{label:"Graph id",type:"str",pointer:{main:m,index:"id"},classes:["graph_id"],validate:[function(a){return a in s?{msg:"This graph id has already been used. Please enter something else.",classes:["red"]}:
|
||||||
["upbps","Bandwidth (up)"],["downbps","Bandwidth (down)"],["cpuload","CPU load"],["memload","Memory load"],["coords","Client location"]],pointer:{main:m,index:"datatype"},classes:["graph_datatype"],"function":function(){$s=u.find(".graph_origin");switch($(this).getval()){case "cpuload":case "memload":$s.find("input[type=radio]").not('[value="total"]').prop("disabled",true);$s.find('input[type=radio][value="total"]').prop("checked",true);break;default:$s.find("input[type=radio]").prop("disabled",false)}}},
|
false}]},{label:"Axis type",type:"select",select:[["time","Time line"],["coords","Geographical"]],pointer:{main:m,index:"xaxis"},classes:["graph_xaxis"],"function":function(){$s=u.find(".graph_datatype");switch($(this).getval()){case "coords":$s.children("option").prop("disabled",true).filter('[value="coords"]').prop("disabled",false);break;case "time":$s.children("option").prop("disabled",false).filter('[value="coords"]').prop("disabled",true)}if(!$s.val()||$s.children('option[value="'+$s.val()+
|
||||||
{label:"Data origin",type:"radioselect",radioselect:[["total","All"],["stream","The stream:",z],["protocol","The protocol:",M]],pointer:{main:m,index:"origin"},value:["total"],classes:["graph_origin"]},{type:"buttons",buttons:[{label:"Add data set",type:"save","function":function(){var a;if(m.graph=="new"){a=UI.plot.addGraph(m,c);s[a.id]=a;u.find("select.graph_ids").append($("<option>").text(a.id)).val(a.id).trigger("change")}else a=s[m.graph];var b=UI.plot.datatype.getOptions({datatype:m.datatype,
|
'"]:disabled').length){$s.val($s.children("option:enabled").first().val());$s.trigger("change")}}},{label:"Data type",type:"select",select:[["clients","Connections"],["upbps","Bandwidth (up)"],["downbps","Bandwidth (down)"],["cpuload","CPU load"],["memload","Memory load"],["coords","Client location"]],pointer:{main:m,index:"datatype"},classes:["graph_datatype"],"function":function(){$s=u.find(".graph_origin");switch($(this).getval()){case "cpuload":case "memload":$s.find("input[type=radio]").not('[value="total"]').prop("disabled",
|
||||||
origin:m.origin});a.datasets.push(b);UI.plot.save(a);UI.plot.go(s)}}]}]));var c=$("<div>").addClass("graph_container");b.append(c);var d=u.find("select.graph_ids");for(a in s){var e=UI.plot.addGraph(s[a],c);d.append($("<option>").text(e.id)).val(e.id);var f=[],g;for(g in s[a].datasets){var i=UI.plot.datatype.getOptions({datatype:s[a].datasets[g].datatype,origin:s[a].datasets[g].origin});f.push(i)}e.datasets=f;s[e.id]=e}d.trigger("change");UI.plot.go(s);UI.interval.set(function(){UI.plot.go(s)},1E4)},
|
true);$s.find('input[type=radio][value="total"]').prop("checked",true);break;default:$s.find("input[type=radio]").prop("disabled",false)}}},{label:"Data origin",type:"radioselect",radioselect:[["total","All"],["stream","The stream:",z],["protocol","The protocol:",M]],pointer:{main:m,index:"origin"},value:["total"],classes:["graph_origin"]},{type:"buttons",buttons:[{label:"Add data set",type:"save","function":function(){var a;if(m.graph=="new"){a=UI.plot.addGraph(m,c);s[a.id]=a;u.find("select.graph_ids").append($("<option>").text(a.id)).val(a.id).trigger("change")}else a=
|
||||||
{active_streams:!0,capabilities:!0});break;case "Server Stats":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a)},{capabilities:!0});b.append("Loading..");break}var N=$("<table>"),O=$("<table>"),i={vheader:"CPUs",labels:["Model","Processor speed","Amount of cores","Amount of threads"],content:[]};for(q in mist.data.capabilities.cpu)p=mist.data.capabilities.cpu[q],i.content.push({header:"CPU #"+(Number(q)+1),body:[p.model,UI.format.addUnit(UI.format.number(p.mhz),"MHz"),
|
s[m.graph];var b=UI.plot.datatype.getOptions({datatype:m.datatype,origin:m.origin});a.datasets.push(b);UI.plot.save(a);UI.plot.go(s)}}]}]));var c=$("<div>").addClass("graph_container");b.append(c);var d=u.find("select.graph_ids");for(a in s){var e=UI.plot.addGraph(s[a],c);d.append($("<option>").text(e.id)).val(e.id);var f=[],g;for(g in s[a].datasets){var i=UI.plot.datatype.getOptions({datatype:s[a].datasets[g].datatype,origin:s[a].datasets[g].origin});f.push(i)}e.datasets=f;s[e.id]=e}d.trigger("change");
|
||||||
p.cores,p.threads]});var i=UI.buildVheaderTable(i),V=function(){var a=mist.data.capabilities.mem,b=mist.data.capabilities.load,a={vheader:"Memory",labels:["Used","Cached","Available","Total"],content:[{header:"Physical memory",body:[UI.format.bytes(a.used*1048576)+" ("+UI.format.addUnit(b.memory,"%")+")",UI.format.bytes(a.cached*1048576),UI.format.bytes(a.free*1048576),UI.format.bytes(a.total*1048576)]},{header:"Swap memory",body:[UI.format.bytes((a.swaptotal-a.swapfree)*1048576),UI.format.addUnit("",
|
UI.plot.go(s);UI.interval.set(function(){UI.plot.go(s)},1E4)},{active_streams:!0,capabilities:!0});break;case "Server Stats":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a)},{capabilities:!0});b.append("Loading..");break}var N=$("<table>"),O=$("<table>"),i={vheader:"CPUs",labels:["Model","Processor speed","Amount of cores","Amount of threads"],content:[]};for(q in mist.data.capabilities.cpu)p=mist.data.capabilities.cpu[q],i.content.push({header:"CPU #"+(Number(q)+1),
|
||||||
"N/A"),UI.format.bytes(a.swapfree*1048576),UI.format.bytes(a.swaptotal*1048576)]}]},a=UI.buildVheaderTable(a);N.replaceWith(a);N=a;b={vheader:"Load average",labels:["1 minute","5 minutes","15 minutes",""],content:[{header:" ",body:[UI.format.number(b.one/100),UI.format.number(b.five/100),UI.format.number(b.fifteen/100),""]}]};b=UI.buildVheaderTable(b);O.replaceWith(b);O=b};V();b.append(UI.buildUI([{type:"help",help:"You can find general server statistics here. Note that memory and CPU usage is for your entire machine, not just MistServer."}])).append($("<table>").css("width",
|
body:[p.model,UI.format.addUnit(UI.format.number(p.mhz),"MHz"),p.cores,p.threads]});var i=UI.buildVheaderTable(i),V=function(){var a=mist.data.capabilities.mem,b=mist.data.capabilities.load,a={vheader:"Memory",labels:["Used","Cached","Available","Total"],content:[{header:"Physical memory",body:[UI.format.bytes(a.used*1048576)+" ("+UI.format.addUnit(b.memory,"%")+")",UI.format.bytes(a.cached*1048576),UI.format.bytes(a.free*1048576),UI.format.bytes(a.total*1048576)]},{header:"Swap memory",body:[UI.format.bytes((a.swaptotal-
|
||||||
|
a.swapfree)*1048576),UI.format.addUnit("","N/A"),UI.format.bytes(a.swapfree*1048576),UI.format.bytes(a.swaptotal*1048576)]}]},a=UI.buildVheaderTable(a);N.replaceWith(a);N=a;b={vheader:"Load average",labels:["1 minute","5 minutes","15 minutes",""],content:[{header:" ",body:[UI.format.number(b.one/100),UI.format.number(b.five/100),UI.format.number(b.fifteen/100),""]}]};b=UI.buildVheaderTable(b);O.replaceWith(b);O=b};V();b.append(UI.buildUI([{type:"help",help:"You can find general server statistics here. Note that memory and CPU usage is for your entire machine, not just MistServer."}])).append($("<table>").css("width",
|
||||||
"auto").addClass("nolay").append($("<tr>").append($("<td>").append(N)).append($("<td>").append(O))).append($("<tr>").append($("<td>").append(i).attr("colspan",2))));UI.interval.set(function(){mist.send(function(){V()},{capabilities:true})},3E4);break;case "Email for Help":i=$.extend({},mist.data);delete i.statistics;delete i.totals;delete i.clients;delete i.capabilities;i=JSON.stringify(i);i="Version: "+mist.data.config.version+"\n\nConfig:\n"+i;m={};b.append(UI.buildUI([{type:"help",help:"You can use this form to email MistServer support if you're having difficulties.<br>A copy of your server config file will automatically be included."},
|
"auto").addClass("nolay").append($("<tr>").append($("<td>").append(N)).append($("<td>").append(O))).append($("<tr>").append($("<td>").append(i).attr("colspan",2))));UI.interval.set(function(){mist.send(function(){V()},{capabilities:true})},3E4);break;case "Email for Help":i=$.extend({},mist.data);delete i.statistics;delete i.totals;delete i.clients;delete i.capabilities;i=JSON.stringify(i);i="Version: "+mist.data.config.version+"\n\nConfig:\n"+i;m={};b.append(UI.buildUI([{type:"help",help:"You can use this form to email MistServer support if you're having difficulties.<br>A copy of your server config file will automatically be included."},
|
||||||
{type:"str",label:"Your name",validate:["required"],pointer:{main:m,index:"name"},value:mist.user.name},{type:"email",label:"Your email address",validate:["required"],pointer:{main:m,index:"email"}},{type:"hidden",value:"Integrated Help",pointer:{main:m,index:"subject"}},{type:"hidden",value:"-",pointer:{main:m,index:"company"}},{type:"textarea",rows:20,label:"Your message",validate:["required"],pointer:{main:m,index:"message"}},{type:"textarea",rows:20,label:"Your config file",readonly:!0,value:i,
|
{type:"str",label:"Your name",validate:["required"],pointer:{main:m,index:"name"},value:mist.user.name},{type:"email",label:"Your email address",validate:["required"],pointer:{main:m,index:"email"}},{type:"hidden",value:"Integrated Help",pointer:{main:m,index:"subject"}},{type:"hidden",value:"-",pointer:{main:m,index:"company"}},{type:"textarea",rows:20,label:"Your message",validate:["required"],pointer:{main:m,index:"message"}},{type:"textarea",rows:20,label:"Your config file",readonly:!0,value:i,
|
||||||
pointer:{main:m,index:"configfile"}},{type:"buttons",buttons:[{type:"save",label:"Send","function":function(a){$(a).text("Sending..");$.ajax({type:"POST",url:"http://mistserver.org/contact_us?skin=plain",data:m,success:function(a){a=$("<span>").html(a);a.find("script").remove();b.html(a[0].innerHTML)}})}}]}]));break;case "Disconnect":mist.user.password="";delete mist.user.authstring;delete mist.user.loggedin;UI.navto("Login");break;default:b.append($("<p>").text("This tab does not exist."))}}}},mist=
|
pointer:{main:m,index:"configfile"}},{type:"buttons",buttons:[{type:"save",label:"Send","function":function(a){$(a).text("Sending..");$.ajax({type:"POST",url:"http://mistserver.org/contact_us?skin=plain",data:m,success:function(a){a=$("<span>").html(a);a.find("script").remove();b.html(a[0].innerHTML)}})}}]}]));break;case "Disconnect":mist.user.password="";delete mist.user.authstring;delete mist.user.loggedin;UI.navto("Login");break;default:b.append($("<p>").text("This tab does not exist."))}}}},mist=
|
||||||
|
|
54
lsp/mist.js
54
lsp/mist.js
|
@ -3445,7 +3445,7 @@ var UI = {
|
||||||
$main.append(
|
$main.append(
|
||||||
UI.buildUI([{
|
UI.buildUI([{
|
||||||
type: 'help',
|
type: 'help',
|
||||||
help: 'Balder verzin iets leuks'
|
help: 'Triggers are the system you can use to react to events that occur inside MistServer. These allow you to block specific users, redirect streams, keep tabs on what is being pushed where, etcetera. For full documentation, please refer to the developer documentation section on the MistServer website.'
|
||||||
}])
|
}])
|
||||||
).append(
|
).append(
|
||||||
$('<button>').text('New trigger').click(function(){
|
$('<button>').text('New trigger').click(function(){
|
||||||
|
@ -3502,34 +3502,34 @@ var UI = {
|
||||||
|
|
||||||
$main.append(UI.buildUI([{
|
$main.append(UI.buildUI([{
|
||||||
type: 'help',
|
type: 'help',
|
||||||
help: 'Balder verzin iets leuks'
|
help: ''
|
||||||
},{
|
},{
|
||||||
label: 'Trigger on',
|
label: 'Trigger on',
|
||||||
pointer: {
|
pointer: {
|
||||||
main: saveas,
|
main: saveas,
|
||||||
index: 'triggeron'
|
index: 'triggeron'
|
||||||
},
|
},
|
||||||
help: 'Balder verzin iets leuks',
|
help: 'For what event this trigger should activate.',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
select: [
|
select: [
|
||||||
['SYSTEM_START', 'server boot'],
|
['SYSTEM_START', 'SYSTEM_START: server boot'],
|
||||||
['SYSTEM_STOP', 'server exit'],
|
['SYSTEM_STOP', 'SYSTEM_STOP: server exit'],
|
||||||
['SYSTEM_CONFIG', 'config changed'],
|
['SYSTEM_CONFIG', 'SYSTEM_CONFIG: config changed'],
|
||||||
['SYSTEM_LOG', 'log line logged'],
|
['OUTPUT_ADD', 'OUTPUT_ADD: new output configured'],
|
||||||
['OUTPUT_ADD', 'new output configured'],
|
['OUTPUT_CONFIG', 'OUTPUT_CONFIG: output config changed'],
|
||||||
['OUTPUT_CONFIG', 'output config changed'],
|
['OUTPUT_REMOVE', 'OUTPUT_REMOVE: deleted output in config'],
|
||||||
['OUTPUT_REMOVE', 'deleted output in config'],
|
['STREAM_ADD', 'STREAM_ADD: new stream configured'],
|
||||||
['STREAM_ADD', 'new stream configured'],
|
['STREAM_CONFIG', 'STREAM_CONFIG: stream config changed'],
|
||||||
['STREAM_CONFIG', 'stream config changed'],
|
['STREAM_REMOVE', 'STREAM_REMOVE: stream config deleted'],
|
||||||
['STREAM_REMOVE', 'stream config deleted'],
|
['STREAM_SOURCE', 'STREAM_SOURCE: right before stream source is loaded'],
|
||||||
['STREAM_LOAD', 'stream input loaded in memory'],
|
['STREAM_PRELOAD', 'STREAM_PRELOAD: right before stream input is loaded in memory'],
|
||||||
['STREAM_UNLOAD', 'stream input unloaded from memory'],
|
['STREAM_LOAD', 'STREAM_LOAD: stream input loaded in memory'],
|
||||||
['STREAM_TRACK_ADD', 'added track to stream; ie: push/multi'],
|
['STREAM_UNLOAD', 'STREAM_UNLOAD: stream input unloaded from memory'],
|
||||||
['STREAM_TRACK_REMOVE', 'removed track from stream'],
|
['STREAM_TRACK_ADD', 'STREAM_TRACK_ADD: added track to stream; e.g.: push received'],
|
||||||
['CONN_OPEN', 'new connection'],
|
['STREAM_TRACK_REMOVE', 'STREAM_TRACK_REMOVE: removed track from stream; e.g.: push timeout'],
|
||||||
['CONN_CLOSE', 'connection closed'],
|
['CONN_OPEN', 'CONN_OPEN: new incoming connection'],
|
||||||
['CONN_PLAY', 'before play start, includes limits status'],
|
['CONN_CLOSE', 'CONN_CLOSE: connection closed'],
|
||||||
['CONN_STOP', 'play end, but no disconnect yet']
|
['CONN_PLAY', 'CONN_PLAY: right before play of a new connection']
|
||||||
],
|
],
|
||||||
LTSonly: true
|
LTSonly: true
|
||||||
},{
|
},{
|
||||||
|
@ -3538,13 +3538,13 @@ var UI = {
|
||||||
main: saveas,
|
main: saveas,
|
||||||
index: 'appliesto'
|
index: 'appliesto'
|
||||||
},
|
},
|
||||||
help: 'Balder verzin iets leuks (none checked = all are checked)',
|
help: 'For triggers that can apply to specific streams, this value decides what streams they are triggered for. (none checked = always triggered)',
|
||||||
type: 'checklist',
|
type: 'checklist',
|
||||||
checklist: Object.keys(mist.data.streams),
|
checklist: Object.keys(mist.data.streams),
|
||||||
LTSonly: true
|
LTSonly: true
|
||||||
},$('<br>'),{
|
},$('<br>'),{
|
||||||
label: 'Handler (URL or executable)',
|
label: 'Handler (URL or executable)',
|
||||||
help: 'Balder verzin iets leuks',
|
help: 'This can be either an HTTP URL or a full path to an executable.',
|
||||||
pointer: {
|
pointer: {
|
||||||
main: saveas,
|
main: saveas,
|
||||||
index: 'url'
|
index: 'url'
|
||||||
|
@ -3553,18 +3553,18 @@ var UI = {
|
||||||
type: 'str',
|
type: 'str',
|
||||||
LTSonly: true
|
LTSonly: true
|
||||||
},{
|
},{
|
||||||
label: 'Asynchronous',
|
label: 'Blocking',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
help: 'Balder verzin iets leuks',
|
help: 'If checked, pauses processing and uses the response of the handler. If the response does not start with 1, true, yes or cont, further processing is aborted. If unchecked, processing is never paused and the response is not checked.',
|
||||||
pointer: {
|
pointer: {
|
||||||
main: saveas,
|
main: saveas,
|
||||||
index: 'async'
|
index: 'async'
|
||||||
},
|
},
|
||||||
LTSonly: true
|
LTSonly: true
|
||||||
},{
|
},{
|
||||||
label: 'Default return on error',
|
label: 'Default response',
|
||||||
type: 'str',
|
type: 'str',
|
||||||
help: 'Balder verzin iets leuks (synchronous only)',
|
help: 'For blocking requests, the default response in case the handler cannot be executed for any reason.',
|
||||||
pointer: {
|
pointer: {
|
||||||
main: saveas,
|
main: saveas,
|
||||||
index: 'default'
|
index: 'default'
|
||||||
|
|
Loading…
Add table
Reference in a new issue