LSP: added/tweaked several help messages; tweaked mist.convertBuildOptions() for select inputs, moved general push settings to general autopush settings
This commit is contained in:
parent
8f874d91d8
commit
e6f64fafb1
3 changed files with 227 additions and 108 deletions
|
@ -490,6 +490,10 @@ th.sorting-desc:after {
|
|||
content: '';
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAB3RJTUUH1wsGDC4gqCc4egAAAAlwSFlzAAAewQAAHsEBw2lUUwAAAARnQU1BAACxjwv8YQUAAADDSURBVHjaY2AgDdSyoYswI3MaGBT/KjMcR1HAhGA2MTBEMHxkiEhDUcAIY7Qw/BNSfMrL8fLHWenv7xZjMYFfaAsXx7s/3BwSWxj4Maxo4xfeLmX5/P45i2f3FSyltmOxYtGHL+9u2X59/VdU4TCLUJUAVk8WREz+mBSBKsaIYFYJqQAd+QLoyAXvsHizhV9qCz/H5z+CHHJbYvmxKBDfLmf57v51i9f3VSzltmNRwKf1/v5T2+6zj21f3xfRIjGGKAMAccw+PBxJau0AAAAASUVORK5CYII=);
|
||||
}
|
||||
table.valigntop td,
|
||||
table.valigntop th {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.browse_container {
|
||||
flex-flow: column nowrap;
|
||||
|
@ -595,6 +599,7 @@ input[type=radio] {
|
|||
position: relative;
|
||||
outline: 1px solid rgba(0,0,0,0.2);
|
||||
}
|
||||
td.LTSonly { outline: none; }
|
||||
.LTSonly:after {
|
||||
content: 'Pro';
|
||||
font-size: 0.8em;
|
||||
|
|
113
lsp/minified.js
113
lsp/minified.js
|
@ -1,10 +1,10 @@
|
|||
var MD5=function(a){function c(a,c){var b,d,f,g,e;f=a&2147483648;g=c&2147483648;b=a&1073741824;d=c&1073741824;e=(a&1073741823)+(c&1073741823);return b&d?e^2147483648^f^g:b|d?e&1073741824?e^3221225472^f^g:e^1073741824^f^g:e^f^g}function d(a,b,d,f,g,e,j){a=c(a,c(c(b&d|~b&f,g),j));return c(a<<e|a>>>32-e,b)}function b(a,b,d,f,g,e,j){a=c(a,c(c(b&f|d&~f,g),j));return c(a<<e|a>>>32-e,b)}function e(a,b,d,f,g,e,j){a=c(a,c(c(b^d^f,g),j));return c(a<<e|a>>>32-e,b)}function h(a,b,d,f,g,e,j){a=c(a,c(c(d^(b|~f),
|
||||
g),j));return c(a<<e|a>>>32-e,b)}function m(a){var c="",b="",d;for(d=0;3>=d;d++)b=a>>>8*d&255,b="0"+b.toString(16),c+=b.substr(b.length-2,2);return c}var g=[],q,o,i,u,f,j,l,k,g=a.replace(/\r\n/g,"\n"),a="";for(q=0;q<g.length;q++)o=g.charCodeAt(q),128>o?a+=String.fromCharCode(o):(127<o&&2048>o?a+=String.fromCharCode(o>>6|192):(a+=String.fromCharCode(o>>12|224),a+=String.fromCharCode(o>>6&63|128)),a+=String.fromCharCode(o&63|128));g=a;a=g.length;q=a+8;o=16*((q-q%64)/64+1);i=Array(o-1);for(f=u=0;f<a;)q=
|
||||
(f-f%4)/4,u=8*(f%4),i[q]|=g.charCodeAt(f)<<u,f++;q=(f-f%4)/4;i[q]|=128<<8*(f%4);i[o-2]=a<<3;i[o-1]=a>>>29;g=i;f=1732584193;j=4023233417;l=2562383102;k=271733878;for(a=0;a<g.length;a+=16)q=f,o=j,i=l,u=k,f=d(f,j,l,k,g[a+0],7,3614090360),k=d(k,f,j,l,g[a+1],12,3905402710),l=d(l,k,f,j,g[a+2],17,606105819),j=d(j,l,k,f,g[a+3],22,3250441966),f=d(f,j,l,k,g[a+4],7,4118548399),k=d(k,f,j,l,g[a+5],12,1200080426),l=d(l,k,f,j,g[a+6],17,2821735955),j=d(j,l,k,f,g[a+7],22,4249261313),f=d(f,j,l,k,g[a+8],7,1770035416),
|
||||
k=d(k,f,j,l,g[a+9],12,2336552879),l=d(l,k,f,j,g[a+10],17,4294925233),j=d(j,l,k,f,g[a+11],22,2304563134),f=d(f,j,l,k,g[a+12],7,1804603682),k=d(k,f,j,l,g[a+13],12,4254626195),l=d(l,k,f,j,g[a+14],17,2792965006),j=d(j,l,k,f,g[a+15],22,1236535329),f=b(f,j,l,k,g[a+1],5,4129170786),k=b(k,f,j,l,g[a+6],9,3225465664),l=b(l,k,f,j,g[a+11],14,643717713),j=b(j,l,k,f,g[a+0],20,3921069994),f=b(f,j,l,k,g[a+5],5,3593408605),k=b(k,f,j,l,g[a+10],9,38016083),l=b(l,k,f,j,g[a+15],14,3634488961),j=b(j,l,k,f,g[a+4],20,3889429448),
|
||||
f=b(f,j,l,k,g[a+9],5,568446438),k=b(k,f,j,l,g[a+14],9,3275163606),l=b(l,k,f,j,g[a+3],14,4107603335),j=b(j,l,k,f,g[a+8],20,1163531501),f=b(f,j,l,k,g[a+13],5,2850285829),k=b(k,f,j,l,g[a+2],9,4243563512),l=b(l,k,f,j,g[a+7],14,1735328473),j=b(j,l,k,f,g[a+12],20,2368359562),f=e(f,j,l,k,g[a+5],4,4294588738),k=e(k,f,j,l,g[a+8],11,2272392833),l=e(l,k,f,j,g[a+11],16,1839030562),j=e(j,l,k,f,g[a+14],23,4259657740),f=e(f,j,l,k,g[a+1],4,2763975236),k=e(k,f,j,l,g[a+4],11,1272893353),l=e(l,k,f,j,g[a+7],16,4139469664),
|
||||
j=e(j,l,k,f,g[a+10],23,3200236656),f=e(f,j,l,k,g[a+13],4,681279174),k=e(k,f,j,l,g[a+0],11,3936430074),l=e(l,k,f,j,g[a+3],16,3572445317),j=e(j,l,k,f,g[a+6],23,76029189),f=e(f,j,l,k,g[a+9],4,3654602809),k=e(k,f,j,l,g[a+12],11,3873151461),l=e(l,k,f,j,g[a+15],16,530742520),j=e(j,l,k,f,g[a+2],23,3299628645),f=h(f,j,l,k,g[a+0],6,4096336452),k=h(k,f,j,l,g[a+7],10,1126891415),l=h(l,k,f,j,g[a+14],15,2878612391),j=h(j,l,k,f,g[a+5],21,4237533241),f=h(f,j,l,k,g[a+12],6,1700485571),k=h(k,f,j,l,g[a+3],10,2399980690),
|
||||
l=h(l,k,f,j,g[a+10],15,4293915773),j=h(j,l,k,f,g[a+1],21,2240044497),f=h(f,j,l,k,g[a+8],6,1873313359),k=h(k,f,j,l,g[a+15],10,4264355552),l=h(l,k,f,j,g[a+6],15,2734768916),j=h(j,l,k,f,g[a+13],21,1309151649),f=h(f,j,l,k,g[a+4],6,4149444226),k=h(k,f,j,l,g[a+11],10,3174756917),l=h(l,k,f,j,g[a+2],15,718787259),j=h(j,l,k,f,g[a+9],21,3951481745),f=c(f,q),j=c(j,o),l=c(l,i),k=c(k,u);return(m(f)+m(j)+m(l)+m(k)).toLowerCase()};(function(a){a.fn.stupidtable=function(){a(this).on("click","thead th",function(){a(this).stupidsort()})};a.fn.stupidsort=function(){function c(c){var b=0,d;a(c).children("td,th").each(function(){if(b==q)return d=a(this),!1;var c=a(this).attr("colspan");b+=c?Number(c):1});c="undefined"!=typeof d.data("sort-value")?d.data("sort-value"):"undefined"!=typeof d.attr("data-sort-value")?d.attr("data-sort-value"):d.text();switch(m){case "string":case "string-ins":c=String(c).toLowerCase();break;case "int":c=
|
||||
g),j));return c(a<<e|a>>>32-e,b)}function m(a){var c="",b="",d;for(d=0;3>=d;d++)b=a>>>8*d&255,b="0"+b.toString(16),c+=b.substr(b.length-2,2);return c}var g=[],q,o,l,u,f,j,i,k,g=a.replace(/\r\n/g,"\n"),a="";for(q=0;q<g.length;q++)o=g.charCodeAt(q),128>o?a+=String.fromCharCode(o):(127<o&&2048>o?a+=String.fromCharCode(o>>6|192):(a+=String.fromCharCode(o>>12|224),a+=String.fromCharCode(o>>6&63|128)),a+=String.fromCharCode(o&63|128));g=a;a=g.length;q=a+8;o=16*((q-q%64)/64+1);l=Array(o-1);for(f=u=0;f<a;)q=
|
||||
(f-f%4)/4,u=8*(f%4),l[q]|=g.charCodeAt(f)<<u,f++;q=(f-f%4)/4;l[q]|=128<<8*(f%4);l[o-2]=a<<3;l[o-1]=a>>>29;g=l;f=1732584193;j=4023233417;i=2562383102;k=271733878;for(a=0;a<g.length;a+=16)q=f,o=j,l=i,u=k,f=d(f,j,i,k,g[a+0],7,3614090360),k=d(k,f,j,i,g[a+1],12,3905402710),i=d(i,k,f,j,g[a+2],17,606105819),j=d(j,i,k,f,g[a+3],22,3250441966),f=d(f,j,i,k,g[a+4],7,4118548399),k=d(k,f,j,i,g[a+5],12,1200080426),i=d(i,k,f,j,g[a+6],17,2821735955),j=d(j,i,k,f,g[a+7],22,4249261313),f=d(f,j,i,k,g[a+8],7,1770035416),
|
||||
k=d(k,f,j,i,g[a+9],12,2336552879),i=d(i,k,f,j,g[a+10],17,4294925233),j=d(j,i,k,f,g[a+11],22,2304563134),f=d(f,j,i,k,g[a+12],7,1804603682),k=d(k,f,j,i,g[a+13],12,4254626195),i=d(i,k,f,j,g[a+14],17,2792965006),j=d(j,i,k,f,g[a+15],22,1236535329),f=b(f,j,i,k,g[a+1],5,4129170786),k=b(k,f,j,i,g[a+6],9,3225465664),i=b(i,k,f,j,g[a+11],14,643717713),j=b(j,i,k,f,g[a+0],20,3921069994),f=b(f,j,i,k,g[a+5],5,3593408605),k=b(k,f,j,i,g[a+10],9,38016083),i=b(i,k,f,j,g[a+15],14,3634488961),j=b(j,i,k,f,g[a+4],20,3889429448),
|
||||
f=b(f,j,i,k,g[a+9],5,568446438),k=b(k,f,j,i,g[a+14],9,3275163606),i=b(i,k,f,j,g[a+3],14,4107603335),j=b(j,i,k,f,g[a+8],20,1163531501),f=b(f,j,i,k,g[a+13],5,2850285829),k=b(k,f,j,i,g[a+2],9,4243563512),i=b(i,k,f,j,g[a+7],14,1735328473),j=b(j,i,k,f,g[a+12],20,2368359562),f=e(f,j,i,k,g[a+5],4,4294588738),k=e(k,f,j,i,g[a+8],11,2272392833),i=e(i,k,f,j,g[a+11],16,1839030562),j=e(j,i,k,f,g[a+14],23,4259657740),f=e(f,j,i,k,g[a+1],4,2763975236),k=e(k,f,j,i,g[a+4],11,1272893353),i=e(i,k,f,j,g[a+7],16,4139469664),
|
||||
j=e(j,i,k,f,g[a+10],23,3200236656),f=e(f,j,i,k,g[a+13],4,681279174),k=e(k,f,j,i,g[a+0],11,3936430074),i=e(i,k,f,j,g[a+3],16,3572445317),j=e(j,i,k,f,g[a+6],23,76029189),f=e(f,j,i,k,g[a+9],4,3654602809),k=e(k,f,j,i,g[a+12],11,3873151461),i=e(i,k,f,j,g[a+15],16,530742520),j=e(j,i,k,f,g[a+2],23,3299628645),f=h(f,j,i,k,g[a+0],6,4096336452),k=h(k,f,j,i,g[a+7],10,1126891415),i=h(i,k,f,j,g[a+14],15,2878612391),j=h(j,i,k,f,g[a+5],21,4237533241),f=h(f,j,i,k,g[a+12],6,1700485571),k=h(k,f,j,i,g[a+3],10,2399980690),
|
||||
i=h(i,k,f,j,g[a+10],15,4293915773),j=h(j,i,k,f,g[a+1],21,2240044497),f=h(f,j,i,k,g[a+8],6,1873313359),k=h(k,f,j,i,g[a+15],10,4264355552),i=h(i,k,f,j,g[a+6],15,2734768916),j=h(j,i,k,f,g[a+13],21,1309151649),f=h(f,j,i,k,g[a+4],6,4149444226),k=h(k,f,j,i,g[a+11],10,3174756917),i=h(i,k,f,j,g[a+2],15,718787259),j=h(j,i,k,f,g[a+9],21,3951481745),f=c(f,q),j=c(j,o),i=c(i,l),k=c(k,u);return(m(f)+m(j)+m(i)+m(k)).toLowerCase()};(function(a){a.fn.stupidtable=function(){a(this).on("click","thead th",function(){a(this).stupidsort()})};a.fn.stupidsort=function(){function c(c){var b=0,d;a(c).children("td,th").each(function(){if(b==q)return d=a(this),!1;var c=a(this).attr("colspan");b+=c?Number(c):1});c="undefined"!=typeof d.data("sort-value")?d.data("sort-value"):"undefined"!=typeof d.attr("data-sort-value")?d.attr("data-sort-value"):d.text();switch(m){case "string":case "string-ins":c=String(c).toLowerCase();break;case "int":c=
|
||||
parseInt(Number(c));break;case "float":c=Number(c)}return c}var d=a(this),b=d.closest("table"),e=b.children("tbody"),h=e.children("tr"),m=d.attr("data-sort-type");if(m){var g=!0;d.hasClass("sorting-asc")&&(g=!1);var q=0;d.prevAll().each(function(){var c=a(this).attr("colspan");q+=c?Number(c):1});h.sort(function(a,b){var d=g?1:-1,a=c(a),b=c(b);return a>b?1*d:a<b?-1*d:0});e.append(h);b.find("thead th").removeClass("sorting-asc").removeClass("sorting-desc");d.addClass(g?"sorting-asc":"sorting-desc")}}})(jQuery);$(function(){UI.elements={menu:$("nav > .menu"),main:$("main"),header:$("header"),connection:{status:$("#connection"),user_and_host:$("#user_and_host"),msg:$("#message")}};UI.buildMenu();UI.stored.getOpts();try{if("mistLogin"in sessionStorage){var a=JSON.parse(sessionStorage.mistLogin);mist.user.name=a.name;mist.user.password=a.password;mist.user.host=a.host}}catch(c){}location.hash&&(a=decodeURIComponent(location.hash).substring(1).split("@")[0].split("&"),mist.user.name=a[0],a[1]&&(mist.user.host=
|
||||
a[1]));mist.send(function(){$(window).trigger("hashchange")},{},{timeout:5,hide:!0});var d=0;$("body > div.filler").on("scroll",function(){var a=$(this).scrollLeft();a!=d&&UI.elements.header.css("margin-right",-1*a+"px");d=a})});$(window).on("hashchange",function(){var a=decodeURIComponent(location.hash).substring(1).split("@");a[1]||(a[1]="");a=a[1].split("&");""==a[0]&&(a[0]="Overview");UI.showTab(a[0],a[1])});
|
||||
var otherhost={host:!1,https:!1},UI={debug:!1,elements:{},stored:{getOpts:function(){var a=localStorage.stored;a&&(a=JSON.parse(a));$.extend(!0,this.vars,a);return this.vars},saveOpt:function(a,c){this.vars[a]=c;localStorage.stored=JSON.stringify(this.vars);return this.vars},vars:{helpme:!0}},interval:{clear:function(){"undefined"!=typeof this.opts&&(clearInterval(this.opts.id),delete this.opts)},set:function(a,c){this.opts&&log("[interval]","Set called on interval, but an interval is already active.");
|
||||
|
@ -29,31 +29,31 @@ $(this).data("validate")(this,!0))return!1});c||(a.find(".isSetting").each(funct
|
|||
""));g=$("<span>").addClass("field_container");m.append(g);switch(b.type){case "password":e=$("<input>").attr("type","password");break;case "int":e=$("<input>").attr("type","number");"min"in b&&e.attr("min",b.min);"max"in b&&e.attr("max",b.min);"validate"in b?b.validate.push("int"):b.validate=["int"];break;case "span":e=$("<span>");break;case "debug":b.select=[["","Default"],[0,"0 - All debugging messages disabled"],[1,"1 - Messages about failed operations"],[2,"2 - Previous level, and error messages"],
|
||||
[3,"3 - Previous level, and warning messages"],[4,"4 - Previous level, and status messages for development"],[5,"5 - Previous level, and more status messages for development"],[6,"6 - Previous level, and verbose debugging messages"],[7,"7 - Previous level, and very verbose debugging messages"],[8,"8 - Report everything in extreme detail"],[9,"9 - Report everything in insane detail"],[10,"10 - All messages enabled"]];case "select":e=$("<select>");for(h in b.select){var o=$("<option>");"string"==typeof b.select[h]?
|
||||
o.text(b.select[h]):o.val(b.select[h][0]).text(b.select[h][1]);e.append(o)}break;case "textarea":e=$("<textarea>").on("keydown",function(a){a.stopPropagation()});break;case "checkbox":e=$("<input>").attr("type","checkbox");break;case "hidden":e=$("<input>").attr("type","hidden");m.hide();break;case "email":e=$("<input>").attr("type","email").attr("autocomplete","on").attr("required","");break;case "browse":e=$("<input>").attr("type","text");"filetypes"in b&&e.data("filetypes",b.filetypes);break;case "geolimited":case "hostlimited":e=
|
||||
$("<input>").attr("type","hidden");break;case "radioselect":e=$("<div>").addClass("radioselect");for(d in b.radioselect){var i=$("<input>").attr("type","radio").val(b.radioselect[d][0]).attr("name",b.label);("LTSonly"in b&&!mist.data.LTS||b.readonly)&&i.prop("disabled",!0);o=$("<label>").append(i).append($("<span>").html(b.radioselect[d][1]));e.append(o);if(2<b.radioselect[d].length)for(h in i=$("<select>").change(function(){$(this).parent().find("input[type=radio]:enabled").prop("checked","true")}),
|
||||
o.append(i),("LTSonly"in b&&!mist.data.LTS||b.readonly)&&i.prop("disabled",!0),b.radioselect[d][2])o=$("<option>"),i.append(o),b.radioselect[d][2][h]instanceof Array?o.val(b.radioselect[d][2][h][0]).html(b.radioselect[d][2][h][1]):o.html(b.radioselect[d][2][h])}break;case "checklist":e=$("<div>").addClass("checkcontainer");$controls=$("<div>").addClass("controls");$checklist=$("<div>").addClass("checklist");e.append($checklist);for(d in b.checklist)"string"==typeof b.checklist[d]&&(b.checklist[d]=
|
||||
[b.checklist[d],b.checklist[d]]),$checklist.append($("<label>").text(b.checklist[d][1]).prepend($("<input>").attr("type","checkbox").attr("name",b.checklist[d][0])));break;case "DOMfield":e=b.DOMfield;break;case "unix":e=$("<input>").attr("type","datetime-local").attr("step",1);b.unit=$("<button>").text("Now").click(function(){$(this).closest(".field_container").find(".field").setval((new Date).getTime()/1E3)});break;case "selectinput":e=$("<div>").addClass("selectinput");i=$("<select>");e.append(i);
|
||||
i.data("input",!1);"LTSonly"in b&&!mist.data.LTS&&i.prop("disabled",!0);for(d in b.selectinput)o=$("<option>"),i.append(o),"string"==typeof b.selectinput[d]?o.text(b.selectinput[d]):(o.text(b.selectinput[d][1]),"string"==typeof b.selectinput[d][0]?o.val(b.selectinput[d][0]):(o.val("CUSTOM"),i.data("input")||i.data("input",UI.buildUI([b.selectinput[d][0]]).children())));i.data("input")&&e.append(i.data("input"));i.change(function(){"CUSTOM"==$(this).val()?$(this).data("input").css("display","flex"):
|
||||
$(this).data("input").hide()});i.trigger("change");break;case "inputlist":e=$("<div>").addClass("inputlist");e.data("newitem",function(){var a=$("<input>").attr("type","text").addClass("listitem");("LTSonly"in b&&!mist.data.LTS||b.readonly)&&a.prop("disabled",!0);var c=function(b){$(this).is(":last-child")?""!=$(this).val()?$(this).after(a.clone().keyup(c).val("")):8==b.which&&$(this).prev().focus():""==$(this).val()&&($(this).next().focus(),$(this).remove())};a.keyup(c);return a});e.append(e.data("newitem"));
|
||||
$("<input>").attr("type","hidden");break;case "radioselect":e=$("<div>").addClass("radioselect");for(d in b.radioselect){var l=$("<input>").attr("type","radio").val(b.radioselect[d][0]).attr("name",b.label);("LTSonly"in b&&!mist.data.LTS||b.readonly)&&l.prop("disabled",!0);o=$("<label>").append(l).append($("<span>").html(b.radioselect[d][1]));e.append(o);if(2<b.radioselect[d].length)for(h in l=$("<select>").change(function(){$(this).parent().find("input[type=radio]:enabled").prop("checked","true")}),
|
||||
o.append(l),("LTSonly"in b&&!mist.data.LTS||b.readonly)&&l.prop("disabled",!0),b.radioselect[d][2])o=$("<option>"),l.append(o),b.radioselect[d][2][h]instanceof Array?o.val(b.radioselect[d][2][h][0]).html(b.radioselect[d][2][h][1]):o.html(b.radioselect[d][2][h])}break;case "checklist":e=$("<div>").addClass("checkcontainer");$controls=$("<div>").addClass("controls");$checklist=$("<div>").addClass("checklist");e.append($checklist);for(d in b.checklist)"string"==typeof b.checklist[d]&&(b.checklist[d]=
|
||||
[b.checklist[d],b.checklist[d]]),$checklist.append($("<label>").text(b.checklist[d][1]).prepend($("<input>").attr("type","checkbox").attr("name",b.checklist[d][0])));break;case "DOMfield":e=b.DOMfield;break;case "unix":e=$("<input>").attr("type","datetime-local").attr("step",1);b.unit=$("<button>").text("Now").click(function(){$(this).closest(".field_container").find(".field").setval((new Date).getTime()/1E3)});break;case "selectinput":e=$("<div>").addClass("selectinput");l=$("<select>");e.append(l);
|
||||
l.data("input",!1);"LTSonly"in b&&!mist.data.LTS&&l.prop("disabled",!0);for(d in b.selectinput)o=$("<option>"),l.append(o),"string"==typeof b.selectinput[d]?o.text(b.selectinput[d]):(o.text(b.selectinput[d][1]),"string"==typeof b.selectinput[d][0]?o.val(b.selectinput[d][0]):(o.val("CUSTOM"),l.data("input")||l.data("input",UI.buildUI([b.selectinput[d][0]]).children())));l.data("input")&&e.append(l.data("input"));l.change(function(){"CUSTOM"==$(this).val()?$(this).data("input").css("display","flex"):
|
||||
$(this).data("input").hide()});l.trigger("change");break;case "inputlist":e=$("<div>").addClass("inputlist");e.data("newitem",function(){var a=$("<input>").attr("type","text").addClass("listitem");("LTSonly"in b&&!mist.data.LTS||b.readonly)&&a.prop("disabled",!0);var c=function(b){$(this).is(":last-child")?""!=$(this).val()?$(this).after(a.clone().keyup(c).val("")):8==b.which&&$(this).prev().focus():""==$(this).val()&&($(this).next().focus(),$(this).remove())};a.keyup(c);return a});e.append(e.data("newitem"));
|
||||
break;default:e=$("<input>").attr("type","text")}e.addClass("field").data("opts",b);"pointer"in b&&e.attr("name",b.pointer.index);g.append(e);if("classes"in b)for(h in b.classes)e.addClass(b.classes[h]);"placeholder"in b&&e.attr("placeholder",b.placeholder);"default"in b&&e.attr("placeholder",b["default"]);"unit"in b&&g.append($("<span>").addClass("unit").html(b.unit));"readonly"in b&&(e.attr("readonly","readonly"),e.click(function(){$(this).select()}));"qrcode"in b&&g.append($("<span>").addClass("unit").html($("<button>").text("QR").on("keydown",
|
||||
function(a){a.stopPropagation()}).click(function(){var a=String($(this).closest(".field_container").find(".field").getval()),c=$("<div>").addClass("qrcode");UI.popup.show($("<span>").addClass("qr_container").append($("<p>").text(a)).append(c));c.qrcode({text:a,size:Math.min(c.width(),c.height())})})));"clipboard"in b&&document.queryCommandSupported("copy")&&g.append($("<span>").addClass("unit").html($("<button>").text("Copy").on("keydown",function(a){a.stopPropagation()}).click(function(){var a=String($(this).closest(".field_container").find(".field").getval()),
|
||||
c=document.createElement("textarea");c.value=a;document.body.appendChild(c);c.select();var b=false;try{b=document.execCommand("copy")}catch(d){}if(b){$(this).text("Copied to clipboard!");document.body.removeChild(c);var g=$(this);setTimeout(function(){g.text("Copy")},5E3)}else{document.body.removeChild(c);alert("Failed to copy:\n"+a)}})));"rows"in b&&e.attr("rows",b.rows);"LTSonly"in b&&!mist.data.LTS&&(g.addClass("LTSonly"),e.prop("disabled",!0));switch(b.type){case "browse":i=$("<div>").addClass("grouper").append(m);
|
||||
c.append(i);i=$("<button>").text("Browse").on("keydown",function(a){a.stopPropagation()});g.append(i);i.click(function(){function a(c){m.text("Loading..");mist.send(function(a){h.text(a.browse.path[0]);mist.data.LTS&&d.setval(a.browse.path[0]+"/");m.html(i.clone(true).text("..").attr("title","Folder up"));if(a.browse.subdirectories){a.browse.subdirectories.sort();for(var c in a.browse.subdirectories){var e=a.browse.subdirectories[c];m.append(i.clone(true).attr("title",h.text()+q+e).text(e))}}if(a.browse.files){a.browse.files.sort();
|
||||
c=document.createElement("textarea");c.value=a;document.body.appendChild(c);c.select();var b=false;try{b=document.execCommand("copy")}catch(d){}if(b){$(this).text("Copied to clipboard!");document.body.removeChild(c);var g=$(this);setTimeout(function(){g.text("Copy")},5E3)}else{document.body.removeChild(c);alert("Failed to copy:\n"+a)}})));"rows"in b&&e.attr("rows",b.rows);"LTSonly"in b&&!mist.data.LTS&&(g.addClass("LTSonly"),e.prop("disabled",!0));switch(b.type){case "browse":l=$("<div>").addClass("grouper").append(m);
|
||||
c.append(l);l=$("<button>").text("Browse").on("keydown",function(a){a.stopPropagation()});g.append(l);l.click(function(){function a(c){m.text("Loading..");mist.send(function(a){h.text(a.browse.path[0]);mist.data.LTS&&d.setval(a.browse.path[0]+"/");m.html(l.clone(true).text("..").attr("title","Folder up"));if(a.browse.subdirectories){a.browse.subdirectories.sort();for(var c in a.browse.subdirectories){var e=a.browse.subdirectories[c];m.append(l.clone(true).attr("title",h.text()+q+e).text(e))}}if(a.browse.files){a.browse.files.sort();
|
||||
for(c in a.browse.files){var e=a.browse.files[c],f=h.text()+q+e,e=$("<a>").text(e).addClass("file").attr("title",f);m.append(e);if(o){var u=true,I;for(I in o)if(typeof o[I]!="undefined"&&mist.inputMatch(o[I],f)){u=false;break}u&&e.hide()}e.click(function(){var a=$(this).attr("title");d.setval(a).removeAttr("readonly").css("opacity",1);g.show();b.remove()})}}},{browse:c})}var c=$(this).closest(".grouper"),b=$("<div>").addClass("browse_container"),d=c.find(".field").attr("readonly","readonly").css("opacity",
|
||||
0.5),g=$(this),e=$("<button>").text("Stop browsing").click(function(){g.show();b.remove();d.removeAttr("readonly").css("opacity",1)}),h=$("<span>").addClass("field"),m=$("<div>").addClass("browse_contents"),i=$("<a>").addClass("folder"),o=d.data("filetypes");c.append(b);b.append($("<label>").addClass("UIelement").append($("<span>").addClass("label").text("Current folder:")).append($("<span>").addClass("field_container").append(h).append(e))).append(m);var q="/";mist.data.config.version.indexOf("indows")>
|
||||
-1&&(q="\\");i.click(function(){var c=h.text()+q+$(this).text();a(c)});c=d.getval();e=c.split("://");e.length>1&&(c=e[0]=="file"?e[1]:"");c=c.split(q);c.pop();c=c.join(q);g.hide();a(c)});break;case "geolimited":case "hostlimited":i={field:e};i.blackwhite=$("<select>").append($("<option>").val("-").text("Blacklist")).append($("<option>").val("+").text("Whitelist"));i.values=$("<span>").addClass("limit_value_list");switch(b.type){case "geolimited":i.prototype=$("<select>").append($("<option>").val("").text("[Select a country]"));
|
||||
for(d in UI.countrylist)i.prototype.append($("<option>").val(d).html(UI.countrylist[d]));break;case "hostlimited":i.prototype=$("<input>").attr("type","text").attr("placeholder","type a host")}i.prototype.on("change keyup",function(){$(this).closest(".field_container").data("subUI").blackwhite.trigger("change")});i.blackwhite.change(function(){var a=$(this).closest(".field_container").data("subUI"),c=[],b=false;a.values.children().each(function(){b=$(this).val();b!=""?c.push(b):$(this).remove()});
|
||||
a.values.append(a.prototype.clone(true));c.length>0?a.field.val($(this).val()+c.join(" ")):a.field.val("");a.field.trigger("change")});"LTSonly"in b&&!mist.data.LTS&&(i.blackwhite.prop("disabled",!0),i.prototype.prop("disabled",!0));i.values.append(i.prototype.clone(!0));g.data("subUI",i).addClass("limit_list").append(i.blackwhite).append(i.values)}"pointer"in b&&(e.data("pointer",b.pointer).addClass("isSetting"),b.pointer.main&&(i=b.pointer.main[b.pointer.index],"undefined"!=i&&e.setval(i)));"value"in
|
||||
b&&e.setval(b.value);if("datalist"in b)for(d in i="datalist_"+d+MD5(e[0].outerHTML),e.attr("list",i),i=$("<datalist>").attr("id",i),g.append(i),b.datalist)i.append($("<option>").val(b.datalist[d]));g=$("<span>").addClass("help_container");m.append(g);"help"in b&&(g.append($("<span>").addClass("ih_balloon").html(b.help)),e.on("focus mouseover",function(){$(this).closest("label").addClass("active")}).on("blur mouseout",function(){$(this).closest("label").removeClass("active")}));if("validate"in b){m=
|
||||
[];for(h in b.validate){i=b.validate[h];if("function"!=typeof i)switch(i){case "required":i=function(a){return a==""||a==null?{msg:"This is a required field.",classes:["red"]}:false};break;case "int":i=function(a,c){var b=$(c).data("opts");if(!$(c)[0].validity.valid){var d=[];"min"in b&&d.push(" greater than or equal to "+b.min);"max"in b&&d.push(" smaller than or equal to "+b.max);return{msg:"Please enter an integer"+d.join(" and")+".",classes:["red"]}}if(parseInt(Number(a))!=a)return{msg:"Please enter an integer.",
|
||||
classes:["red"]}};break;case "streamname":i=function(a,c){if(!isNaN(a.charAt(0)))return{msg:"The first character may not be a number.",classes:["red"]};if(a.toLowerCase()!=a)return{msg:"Uppercase letters are not allowed.",classes:["red"]};if(a.replace(/[^\da-z_]/g,"")!=a)return{msg:"Special characters (except for underscores) are not allowed.",classes:["red"]};if("streams"in mist.data&&a in mist.data.streams&&$(c).data("pointer").main.name!=a)return{msg:"This streamname already exists.<br>If you want to edit an existing stream, please click edit on the the streams tab.",
|
||||
classes:["red"]}};break;default:i=function(){}}m.push(i)}e.data("validate_functions",m).data("help_container",g).data("validate",function(a,c){var b=$(a).getval(),d=$(a).data("validate_functions"),e=$(a).data("help_container");e.find(".err_balloon").remove();for(var g in d){var h=d[g](b,a);if(h){$err=$("<span>").addClass("err_balloon").html(h.msg);for(var m in h.classes)$err.addClass(h.classes[m]);e.prepend($err);c&&$(a).focus();return typeof h=="object"&&"break"in h?h["break"]:true}}return false}).addClass("hasValidate").on("change keyup",
|
||||
0.5),g=$(this),e=$("<button>").text("Stop browsing").click(function(){g.show();b.remove();d.removeAttr("readonly").css("opacity",1)}),h=$("<span>").addClass("field"),m=$("<div>").addClass("browse_contents"),l=$("<a>").addClass("folder"),o=d.data("filetypes");c.append(b);b.append($("<label>").addClass("UIelement").append($("<span>").addClass("label").text("Current folder:")).append($("<span>").addClass("field_container").append(h).append(e))).append(m);var q="/";mist.data.config.version.indexOf("indows")>
|
||||
-1&&(q="\\");l.click(function(){var c=h.text()+q+$(this).text();a(c)});c=d.getval();e=c.split("://");e.length>1&&(c=e[0]=="file"?e[1]:"");c=c.split(q);c.pop();c=c.join(q);g.hide();a(c)});break;case "geolimited":case "hostlimited":l={field:e};l.blackwhite=$("<select>").append($("<option>").val("-").text("Blacklist")).append($("<option>").val("+").text("Whitelist"));l.values=$("<span>").addClass("limit_value_list");switch(b.type){case "geolimited":l.prototype=$("<select>").append($("<option>").val("").text("[Select a country]"));
|
||||
for(d in UI.countrylist)l.prototype.append($("<option>").val(d).html(UI.countrylist[d]));break;case "hostlimited":l.prototype=$("<input>").attr("type","text").attr("placeholder","type a host")}l.prototype.on("change keyup",function(){$(this).closest(".field_container").data("subUI").blackwhite.trigger("change")});l.blackwhite.change(function(){var a=$(this).closest(".field_container").data("subUI"),c=[],b=false;a.values.children().each(function(){b=$(this).val();b!=""?c.push(b):$(this).remove()});
|
||||
a.values.append(a.prototype.clone(true));c.length>0?a.field.val($(this).val()+c.join(" ")):a.field.val("");a.field.trigger("change")});"LTSonly"in b&&!mist.data.LTS&&(l.blackwhite.prop("disabled",!0),l.prototype.prop("disabled",!0));l.values.append(l.prototype.clone(!0));g.data("subUI",l).addClass("limit_list").append(l.blackwhite).append(l.values)}"pointer"in b&&(e.data("pointer",b.pointer).addClass("isSetting"),b.pointer.main&&(l=b.pointer.main[b.pointer.index],"undefined"!=l&&e.setval(l)));"value"in
|
||||
b&&e.setval(b.value);if("datalist"in b)for(d in l="datalist_"+d+MD5(e[0].outerHTML),e.attr("list",l),l=$("<datalist>").attr("id",l),g.append(l),b.datalist)l.append($("<option>").val(b.datalist[d]));g=$("<span>").addClass("help_container");m.append(g);"help"in b&&(g.append($("<span>").addClass("ih_balloon").html(b.help)),e.on("focus mouseover",function(){$(this).closest("label").addClass("active")}).on("blur mouseout",function(){$(this).closest("label").removeClass("active")}));if("validate"in b){m=
|
||||
[];for(h in b.validate){l=b.validate[h];if("function"!=typeof l)switch(l){case "required":l=function(a){return a==""||a==null?{msg:"This is a required field.",classes:["red"]}:false};break;case "int":l=function(a,c){var b=$(c).data("opts");if(!$(c)[0].validity.valid){var d=[];"min"in b&&d.push(" greater than or equal to "+b.min);"max"in b&&d.push(" smaller than or equal to "+b.max);return{msg:"Please enter an integer"+d.join(" and")+".",classes:["red"]}}if(parseInt(Number(a))!=a)return{msg:"Please enter an integer.",
|
||||
classes:["red"]}};break;case "streamname":l=function(a,c){if(!isNaN(a.charAt(0)))return{msg:"The first character may not be a number.",classes:["red"]};if(a.toLowerCase()!=a)return{msg:"Uppercase letters are not allowed.",classes:["red"]};if(a.replace(/[^\da-z_]/g,"")!=a)return{msg:"Special characters (except for underscores) are not allowed.",classes:["red"]};if("streams"in mist.data&&a in mist.data.streams&&$(c).data("pointer").main.name!=a)return{msg:"This streamname already exists.<br>If you want to edit an existing stream, please click edit on the the streams tab.",
|
||||
classes:["red"]}};break;default:l=function(){}}m.push(l)}e.data("validate_functions",m).data("help_container",g).data("validate",function(a,c){var b=$(a).getval(),d=$(a).data("validate_functions"),e=$(a).data("help_container");e.find(".err_balloon").remove();for(var g in d){var h=d[g](b,a);if(h){$err=$("<span>").addClass("err_balloon").html(h.msg);for(var m in h.classes)$err.addClass(h.classes[m]);e.prepend($err);c&&$(a).focus();return typeof h=="object"&&"break"in h?h["break"]:true}}return false}).addClass("hasValidate").on("change keyup",
|
||||
function(){$(this).data("validate")($(this))});""!=e.getval()&&e.trigger("change")}"function"in b&&(e.on("change keyup",b["function"]),e.trigger("change"))}}c.on("keydown",function(a){switch(a.which){case 13:$(this).find("button.save").first().trigger("click");break;case 27:$(this).find("button.cancel").first().trigger("click")}});return c},buildVheaderTable:function(a){var c=$("<table>").css("margin","0.2em"),d=$("<tr>").addClass("header").append($("<td>").addClass("vheader").attr("rowspan",a.labels.length+
|
||||
1).append($("<span>").text(a.vheader))),b=[];d.append($("<td>"));for(var e in a.labels)b.push($("<tr>").append($("<td>").html(""==a.labels[e]?" ":a.labels[e]+":")));for(var h in a.content)for(e in d.append($("<td>").html(a.content[h].header)),a.content[h].body)b[e].append($("<td>").html(a.content[h].body[e]));c.append($("<tbody>").append(d).append(b));return c},plot:{addGraph:function(a,c){var d={id:a.id,xaxis:a.xaxis,datasets:[],elements:{cont:$("<div>").addClass("graph"),plot:$("<div>").addClass("plot"),
|
||||
legend:$("<div>").addClass("legend").attr("draggable","true")}};UI.draggable(d.elements.legend);d.elements.cont.append(d.elements.plot).append(d.elements.legend);c.append(d.elements.cont);return d},go:function(a){if(!(1>Object.keys(a).length)){var c={totals:[],clients:[]},d;for(d in a)for(var b in a[d].datasets){var e=a[d].datasets[b];switch(e.datatype){case "clients":case "upbps":case "downbps":switch(e.origin[0]){case "total":c.totals.push({fields:[e.datatype],end:-15});break;case "stream":c.totals.push({fields:[e.datatype],
|
||||
streams:[e.origin[1]],end:-15});break;case "protocol":c.totals.push({fields:[e.datatype],protocols:[e.origin[1]],end:-15})}break;case "cpuload":case "memload":c.capabilities={}}}0==c.totals.length&&delete c.totals;0==c.clients.length&&delete c.clients;mist.send(function(){for(var c in a){var b=a[c];if(1>b.datasets.length){b.elements.plot.html("");b.elements.legend.html("");break}switch(b.xaxis){case "time":var d=[];b.yaxes={};var e=[],o;for(o in b.datasets){var i=b.datasets[o];i.display&&(i.getdata(),
|
||||
i.yaxistype in b.yaxes||(d.push(UI.plot.yaxes[i.yaxistype]),b.yaxes[i.yaxistype]=d.length),i.yaxis=b.yaxes[i.yaxistype],e.push(i))}d[0]&&(d[0].color=0);b.plot=$.plot(b.elements.plot,e,{legend:{show:!1},xaxis:UI.plot.xaxes[b.xaxis],yaxes:d,grid:{hoverable:!0,borderWidth:{top:0,right:0,bottom:1,left:1},color:"black",backgroundColor:{colors:["rgba(0,0,0,0)","rgba(0,0,0,0.025)"]}},crosshair:{mode:"x"}});d=$("<table>").addClass("legend-list").addClass("nolay").html($("<tr>").html($("<td>").html($("<h3>").text(b.id))).append($("<td>").css("padding-right",
|
||||
streams:[e.origin[1]],end:-15});break;case "protocol":c.totals.push({fields:[e.datatype],protocols:[e.origin[1]],end:-15})}break;case "cpuload":case "memload":c.capabilities={}}}0==c.totals.length&&delete c.totals;0==c.clients.length&&delete c.clients;mist.send(function(){for(var c in a){var b=a[c];if(1>b.datasets.length){b.elements.plot.html("");b.elements.legend.html("");break}switch(b.xaxis){case "time":var d=[];b.yaxes={};var e=[],o;for(o in b.datasets){var l=b.datasets[o];l.display&&(l.getdata(),
|
||||
l.yaxistype in b.yaxes||(d.push(UI.plot.yaxes[l.yaxistype]),b.yaxes[l.yaxistype]=d.length),l.yaxis=b.yaxes[l.yaxistype],e.push(l))}d[0]&&(d[0].color=0);b.plot=$.plot(b.elements.plot,e,{legend:{show:!1},xaxis:UI.plot.xaxes[b.xaxis],yaxes:d,grid:{hoverable:!0,borderWidth:{top:0,right:0,bottom:1,left:1},color:"black",backgroundColor:{colors:["rgba(0,0,0,0)","rgba(0,0,0,0.025)"]}},crosshair:{mode:"x"}});d=$("<table>").addClass("legend-list").addClass("nolay").html($("<tr>").html($("<td>").html($("<h3>").text(b.id))).append($("<td>").css("padding-right",
|
||||
"2em").css("text-align","right").html($("<span>").addClass("value")).append($("<button>").data("opts",b).text("X").addClass("close").click(function(){var c=$(this).data("opts");if(confirm("Are you sure you want to remove "+c.id+"?")){c.elements.cont.remove();var b=$(".graph_ids option:contains("+c.id+")"),d=b.parent();b.remove();UI.plot.del(c.id);delete a[c.id];d.trigger("change");UI.plot.go(a)}}))));b.elements.legend.html(d);var u=function(a){var c=b.elements.legend.find(".value"),d=1;if(typeof a==
|
||||
"undefined")c.eq(0).html("Latest:");else{var e=b.plot.getXAxes()[0],a=Math.min(e.max,a),a=Math.max(e.min,a);c.eq(0).html(UI.format.time(a/1E3))}for(var g in b.datasets){var f=" ";if(b.datasets[g].display){var e=UI.plot.yaxes[b.datasets[g].yaxistype].tickFormatter,h=b.datasets[g].data;if(a)for(var i in h){if(h[i][0]==a){f=e(h[i][1]);break}if(h[i][0]>a){if(i!=0){f=h[i];h=h[i-1];f=e(f[1]+(a-f[0])*(h[1]-f[1])/(h[0]-f[0]))}break}}else f=e(b.datasets[g].data[b.datasets[g].data.length-1][1])}c.eq(d).html(f);
|
||||
"undefined")c.eq(0).html("Latest:");else{var e=b.plot.getXAxes()[0],a=Math.min(e.max,a),a=Math.max(e.min,a);c.eq(0).html(UI.format.time(a/1E3))}for(var g in b.datasets){var f=" ";if(b.datasets[g].display){var e=UI.plot.yaxes[b.datasets[g].yaxistype].tickFormatter,h=b.datasets[g].data;if(a)for(var l in h){if(h[l][0]==a){f=e(h[l][1]);break}if(h[l][0]>a){if(l!=0){f=h[l];h=h[l-1];f=e(f[1]+(a-f[0])*(h[1]-f[1])/(h[0]-f[0]))}break}}else f=e(b.datasets[g].data[b.datasets[g].data.length-1][1])}c.eq(d).html(f);
|
||||
d++}};b.plot.getOptions();for(o in b.datasets)e=$("<input>").attr("type","checkbox").data("index",o).data("graph",b).click(function(){var a=$(this).data("graph");$(this).is(":checked")?a.datasets[$(this).data("index")].display=true:a.datasets[$(this).data("index")].display=false;var c={};c[a.id]=a;UI.plot.go(c)}),b.datasets[o].display&&e.attr("checked","checked"),d.append($("<tr>").html($("<td>").html($("<label>").html(e).append($("<div>").addClass("series-color").css("background-color",b.datasets[o].color)).append(b.datasets[o].label))).append($("<td>").css("padding-right",
|
||||
"2em").css("text-align","right").html($("<span>").addClass("value")).append($("<button>").text("X").addClass("close").data("index",o).data("graph",b).click(function(){var c=$(this).data("index"),b=$(this).data("graph");if(confirm("Are you sure you want to remove "+b.datasets[c].label+" from "+b.id+"?")){b.datasets.splice(c,1);if(b.datasets.length==0){b.elements.cont.remove();var c=$(".graph_ids option:contains("+b.id+")"),d=c.parent();c.remove();d.trigger("change");UI.plot.del(b.id);delete a[b.id];
|
||||
UI.plot.go(a)}else{UI.plot.save(b);c={};c[b.id]=b;UI.plot.go(c)}}}))));u();var f=!1;b.elements.plot.on("plothover",function(a,c,b){if(c.x!=f){u(c.x);f=c.x}if(b){a=$("<span>").append($("<h3>").text(b.series.label).prepend($("<div>").addClass("series-color").css("background-color",b.series.color))).append($("<table>").addClass("nolay").html($("<tr>").html($("<td>").text("Time:")).append($("<td>").html(UI.format.dateTime(b.datapoint[0]/1E3,"long")))).append($("<tr>").html($("<td>").text("Value:")).append($("<td>").html(b.series.yaxis.tickFormatter(b.datapoint[1],
|
||||
|
@ -78,9 +78,9 @@ return false}],help:"Enter your desired password. In the future, you will need t
|
|||
label:"Create new account","function":function(){mist.send(function(){UI.navto("Account created")},{authorize:{new_username:mist.user.name,new_password:mist.user.rawpassword}});mist.user.password=MD5(mist.user.rawpassword);delete mist.user.rawpassword}}]}]));break;case "Account created":UI.elements.menu.addClass("hide");d.append($("<p>").text("Your account has been created succesfully.")).append(UI.buildUI([{type:"text",text:"Would you like to enable all (currently) available protocols with their default settings?"},
|
||||
{type:"buttons",buttons:[{label:"Enable protocols",type:"save","function":function(){if(mist.data.config.protocols)d.append("Unable to enable all protocols as protocol settings already exist.<br>");else{d.append("Retrieving available protocols..<br>");mist.send(function(a){var c=[],b;for(b in a.capabilities.connectors)if(a.capabilities.connectors[b].required)d.append('Could not enable protocol "'+b+'" because it has required settings.<br>');else{c.push({connector:b});d.append('Enabled protocol "'+
|
||||
b+'".<br>')}d.append("Saving protocol settings..<br>");mist.send(function(){d.append("Protocols enabled. Redirecting..");setTimeout(function(){UI.navto("Overview")},5E3)},{config:{protocols:c}})},{capabilities:true})}}},{label:"Skip",type:"cancel","function":function(){UI.navto("Overview")}}]}]));break;case "Overview":if("undefined"==typeof mist.data.bandwidth){mist.send(function(){UI.navto(a)},{bandwidth:!0});d.append("Loading..");return}var g=$("<span>").text("Loading.."),q=$("<span>"),o=$("<span>").addClass("logs"),
|
||||
i=$("<span>"),u=$("<span>"),f=$("<span>").text("Unknown"),j=$("<span>"),l=$("<span>");e={serverid:mist.data.config.serverid,debug:mist.data.config.debug,accesslog:mist.data.config.accesslog,prometheus:mist.data.config.prometheus};var k={};"bandwidth"in mist.data&&(k=mist.data.bandwidth,null==k&&(k={}),k.limit||(k.limit=""));var I=$("<select>").html($("<option>").val(1).text("bytes/s")).append($("<option>").val(1024).text("KiB/s")).append($("<option>").val(1048576).text("MiB/s")).append($("<option>").val(1073741824).text("GiB/s")),
|
||||
l=$("<span>"),u=$("<span>"),f=$("<span>").text("Unknown"),j=$("<span>"),i=$("<span>");e={serverid:mist.data.config.serverid,debug:mist.data.config.debug,accesslog:mist.data.config.accesslog,prometheus:mist.data.config.prometheus};var k={};"bandwidth"in mist.data&&(k=mist.data.bandwidth,null==k&&(k={}),k.limit||(k.limit=""));var I=$("<select>").html($("<option>").val(1).text("bytes/s")).append($("<option>").val(1024).text("KiB/s")).append($("<option>").val(1048576).text("MiB/s")).append($("<option>").val(1073741824).text("GiB/s")),
|
||||
b=parseURL(mist.user.host),b=b.protocol+b.host+b.port;d.append(UI.buildUI([{type:"help",help:"You can find most basic information about your MistServer here.<br>You can also set the debug level and force a save to the config.json file that MistServer uses to save your settings. "},{type:"span",label:"Version",pointer:{main:mist.data.config,index:"version"}},{type:"span",label:"Version check",value:g,LTSonly:!0},{type:"span",label:"Server time",value:u},{type:"span",label:"Licensed to",value:"license"in
|
||||
mist.data.config?mist.data.config.license.user:"",LTSonly:!0},{type:"span",label:"Active products",value:f,LTSonly:!0},{type:"span",label:"Configured streams",value:mist.data.streams?Object.keys(mist.data.streams).length:0},{type:"span",label:"Active streams",value:q},{type:"span",label:"Current connections",value:i},{type:"span",label:"Enabled protocols",value:j},{type:"span",label:"Disabled protocols",value:l},{type:"span",label:"Recent problems",value:o},$("<br>"),{type:"str",label:"Human readable name",
|
||||
mist.data.config?mist.data.config.license.user:"",LTSonly:!0},{type:"span",label:"Active products",value:f,LTSonly:!0},{type:"span",label:"Configured streams",value:mist.data.streams?Object.keys(mist.data.streams).length:0},{type:"span",label:"Active streams",value:q},{type:"span",label:"Current connections",value:l},{type:"span",label:"Enabled protocols",value:j},{type:"span",label:"Disabled protocols",value:i},{type:"span",label:"Recent problems",value:o},$("<br>"),{type:"str",label:"Human readable name",
|
||||
pointer:{main:e,index:"serverid"},help:"You can name your MistServer here for personal use. You'll still need to set host name within your network yourself."},{type:"debug",label:"Debug level",pointer:{main:e,index:"debug"},help:"You can set the amount of debug information MistServer saves in the log. A full reboot of MistServer is required before some components of MistServer can post debug information."},{type:"selectinput",label:"Access log",selectinput:[["","Do not track"],["LOG","Log to MistServer log"],
|
||||
[{type:"str",label:"Path",LTSonly:!0},"Log to file"]],pointer:{main:e,index:"accesslog"},help:"Enable access logs.",LTSonly:!0},{type:"selectinput",label:"Prometheus stats output",selectinput:[["","Disabled"],[{type:"str",label:"Passphrase",LTSonly:!0},"Enabled"]],pointer:{main:e,index:"prometheus"},help:"Make stats available in Prometheus format. These can be accessed via "+b+"/PASSPHRASE or "+b+"/PASSPHRASE.json.",LTSonly:!0},{type:"selectinput",label:"Load balancer bandwidth limit",selectinput:[["",
|
||||
"Default (1 gbps)"],[{label:"Custom",type:"int",min:0,unit:I},"Custom"]],pointer:{main:k,index:"limit"},help:"This setting only applies when MistServer is combined with a load balancer. This is the amount of traffic this server is willing to handle.",LTSonly:!0},{type:"inputlist",label:"Load balancer bandwidth exceptions",pointer:{main:k,index:"exceptions"},help:"This setting only applies when MistServer is combined with a load balancer. Data sent to the hosts and subnets listed here will not count towards reported bandwidth usage.<br>Examples:<ul><li>192.168.0.0/16</li><li>localhost</li><li>10.0.0.0/8</li><li>fe80::/16</li></ul>",
|
||||
|
@ -89,9 +89,9 @@ LTSonly:!0},{type:"checkbox",label:"Force configurations save",pointer:{main:e,i
|
|||
5E3)}else if(a.update.error)g.addClass("red").text(a.update.error);else if(a.update.uptodate)g.text("Your version is up to date.").addClass("green");else if(a.update.progress){g.addClass("orange").removeClass("red").text("Updating..");c(a)}else g.addClass("red").text("Version outdated!").append($("<button>").text("Update").css({"font-size":"1em","margin-left":"1em"}).click(function(){if(confirm("Are you sure you want to execute a rolling update?")){g.addClass("orange").removeClass("red").text("Rolling update command sent..");
|
||||
mist.send(function(a){c(a)},{autoupdate:true})}}))};ia(mist.data);if("license"in mist.data.config){if("active_products"in mist.data.config.license&&Object.keys(mist.data.config.license.active_products).length){var J=$("<table>").css("text-indent","0");f.html(J);J.append($("<tr>").append($("<th>").append("Product")).append($("<th>").append("Updates until")).append($("<th>").append("Use until")).append($("<th>").append("Max. simul. instances")));for(h in mist.data.config.license.active_products)b=mist.data.config.license.active_products[h],
|
||||
J.append($("<tr>").append($("<td>").append(b.name)).append($("<td>").append(b.updates_final?b.updates_final:"∞")).append($("<td>").append(b.use_final?b.use_final:"∞")).append($("<td>").append(b.amount?b.amount:"∞")))}else f.text("None. ");f.append($("<a>").text("More details").attr("href","https://shop.mistserver.org/myinvoices").attr("target","_blank"))}}else g.text("");h=function(){var a={totals:{fields:["clients"],start:-10},active_streams:true};if(!("cabailities"in mist.data))a.capabilities=
|
||||
true;mist.send(function(){ja()},a)};var ja=function(){q.text("active_streams"in mist.data?mist.data.active_streams?mist.data.active_streams.length:0:"?");if("totals"in mist.data&&"all_streams"in mist.data.totals)var a=mist.data.totals.all_streams.all_protocols.clients,a=a.length?UI.format.number(a[a.length-1][1]):0;else a="Loading..";i.text(a);u.text(UI.format.dateTime(mist.data.config.time,"long"));o.html("");a=0;"license"in mist.data.config&&"user_msg"in mist.data.config.license&&mist.data.log.unshift([mist.data.config.license.time,
|
||||
true;mist.send(function(){ja()},a)};var ja=function(){q.text("active_streams"in mist.data?mist.data.active_streams?mist.data.active_streams.length:0:"?");if("totals"in mist.data&&"all_streams"in mist.data.totals)var a=mist.data.totals.all_streams.all_protocols.clients,a=a.length?UI.format.number(a[a.length-1][1]):0;else a="Loading..";l.text(a);u.text(UI.format.dateTime(mist.data.config.time,"long"));o.html("");a=0;"license"in mist.data.config&&"user_msg"in mist.data.config.license&&mist.data.log.unshift([mist.data.config.license.time,
|
||||
"ERROR",mist.data.config.license.user_msg]);for(var c in mist.data.log){var b=mist.data.log[c];if(["FAIL","ERROR"].indexOf(b[1])>-1){a++;var d=$("<span>").addClass("content").addClass("red"),e=b[2].split("|");for(c in e)d.append($("<span>").text(e[c]));o.append($("<div>").append($("<span>").append(UI.format.time(b[0]))).append(d));if(a==5)break}}a==0&&o.html("None.");a=[];b=[];for(c in mist.data.config.protocols){d=mist.data.config.protocols[c];a.indexOf(d.connector)>-1||a.push(d.connector)}j.text(a.length?
|
||||
a.join(", "):"None.");if("capabilities"in mist.data){for(c in mist.data.capabilities.connectors)a.indexOf(c)==-1&&b.push(c);l.text(b.length?b.join(", "):"None.")}else l.text("Loading..")};h();ja();UI.interval.set(h,3E4);break;case "Protocols":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a)},{capabilities:!0});d.append("Loading..");return}var y=$("<tbody>");d.append(UI.buildUI([{type:"help",help:"You can find an overview of all the protocols and their relevant information here. You can add, edit or delete protocols."}])).append($("<button>").text("Delete all protocols").click(function(){if(confirm("Are you sure you want to delete all currently configured protocols?")){mist.data.config.protocols=
|
||||
a.join(", "):"None.");if("capabilities"in mist.data){for(c in mist.data.capabilities.connectors)a.indexOf(c)==-1&&b.push(c);i.text(b.length?b.join(", "):"None.")}else i.text("Loading..")};h();ja();UI.interval.set(h,3E4);break;case "Protocols":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a)},{capabilities:!0});d.append("Loading..");return}var y=$("<tbody>");d.append(UI.buildUI([{type:"help",help:"You can find an overview of all the protocols and their relevant information here. You can add, edit or delete protocols."}])).append($("<button>").text("Delete all protocols").click(function(){if(confirm("Are you sure you want to delete all currently configured protocols?")){mist.data.config.protocols=
|
||||
[];mist.send(function(){UI.navto("Protocols")},{config:mist.data.config})}})).append($("<button>").text("Enable default protocols").click(function(){var a=Object.keys(mist.data.capabilities.connectors),c;for(c in mist.data.config.protocols){var b=a.indexOf(mist.data.config.protocols[c].connector);b>-1&&a.splice(b,1)}var d=[];for(c in a)(!("required"in mist.data.capabilities.connectors[a[c]])||Object.keys(mist.data.capabilities.connectors[a[c]].required).length==0)&&d.push(a[c]);b="Click OK to enable disabled protocols with their default settings:\n ";
|
||||
b=d.length?b+d.join(", "):b+"None.";if(d.length!=a.length){a=a.filter(function(a){return d.indexOf(a)<0});b=b+("\n\nThe following protocols can only be set manually:\n "+a.join(", "))}if(confirm(b)&&d.length){for(c in d)mist.data.config.protocols.push({connector:d[c]});mist.send(function(){UI.navto("Protocols")},{config:mist.data.config})}})).append("<br>").append($("<button>").text("New protocol").click(function(){UI.navto("Edit Protocol")}).css("clear","both")).append($("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Protocol")).append($("<th>").text("Status")).append($("<th>").text("Settings")).append($("<th>")))).append(y));
|
||||
var ka=function(){function a(c){var b=mist.data.capabilities.connectors[c.connector];if(!b)return"";var d=[],e=["required","optional"],g;for(g in e)for(var z in b[e[g]])c[z]&&c[z]!=""?d.push(z+": "+c[z]):b[e[g]][z]["default"]&&d.push(z+": "+b[e[g]][z]["default"]);return $("<span>").addClass("description").text(d.join(", "))}y.html("");for(var c in mist.data.config.protocols){var b=mist.data.config.protocols[c];y.append($("<tr>").data("index",c).append($("<td>").text(b.connector)).append($("<td>").html(UI.format.status(b))).append($("<td>").html(a(b))).append($("<td>").css("text-align",
|
||||
|
@ -102,13 +102,13 @@ a.append($("<span>").addClass("red").text("(Not yet configured)"))}b.unshift({ty
|
|||
type:"select",select:s,"function":function(){$(this).getval()!=""&&K.html(la($(this).getval()))}}])).append(K)}break;case "Streams":if(!("capabilities"in mist.data)){d.html("Loading..");mist.send(function(){UI.navto(a)},{capabilities:!0});return}h=$("<button>");var E=$("<span>").text("Loading..");d.append(UI.buildUI([{type:"help",help:"Here you can create, edit or delete new and existing streams. Go to stream preview or embed a video player on your website."},$("<div>").css({width:"45.25em",display:"flex",
|
||||
"justify-content":"flex-end"}).append(h).append($("<button>").text("Create a new stream").click(function(){UI.navto("Edit")}))])).append(E);""==c&&(e=mist.stored.get(),"viewmode"in e&&(c=e.viewmode));h.text("Switch to "+("thumbnails"==c?"list":"thumbnail")+" view").click(function(){mist.stored.set("viewmode",c=="thumbnails"?"list":"thumbnails");UI.navto("Streams",c=="thumbnails"?"list":"thumbnails")});var x=$.extend(!0,{},mist.data.streams),W=function(a,c){var b=$.extend({},c);delete b.meta;delete b.error;
|
||||
b.online=2;b.name=a;b.ischild=true;return b},Y=function(c,b,e){E.remove();switch(c){case "thumbnails":var g=$("<div>").addClass("preview_icons"),f;f=e||[];b.sort();b.unshift("");E.remove();d.append($("<h2>").text(a)).append(UI.buildUI([{label:"Filter the streams",type:"datalist",datalist:b,pointer:{main:{},index:"stream"},help:"If you type something here, the box below will only show streams with names that contain your text.","function":function(){var a=$(this).val();g.children().each(function(){$(this).hide();
|
||||
$(this).attr("data-stream").indexOf(a)>-1&&$(this).show()})}}]));b.shift();d.append($("<span>").addClass("description").text("Choose a stream below.")).append(g);for(var h in b){var c=b[h],j="",k=$("<button>").text("Delete").click(function(){var a=$(this).closest("div").attr("data-stream");if(confirm('Are you sure you want to delete the stream "'+a+'"?')){delete mist.data.streams[a];var c={};c.deletestream=[a];mist.send(function(){UI.navto("Streams")},c)}}),l=$("<button>").text("Settings").click(function(){UI.navto("Edit",
|
||||
$(this).closest("div").attr("data-stream"))}),e=$("<button>").text("Preview").click(function(){UI.navto("Preview",$(this).closest("div").attr("data-stream"))}),i=$("<button>").text("Embed").click(function(){UI.navto("Embed",$(this).closest("div").attr("data-stream"))}),X=$("<span>").addClass("image");if(c.indexOf("+")>-1){j=c.split("+");j=mist.data.streams[j[0]].source+j[1];l=k="";X.addClass("wildcard")}else{j=mist.data.streams[c].source;if(f.indexOf(c)>-1){i=e="";X.addClass("folder")}}g.append($("<div>").append($("<span>").addClass("streamname").text(c)).append(X).append($("<span>").addClass("description").text(j)).append($("<span>").addClass("button_container").append(l).append(k).append(e).append(i)).attr("title",
|
||||
c).attr("data-stream",c))}break;default:var m=$("<tbody>").append($("<tr>").append("<td>").attr("colspan",6).text("Loading.."));h=$("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Stream name").attr("data-sort-type","string").addClass("sorting-asc")).append($("<th>").text("Source").attr("data-sort-type","string")).append($("<th>").text("Status").attr("data-sort-type","int")).append($("<th>").css("text-align","right").text("Connections").attr("data-sort-type","int")).append($("<th>")).append($("<th>")))).append(m);
|
||||
d.append(h);h.stupidtable();var n=function(){var a=[],c;for(c in mist.data.active_streams)a.push({streams:[mist.data.active_streams[c]],fields:["clients"],start:-2});mist.send(function(){$.extend(true,x,mist.data.streams);var a=0;m.html("");b.sort();for(var c in b){var d=b[c],e;e=d in mist.data.streams?mist.data.streams[d]:x[d];var g=$("<td>").css("text-align","right").html($("<span>").addClass("description").text("Loading..")),f=0;if(typeof mist.data.totals!="undefined"&&typeof mist.data.totals[d]!=
|
||||
$(this).attr("data-stream").indexOf(a)>-1&&$(this).show()})}}]));b.shift();d.append($("<span>").addClass("description").text("Choose a stream below.")).append(g);for(var h in b){var c=b[h],j="",k=$("<button>").text("Delete").click(function(){var a=$(this).closest("div").attr("data-stream");if(confirm('Are you sure you want to delete the stream "'+a+'"?')){delete mist.data.streams[a];var c={};c.deletestream=[a];mist.send(function(){UI.navto("Streams")},c)}}),m=$("<button>").text("Settings").click(function(){UI.navto("Edit",
|
||||
$(this).closest("div").attr("data-stream"))}),e=$("<button>").text("Preview").click(function(){UI.navto("Preview",$(this).closest("div").attr("data-stream"))}),i=$("<button>").text("Embed").click(function(){UI.navto("Embed",$(this).closest("div").attr("data-stream"))}),X=$("<span>").addClass("image");if(c.indexOf("+")>-1){j=c.split("+");j=mist.data.streams[j[0]].source+j[1];m=k="";X.addClass("wildcard")}else{j=mist.data.streams[c].source;if(f.indexOf(c)>-1){i=e="";X.addClass("folder")}}g.append($("<div>").append($("<span>").addClass("streamname").text(c)).append(X).append($("<span>").addClass("description").text(j)).append($("<span>").addClass("button_container").append(m).append(k).append(e).append(i)).attr("title",
|
||||
c).attr("data-stream",c))}break;default:var l=$("<tbody>").append($("<tr>").append("<td>").attr("colspan",6).text("Loading.."));h=$("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Stream name").attr("data-sort-type","string").addClass("sorting-asc")).append($("<th>").text("Source").attr("data-sort-type","string")).append($("<th>").text("Status").attr("data-sort-type","int")).append($("<th>").css("text-align","right").text("Connections").attr("data-sort-type","int")).append($("<th>")).append($("<th>")))).append(l);
|
||||
d.append(h);h.stupidtable();var n=function(){var a=[],c;for(c in mist.data.active_streams)a.push({streams:[mist.data.active_streams[c]],fields:["clients"],start:-2});mist.send(function(){$.extend(true,x,mist.data.streams);var a=0;l.html("");b.sort();for(var c in b){var d=b[c],e;e=d in mist.data.streams?mist.data.streams[d]:x[d];var g=$("<td>").css("text-align","right").html($("<span>").addClass("description").text("Loading..")),f=0;if(typeof mist.data.totals!="undefined"&&typeof mist.data.totals[d]!=
|
||||
"undefined"){var h=mist.data.totals[d].all_protocols.clients,f=0;if(h.length){for(a in h)f=f+h[a][1];f=Math.round(f/h.length)}}g.html(UI.format.number(f));if(f==0&&e.online==1)e.online=2;f=$("<td>").css("text-align","right").css("white-space","nowrap");(!("ischild"in e)||!e.ischild)&&f.html($("<button>").text("Settings").click(function(){UI.navto("Edit",$(this).closest("tr").data("index"))})).append($("<button>").text("Delete").click(function(){var a=$(this).closest("tr").data("index");if(confirm('Are you sure you want to delete the stream "'+
|
||||
a+'"?')){delete mist.data.streams[a];var c={};mist.data.LTS?c.deletestream=[a]:c.streams=mist.data.streams;mist.send(function(){UI.navto("Streams")},c)}}));h=$("<span>").text(d);e.ischild&&h.css("padding-left","1em");var z=UI.format.status(e),j=$("<button>").text("Preview").click(function(){UI.navto("Preview",$(this).closest("tr").data("index"))}),k=$("<button>").text("Embed").click(function(){UI.navto("Embed",$(this).closest("tr").data("index"))});if("filesfound"in x[d]){z.html("");j="";g.html("");
|
||||
k=""}m.append($("<tr>").data("index",d).html($("<td>").html(h).attr("title",d).addClass("overflow_ellipsis")).append($("<td>").text(e.source).attr("title",e.source).addClass("description").addClass("overflow_ellipsis").css("max-width","20em")).append($("<td>").data("sort-value",e.online).html(z)).append(g).append($("<td>").css("white-space","nowrap").html(j).append(k)).append(f));a++}},{totals:a,active_streams:true})};if(mist.data.LTS){var o=0,p=0;for(f in mist.data.streams){h=mist.data.capabilities.inputs.Folder||
|
||||
k=""}l.append($("<tr>").data("index",d).html($("<td>").html(h).attr("title",d).addClass("overflow_ellipsis")).append($("<td>").text(e.source).attr("title",e.source).addClass("description").addClass("overflow_ellipsis").css("max-width","20em")).append($("<td>").data("sort-value",e.online).html(z)).append(g).append($("<td>").css("white-space","nowrap").html(j).append(k)).append(f));a++}},{totals:a,active_streams:true})};if(mist.data.LTS){var o=0,p=0;for(f in mist.data.streams){h=mist.data.capabilities.inputs.Folder||
|
||||
mist.data.capabilities.inputs["Folder.exe"];if(!h)break;if(mist.inputMatch(h.source_match,mist.data.streams[f].source)){x[f].source=x[f].source+"*";x[f].filesfound=null;mist.send(function(a,c){var b=c.stream,d;for(d in a.browse.files)for(var e in mist.data.capabilities.inputs)if(!(e.indexOf("Buffer")>=0||e.indexOf("Buffer.exe")>=0||e.indexOf("Folder")>=0||e.indexOf("Folder.exe")>=0)&&mist.inputMatch(mist.data.capabilities.inputs[e].source_match,"/"+a.browse.files[d])){var g=b+"+"+a.browse.files[d];
|
||||
x[g]=W(g,mist.data.streams[b]);x[g].source=mist.data.streams[b].source+a.browse.files[d]}"files"in a.browse&&a.browse.files.length?x[b].filesfound=true:mist.data.streams[b].filesfound=false;p++;if(o==p){mist.send(function(){n()},{active_streams:true});UI.interval.set(function(){n()},5E3)}},{browse:mist.data.streams[f].source},{stream:f});o++}}if(o==0){mist.send(function(){n()},{active_streams:true});UI.interval.set(function(){n()},5E3)}}else{mist.send(function(){n()},{active_streams:true});UI.interval.set(function(){n()},
|
||||
5E3)}}};if(mist.data.LTS){var Z=0,ma=0,s={},na=[];for(e in mist.data.streams)if(mist.inputMatch((mist.data.capabilities.inputs.Folder||mist.data.capabilities.inputs["Folder.exe"]).source_match,mist.data.streams[e].source))na.push(e),mist.send(function(a,b){var d=b.stream,e;for(e in a.browse.files)for(var g in mist.data.capabilities.inputs)g.indexOf("Buffer")>=0||g.indexOf("Folder")>=0||mist.inputMatch(mist.data.capabilities.inputs[g].source_match,"/"+a.browse.files[e])&&(s[d+"+"+a.browse.files[e]]=
|
||||
|
@ -116,11 +116,11 @@ true);ma++;Z==ma&&mist.send(function(){for(var a in mist.data.active_streams){va
|
|||
mist.data.active_streams[a].split("+");if(b.length>1&&b[0]in mist.data.streams){s[mist.data.active_streams[a]]=true;x[mist.data.active_streams[a]]=W(mist.data.active_streams[a],mist.data.streams[b[0]])}}s=Object.keys(s);mist.data.streams&&(s=s.concat(Object.keys(mist.data.streams)));s.sort();Y(c,s)},{active_streams:!0})}else Y(c,Object.keys(mist.data.streams));break;case "Edit":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,c)},{capabilities:!0});d.append("Loading..");
|
||||
return}D=!1;""!=c&&(D=!0);D?(f=c,n=mist.data.streams[f],d.find("h2").append(' "'+f+'"')):(d.html($("<h2>").text("New Stream")),n={});f=[];for(h in mist.data.capabilities.inputs)f.push(mist.data.capabilities.inputs[h].source_match);var R=$("<div>"),oa=function(a){var b={};if(!mist.data.streams)mist.data.streams={};mist.data.streams[n.name]=n;c!=n.name&&delete mist.data.streams[c];b.addstream={};b.addstream[n.name]=n;if(c!=n.name)b.deletestream=[c];if(n.stop_sessions&&c!=""){b.stop_sessions=c;delete n.stop_sessions}mist.send(function(){delete mist.data.streams[n.name].online;
|
||||
delete mist.data.streams[n.name].error;UI.navto(a,a=="Preview"?n.name:"")},b)},pa=$("<style>").text("button.saveandpreview { display: none; }"),F=$("<span>"),aa=function(){var a=d.find("[name=name]").val();if(a){var c=parseURL(mist.user.host),b=d.find("[name=source]").val(),e=b.match(/@.*/);e&&(e=e[0].substring(1));var g=b.replace(/(?:.+?):\/\//,""),g=g.split("/"),g=g[0],g=g.split(":"),g=g[0];(b=b.match(/:\d+/))&&(b=b[0]);var f={},h=["RTMP","RTSP","RTMP.exe","RTSP.exe"],j;for(j in h)h[j]in mist.data.capabilities.connectors&&
|
||||
(f[h[j]]=mist.data.capabilities.connectors[h[j]].optional.port["default"]);var h={RTMP:1935,"RTMP.exe":1935,RTSP:554,"RTSP.exe":554,TS:-1,"TS.exe":-1},k;for(k in f){for(j in mist.data.config.protocols){var l=mist.data.config.protocols[j];if(l.connector==k){if("port"in l)f[k]=l.port;break}}f[k]=f[k]==h[k]?"":":"+f[k]}f.TS="";f["TS.exe"]="";F.find(".field").closest("label").hide();for(j in f){var i;k=b?b:f[j];switch(j){case "RTMP":case "RTMP.exe":i="rtmp://"+c.host+k+"/"+(e?e:"live")+"/";F.find(".field.RTMPurl").setval(i).closest("label").show();
|
||||
(f[h[j]]=mist.data.capabilities.connectors[h[j]].optional.port["default"]);var h={RTMP:1935,"RTMP.exe":1935,RTSP:554,"RTSP.exe":554,TS:-1,"TS.exe":-1},k;for(k in f){for(j in mist.data.config.protocols){var m=mist.data.config.protocols[j];if(m.connector==k){if("port"in m)f[k]=m.port;break}}f[k]=f[k]==h[k]?"":":"+f[k]}f.TS="";f["TS.exe"]="";F.find(".field").closest("label").hide();for(j in f){var i;k=b?b:f[j];switch(j){case "RTMP":case "RTMP.exe":i="rtmp://"+c.host+k+"/"+(e?e:"live")+"/";F.find(".field.RTMPurl").setval(i).closest("label").show();
|
||||
F.find(".field.RTMPkey").setval(a==""?"STREAMNAME":a).closest("label").show();i=i+(a==""?"STREAMNAME":a);break;case "RTSP":case "RTSP.exe":i="rtsp://"+c.host+k+"/"+(a==""?"STREAMNAME":a)+(e?"?pass="+e:"");break;case "TS":case "TS.exe":i="udp://"+(g==""?c.host:g)+k+"/"}F.find(".field."+j.replace(".exe","")).setval(i).closest("label").show()}}};d.append(UI.buildUI([{label:"Stream name",type:"str",validate:["required","streamname"],pointer:{main:n,index:"name"},help:"Set the name this stream will be recognised by for players and/or stream pushing."},
|
||||
{label:"Source",type:"browse",filetypes:f,pointer:{main:n,index:"source"},help:"<p>Below is the explanation of the input methods for MistServer. Anything between brackets () will go to default settings if not specified.</p><table><tr><td>File input</td><td>Syntax</td><td>Explanation</td></tr><tr><th>File</th><td>Linux/MacOS: /PATH/FILE<br>Windows: /cygdrive/DRIVE/PATH/FILE</td><td>For file input please specify the proper path and file.<br>Supported inputs are: DTSC, FLV, MP3. MistServer Pro has TS, MP4, ISMV added as input.</td></tr><th>Folder<br>(Pro only)</th><td>Linux/MacOS: /PATH/<br>Windows: /cygdrive/DRIVE/PATH/</td><td>A folder stream makes all the recognised files in the selected folder available as a stream.</td></tr><tr><td>Push input</td><td>Syntax</td><td>Explanation</td></tr><tr><th>RTMP</th><td>push://(IP)(@PASSWORD)</td><td>IP is white listed IP for pushing towards MistServer, if left empty all are white listed.<br>PASSWORD is the application under which to push to MistServer, if it doesn't match the stream will be rejected. PASSWORD is MistServer Pro only. <tr><th>RTSP<br>(Pro only)</th><td>push://(IP)(@PASSWORD)</td><td>IP is white listed IP for pushing towards MistServer, if left empty all are white listed.</td></tr> <tr><th>TS<br>(Pro only)</th><td>tsudp://(IP):PORT(/INTERFACE)</td><td>IP is the IP address used to listen for this stream, multi-cast IP range is: 224.0.0.0 - 239.255.255.255. If IP is not set all addresses will listened to.<br>PORT is the port you reserve for this stream on the chosen IP.<br>INTERFACE is the interface used, if left all interfaces will be used.</td></tr><tr><td>Pull input</td><td>Syntax</td><td>Explanation</td></tr><tr><th>DTSC</th><td>dtsc://MISTSERVER_IP:PORT/(STREAMNAME)</td><td>MISTSERVER_IP is the IP of another MistServer to pull from.<br>PORT is the DTSC port of the other MistServer. (default is 4200)<br>STREAMNAME is the name of the target stream on the other MistServer. If left empty, the name of this stream will be used.</td></tr><tr><th>HLS<br>(Pro only)</th><td>http://URL/TO/STREAM.m3u8</td><td>The URL where the HLS stream is available to MistServer.</td></tr></table>",
|
||||
"function":function(){var a=$(this).val();pa.remove();F.html("");if(a!=""){var c=null,b;for(b in mist.data.capabilities.inputs)if(typeof mist.data.capabilities.inputs[b].source_match!="undefined"&&mist.inputMatch(mist.data.capabilities.inputs[b].source_match,a)){c=b;break}if(c===null)R.html($("<h3>").text("Unrecognized input").addClass("red")).append($("<span>").text("Please edit the stream source.").addClass("red"));else{c=mist.data.capabilities.inputs[c];R.html($("<h3>").text(c.name+" Input options"));
|
||||
var e=mist.convertBuildOptions(c,n);"always_match"in mist.data.capabilities.inputs[b]&&mist.inputMatch(mist.data.capabilities.inputs[b].always_match,a)&&e.push({label:"Always on",type:"checkbox",help:"Keep this input available at all times, even when there are no active viewers.",pointer:{main:n,index:"always_on"}});R.append(UI.buildUI(e));if(c.name=="Folder")d.append(pa);else if(["Buffer","Buffer.exe","TS","TS.exe"].indexOf(c.name)>-1){b=[$("<br>"),$("<span>").text("Configure your source to push to:")];
|
||||
{label:"Source",type:"browse",filetypes:f,pointer:{main:n,index:"source"},help:"<p> Below is the explanation of the input methods for MistServer. Anything between brackets () will go to default settings if not specified. </p> <table class=valigntop> <tr> <th colspan=3><b>File inputs</b></th> </tr> <tr> <th>File</th> <td> Linux/MacOS: /PATH/FILE<br> Windows: /cygdrive/DRIVE/PATH/FILE </td> <td> For file input please specify the proper path and file.<br> Supported inputs are: DTSC, FLV, MP3. MistServer Pro has TS, MP4, ISMV added as input. </td> </tr> <th> Folder </th> <td> Linux/MacOS: /PATH/<br> Windows: /cygdrive/DRIVE/PATH/ </td> <td class=LTSonly> A folder stream makes all the recognised files in the selected folder available as a stream. </td> </tr> <tr><td colspan=3> </td></tr> <tr> <th colspan=3><b>Push inputs</b></th> </tr> <tr> <th>RTMP</th> <td>push://(IP)(@PASSWORD)</td> <td> IP is white listed IP for pushing towards MistServer, if left empty all are white listed.<br> PASSWORD is the application under which to push to MistServer, if it doesn't match the stream will be rejected. PASSWORD is MistServer Pro only. </td> </tr> <tr> <th>RTSP</th> <td>push://(IP)(@PASSWORD)</td> <td class=LTSonly>IP is white listed IP for pushing towards MistServer, if left empty all are white listed.</td> </tr> <tr> <th>TS</th> <td>tsudp://(IP):PORT(/INTERFACE)</td> <td class=LTSonly> IP is the IP address used to listen for this stream, multi-cast IP range is: 224.0.0.0 - 239.255.255.255. If IP is not set all addresses will listened to.<br> PORT is the port you reserve for this stream on the chosen IP.<br> INTERFACE is the interface used, if left all interfaces will be used. </td> </tr> <tr><td colspan=3> </td></tr> <tr> <th colspan=3><b>Pull inputs</b></th> </tr> <tr> <th>DTSC</th> <td>dtsc://MISTSERVER_IP:PORT/(STREAMNAME)</td> <td>MISTSERVER_IP is the IP of another MistServer to pull from.<br> PORT is the DTSC port of the other MistServer. (default is 4200)<br> STREAMNAME is the name of the target stream on the other MistServer. If left empty, the name of this stream will be used. </td> </tr> <tr> <th>HLS</th> <td>http://URL/TO/STREAM.m3u8</td> <td class=LTSonly>The URL where the HLS stream is available to MistServer.</td> </tr> <tr> <th>RTSP</th> <td>rtsp://(USER:PASSWORD@)IP(:PORT)(/path)</td> <td class=LTSonly> USER:PASSWORD is the account used if authorization is required.<br> IP is the IP address used to pull this stream from.<br> PORT is the port used to connect through.<br> PATH is the path to be used to identify the correct stream. </td> </tr> </table>".replace(/LTSonly/g,
|
||||
mist.data.LTS?'""':"LTSonly"),"function":function(){var a=$(this).val();pa.remove();F.html("");if(a!=""){var c=null,b;for(b in mist.data.capabilities.inputs)if(typeof mist.data.capabilities.inputs[b].source_match!="undefined"&&mist.inputMatch(mist.data.capabilities.inputs[b].source_match,a)){c=b;break}if(c===null)R.html($("<h3>").text("Unrecognized input").addClass("red")).append($("<span>").text("Please edit the stream source.").addClass("red"));else{c=mist.data.capabilities.inputs[c];R.html($("<h3>").text(c.name+
|
||||
" Input options"));var e=mist.convertBuildOptions(c,n);"always_match"in mist.data.capabilities.inputs[b]&&mist.inputMatch(mist.data.capabilities.inputs[b].always_match,a)&&e.push({label:"Always on",type:"checkbox",help:"Keep this input available at all times, even when there are no active viewers.",pointer:{main:n,index:"always_on"}});R.append(UI.buildUI(e));if(c.name=="Folder")d.append(pa);else if(["Buffer","Buffer.exe","TS","TS.exe"].indexOf(c.name)>-1){b=[$("<br>"),$("<span>").text("Configure your source to push to:")];
|
||||
switch(c.name){case "Buffer":case "Buffer.exe":b.push({label:"RTMP full url",type:"span",clipboard:true,readonly:true,classes:["RTMP"],help:"Use this RTMP url if your client doesn't ask for a stream key"});b.push({label:"RTMP url",type:"span",clipboard:true,readonly:true,classes:["RTMPurl"],help:"Use this RTMP url if your client also asks for a stream key"});b.push({label:"RTMP stream key",type:"span",clipboard:true,readonly:true,classes:["RTMPkey"],help:"Use this key if your client asks for a stream key"});
|
||||
b.push({label:"RTSP",type:"span",clipboard:true,readonly:true,classes:["RTSP"]});break;case "TS":case "TS.exe":a.charAt(0)=="/"?b=[]:b.push({label:"TS",type:"span",clipboard:true,readonly:true,classes:["TS"]})}F.html(UI.buildUI(b));aa()}}}}},{label:"Stop sessions",type:"checkbox",help:"When saving these stream settings, kill this stream's current connections.",LTSonly:!0,pointer:{main:n,index:"stop_sessions"}},F,$("<br>"),{type:"custom",custom:R},$("<br>"),$("<h3>").text("Encryption"),{type:"help",
|
||||
help:"To enable encryption, the licence acquisition url must be entered, as well as either the content key or the key ID and seed.<br>Unsure how you should fill in your encryption or missing your preferred encryption? Please contact us."},{label:"License acquisition url",type:"str",LTSonly:!0,pointer:{main:n,index:"la_url"}},$("<br>"),{label:"Content key",type:"str",LTSonly:!0,pointer:{main:n,index:"contentkey"}},{type:"text",text:" - or - "},{label:"Key ID",type:"str",LTSonly:!0,pointer:{main:n,
|
||||
|
@ -153,21 +153,21 @@ help:"The maximum height this video can use."},{label:"Poster",type:"str",pointe
|
|||
$(this).getval();$(".embed_code").setval(v(p))}},{label:"Preselect tracks",type:"DOMfield",DOMfield:L,help:"Pre-select these tracks."},$("<h3>").text("Protocol stream urls"),ea]));$.ajax({type:"GET",url:H+"json_"+G+".js",success:function(a){var b=[],c=U.find(".forceType"),d;for(d in a.source){var e=a.source[d],f=UI.humanMime(e.type);b.push({label:f?f+" <span class=description>("+e.type+")</span>":UI.format.capital(e.type),type:"str",value:e.url,readonly:true,qrcode:true,clipboard:true});f=UI.humanMime(e.type);
|
||||
c.append($("<option>").text(f?f+" ("+e.type+")":UI.format.capital(e.type)).val(e.type))}ea.html(UI.buildUI(b));L.html("");b={};for(d in a.meta.tracks){c=a.meta.tracks[d];c.type!="audio"&&c.type!="video"||(c.type in b?b[c.type].push([c.trackid,UI.format.capital(c.type)+" track "+(b[c.type].length+1)]):b[c.type]=[["",UI.format.capital(c.type)+" track 1"]])}if(Object.keys(b).length){L.closest("label").show();for(d in b){a=$("<select>").attr("data-type",d).css("flex-grow","1").change(function(){$(this).val()==
|
||||
""?delete p.setTracks[$(this).attr("data-type")]:p.setTracks[$(this).attr("data-type")]=$(this).val();$(".embed_code").setval(v(p))});L.append(a);b[d].push([-1,"No "+d]);for(var g in b[d])a.append($("<option>").val(b[d][g][0]).text(b[d][g][1]));if(d in p.setTracks){a.val(p.setTracks[d]);if(a.val()==null){a.val("");delete p.setTracks[d];$(".embed_code").setval(v(p))}}}}else L.closest("label").hide()},error:function(){ea.html("Error while retrieving stream info.");L.closest("label").hide();p.setTracks=
|
||||
{}}});h=document.createElement("script");h.src=N+"player.js";document.head.appendChild(h);h.onload=function(){var a=U.find(".forcePlayer"),b;for(b in mistplayers)a.append($("<option>").text(mistplayers[b].name).val(b));document.head.removeChild(this)};h.onerror=function(){document.head.removeChild(this)};break;case "Push":var B=$("<div>").text("Loading..");d.append(B);mist.send(function(a){function b(a){setTimeout(function(){mist.send(function(c){var d=false;if("push_list"in c&&c.push_list&&c.push_list.length){var d=
|
||||
{}}});h=document.createElement("script");h.src=N+"player.js";document.head.appendChild(h);h.onload=function(){var a=U.find(".forcePlayer"),b;for(b in mistplayers)a.append($("<option>").text(mistplayers[b].name).val(b));document.head.removeChild(this)};h.onerror=function(){document.head.removeChild(this)};break;case "Push":var C=$("<div>").text("Loading..");d.append(C);mist.send(function(a){function b(a){setTimeout(function(){mist.send(function(c){var d=false;if("push_list"in c&&c.push_list&&c.push_list.length){var d=
|
||||
true,f;for(f in c.push_list)if(a.indexOf(c.push_list[f][0])>-1){d=false;break}}else d=true;if(d)for(f in a)e.find("tr[data-pushid="+a[f]+"]").remove();else b()},{push_list:1})},1E3)}function c(f,g){var h=$("<span>");if(g=="Automatic"&&f.length>=4){h.append($("<span>").text(f[2]));f[3]&&h.append($("<span>").text(", schedule on "+(new Date(f[3]*1E3)).toLocaleString()));f.length>=5&&f[4]&&h.append($("<span>").text(", complete on "+(new Date(f[4]*1E3)).toLocaleString()))}else f.length>=4&&f[2]!=f[3]?
|
||||
h.append($("<span>").text(f[2])).append($("<span>").html("»").addClass("unit").css("margin","0 0.5em")).append($("<span>").text(f[3])):h.append($("<span>").text(f[2]));var i=$("<td>").append($("<button>").text(g=="Automatic"?"Remove":"Stop").click(function(){if(confirm("Are you sure you want to "+$(this).text().toLowerCase()+" this push?\n"+f[1]+" to "+f[2])){var a=$(this).closest("tr");a.html($("<td colspan=99>").html($("<span>").addClass("red").text(g=="Automatic"?"Removing..":"Stopping..")));
|
||||
if(g=="Automatic"){var c=f.slice(1);mist.send(function(){a.remove()},{push_auto_remove:[c]})}else mist.send(function(){b([f[0]])},{push_stop:[f[0]]})}}));if(g=="Automatic"){i.prepend($("<button>").text("Edit").click(function(){UI.navto("Start Push","auto_"+($(this).closest("tr").index()-1))}));i.append($("<button>").text("Stop pushes").click(function(){if(confirm('Are you sure you want to stop all pushes matching \n"'+f[1]+" to "+f[2]+'"?'+(d.wait!=0?"\n\nRetrying is enabled. You'll probably want to set that to 0.":
|
||||
""))){var c=$(this);c.text("Stopping pushes..");var g=[],h;for(h in a.push_list)if(f[1]==a.push_list[h][1]&&f[2]==a.push_list[h][2]){g.push(a.push_list[h][0]);e.find("tr[data-pushid="+a.push_list[h][0]+"]").html($("<td colspan=99>").html($("<span>").addClass("red").text("Stopping..")))}mist.send(function(){c.text("Stop pushes");b(g)},{push_stop:g,push_settings:{wait:0}})}}))}return $("<tr>").attr("data-pushid",f[0]).append($("<td>").text(f[1])).append($("<td>").append(h.children())).append(i)}B.html("");
|
||||
var d=a.push_settings;d||(d={});B.append(UI.buildUI([{type:"help",help:"You can push streams to files or other servers, allowing them to broadcast your stream as well."},$("<h3>").text("Settings"),{label:"Delay before retry",unit:"s",type:"int",min:0,help:"How long the delay should be before MistServer retries an automatic push.<br>If set to 0, it does not retry.","default":0,pointer:{main:d,index:"wait"},LTSonly:1},{label:"Maximum retries",unit:"/s",type:"int",min:0,help:"The maximum amount of retries per second (for all automatic pushes).<br>If set to 0, there is no limit.",
|
||||
"default":0,pointer:{main:d,index:"maxspeed"},LTSonly:1},{type:"buttons",buttons:[{type:"save",label:"Save","function":function(){mist.send(function(){UI.navto("Push")},{push_settings:d})}}]}]));var e=$("<table>").append($("<tr>").append($("<th>").text("Stream")).append($("<th>").text("Target")).append($("<th>"))),f=e.clone();if("push_list"in a)for(var g in a.push_list)e.append(c(a.push_list[g],"Manual"));if("push_auto_list"in a)for(g in a.push_auto_list){var h=a.push_auto_list[g].slice();h.unshift(-1);
|
||||
f.append(c(h,"Automatic"))}B.append($("<h3>").text("Automatic pushes")).append($("<button>").text("Add an automatic push").click(function(){UI.navto("Start Push","auto")}));f.find("tr").length==1?B.append($("<div>").text("No automatic pushes have been configured.").addClass("text").css("margin-top","0.5em")):B.append(f);B.append($("<h3>").text("Pushes")).append($("<button>").text("Start a push").click(function(){UI.navto("Start Push")}));if(e.find("tr").length==1)B.append($("<div>").text("No pushes are active.").addClass("text").css("margin-top",
|
||||
"0.5em"));else{var f=[],h=[],i=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any stream").val("")),j=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any target").val(""));for(g in a.push_list){f.indexOf(a.push_list[g][1])==-1&&f.push(a.push_list[g][1]);h.indexOf(a.push_list[g][2])==-1&&h.push(a.push_list[g][2])}f.sort();h.sort();for(g in f)i.append($("<option>").text(f[g]));for(g in h)j.append($("<option>").text(h[g]));B.append($("<button>").text("Stop all pushes").click(function(){var c=
|
||||
""))){var c=$(this);c.text("Stopping pushes..");var g=[],h;for(h in a.push_list)if(f[1]==a.push_list[h][1]&&f[2]==a.push_list[h][2]){g.push(a.push_list[h][0]);e.find("tr[data-pushid="+a.push_list[h][0]+"]").html($("<td colspan=99>").html($("<span>").addClass("red").text("Stopping..")))}mist.send(function(){c.text("Stop pushes");b(g)},{push_stop:g,push_settings:{wait:0}})}}))}return $("<tr>").attr("data-pushid",f[0]).append($("<td>").text(f[1])).append($("<td>").append(h.children())).append(i)}C.html(UI.buildUI([{type:"help",
|
||||
help:"You can push streams to files or other servers, allowing them to broadcast your stream as well."}]));var d=a.push_settings;d||(d={});var e=$("<table>").append($("<tr>").append($("<th>").text("Stream")).append($("<th>").text("Target")).append($("<th>"))),f=e.clone();if("push_list"in a)for(var g in a.push_list)e.append(c(a.push_list[g],"Manual"));if("push_auto_list"in a)for(g in a.push_auto_list){var h=a.push_auto_list[g].slice();h.unshift(-1);f.append(c(h,"Automatic"))}C.append($("<h3>").text("Automatic pushes")).append(UI.buildUI([{label:"Delay before retry",
|
||||
unit:"s",type:"int",min:0,help:"How long the delay should be before MistServer retries an automatic push.<br>If set to 0, it does not retry.","default":0,pointer:{main:d,index:"wait"},LTSonly:1},{label:"Maximum retries",unit:"/s",type:"int",min:0,help:"The maximum amount of retries per second (for all automatic pushes).<br>If set to 0, there is no limit.","default":0,pointer:{main:d,index:"maxspeed"},LTSonly:1},{type:"buttons",buttons:[{type:"save",label:"Save","function":function(){mist.send(function(){UI.navto("Push")},
|
||||
{push_settings:d})}}]}])).append($("<button>").text("Add an automatic push").click(function(){UI.navto("Start Push","auto")}));f.find("tr").length==1?C.append($("<div>").text("No automatic pushes have been configured.").addClass("text").css("margin-top","0.5em")):C.append(f);C.append($("<h3>").text("Pushes")).append($("<button>").text("Start a push").click(function(){UI.navto("Start Push")}));if(e.find("tr").length==1)C.append($("<div>").text("No pushes are active.").addClass("text").css("margin-top",
|
||||
"0.5em"));else{var f=[],h=[],i=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any stream").val("")),j=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any target").val(""));for(g in a.push_list){f.indexOf(a.push_list[g][1])==-1&&f.push(a.push_list[g][1]);h.indexOf(a.push_list[g][2])==-1&&h.push(a.push_list[g][2])}f.sort();h.sort();for(g in f)i.append($("<option>").text(f[g]));for(g in h)j.append($("<option>").text(h[g]));C.append($("<button>").text("Stop all pushes").click(function(){var c=
|
||||
[],d;for(d in a.push_list)c.push(a.push_list[d][0]);if(c.length!=0&&confirm("Are you sure you want to stop all pushes?")){mist.send(function(){b(c)},{push_stop:c});e.find("tr:not(:first-child)").html($("<td colspan=99>").append($("<span>").addClass("red").text("Stopping..")));$(this).remove()}})).append($("<label>").css("margin-left","1em").append($("<span>").text("Stop all pushes that match: ").css("font-size","0.9em")).append(i).append($("<span>").css("margin-left","0.5em").text("and").css("font-size",
|
||||
"0.9em")).append(j).append($("<button>").css("margin-left","0.5em").text("Apply").click(function(){var c=i.val(),d=j.val();if(c==""&&d=="")return alert("Looks like you want to stop all pushes. Maybe you should use that button?");var f={},g;for(g in a.push_list)if((c==""||a.push_list[g][1]==c)&&(d==""||a.push_list[g][2]==d))f[a.push_list[g][0]]=a.push_list[g];if(Object.keys(f).length==0)return alert("No matching pushes.");c="Are you sure you want to stop these pushes?\n\n";for(g in f)c=c+(f[g][1]+
|
||||
" to "+f[g][2]+"\n");if(confirm(c)){f=Object.keys(f);mist.send(function(){b(f)},{push_stop:f});for(g in f)e.find("tr[data-pushid="+f[g]+"]").html($("<td colspan=99>").html($("<span>").addClass("red").text("Stopping..")))}}))).append(e)}},{push_settings:1,push_list:1,push_auto_list:1});break;case "Start Push":if(!("capabilities"in mist.data)){d.append("Loading Mist capabilities..");mist.send(function(){UI.navto("Start Push",c)},{capabilities:1});return}var t,V=function(a){var b=false,f=c.split("_");
|
||||
c=f[0];f.length==2&&(b=f[1]);if(b!==false&&typeof a=="undefined")mist.send(function(a){V(a.push_auto_list[b])},{push_auto_list:1});else{var e=[],g;for(g in mist.data.capabilities.connectors){f=mist.data.capabilities.connectors[g];"push_urls"in f&&(e=e.concat(f.push_urls))}c=="auto"&&d.find("h2").text("Add automatic push");var h={};if(c=="auto"&&typeof a!="undefined"){h={stream:a[0],target:a[1]};if(a.length>=3)h.scheduletime=a[2];if(a.length>=4)h.completetime=a[3];if(h.target.indexOf("recstartunix=")>
|
||||
-1){g=h.target.split("recstartunix=")[1];h.recstartunix=g.split("&")[0];h.target=h.target.replace("recstartunix="+h.recstartunix,"").replace("?&","?").replace("&&","&");if(h.target[h.target.length-1]=="?")h.target=h.target.slice(0,-1)}}g=[{label:"Stream name",type:"str",help:"This may either be a full stream name, a partial wildcard stream name, or a full wildcard stream name.<br>For example, given the stream <i>a</i> you can use:<ul><li><i>a</i>: the stream configured as <i>a</i></li><li><i>a+</i>: all streams configured as <i>a</i> with a wildcard behind it, but not <i>a</i> itself</li><li><i>a+b</i>: only the version of stream <i>a</i> that has wildcard <i>b</i></li></ul>",
|
||||
pointer:{main:h,index:"stream"},validate:["required",function(a){a=a.split("+");a=a[0];return a in mist.data.streams?false:{msg:"'"+a+"' is not a stream name.",classes:["orange"],"break":false}}],datalist:t,LTSonly:1},{label:"Target",type:"str",help:"Where the stream will be pushed to.<br>Valid formats:<ul><li>"+e.join("</li><li>")+"</li></ul> Valid text replacements:<ul><li>$stream - inserts the stream name used to push to MistServer</li><li>$day - inserts the current day number</li><li>$month - inserts the current month number</li><li>$year - inserts the current year number</li><li>$hour - inserts the hour timestamp when stream was received</li><li>$minute - inserts the minute timestamp the stream was received</li><li>$seconds - inserts the seconds timestamp when the stream was received</li><li>$datetime - inserts $year.$month.$day.$hour.$minute.$seconds timestamp when the stream was received</li>",
|
||||
-1){g=h.target.split("recstartunix=")[1];h.recstartunix=g.split("&")[0];h.target=h.target.replace("recstartunix="+h.recstartunix,"").replace("?&","?").replace("&&","&");if(h.target[h.target.length-1]=="?")h.target=h.target.slice(0,-1)}}g=[{label:"Stream name",type:"str",help:"This may either be a full stream name, a partial wildcard stream name, or a full wildcard stream name.<br>For example, given the stream <i>a</i> you can use: <ul> <li><i>a</i>: the stream configured as <i>a</i></li> <li><i>a+</i>: all streams configured as <i>a</i> with a wildcard behind it, but not <i>a</i> itself</li> <li><i>a+b</i>: only the version of stream <i>a</i> that has wildcard <i>b</i></li> </ul>",
|
||||
pointer:{main:h,index:"stream"},validate:["required",function(a){a=a.split("+");a=a[0];return a in mist.data.streams?false:{msg:"'"+a+"' is not a stream name.",classes:["orange"],"break":false}}],datalist:t,LTSonly:1},{label:"Target",type:"str",help:"Where the stream will be pushed to.<br> Valid formats: <ul> <li>"+e.join("</li><li>")+"</li> </ul> Valid text replacements: <ul> <li>$stream - inserts the stream name used to push to MistServer</li> <li>$day - inserts the current day number</li><li>$month - inserts the current month number</li> <li>$year - inserts the current year number</li><li>$hour - inserts the hour timestamp when stream was received</li> <li>$minute - inserts the minute timestamp the stream was received</li> <li>$seconds - inserts the seconds timestamp when the stream was received</li> <li>$datetime - inserts $year.$month.$day.$hour.$minute.$seconds timestamp when the stream was received</li> </ul> Valid URL parameters: <ul> <li>recstart=123 - media timestamp in milisseconds where the push should start</li> <li>recstop=456 - media timestamp in miliseconds where the push should stop</li> <li>recstartunix=150000000 - unix time in seconds where the push should start. This will override the recstart parameter.</li> <li>recstopunix=150000000 - unix time in seconds where the push should stop. This will override the recstop parameter.</li> </ul>",
|
||||
pointer:{main:h,index:"target"},validate:["required",function(a){for(var b in e)if(mist.inputMatch(e[b],a))return false;return{msg:"Does not match a valid target.<br>Valid formats:<ul><li>"+e.join("</li><li>")+"</li></ul>",classes:["red"]}}],LTSonly:1}];c=="auto"&&g.push($("<h4>").text("Optional parameters"),{type:"unix",label:"Schedule time",min:0,help:"The time where the push will become active. The default is to start immediately.",pointer:{main:h,index:"scheduletime"}},{type:"unix",label:"Recording start time",
|
||||
min:0,help:"Where in the media buffer the recording will start. Defaults to the most recently received keyframe.<br>Only makes sense for live streams.",pointer:{main:h,index:"recstartunix"}},{type:"unix",label:"Complete time",min:0,help:"The time where the push will stop. Defaults to never stop automatically.<br>Only makes sense for live streams.",pointer:{main:h,index:"completetime"}});g.push({type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Push")}},{type:"save",
|
||||
label:"Save","function":function(){var b={};h.recstartunix?b.recstartunix="recstartunix="+h.recstartunix:h.scheduletime&&(b.recstartunix="recstartunix="+h.scheduletime);delete h.recstartunix;if(Object.keys(b).length){var d="?",f=h.target.split("?");if(f.length>1){var d="&",f=f[f.length-1],f=f.split("&"),e;for(e in f){var g=f[e].split("=")[0];g in b&&delete b[g]}}if(Object.keys(b).length){d=d+Object.values(b).join("&");h.target=h.target+d}}b={};b[c=="auto"?"push_auto_add":"push_start"]=h;if(typeof a!=
|
||||
|
@ -183,18 +183,18 @@ if(confirm("Are you sure you want to delete this "+a[0]+" trigger?")){mist.data.
|
|||
"USER_NEW: a new user connects that hasn't been allowed or denied access before"],["LIVE_BANDWIDTH","LIVE_BANDWIDTH: when the value specified as param is surpassed"]],LTSonly:!0,validate:["required"],"function":function(){switch($(this).getval()){case "SYSTEM_START":case "SYSTEM_STOP":case "SYSTEM_CONFIG":case "OUTPUT_START":case "OUTPUT_STOP":case "RTMP_PUSH_REWRITE":$("[name=appliesto]").setval([]).closest(".UIelement").hide();$("[name=params]").setval("").closest(".UIelement").hide();break;case "LIVE_BANDWIDTH":$("[name=appliesto]").closest(".UIelement").show();
|
||||
$("[name=params]").closest(".UIelement").show();break;default:$("[name=appliesto]").closest(".UIelement").show();$("[name=params]").setval("").closest(".UIelement").hide()}}},{label:"Applies to",pointer:{main:n,index:"appliesto"},help:"For triggers that can apply to specific streams, this value decides what streams they are triggered for. (none checked = always triggered)",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:n,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.",pointer:{main:n,index:"async"},LTSonly:!0},{label:"Parameters",type:"str",help:"The extra data you want this trigger to use.",pointer:{main:n,index:"params"},
|
||||
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:n,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={handler:n.url,sync:n.async?true:false,streams:typeof n.appliesto=="undefined"?[]:n.appliesto,params:n.params,
|
||||
"default":n["default"]};if(!("triggers"in mist.data.config))mist.data.config.triggers={};n.triggeron in mist.data.config.triggers||(mist.data.config.triggers[n.triggeron]=[]);mist.data.config.triggers[n.triggeron].push(a);mist.send(function(){UI.navto("Triggers")},{config:mist.data.config})}}]}]));$("[name=triggeron]").trigger("change");break;case "Logs":var ta=$("<button>").text("Refresh now").click(function(){$(this).text("Loading..");mist.send(function(){fa();ta.text("Refresh now")})}).css("padding",
|
||||
"0.2em 0.5em").css("flex-grow",0);d.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"]],value:30,"function":function(){UI.interval.clear();UI.interval.set(function(){mist.send(function(){fa()})},$(this).val()*1E3)},help:"How often the table below should be updated."},
|
||||
LTSonly:!0},{label:"Default response",type:"str",help:"The default response in case the handler fails or is set to non-blocking.",pointer:{main:n,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={handler:n.url,sync:n.async?true:false,streams:typeof n.appliesto=="undefined"?[]:n.appliesto,params:n.params,"default":n["default"]};
|
||||
if(!("triggers"in mist.data.config))mist.data.config.triggers={};n.triggeron in mist.data.config.triggers||(mist.data.config.triggers[n.triggeron]=[]);mist.data.config.triggers[n.triggeron].push(a);mist.send(function(){UI.navto("Triggers")},{config:mist.data.config})}}]}]));$("[name=triggeron]").trigger("change");break;case "Logs":var ta=$("<button>").text("Refresh now").click(function(){$(this).text("Loading..");mist.send(function(){fa();ta.text("Refresh now")})}).css("padding","0.2em 0.5em").css("flex-grow",
|
||||
0);d.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"]],value:30,"function":function(){UI.interval.clear();UI.interval.set(function(){mist.send(function(){fa()})},$(this).val()*1E3)},help:"How often the table below should be updated."},
|
||||
{label:"..or",type:"DOMfield",DOMfield:ta,help:"Instantly refresh the table below."}]));d.append($("<button>").text("Purge logs").click(function(){mist.send(function(){mist.data.log=[];UI.navto("Logs")},{clearstatlogs:true})}));y=$("<tbody>").css("font-size","0.9em");d.append($("<table>").addClass("logs").append(y));var va=function(a){var b=$("<span>").text(a);switch(a){case "WARN":b.addClass("orange");break;case "ERROR":case "FAIL":b.addClass("red")}return b},fa=function(){var a=mist.data.log;if(a){a.length>=
|
||||
2&&a[0][0]<a[a.length-1][0]&&a.reverse();y.html("");for(var b in a){var c=$("<span>").addClass("content"),d=a[b][2].split("|"),f;for(f in d)c.append($("<span>").text(d[f]));y.append($("<tr>").html($("<td>").text(UI.format.dateTime(a[b][0],"long")).css("white-space","nowrap")).append($("<td>").html(va(a[b][1])).css("text-align","center")).append($("<td>").html(c).css("text-align","left")))}}};fa();break;case "Statistics":var C=$("<span>").text("Loading..");d.append(C);var n={graph:"new"},w=mist.stored.get().graphs?
|
||||
2&&a[0][0]<a[a.length-1][0]&&a.reverse();y.html("");for(var b in a){var c=$("<span>").addClass("content"),d=a[b][2].split("|"),f;for(f in d)c.append($("<span>").text(d[f]));y.append($("<tr>").html($("<td>").text(UI.format.dateTime(a[b][0],"long")).css("white-space","nowrap")).append($("<td>").html(va(a[b][1])).css("text-align","center")).append($("<td>").html(c).css("text-align","left")))}}};fa();break;case "Statistics":var B=$("<span>").text("Loading..");d.append(B);var n={graph:"new"},w=mist.stored.get().graphs?
|
||||
$.extend(!0,{},mist.stored.get().graphs):{},Q={};for(h in mist.data.streams)Q[h]=!0;for(h in mist.data.active_streams)Q[mist.data.active_streams[h]]=!0;var Q=Object.keys(Q).sort(),ga=[];for(h in mist.data.config.protocols)ga.push(mist.data.config.protocols[h].connector);ga.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;
|
||||
C.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."},$("<h3>").text("Select the data to display"),{label:"Add to",type:"select",select:[["new","New graph"]],pointer:{main:n,index:"graph"},classes:["graph_ids"],"function":function(){if($(this).val()){var a=C.find(".graph_xaxis"),b=C.find(".graph_id");if($(this).val()=="new"){a.children("option").prop("disabled",
|
||||
B.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."},$("<h3>").text("Select the data to display"),{label:"Add to",type:"select",select:[["new","New graph"]],pointer:{main:n,index:"graph"},classes:["graph_ids"],"function":function(){if($(this).val()){var a=B.find(".graph_xaxis"),b=B.find(".graph_id");if($(this).val()=="new"){a.children("option").prop("disabled",
|
||||
false);b.setval("Graph "+(Object.keys(w).length+1)).closest("label").show()}else{var c=w[$(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:n,index:"id"},classes:["graph_id"],validate:[function(a){return a in w?{msg:"This graph id has already been used. Please enter something else.",
|
||||
classes:["red"]}:false}]},{label:"Axis type",type:"select",select:[["time","Time line"]],pointer:{main:n,index:"xaxis"},value:"time",classes:["graph_xaxis"],"function":function(){$s=C.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"],["upbps","Bandwidth (up)"],["downbps","Bandwidth (down)"],["cpuload","CPU use"],["memload","Memory load"],["coords","Client location"]],pointer:{main:n,index:"datatype"},classes:["graph_datatype"],"function":function(){$s=C.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)}}},{label:"Data origin",type:"radioselect",radioselect:[["total","All"],["stream","The stream:",Q],["protocol","The protocol:",ga]],pointer:{main:n,index:"origin"},value:["total"],classes:["graph_origin"]},{type:"buttons",buttons:[{label:"Add data set",type:"save","function":function(){var a;if(n.graph=="new"){a=UI.plot.addGraph(n,b);w[a.id]=a;C.find("input.graph_id").val("");
|
||||
C.find("select.graph_ids").append($("<option>").text(a.id)).val(a.id).trigger("change")}else a=w[n.graph];var c=UI.plot.datatype.getOptions({datatype:n.datatype,origin:n.origin});a.datasets.push(c);UI.plot.save(a);UI.plot.go(w)}}]}]));var b=$("<div>").addClass("graph_container");d.append(b);var c=C.find("select.graph_ids");for(a in w){var f=UI.plot.addGraph(w[a],b);c.append($("<option>").text(f.id)).val(f.id);var e=[],g;for(g in w[a].datasets){var h=UI.plot.datatype.getOptions({datatype:w[a].datasets[g].datatype,
|
||||
classes:["red"]}:false}]},{label:"Axis type",type:"select",select:[["time","Time line"]],pointer:{main:n,index:"xaxis"},value:"time",classes:["graph_xaxis"],"function":function(){$s=B.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"],["upbps","Bandwidth (up)"],["downbps","Bandwidth (down)"],["cpuload","CPU use"],["memload","Memory load"],["coords","Client location"]],pointer:{main:n,index:"datatype"},classes:["graph_datatype"],"function":function(){$s=B.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)}}},{label:"Data origin",type:"radioselect",radioselect:[["total","All"],["stream","The stream:",Q],["protocol","The protocol:",ga]],pointer:{main:n,index:"origin"},value:["total"],classes:["graph_origin"]},{type:"buttons",buttons:[{label:"Add data set",type:"save","function":function(){var a;if(n.graph=="new"){a=UI.plot.addGraph(n,b);w[a.id]=a;B.find("input.graph_id").val("");
|
||||
B.find("select.graph_ids").append($("<option>").text(a.id)).val(a.id).trigger("change")}else a=w[n.graph];var c=UI.plot.datatype.getOptions({datatype:n.datatype,origin:n.origin});a.datasets.push(c);UI.plot.save(a);UI.plot.go(w)}}]}]));var b=$("<div>").addClass("graph_container");d.append(b);var c=B.find("select.graph_ids");for(a in w){var f=UI.plot.addGraph(w[a],b);c.append($("<option>").text(f.id)).val(f.id);var e=[],g;for(g in w[a].datasets){var h=UI.plot.datatype.getOptions({datatype:w[a].datasets[g].datatype,
|
||||
origin:w[a].datasets[g].origin});e.push(h)}f.datasets=e;w[f.id]=f}c.trigger("change");UI.plot.go(w);UI.interval.set(function(){UI.plot.go(w)},1E4)},{active_streams:!0,capabilities:!0});break;case "Server Stats":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a)},{capabilities:!0});d.append("Loading..");return}var ha=$("<table>"),E=$("<table>"),f={vheader:"CPUs",labels:["Model","Processor speed","Amount of cores","Amount of threads"],content:[]};for(h in mist.data.capabilities.cpu)b=
|
||||
mist.data.capabilities.cpu[h],f.content.push({header:"CPU #"+(Number(h)+1),body:[b.model,UI.format.addUnit(UI.format.number(b.mhz),"MHz"),b.cores,b.threads]});h=UI.buildVheaderTable(f);var ua=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);ha.replaceWith(a);ha=a;b={vheader:"Load average",labels:["CPU use","1 minute","5 minutes","15 minutes"],content:[{header:" ",body:[UI.format.addUnit(UI.format.number(mist.data.capabilities.cpu_use/10),"%"),UI.format.number(b.one/100),UI.format.number(b.five/
|
||||
|
@ -213,8 +213,9 @@ c.data[g][q]]);if(h){d();h--}}if(mist.data.config.time-c.end>20){d();m=(mist.dat
|
|||
c.totals.protocols,e.totals);else for(o in e.totals)g(c.totals[o].streams,c.totals[o].protocols,e.totals[o])}a&&a(e,d);break;case "CHALL":if(e.authorize.challenge==mist.user.authstring){mist.user.password!=""&&UI.elements.connection.msg.text("The credentials you provided are incorrect.").addClass("red");UI.navto("Login")}else if(mist.user.password=="")UI.navto("Login");else{mist.user.authstring=e.authorize.challenge;mist.send(a,c,d);sessionStorage.setItem("mistLogin",JSON.stringify({host:mist.user.host,
|
||||
name:mist.user.name,password:mist.user.password}))}break;case "NOACC":UI.navto("Create a new account");break;case "ACC_MADE":delete c.authorize;mist.send(a,c,d);break;default:UI.navto("Login")}}};d.hide||UI.elements.connection.msg.removeClass("red").text("Data sent, waiting for a reply..").append($("<br>")).append($("<a>").text("Cancel request").click(function(){h.abort()}));var h=$.ajax(e)},inputMatch:function(a,c){if(typeof a=="undefined")return false;typeof a=="string"&&(a=[a]);for(var d in a){var b=
|
||||
a[d].replace(/[^\w\s]/g,"\\$&"),b=b.replace(/\\\*/g,".*");if(RegExp("^(?:[a-zA-Z]:)?"+b+"(?:\\?[^\\?]*)?$","i").test(c))return true}return false},convertBuildOptions:function(a,c){var d=[],b=["required","optional"];"desc"in a&&d.push({type:"help",help:a.desc});for(var e in b)if(a[b[e]]){d.push($("<h4>").text(UI.format.capital(b[e])+" parameters"));for(var h in a[b[e]]){var m=a[b[e]][h],g={label:UI.format.capital(m.name),pointer:{main:c,index:h},validate:[]};b[e]=="required"&&(!("default"in m)||m["default"]==
|
||||
"")&&g.validate.push("required");if("default"in m)g.placeholder=m["default"];if("help"in m)g.help=m.help;if("unit"in m)g.unit=m.unit;if("type"in m)switch(m.type){case "int":g.type="int";break;case "uint":g.type="int";g.min=0;break;case "debug":g.type="debug";break;case "select":g.type="select";g.select=m.select.slice(0);g.select.unshift(["","Default"+("placeholder"in g?" ("+g.placeholder+")":"")]);break;default:g.type="str"}else g.type="checkbox";d.push(g)}}return d},stored:{get:function(){return mist.data.ui_settings||
|
||||
{}},set:function(a,c){var d=this.get();d[a]=c;mist.send(function(){},{ui_settings:d})},del:function(a){delete mist.data.ui_settings[a];mist.send(function(){},{ui_settings:mist.data.ui_settings})}}};function log(){try{UI.debug&&[].push.call(arguments,Error().stack);[].unshift.call(arguments,"["+UI.format.time((new Date).getTime()/1E3)+"]");console.log.apply(console,arguments)}catch(a){}}
|
||||
"")&&g.validate.push("required");if("default"in m){g.placeholder=m["default"];if(m.type=="select")for(var q in m.select)if(m.select[q][0]==m["default"]){g.placeholder=m.select[q][1];break}}if("help"in m)g.help=m.help;if("unit"in m)g.unit=m.unit;if("type"in m)switch(m.type){case "int":g.type="int";break;case "uint":g.type="int";g.min=0;break;case "debug":g.type="debug";break;case "select":g.type="select";g.select=m.select.slice(0);g.select.unshift(["","Default"+("placeholder"in g?" ("+g.placeholder+
|
||||
")":"")]);break;default:g.type="str"}else g.type="checkbox";d.push(g)}}return d},stored:{get:function(){return mist.data.ui_settings||{}},set:function(a,c){var d=this.get();d[a]=c;mist.send(function(){},{ui_settings:d})},del:function(a){delete mist.data.ui_settings[a];mist.send(function(){},{ui_settings:mist.data.ui_settings})}}};
|
||||
function log(){try{UI.debug&&[].push.call(arguments,Error().stack);[].unshift.call(arguments,"["+UI.format.time((new Date).getTime()/1E3)+"]");console.log.apply(console,arguments)}catch(a){}}
|
||||
$.fn.getval=function(){var a=$(this).data("opts"),c=$(this).val();if(a&&"type"in a)switch(a.type){case "span":c=$(this).html();break;case "checkbox":c=$(this).prop("checked");break;case "radioselect":a=$(this).find("label > input[type=radio]:checked").parent();if(a.length){c=[];c.push(a.children("input[type=radio]").val());a=a.children("select");a.length&&c.push(a.val())}else c="";break;case "checklist":c=[];$(this).find(".checklist input[type=checkbox]:checked").each(function(){c.push($(this).attr("name"))});
|
||||
break;case "unix":c!=""&&(c=Math.round(new Date($(this).val())/1E3));break;case "selectinput":c=$(this).children("select").first().val();c=="CUSTOM"&&(c=$(this).children("label").first().find(".field_container").children().first().getval());break;case "inputlist":c=[];$(this).children().each(function(){$(this).val()!=""&&c.push($(this).val())})}return c};
|
||||
$.fn.setval=function(a){var c=$(this).data("opts");$(this).val(a);if(c&&"type"in c)switch(c.type){case "span":$(this).html(a);break;case "checkbox":$(this).prop("checked",a);break;case "geolimited":case "hostlimited":c=$(this).closest(".field_container").data("subUI");if(typeof a=="undefined"||a.length==0)a="-";c.blackwhite.val(a.charAt(0));var a=a.substr(1).split(" "),d;for(d in a)c.values.append(c.prototype.clone(true).val(a[d]));c.blackwhite.trigger("change");break;case "radioselect":if(typeof a==
|
||||
|
|
217
lsp/mist.js
217
lsp/mist.js
|
@ -3390,7 +3390,90 @@ var UI = {
|
|||
main: saveas,
|
||||
index: 'source'
|
||||
},
|
||||
help: '<p>Below is the explanation of the input methods for MistServer. Anything between brackets () will go to default settings if not specified.</p><table><tr><td>File input</td><td>Syntax</td><td>Explanation</td></tr><tr><th>File</th><td>Linux/MacOS: /PATH/FILE<br>Windows: /cygdrive/DRIVE/PATH/FILE</td><td>For file input please specify the proper path and file.<br>Supported inputs are: DTSC, FLV, MP3. MistServer Pro has TS, MP4, ISMV added as input.</td></tr><th>Folder<br>(Pro only)</th><td>Linux/MacOS: /PATH/<br>Windows: /cygdrive/DRIVE/PATH/</td><td>A folder stream makes all the recognised files in the selected folder available as a stream.</td></tr><tr><td>Push input</td><td>Syntax</td><td>Explanation</td></tr><tr><th>RTMP</th><td>push://(IP)(@PASSWORD)</td><td>IP is white listed IP for pushing towards MistServer, if left empty all are white listed.<br>PASSWORD is the application under which to push to MistServer, if it doesn\'t match the stream will be rejected. PASSWORD is MistServer Pro only. <tr><th>RTSP<br>(Pro only)</th><td>push://(IP)(@PASSWORD)</td><td>IP is white listed IP for pushing towards MistServer, if left empty all are white listed.</td></tr> <tr><th>TS<br>(Pro only)</th><td>tsudp://(IP):PORT(/INTERFACE)</td><td>IP is the IP address used to listen for this stream, multi-cast IP range is: 224.0.0.0 - 239.255.255.255. If IP is not set all addresses will listened to.<br>PORT is the port you reserve for this stream on the chosen IP.<br>INTERFACE is the interface used, if left all interfaces will be used.</td></tr><tr><td>Pull input</td><td>Syntax</td><td>Explanation</td></tr><tr><th>DTSC</th><td>dtsc://MISTSERVER_IP:PORT/(STREAMNAME)</td><td>MISTSERVER_IP is the IP of another MistServer to pull from.<br>PORT is the DTSC port of the other MistServer. (default is 4200)<br>STREAMNAME is the name of the target stream on the other MistServer. If left empty, the name of this stream will be used.</td></tr><tr><th>HLS<br>(Pro only)</th><td>http://URL/TO/STREAM.m3u8</td><td>The URL where the HLS stream is available to MistServer.</td></tr></table>',
|
||||
help: ("<p>\
|
||||
Below is the explanation of the input methods for MistServer. Anything between brackets () will go to default settings if not specified.\
|
||||
</p>\
|
||||
<table class=valigntop>\
|
||||
<tr>\
|
||||
<th colspan=3><b>File inputs</b></th>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<th>File</th>\
|
||||
<td>\
|
||||
Linux/MacOS: /PATH/FILE<br>\
|
||||
Windows: /cygdrive/DRIVE/PATH/FILE\
|
||||
</td>\
|
||||
<td>\
|
||||
For file input please specify the proper path and file.<br>\
|
||||
Supported inputs are: DTSC, FLV, MP3. MistServer Pro has TS, MP4, ISMV added as input.\
|
||||
</td>\
|
||||
</tr>\
|
||||
<th>\
|
||||
Folder\
|
||||
</th>\
|
||||
<td>\
|
||||
Linux/MacOS: /PATH/<br>\
|
||||
Windows: /cygdrive/DRIVE/PATH/\
|
||||
</td>\
|
||||
<td class=LTSonly>\
|
||||
A folder stream makes all the recognised files in the selected folder available as a stream.\
|
||||
</td>\
|
||||
</tr>\
|
||||
<tr><td colspan=3> </td></tr>\
|
||||
<tr>\
|
||||
<th colspan=3><b>Push inputs</b></th>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<th>RTMP</th>\
|
||||
<td>push://(IP)(@PASSWORD)</td>\
|
||||
<td>\
|
||||
IP is white listed IP for pushing towards MistServer, if left empty all are white listed.<br>\
|
||||
PASSWORD is the application under which to push to MistServer, if it doesn\'t match the stream will be rejected. PASSWORD is MistServer Pro only.\
|
||||
</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<th>RTSP</th>\
|
||||
<td>push://(IP)(@PASSWORD)</td>\
|
||||
<td class=LTSonly>IP is white listed IP for pushing towards MistServer, if left empty all are white listed.</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<th>TS</th>\
|
||||
<td>tsudp://(IP):PORT(/INTERFACE)</td>\
|
||||
<td class=LTSonly>\
|
||||
IP is the IP address used to listen for this stream, multi-cast IP range is: 224.0.0.0 - 239.255.255.255. If IP is not set all addresses will listened to.<br>\
|
||||
PORT is the port you reserve for this stream on the chosen IP.<br>\
|
||||
INTERFACE is the interface used, if left all interfaces will be used.\
|
||||
</td>\
|
||||
</tr>\
|
||||
<tr><td colspan=3> </td></tr>\
|
||||
<tr>\
|
||||
<th colspan=3><b>Pull inputs</b></th>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<th>DTSC</th>\
|
||||
<td>dtsc://MISTSERVER_IP:PORT/(STREAMNAME)</td>\
|
||||
<td>MISTSERVER_IP is the IP of another MistServer to pull from.<br>\
|
||||
PORT is the DTSC port of the other MistServer. (default is 4200)<br>\
|
||||
STREAMNAME is the name of the target stream on the other MistServer. If left empty, the name of this stream will be used.\
|
||||
</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<th>HLS</th>\
|
||||
<td>http://URL/TO/STREAM.m3u8</td>\
|
||||
<td class=LTSonly>The URL where the HLS stream is available to MistServer.</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<th>RTSP</th>\
|
||||
<td>rtsp://(USER:PASSWORD@)IP(:PORT)(/path)</td>\
|
||||
<td class=LTSonly>\
|
||||
USER:PASSWORD is the account used if authorization is required.<br>\
|
||||
IP is the IP address used to pull this stream from.<br>\
|
||||
PORT is the port used to connect through.<br>\
|
||||
PATH is the path to be used to identify the correct stream.\
|
||||
</td>\
|
||||
</tr>\
|
||||
</table>").replace(/LTSonly/g,(mist.data.LTS ? "\"\"" : "LTSonly"))
|
||||
,
|
||||
'function': function(){
|
||||
var source = $(this).val();
|
||||
$style.remove();
|
||||
|
@ -4394,59 +4477,15 @@ var UI = {
|
|||
$main.append($c);
|
||||
|
||||
mist.send(function(d){
|
||||
$c.html('');
|
||||
$c.html(UI.buildUI([{
|
||||
type: 'help',
|
||||
help: 'You can push streams to files or other servers, allowing them to broadcast your stream as well.'
|
||||
}]));
|
||||
|
||||
|
||||
var push_settings = d.push_settings;
|
||||
if (!push_settings) { push_settings = {}; }
|
||||
|
||||
$c.append(
|
||||
UI.buildUI([
|
||||
{
|
||||
type: 'help',
|
||||
help: 'You can push streams to files or other servers, allowing them to broadcast your stream as well.'
|
||||
},
|
||||
$('<h3>').text('Settings'),
|
||||
{
|
||||
label: 'Delay before retry',
|
||||
unit: 's',
|
||||
type: 'int',
|
||||
min: 0,
|
||||
help: 'How long the delay should be before MistServer retries an automatic push.<br>If set to 0, it does not retry.',
|
||||
'default': 0,
|
||||
pointer: {
|
||||
main: push_settings,
|
||||
index: 'wait'
|
||||
},
|
||||
LTSonly: 1
|
||||
},{
|
||||
label: 'Maximum retries',
|
||||
unit: '/s',
|
||||
type: 'int',
|
||||
min: 0,
|
||||
help: 'The maximum amount of retries per second (for all automatic pushes).<br>If set to 0, there is no limit.',
|
||||
'default': 0,
|
||||
pointer: {
|
||||
main: push_settings,
|
||||
index: 'maxspeed'
|
||||
},
|
||||
LTSonly: 1
|
||||
},{
|
||||
type: 'buttons',
|
||||
buttons: [{
|
||||
type: 'save',
|
||||
label: 'Save',
|
||||
'function': function(){
|
||||
mist.send(function(d){
|
||||
UI.navto('Push');
|
||||
},{
|
||||
push_settings: push_settings
|
||||
})
|
||||
}
|
||||
}]
|
||||
}
|
||||
])
|
||||
);
|
||||
|
||||
var $push = $('<table>').append(
|
||||
$('<tr>').append(
|
||||
$('<th>').text('Stream')
|
||||
|
@ -4599,6 +4638,47 @@ var UI = {
|
|||
|
||||
$c.append(
|
||||
$('<h3>').text('Automatic pushes')
|
||||
).append(
|
||||
UI.buildUI([
|
||||
{
|
||||
label: 'Delay before retry',
|
||||
unit: 's',
|
||||
type: 'int',
|
||||
min: 0,
|
||||
help: 'How long the delay should be before MistServer retries an automatic push.<br>If set to 0, it does not retry.',
|
||||
'default': 0,
|
||||
pointer: {
|
||||
main: push_settings,
|
||||
index: 'wait'
|
||||
},
|
||||
LTSonly: 1
|
||||
},{
|
||||
label: 'Maximum retries',
|
||||
unit: '/s',
|
||||
type: 'int',
|
||||
min: 0,
|
||||
help: 'The maximum amount of retries per second (for all automatic pushes).<br>If set to 0, there is no limit.',
|
||||
'default': 0,
|
||||
pointer: {
|
||||
main: push_settings,
|
||||
index: 'maxspeed'
|
||||
},
|
||||
LTSonly: 1
|
||||
},{
|
||||
type: 'buttons',
|
||||
buttons: [{
|
||||
type: 'save',
|
||||
label: 'Save',
|
||||
'function': function(){
|
||||
mist.send(function(d){
|
||||
UI.navto('Push');
|
||||
},{
|
||||
push_settings: push_settings
|
||||
})
|
||||
}
|
||||
}]
|
||||
}
|
||||
])
|
||||
).append(
|
||||
$('<button>').text('Add an automatic push').click(function(){
|
||||
UI.navto('Start Push','auto');
|
||||
|
@ -4787,7 +4867,12 @@ var UI = {
|
|||
var build = [{
|
||||
label: 'Stream name',
|
||||
type: 'str',
|
||||
help: 'This may either be a full stream name, a partial wildcard stream name, or a full wildcard stream name.<br>For example, given the stream <i>a</i> you can use:<ul><li><i>a</i>: the stream configured as <i>a</i></li><li><i>a+</i>: all streams configured as <i>a</i> with a wildcard behind it, but not <i>a</i> itself</li><li><i>a+b</i>: only the version of stream <i>a</i> that has wildcard <i>b</i></li></ul>',
|
||||
help: 'This may either be a full stream name, a partial wildcard stream name, or a full wildcard stream name.<br>For example, given the stream <i>a</i> you can use:\
|
||||
<ul>\
|
||||
<li><i>a</i>: the stream configured as <i>a</i></li>\
|
||||
<li><i>a+</i>: all streams configured as <i>a</i> with a wildcard behind it, but not <i>a</i> itself</li>\
|
||||
<li><i>a+b</i>: only the version of stream <i>a</i> that has wildcard <i>b</i></li>\
|
||||
</ul>',
|
||||
pointer: {
|
||||
main: saveas,
|
||||
index: 'stream'
|
||||
|
@ -4809,7 +4894,27 @@ var UI = {
|
|||
},{
|
||||
label: 'Target',
|
||||
type: 'str',
|
||||
help: 'Where the stream will be pushed to.<br>Valid formats:<ul><li>'+target_match.join('</li><li>')+'</li></ul> Valid text replacements:<ul><li>$stream - inserts the stream name used to push to MistServer</li><li>$day - inserts the current day number</li><li>$month - inserts the current month number</li><li>$year - inserts the current year number</li><li>$hour - inserts the hour timestamp when stream was received</li><li>$minute - inserts the minute timestamp the stream was received</li><li>$seconds - inserts the seconds timestamp when the stream was received</li><li>$datetime - inserts $year.$month.$day.$hour.$minute.$seconds timestamp when the stream was received</li>',
|
||||
help: 'Where the stream will be pushed to.<br>\
|
||||
Valid formats:\
|
||||
<ul>\
|
||||
<li>'+target_match.join('</li><li>')+'</li>\
|
||||
</ul>\
|
||||
Valid text replacements:\
|
||||
<ul>\
|
||||
<li>$stream - inserts the stream name used to push to MistServer</li>\
|
||||
<li>$day - inserts the current day number</li><li>$month - inserts the current month number</li>\
|
||||
<li>$year - inserts the current year number</li><li>$hour - inserts the hour timestamp when stream was received</li>\
|
||||
<li>$minute - inserts the minute timestamp the stream was received</li>\
|
||||
<li>$seconds - inserts the seconds timestamp when the stream was received</li>\
|
||||
<li>$datetime - inserts $year.$month.$day.$hour.$minute.$seconds timestamp when the stream was received</li>\
|
||||
</ul>\
|
||||
Valid URL parameters:\
|
||||
<ul>\
|
||||
<li>recstart=123 - media timestamp in milisseconds where the push should start</li>\
|
||||
<li>recstop=456 - media timestamp in miliseconds where the push should stop</li>\
|
||||
<li>recstartunix=150000000 - unix time in seconds where the push should start. This will override the recstart parameter.</li>\
|
||||
<li>recstopunix=150000000 - unix time in seconds where the push should stop. This will override the recstop parameter.</li>\
|
||||
</ul>',
|
||||
pointer: {
|
||||
main: saveas,
|
||||
index: 'target'
|
||||
|
@ -6101,6 +6206,14 @@ var mist = {
|
|||
}
|
||||
if ('default' in ele) {
|
||||
obj.placeholder = ele['default'];
|
||||
if (ele.type == "select") {
|
||||
for (var k in ele.select) {
|
||||
if (ele.select[k][0] == ele["default"]) {
|
||||
obj.placeholder = ele.select[k][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ('help' in ele) {
|
||||
obj.help = ele.help;
|
||||
|
|
Loading…
Add table
Reference in a new issue