LSP: Display package stats in list of active pushes

This commit is contained in:
Cat 2021-05-05 11:12:52 +02:00 committed by Thulinma
parent 007d1563fd
commit a8750ccd94
3 changed files with 63 additions and 61 deletions

View file

@ -936,19 +936,6 @@ button.return:before {
color: rgba(0,0,0,0.8);
margin-bottom: 1em;
}
.logs {
text-indent: 0;
}
.logs > div {
display: flex;
flex-flow: row nowrap;
}
.logs > div > * {
margin-right: 1em;
}
.logs .content > * {
margin-right: 0.5em;
}
.mistvideo-log table {
width: auto;
box-shadow: none;

View file

@ -1,10 +1,10 @@
var MD5=function(a){function b(a,b){var c,d,g,h,e;g=a&2147483648;h=b&2147483648;c=a&1073741824;d=b&1073741824;e=(a&1073741823)+(b&1073741823);return c&d?e^2147483648^g^h:c|d?e&1073741824?e^3221225472^g^h:e^1073741824^g^h:e^g^h}function c(a,c,d,g,h,e,f){a=b(a,b(b(c&d|~c&g,h),f));return b(a<<e|a>>>32-e,c)}function d(a,c,d,g,h,e,f){a=b(a,b(b(c&g|d&~g,h),f));return b(a<<e|a>>>32-e,c)}function f(a,c,d,g,h,e,f){a=b(a,b(b(c^d^g,h),f));return b(a<<e|a>>>32-e,c)}function l(a,c,d,g,h,e,f){a=b(a,b(b(d^(c|~g),
h),f));return b(a<<e|a>>>32-e,c)}function m(a){var b="",c="",d;for(d=0;3>=d;d++)c=a>>>8*d&255,c="0"+c.toString(16),b+=c.substr(c.length-2,2);return b}var e=[],q,n,i,v,g,h,k,j,e=a.replace(/\r\n/g,"\n"),a="";for(q=0;q<e.length;q++)n=e.charCodeAt(q),128>n?a+=String.fromCharCode(n):(127<n&&2048>n?a+=String.fromCharCode(n>>6|192):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128)),a+=String.fromCharCode(n&63|128));e=a;a=e.length;q=a+8;n=16*((q-q%64)/64+1);i=Array(n-1);for(g=v=0;g<a;)q=
(g-g%4)/4,v=8*(g%4),i[q]|=e.charCodeAt(g)<<v,g++;q=(g-g%4)/4;i[q]|=128<<8*(g%4);i[n-2]=a<<3;i[n-1]=a>>>29;e=i;g=1732584193;h=4023233417;k=2562383102;j=271733878;for(a=0;a<e.length;a+=16)q=g,n=h,i=k,v=j,g=c(g,h,k,j,e[a+0],7,3614090360),j=c(j,g,h,k,e[a+1],12,3905402710),k=c(k,j,g,h,e[a+2],17,606105819),h=c(h,k,j,g,e[a+3],22,3250441966),g=c(g,h,k,j,e[a+4],7,4118548399),j=c(j,g,h,k,e[a+5],12,1200080426),k=c(k,j,g,h,e[a+6],17,2821735955),h=c(h,k,j,g,e[a+7],22,4249261313),g=c(g,h,k,j,e[a+8],7,1770035416),
j=c(j,g,h,k,e[a+9],12,2336552879),k=c(k,j,g,h,e[a+10],17,4294925233),h=c(h,k,j,g,e[a+11],22,2304563134),g=c(g,h,k,j,e[a+12],7,1804603682),j=c(j,g,h,k,e[a+13],12,4254626195),k=c(k,j,g,h,e[a+14],17,2792965006),h=c(h,k,j,g,e[a+15],22,1236535329),g=d(g,h,k,j,e[a+1],5,4129170786),j=d(j,g,h,k,e[a+6],9,3225465664),k=d(k,j,g,h,e[a+11],14,643717713),h=d(h,k,j,g,e[a+0],20,3921069994),g=d(g,h,k,j,e[a+5],5,3593408605),j=d(j,g,h,k,e[a+10],9,38016083),k=d(k,j,g,h,e[a+15],14,3634488961),h=d(h,k,j,g,e[a+4],20,3889429448),
g=d(g,h,k,j,e[a+9],5,568446438),j=d(j,g,h,k,e[a+14],9,3275163606),k=d(k,j,g,h,e[a+3],14,4107603335),h=d(h,k,j,g,e[a+8],20,1163531501),g=d(g,h,k,j,e[a+13],5,2850285829),j=d(j,g,h,k,e[a+2],9,4243563512),k=d(k,j,g,h,e[a+7],14,1735328473),h=d(h,k,j,g,e[a+12],20,2368359562),g=f(g,h,k,j,e[a+5],4,4294588738),j=f(j,g,h,k,e[a+8],11,2272392833),k=f(k,j,g,h,e[a+11],16,1839030562),h=f(h,k,j,g,e[a+14],23,4259657740),g=f(g,h,k,j,e[a+1],4,2763975236),j=f(j,g,h,k,e[a+4],11,1272893353),k=f(k,j,g,h,e[a+7],16,4139469664),
h=f(h,k,j,g,e[a+10],23,3200236656),g=f(g,h,k,j,e[a+13],4,681279174),j=f(j,g,h,k,e[a+0],11,3936430074),k=f(k,j,g,h,e[a+3],16,3572445317),h=f(h,k,j,g,e[a+6],23,76029189),g=f(g,h,k,j,e[a+9],4,3654602809),j=f(j,g,h,k,e[a+12],11,3873151461),k=f(k,j,g,h,e[a+15],16,530742520),h=f(h,k,j,g,e[a+2],23,3299628645),g=l(g,h,k,j,e[a+0],6,4096336452),j=l(j,g,h,k,e[a+7],10,1126891415),k=l(k,j,g,h,e[a+14],15,2878612391),h=l(h,k,j,g,e[a+5],21,4237533241),g=l(g,h,k,j,e[a+12],6,1700485571),j=l(j,g,h,k,e[a+3],10,2399980690),
k=l(k,j,g,h,e[a+10],15,4293915773),h=l(h,k,j,g,e[a+1],21,2240044497),g=l(g,h,k,j,e[a+8],6,1873313359),j=l(j,g,h,k,e[a+15],10,4264355552),k=l(k,j,g,h,e[a+6],15,2734768916),h=l(h,k,j,g,e[a+13],21,1309151649),g=l(g,h,k,j,e[a+4],6,4149444226),j=l(j,g,h,k,e[a+11],10,3174756917),k=l(k,j,g,h,e[a+2],15,718787259),h=l(h,k,j,g,e[a+9],21,3951481745),g=b(g,q),h=b(h,n),k=b(k,i),j=b(j,v);return(m(g)+m(h)+m(k)+m(j)).toLowerCase()};(function(a){a.fn.stupidtable=function(){a(this).on("click","thead th",function(){a(this).stupidsort()})};a.fn.stupidsort=function(){function b(b){var c=0,d;a(b).children("td,th").each(function(){if(c==q)return d=a(this),!1;var b=a(this).attr("colspan");c+=b?Number(b):1});b="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":b=String(b).toLowerCase();break;case "int":b=
h),f));return b(a<<e|a>>>32-e,c)}function m(a){var b="",c="",d;for(d=0;3>=d;d++)c=a>>>8*d&255,c="0"+c.toString(16),b+=c.substr(c.length-2,2);return b}var e=[],q,n,i,v,g,h,j,k,e=a.replace(/\r\n/g,"\n"),a="";for(q=0;q<e.length;q++)n=e.charCodeAt(q),128>n?a+=String.fromCharCode(n):(127<n&&2048>n?a+=String.fromCharCode(n>>6|192):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128)),a+=String.fromCharCode(n&63|128));e=a;a=e.length;q=a+8;n=16*((q-q%64)/64+1);i=Array(n-1);for(g=v=0;g<a;)q=
(g-g%4)/4,v=8*(g%4),i[q]|=e.charCodeAt(g)<<v,g++;q=(g-g%4)/4;i[q]|=128<<8*(g%4);i[n-2]=a<<3;i[n-1]=a>>>29;e=i;g=1732584193;h=4023233417;j=2562383102;k=271733878;for(a=0;a<e.length;a+=16)q=g,n=h,i=j,v=k,g=c(g,h,j,k,e[a+0],7,3614090360),k=c(k,g,h,j,e[a+1],12,3905402710),j=c(j,k,g,h,e[a+2],17,606105819),h=c(h,j,k,g,e[a+3],22,3250441966),g=c(g,h,j,k,e[a+4],7,4118548399),k=c(k,g,h,j,e[a+5],12,1200080426),j=c(j,k,g,h,e[a+6],17,2821735955),h=c(h,j,k,g,e[a+7],22,4249261313),g=c(g,h,j,k,e[a+8],7,1770035416),
k=c(k,g,h,j,e[a+9],12,2336552879),j=c(j,k,g,h,e[a+10],17,4294925233),h=c(h,j,k,g,e[a+11],22,2304563134),g=c(g,h,j,k,e[a+12],7,1804603682),k=c(k,g,h,j,e[a+13],12,4254626195),j=c(j,k,g,h,e[a+14],17,2792965006),h=c(h,j,k,g,e[a+15],22,1236535329),g=d(g,h,j,k,e[a+1],5,4129170786),k=d(k,g,h,j,e[a+6],9,3225465664),j=d(j,k,g,h,e[a+11],14,643717713),h=d(h,j,k,g,e[a+0],20,3921069994),g=d(g,h,j,k,e[a+5],5,3593408605),k=d(k,g,h,j,e[a+10],9,38016083),j=d(j,k,g,h,e[a+15],14,3634488961),h=d(h,j,k,g,e[a+4],20,3889429448),
g=d(g,h,j,k,e[a+9],5,568446438),k=d(k,g,h,j,e[a+14],9,3275163606),j=d(j,k,g,h,e[a+3],14,4107603335),h=d(h,j,k,g,e[a+8],20,1163531501),g=d(g,h,j,k,e[a+13],5,2850285829),k=d(k,g,h,j,e[a+2],9,4243563512),j=d(j,k,g,h,e[a+7],14,1735328473),h=d(h,j,k,g,e[a+12],20,2368359562),g=f(g,h,j,k,e[a+5],4,4294588738),k=f(k,g,h,j,e[a+8],11,2272392833),j=f(j,k,g,h,e[a+11],16,1839030562),h=f(h,j,k,g,e[a+14],23,4259657740),g=f(g,h,j,k,e[a+1],4,2763975236),k=f(k,g,h,j,e[a+4],11,1272893353),j=f(j,k,g,h,e[a+7],16,4139469664),
h=f(h,j,k,g,e[a+10],23,3200236656),g=f(g,h,j,k,e[a+13],4,681279174),k=f(k,g,h,j,e[a+0],11,3936430074),j=f(j,k,g,h,e[a+3],16,3572445317),h=f(h,j,k,g,e[a+6],23,76029189),g=f(g,h,j,k,e[a+9],4,3654602809),k=f(k,g,h,j,e[a+12],11,3873151461),j=f(j,k,g,h,e[a+15],16,530742520),h=f(h,j,k,g,e[a+2],23,3299628645),g=l(g,h,j,k,e[a+0],6,4096336452),k=l(k,g,h,j,e[a+7],10,1126891415),j=l(j,k,g,h,e[a+14],15,2878612391),h=l(h,j,k,g,e[a+5],21,4237533241),g=l(g,h,j,k,e[a+12],6,1700485571),k=l(k,g,h,j,e[a+3],10,2399980690),
j=l(j,k,g,h,e[a+10],15,4293915773),h=l(h,j,k,g,e[a+1],21,2240044497),g=l(g,h,j,k,e[a+8],6,1873313359),k=l(k,g,h,j,e[a+15],10,4264355552),j=l(j,k,g,h,e[a+6],15,2734768916),h=l(h,j,k,g,e[a+13],21,1309151649),g=l(g,h,j,k,e[a+4],6,4149444226),k=l(k,g,h,j,e[a+11],10,3174756917),j=l(j,k,g,h,e[a+2],15,718787259),h=l(h,j,k,g,e[a+9],21,3951481745),g=b(g,q),h=b(h,n),j=b(j,i),k=b(k,v);return(m(g)+m(h)+m(j)+m(k)).toLowerCase()};(function(a){a.fn.stupidtable=function(){a(this).on("click","thead th",function(){a(this).stupidsort()})};a.fn.stupidsort=function(){function b(b){var c=0,d;a(b).children("td,th").each(function(){if(c==q)return d=a(this),!1;var b=a(this).attr("colspan");c+=b?Number(b):1});b="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":b=String(b).toLowerCase();break;case "int":b=
parseInt(Number(b));break;case "float":b=Number(b)}return b}var c=a(this),d=c.closest("table"),f=d.children("tbody"),l=f.children("tr"),m=c.attr("data-sort-type");if(m){var e=!0;c.hasClass("sorting-asc")&&(e=!1);var q=0;c.prevAll().each(function(){var b=a(this).attr("colspan");q+=b?Number(b):1});l.sort(function(a,c){var d=e?1:-1,a=b(a),c=b(c);return a>c?1*d:a<c?-1*d:0});f.append(l);d.find("thead th").removeClass("sorting-asc").removeClass("sorting-desc");c.addClass(e?"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(b){}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 c=0;$("body > div.filler").on("scroll",function(){var a=$(this).scrollLeft();a!=c&&UI.elements.header.css("margin-right",-1*a+"px");c=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 MistVideoObject={},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,b){this.vars[a]=b;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,b){this.opts&&log("[interval]","Set called on interval, but an interval is already active.");
@ -35,16 +35,16 @@ d&&!mist.data.LTS||d.readonly)&&i.prop("disabled",!0),d.radioselect[c][2])n=$("<
$checklist.append($("<label>").text(d.checklist[c][1]).prepend($("<input>").attr("type","checkbox").attr("name",d.checklist[c][0])));break;case "DOMfield":f=d.DOMfield;break;case "unix":f=$("<input>").attr("type","datetime-local").attr("step",1);d.unit=$("<button>").text("Now").click(function(){$(this).closest(".field_container").find(".field").setval((new Date).getTime()/1E3)});break;case "selectinput":f=$("<div>").addClass("selectinput");i=$("<select>");f.append(i);i.data("input",!1);"LTSonly"in
d&&!mist.data.LTS&&i.prop("disabled",!0);for(c in d.selectinput)n=$("<option>"),i.append(n),"string"==typeof d.selectinput[c]?n.text(d.selectinput[c]):(n.text(d.selectinput[c][1]),"string"==typeof d.selectinput[c][0]?n.val(d.selectinput[c][0]):(n.val("CUSTOM"),i.data("input")||i.data("input",UI.buildUI([d.selectinput[c][0]]).children())));i.data("input")&&f.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":f=$("<div>").addClass("inputlist");f.data("newitem",function(){var a=$("<input>").attr("type","text").addClass("listitem");("LTSonly"in d&&!mist.data.LTS||d.readonly)&&a.prop("disabled",!0);var b=function(c){$(this).is(":last-child")?""!=$(this).val()?$(this).after(a.clone().keyup(b).val("")):8==c.which&&$(this).prev().focus():""==$(this).val()&&($(this).next().focus(),$(this).remove())};a.keyup(b);return a});f.append(f.data("newitem"));break;case "sublist":f=
$("<div>").addClass("sublist");i=$("<div>").addClass("curvals");i.append($("<span>").text("None."));var v=$("<div>").addClass("itemsettings"),g=$("<button>").text("New "+d.itemLabel),h=d.sublist,k=d,j=f,P=m;f.data("build",function(a,b){for(var c in k.saveas)c in a||delete k.saveas[c];k.saveas=Object.assign(k.saveas,a);c="New";"undefined"!=typeof b&&(c="Edit");c=UI.buildUI([$("<h4>").text(c+" "+k.itemLabel)].concat(h).concat([{label:"Save first",type:"str",classes:["onlyshowhelp"],validate:[function(){return{msg:"Did you want to save this "+
k.itemLabel+"?",classes:["red"]}}]},{type:"buttons",buttons:[{label:"Cancel",type:"cancel","function":function(){v.html("");g.show();P.show()}},{label:"Save "+k.itemLabel,type:"save",preSave:function(){$(this).closest(".input_container").find(".onlyshowhelp").closest("label").hide()},failedValidate:function(){$(this).closest(".input_container").find(".onlyshowhelp").closest("label").show()},"function":function(){var a=j.getval(),c=Object.assign({},k.saveas),d;for(d in c)null===c[d]&&delete c[d];"undefined"==
typeof b?a.push(c):a[b]=c;j.setval(a);v.html("");g.show();P.show()}}]}]));v.html(c);g.hide();P.hide()});var F=f;g.click(function(){F.data("build")({})});h.unshift({type:"str",label:"Human readable name",placeholder:"none",help:"A convenient name to describe this "+d.itemLabel+". It won't be used by MistServer.",pointer:{main:d.saveas,index:"x-LSP-name"}});f.data("savelist",[]);f.append(i).append(g);b.append(v);break;default:f=$("<input>").attr("type","text")}f.addClass("field").data("opts",d);"pointer"in
$("<div>").addClass("sublist");i=$("<div>").addClass("curvals");i.append($("<span>").text("None."));var v=$("<div>").addClass("itemsettings"),g=$("<button>").text("New "+d.itemLabel),h=d.sublist,j=d,k=f,P=m;f.data("build",function(a,b){for(var c in j.saveas)c in a||delete j.saveas[c];j.saveas=Object.assign(j.saveas,a);c="New";"undefined"!=typeof b&&(c="Edit");c=UI.buildUI([$("<h4>").text(c+" "+j.itemLabel)].concat(h).concat([{label:"Save first",type:"str",classes:["onlyshowhelp"],validate:[function(){return{msg:"Did you want to save this "+
j.itemLabel+"?",classes:["red"]}}]},{type:"buttons",buttons:[{label:"Cancel",type:"cancel","function":function(){v.html("");g.show();P.show()}},{label:"Save "+j.itemLabel,type:"save",preSave:function(){$(this).closest(".input_container").find(".onlyshowhelp").closest("label").hide()},failedValidate:function(){$(this).closest(".input_container").find(".onlyshowhelp").closest("label").show()},"function":function(){var a=k.getval(),c=Object.assign({},j.saveas),d;for(d in c)null===c[d]&&delete c[d];"undefined"==
typeof b?a.push(c):a[b]=c;k.setval(a);v.html("");g.show();P.show()}}]}]));v.html(c);g.hide();P.hide()});var F=f;g.click(function(){F.data("build")({})});h.unshift({type:"str",label:"Human readable name",placeholder:"none",help:"A convenient name to describe this "+d.itemLabel+". It won't be used by MistServer.",pointer:{main:d.saveas,index:"x-LSP-name"}});f.data("savelist",[]);f.append(i).append(g);b.append(v);break;default:f=$("<input>").attr("type","text")}f.addClass("field").data("opts",d);"pointer"in
d&&f.attr("name",d.pointer.index);e.append(f);if("classes"in d)for(l in d.classes)f.addClass(d.classes[l]);"placeholder"in d&&f.attr("placeholder",d.placeholder);"default"in d&&f.attr("placeholder",d["default"]);"unit"in d&&e.append($("<span>").addClass("unit").html(d.unit));"readonly"in d&&(f.attr("readonly","readonly"),f.click(function(){$(this).select()}));"qrcode"in d&&e.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()),b=$("<div>").addClass("qrcode");UI.popup.show($("<span>").addClass("qr_container").append($("<p>").text(a)).append(b));b.qrcode({text:a,size:Math.min(b.width(),b.height())})})));"clipboard"in d&&document.queryCommandSupported("copy")&&e.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()),
b=document.createElement("textarea");b.value=a;document.body.appendChild(b);b.select();var c=false;try{c=document.execCommand("copy")}catch(d){}if(c){$(this).text("Copied to clipboard!");document.body.removeChild(b);var g=$(this);setTimeout(function(){g.text("Copy")},5E3)}else{document.body.removeChild(b);alert("Failed to copy:\n"+a)}})));"rows"in d&&f.attr("rows",d.rows);"LTSonly"in d&&!mist.data.LTS&&(e.addClass("LTSonly"),f.prop("disabled",!0));if("dependent"in d)for(c in d.dependent)m.attr("data-dependent-"+
c,d.dependent[c]);switch(d.type){case "browse":i=$("<div>").addClass("grouper").append(m);b.append(i);i=$("<button>").text("Browse").on("keydown",function(a){a.stopPropagation()});e.append(i);i.click(function(){function a(b){f.text("Loading..");mist.send(function(a){e.text(a.browse.path[0]);mist.data.LTS&&d.setval(a.browse.path[0]+"/");f.html(k.clone(true).text("..").attr("title","Folder up"));if(a.browse.subdirectories){a.browse.subdirectories.sort();for(var b in a.browse.subdirectories){var h=a.browse.subdirectories[b];
f.append(k.clone(true).attr("title",e.text()+j+h).text(h))}}if(a.browse.files){a.browse.files.sort();for(b in a.browse.files){var h=a.browse.files[b],r=e.text()+j+h,h=$("<a>").text(h).addClass("file").attr("title",r);f.append(h);if(m){var i=true,l;for(l in m)if(typeof m[l]!="undefined"&&mist.inputMatch(m[l],r)){i=false;break}i&&h.hide()}h.click(function(){var a=$(this).attr("title");d.setval(a).removeAttr("readonly").css("opacity",1);g.show();c.remove()})}}},{browse:b})}var b=$(this).closest(".grouper"),
c=$("<div>").addClass("browse_container"),d=b.find(".field").attr("readonly","readonly").css("opacity",0.5),g=$(this),h=$("<button>").text("Stop browsing").click(function(){g.show();c.remove();d.removeAttr("readonly").css("opacity",1)}),e=$("<span>").addClass("field"),f=$("<div>").addClass("browse_contents"),k=$("<a>").addClass("folder"),m=d.data("filetypes");b.append(c);c.append($("<label>").addClass("UIelement").append($("<span>").addClass("label").text("Current folder:")).append($("<span>").addClass("field_container").append(e).append(h))).append(f);
var j="/";mist.data.config.version.indexOf("indows")>-1&&(j="\\");k.click(function(){var b=e.text()+j+$(this).text();a(b)});b=d.getval();h=b.split("://");h.length>1&&(b=h[0]=="file"?h[1]:"");b=b.split(j);b.pop();b=b.join(j);g.hide();a(b)});break;case "geolimited":case "hostlimited":i={field:f};i.blackwhite=$("<select>").append($("<option>").val("-").text("Blacklist")).append($("<option>").val("+").text("Whitelist"));i.values=$("<span>").addClass("limit_value_list");switch(d.type){case "geolimited":i.prototype=
c,d.dependent[c]);switch(d.type){case "browse":i=$("<div>").addClass("grouper").append(m);b.append(i);i=$("<button>").text("Browse").on("keydown",function(a){a.stopPropagation()});e.append(i);i.click(function(){function a(b){f.text("Loading..");mist.send(function(a){e.text(a.browse.path[0]);mist.data.LTS&&d.setval(a.browse.path[0]+"/");f.html(j.clone(true).text("..").attr("title","Folder up"));if(a.browse.subdirectories){a.browse.subdirectories.sort();for(var b in a.browse.subdirectories){var h=a.browse.subdirectories[b];
f.append(j.clone(true).attr("title",e.text()+k+h).text(h))}}if(a.browse.files){a.browse.files.sort();for(b in a.browse.files){var h=a.browse.files[b],r=e.text()+k+h,h=$("<a>").text(h).addClass("file").attr("title",r);f.append(h);if(m){var i=true,l;for(l in m)if(typeof m[l]!="undefined"&&mist.inputMatch(m[l],r)){i=false;break}i&&h.hide()}h.click(function(){var a=$(this).attr("title");d.setval(a).removeAttr("readonly").css("opacity",1);g.show();c.remove()})}}},{browse:b})}var b=$(this).closest(".grouper"),
c=$("<div>").addClass("browse_container"),d=b.find(".field").attr("readonly","readonly").css("opacity",0.5),g=$(this),h=$("<button>").text("Stop browsing").click(function(){g.show();c.remove();d.removeAttr("readonly").css("opacity",1)}),e=$("<span>").addClass("field"),f=$("<div>").addClass("browse_contents"),j=$("<a>").addClass("folder"),m=d.data("filetypes");b.append(c);c.append($("<label>").addClass("UIelement").append($("<span>").addClass("label").text("Current folder:")).append($("<span>").addClass("field_container").append(e).append(h))).append(f);
var k="/";mist.data.config.version.indexOf("indows")>-1&&(k="\\");j.click(function(){var b=e.text()+k+$(this).text();a(b)});b=d.getval();h=b.split("://");h.length>1&&(b=h[0]=="file"?h[1]:"");b=b.split(k);b.pop();b=b.join(k);g.hide();a(b)});break;case "geolimited":case "hostlimited":i={field:f};i.blackwhite=$("<select>").append($("<option>").val("-").text("Blacklist")).append($("<option>").val("+").text("Whitelist"));i.values=$("<span>").addClass("limit_value_list");switch(d.type){case "geolimited":i.prototype=
$("<select>").append($("<option>").val("").text("[Select a country]"));for(c in UI.countrylist)i.prototype.append($("<option>").val(c).html(UI.countrylist[c]));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"),b=[],c=false;a.values.children().each(function(){c=
$(this).val();c!=""?b.push(c):$(this).remove()});a.values.append(a.prototype.clone(true));b.length>0?a.field.val($(this).val()+b.join(" ")):a.field.val("");a.field.trigger("change")});"LTSonly"in d&&!mist.data.LTS&&(i.blackwhite.prop("disabled",!0),i.prototype.prop("disabled",!0));i.values.append(i.prototype.clone(!0));e.data("subUI",i).addClass("limit_list").append(i.blackwhite).append(i.values)}"pointer"in d&&(f.data("pointer",d.pointer).addClass("isSetting"),d.pointer.main&&(i=d.pointer.main[d.pointer.index],
"undefined"!=i&&f.setval(i)));(""==f.getval()||null==f.getval())&&"value"in d&&f.setval(d.value);if("datalist"in d)for(c in i="datalist_"+c+MD5(f[0].outerHTML),f.attr("list",i),i=$("<datalist>").attr("id",i),e.append(i),d.datalist)i.append($("<option>").val(d.datalist[c]));e=$("<span>").addClass("help_container");m.append(e);"help"in d&&(e.append($("<span>").addClass("ih_balloon").html(d.help)),f.on("focus mouseover",function(){$(this).closest("label").addClass("active")}).on("blur mouseout",function(){$(this).closest("label").removeClass("active")}));
@ -68,13 +68,13 @@ c.series.yaxis)))));UI.tooltip.show(b,a.children())}else UI.tooltip.hide()}).on(
c=$.extend(!0,{},UI.plot.datatype.templates[a.datatype]),a=$.extend(!0,c,a),a=$.extend(!0,b,a);switch(a.origin[0]){case "total":switch(a.datatype){case "cpuload":case "memload":break;default:a.label+=" (total)"}break;case "stream":case "protocol":a.label+=" ("+a.origin[1]+")"}var b=[],d;for(d in a.basecolor)c=a.basecolor[d],c+=50*(0.5-Math.random()),c=Math.round(c),c=Math.min(255,Math.max(0,c)),b.push(c);a.color="rgb("+b.join(",")+")";return a},templates:{general:{display:!0,datatype:"general",label:"",
yaxistype:"amount",data:[],lines:{show:!0},points:{show:!1},getdata:function(){var a=mist.data.totals["stream"==this.origin[0]?this.origin[1]:"all_streams"]["protocol"==this.origin[0]?this.origin[1]:"all_protocols"][this.datatype];return this.data=a}},cpuload:{label:"CPU use",yaxistype:"percentage",basecolor:[237,194,64],cores:1,getdata:function(){var a=!1,b;for(b in this.data)this.data[b][0]<1E3*(mist.data.config.time-600)&&(a=b);!1!==a&&this.data.splice(0,Number(a)+1);this.data.push([1E3*mist.data.config.time,
mist.data.capabilities.cpu_use/10]);return this.data}},memload:{label:"Memory load",yaxistype:"percentage",basecolor:[175,216,248],getdata:function(){var a=!1,b;for(b in this.data)this.data[b][0]<1E3*(mist.data.config.time-600)&&(a=b);!1!==a&&this.data.splice(0,Number(a)+1);this.data.push([1E3*mist.data.config.time,mist.data.capabilities.load.memory]);return this.data}},clients:{label:"Connections",basecolor:[203,75,75]},upbps:{label:"Bandwidth up",yaxistype:"bytespersec",basecolor:[77,167,77]},downbps:{label:"Bandwidth down",
yaxistype:"bytespersec",basecolor:[148,64,237]},perc_lost:{label:"Lost packages",yaxistype:"percentage",basecolor:[255,33,234]},perc_retrans:{label:"Re-transmitted packages",yaxistype:"percentage",basecolor:[255,87,34]}}},yaxes:{percentage:{name:"percentage",color:"black",tickColor:0,tickDecimals:0,tickFormatter:function(a){return UI.format.addUnit(UI.format.number(a),"%")},tickLength:0,min:0,max:100},amount:{name:"amount",color:"black",tickColor:0,tickDecimals:0,tickFormatter:function(a){return UI.format.number(a)},
yaxistype:"bytespersec",basecolor:[148,64,237]},perc_lost:{label:"Lost packages",yaxistype:"percentage",basecolor:[255,33,234]},perc_retrans:{label:"Re-transmitted packages",yaxistype:"percentage",basecolor:[0,0,255]}}},yaxes:{percentage:{name:"percentage",color:"black",tickColor:0,tickDecimals:0,tickFormatter:function(a){return UI.format.addUnit(UI.format.number(a),"%")},tickLength:0,min:0,max:100},amount:{name:"amount",color:"black",tickColor:0,tickDecimals:0,tickFormatter:function(a){return UI.format.number(a)},
tickLength:0,min:0},bytespersec:{name:"bytespersec",color:"black",tickColor:0,tickDecimals:1,tickFormatter:function(a){return UI.format.bytes(a,!0)},tickLength:0,ticks:function(a){var b=0.3*Math.sqrt($(".graph").first().height()),b=(a.max-a.min)/b,c=Math.floor(Math.log(Math.abs(b))/Math.log(1024)),d=b/Math.pow(1024,c),f=-Math.floor(Math.log(d)/Math.LN10),l=a.tickDecimals;null!=l&&f>l&&(f=l);var m=Math.pow(10,-f),d=d/m,e;if(1.5>d)e=1;else if(3>d){if(e=2,2.25<d&&(null==l||f+1<=l))e=2.5,++f}else e=7.5>
d?5:10;e=e*m*Math.pow(1024,c);null!=a.minTickSize&&e<a.minTickSize&&(e=a.minTickSize);a.delta=b;a.tickDecimals=Math.max(0,null!=l?l:f);a.tickSize=e;b=[];c=a.tickSize*Math.floor(a.min/a.tickSize);f=0;l=Number.NaN;do m=l,l=c+f*a.tickSize,b.push(l),++f;while(l<a.max&&l!=m);return b},min:0}},xaxes:{time:{name:"time",mode:"time",timezone:"browser",ticks:5}}},draggable:function(a){a.attr("draggable",!0);a.on("dragstart",function(a){$(this).css("opacity",0.4).data("dragstart",{click:{x:a.originalEvent.pageX,
y:a.originalEvent.pageY},ele:{x:this.offsetLeft,y:this.offsetTop}})}).on("dragend",function(a){var c=$(this).data("dragstart"),d=c.ele.x-c.click.x+a.originalEvent.pageX,a=c.ele.y-c.click.y+a.originalEvent.pageY;$(this).css({opacity:1,top:a,left:d,right:"auto",bottom:"auto"})});a.parent().on("dragleave",function(){})},format:{time:function(a,b){var c=new Date(1E3*a),d=[];d.push(("0"+c.getHours()).slice(-2));d.push(("0"+c.getMinutes()).slice(-2));"short"!=b&&d.push(("0"+c.getSeconds()).slice(-2));return d.join(":")},
date:function(a,b){var c=new Date(1E3*a),d="Sun Mon Tue Wed Thu Fri Sat".split(" "),f=[];"long"==b&&f.push(d[c.getDay()]);f.push(("0"+c.getDate()).slice(-2));f.push("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")[c.getMonth()]);"short"!=b&&f.push(c.getFullYear());return f.join(" ")},dateTime:function(a,b){return UI.format.date(a,b)+", "+UI.format.time(a,b)},duration:function(a){var b=[0.001,1E3,60,60,24,7,52,1E9],c="ms sec min hr day week year".split(" "),d={},f;for(f in c){var a=a/b[f],
l=Math.round(a%b[Number(f)+1]);d[c[f]]=l;a-=l}var m;for(f=c.length-1;0<=f;f--)if(0<d[c[f]]){m=c[f];break}b=$("<span>");switch(m){case "year":b.append(UI.format.addUnit(d.year,"years, ")).append(UI.format.addUnit(d.week,"wks"));break;case "week":b.append(UI.format.addUnit(d.week,"wks, ")).append(UI.format.addUnit(d.day,"days"));break;case "day":b.append(UI.format.addUnit(d.day,"days, ")).append(UI.format.addUnit(d.hr,"hrs"));break;default:b.append([("0"+d.hr).slice(-2),("0"+d.min).slice(-2),("0"+d.sec).slice(-2)+
(d.ms?"."+d.ms:"")].join(":"))}return b[0].innerHTML},number:function(a){if(isNaN(Number(a))||0==a)return a;var b=Math.pow(10,3-Math.floor(Math.log(a)/Math.LN10)-1),a=Math.round(a*b)/b;if(1E4<a){number=a.toString().split(".");for(a=/(\d+)(\d{3})/;a.test(number[0]);)number[0]=number[0].replace(a,"$1 $2");a=number.join(".")}return a},status:function(a){var b=$("<span>");if("undefined"==typeof a.online)return b.text("Unknown, checking.."),"undefined"!=typeof a.error&&b.text(a.error),b;switch(a.online){case -1:b.text("Enabling");
(d.ms?"."+d.ms:"")].join(":"))}return b[0].innerHTML},number:function(a){if(isNaN(Number(a))||0==a)return a;var b=Math.pow(10,3-Math.floor(Math.log(a)/Math.LN10)-1),a=Math.round(a*b)/b;if(1E4<=a){number=a.toString().split(".");for(a=/(\d+)(\d{3})/;a.test(number[0]);)number[0]=number[0].replace(a,"$1 $2");a=number.join(".")}return a},status:function(a){var b=$("<span>");if("undefined"==typeof a.online)return b.text("Unknown, checking.."),"undefined"!=typeof a.error&&b.text(a.error),b;switch(a.online){case -1:b.text("Enabling");
break;case 0:b.text("Unavailable").addClass("red");break;case 1:b.text("Active").addClass("green");break;case 2:b.text("Standby").addClass("orange");break;default:b.text(a.online)}"error"in a&&b.text(a.error);return b},capital:function(a){return a.charAt(0).toUpperCase()+a.substring(1)},addUnit:function(a,b){var c=$("<span>").html(a);c.append($("<span>").addClass("unit").html(b));return c[0].innerHTML},bytes:function(a,b){var c="bytes KiB MiB GiB TiB PiB".split(" ");if(0==a)unit=c[0];else{var d=Math.floor(Math.log(Math.abs(a))/
Math.log(1024));0>d?unit=c[0]:(a/=Math.pow(1024,d),unit=c[d])}return UI.format.addUnit(UI.format.number(a),unit+(b?"/s":""))}},navto:function(a,b){var c=location.hash,d=c.split("@");d[0]=[mist.user.name,mist.user.host].join("&");d[1]=[a,b].join("&");"undefined"!=typeof screenlog&&screenlog.navto(d[1]);location.hash=d.join("@");location.hash==c&&$(window).trigger("hashchange")},showTab:function(a,b){var c=UI.elements.main;if(mist.user.loggedin){if(!("ui_settings"in mist.data)){c.html("Loading..");
mist.send(function(){UI.showTab(a,b)},{ui_settings:!0});return}mist.data.config.serverid&&(document.title=mist.data.config.serverid+" - MistServer MI")}var d=UI.elements.menu.removeClass("hide").find('.plain:contains("'+a+'")').closest(".button");0<d.length&&(UI.elements.menu.find(".button.active").removeClass("active"),d.addClass("active"));MistVideoObject&&MistVideoObject.reference&&MistVideoObject.reference.unload();UI.interval.clear();c.html($("<h2>").text(a));switch(a){case "Login":if(mist.user.loggedin){UI.navto("Overview");
@ -85,14 +85,14 @@ pointer:{main:mist.user,index:"name"}},{label:"Desired password",type:"password"
classes:["red"]}:false}],help:"Repeat your desired password.",classes:["match_password"]},{type:"buttons",buttons:[{type:"save",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");c.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)c.append("Unable to enable all protocols as protocol settings already exist.<br>");else{c.append("Retrieving available protocols..<br>");mist.send(function(a){var b=[],d;for(d in a.capabilities.connectors)if(a.capabilities.connectors[d].required)c.append('Could not enable protocol "'+d+'" because it has required settings.<br>');
else{b.push({connector:d});c.append('Enabled protocol "'+d+'".<br>')}c.append("Saving protocol settings..<br>");mist.send(function(){c.append("Protocols enabled. Redirecting..");setTimeout(function(){UI.navto("Overview")},5E3)},{config:{protocols:b}})},{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});c.append("Loading..");return}var f=
$("<span>").text("Loading.."),l=$("<span>"),m=$("<span>").addClass("logs"),e=$("<span>"),q=$("<span>"),n=$("<span>").text("Unknown"),i=$("<span>"),v=$("<span>"),g={serverid:mist.data.config.serverid,debug:mist.data.config.debug,accesslog:mist.data.config.accesslog,prometheus:mist.data.config.prometheus,defaultStream:mist.data.config.defaultStream,trustedproxy:mist.data.config.trustedproxy},h={};"bandwidth"in mist.data&&(h=mist.data.bandwidth,null==h&&(h={}),h.limit||(h.limit=""));var k=$("<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")),
j=parseURL(mist.user.host),j=j.protocol+j.host+j.port;c.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:f,LTSonly:!0},{type:"span",label:"Server time",value:q},{type:"span",label:"Licensed to",value:"license"in
$("<span>").text("Loading.."),l=$("<span>"),m=$("<span>").addClass("logs"),e=$("<span>"),q=$("<span>"),n=$("<span>").text("Unknown"),i=$("<span>"),v=$("<span>"),g={serverid:mist.data.config.serverid,debug:mist.data.config.debug,accesslog:mist.data.config.accesslog,prometheus:mist.data.config.prometheus,defaultStream:mist.data.config.defaultStream,trustedproxy:mist.data.config.trustedproxy},h={};"bandwidth"in mist.data&&(h=mist.data.bandwidth,null==h&&(h={}),h.limit||(h.limit=""));var j=$("<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")),
k=parseURL(mist.user.host),k=k.protocol+k.host+k.port;c.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:f,LTSonly:!0},{type:"span",label:"Server time",value:q},{type:"span",label:"Licensed to",value:"license"in
mist.data.config?mist.data.config.license.user:"",LTSonly:!0},{type:"span",label:"Active licenses",value:n,LTSonly:!0},{type:"span",label:"Configured streams",value:mist.data.streams?Object.keys(mist.data.streams).length:0},{type:"span",label:"Active streams",value:l},{type:"span",label:"Current connections",value:e},{type:"span",label:"Enabled protocols",value:i},{type:"span",label:"Disabled protocols",value:v},{type:"span",label:"Recent problems",value:m},$("<br>"),{type:"str",label:"Human readable name",
pointer:{main:g,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:g,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:g,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:g,index:"prometheus"},help:"Make stats available in Prometheus format. These can be accessed via "+j+"/PASSPHRASE or "+j+"/PASSPHRASE.json.",LTSonly:!0},{type:"inputlist",label:"Trusted proxies",help:"List of proxy server addresses that are allowed to override the viewer IP address to arbitrary values.<br>You may use a hostname or IP address.",
LTSonly:!0,pointer:{main:g,index:"trustedproxy"}},{type:"selectinput",label:"Load balancer bandwidth limit",selectinput:[["","Default (1 gbps)"],[{label:"Custom",type:"int",min:0,unit:k},"Custom"]],pointer:{main:h,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:h,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>",
[{type:"str",label:"Path",LTSonly:!0},"Log to file"]],pointer:{main:g,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:g,index:"prometheus"},help:"Make stats available in Prometheus format. These can be accessed via "+k+"/PASSPHRASE or "+k+"/PASSPHRASE.json.",LTSonly:!0},{type:"inputlist",label:"Trusted proxies",help:"List of proxy server addresses that are allowed to override the viewer IP address to arbitrary values.<br>You may use a hostname or IP address.",
LTSonly:!0,pointer:{main:g,index:"trustedproxy"}},{type:"selectinput",label:"Load balancer bandwidth limit",selectinput:[["","Default (1 gbps)"],[{label:"Custom",type:"int",min:0,unit:j},"Custom"]],pointer:{main:h,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:h,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>",
LTSonly:!0},{type:"str",validate:["streamname_with_wildcard_and_variables"],label:"Fallback stream",pointer:{main:g,index:"defaultStream"},help:"When this is set, if someone attempts to view a stream that does not exist, or is offline, they will be redirected to this stream instead. $stream may be used to refer to the original stream name.",LTSonly:!0},{type:"checkbox",label:"Force configurations save",pointer:{main:g,index:"save"},help:"Tick the box in order to force an immediate save to the config.json MistServer uses to save your settings. Saving will otherwise happen upon closing MistServer. Don't forget to press save after ticking the box."},
{type:"buttons",buttons:[{type:"save",label:"Save","function":function(){var a={config:g},b={};b.limit=h.limit?k.val()*h.limit:0;b.exceptions=h.exceptions;if(b.exceptions===null)b.exceptions=[];a.bandwidth=b;if(g.save)a.save=g.save;delete g.save;mist.send(function(){UI.navto("Overview")},a)}}]}]));if(mist.data.LTS){var P=function(a){function b(a){if(a.update){var d="";"progress"in a.update&&(d=" ("+a.update.progress+"%)");f.text("Updating.."+d);c(a.log);setTimeout(function(){mist.send(function(a){b(a)},
{type:"buttons",buttons:[{type:"save",label:"Save","function":function(){var a={config:g},b={};b.limit=h.limit?j.val()*h.limit:0;b.exceptions=h.exceptions;if(b.exceptions===null)b.exceptions=[];a.bandwidth=b;if(g.save)a.save=g.save;delete g.save;mist.send(function(){UI.navto("Overview")},a)}}]}]));if(mist.data.LTS){var P=function(a){function b(a){if(a.update){var d="";"progress"in a.update&&(d=" ("+a.update.progress+"%)");f.text("Updating.."+d);c(a.log);setTimeout(function(){mist.send(function(a){b(a)},
{update:true})},1E3)}else UI.showTab("Overview")}function c(a){a=a.filter(function(a){return a[1]=="UPDR"});if(a.length){var b=$("<div>");f.append(b);for(var d in a)b.append($("<div>").text(a[d][2]))}}if(!a.update||!("uptodate"in a.update)){f.text("Unknown, checking..");setTimeout(function(){mist.send(function(a){"update"in a&&P(a)},{checkupdate:true})},5E3)}else if(a.update.error)f.addClass("red").text(a.update.error);else if(a.update.uptodate)f.text("Your version is up to date.").addClass("green");
else{if(a.update.progress){f.addClass("orange").removeClass("red").text("Updating..");b(a)}else{f.text("");f.append($("<span>").addClass("red").text("On "+(new Date(a.update.date)).toLocaleDateString()+" version "+a.update.version+" became available."));(!a.update.url||a.update.url.slice(-4)!=".zip")&&f.append($("<button>").text("Rolling update").css({"font-size":"1em","margin-left":"1em"}).click(function(){if(confirm("Are you sure you want to execute a rolling update?")){f.addClass("orange").removeClass("red").text("Rolling update command sent..");
mist.send(function(a){b(a)},{autoupdate:true})}}));var d=$("<a>").attr("href",a.update.url).attr("target","_blank").text("Manual download");d[0].protocol="https:";f.append($("<div>").append(d))}c(a.log)}};P(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 F=$("<table>").css("text-indent","0");n.html(F);F.append($("<tr>").append($("<th>").append("Product")).append($("<th>").append("Updates until")).append($("<th>").append("Use until")).append($("<th>").append("Max. simul. instances")));
@ -111,14 +111,14 @@ b.deps.split(", ");for(var g in b.deps){a=$("<li>").text(b.deps[g]+" ");$ul.appe
s.connector+'"');c.append(Aa(s.connector))}else{c.html($("<h2>").text("New Protocol"));var o={},t=[["",""]];for(r in mist.data.capabilities.connectors)t.push([r,mist.data.capabilities.connectors[r].friendly?mist.data.capabilities.connectors[r].friendly:r]);var Q=$("<span>");c.append(UI.buildUI([{label:"Protocol",type:"select",select:t,"function":function(){$(this).getval()!=""&&Q.html(Aa($(this).getval()))}}])).append(Q)}break;case "Streams":if(!("capabilities"in mist.data)){c.html("Loading..");mist.send(function(){UI.navto(a)},
{capabilities:!0});return}var Ba=$("<button>"),L=$("<span>").text("Loading..");c.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(Ba).append($("<button>").text("Create a new stream").click(function(){UI.navto("Edit")}))])).append(L);""==b&&(g=mist.stored.get(),"viewmode"in g&&(b=g.viewmode));Ba.text("Switch to "+
("thumbnails"==b?"list":"thumbnail")+" view").click(function(){mist.stored.set("viewmode",b=="thumbnails"?"list":"thumbnails");UI.navto("Streams",b=="thumbnails"?"list":"thumbnails")});var z=$.extend(!0,{},mist.data.streams),ja=function(a,b){var c=$.extend({},b);delete c.meta;delete c.error;c.online=2;c.name=a;c.ischild=true;return c},ka=function(b,d,g){L.remove();switch(b){case "thumbnails":var f=$("<div>").addClass("preview_icons"),e;e=g||[];d.sort();d.unshift("");L.remove();c.append($("<h2>").text(a)).append(UI.buildUI([{label:"Filter the streams",
type:"datalist",datalist:d,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();f.children().each(function(){$(this).hide();$(this).attr("data-stream").indexOf(a)>-1&&$(this).show()})}}]));d.shift();c.append($("<span>").addClass("description").text("Choose a stream below.")).append(f);for(var h in d){var b=d[h],j="",k=$("<button>").text("Delete").click(function(){var a=
type:"datalist",datalist:d,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();f.children().each(function(){$(this).hide();$(this).attr("data-stream").indexOf(a)>-1&&$(this).show()})}}]));d.shift();c.append($("<span>").addClass("description").text("Choose a stream below.")).append(f);for(var h in d){var b=d[h],k="",j=$("<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 b={};b.deletestream=[a];mist.send(function(){UI.navto("Streams")},b)}}),i=$("<button>").text("Settings").click(function(){UI.navto("Edit",$(this).closest("div").attr("data-stream"))}),g=$("<button>").text("Preview").click(function(){UI.navto("Preview",$(this).closest("div").attr("data-stream"))}),m=$("<button>").text("Embed").click(function(){UI.navto("Embed",
$(this).closest("div").attr("data-stream"))}),B=$("<span>").addClass("image");if(b.indexOf("+")>-1){j=b.split("+");j=mist.data.streams[j[0]].source+j[1];i=k="";B.addClass("wildcard")}else{j=mist.data.streams[b].source;if(e.indexOf(b)>-1){m=g="";B.addClass("folder")}}f.append($("<div>").append($("<span>").addClass("streamname").text(b)).append(B).append($("<span>").addClass("description").text(j)).append($("<span>").addClass("button_container").append(i).append(k).append(g).append(m)).attr("title",
$(this).closest("div").attr("data-stream"))}),B=$("<span>").addClass("image");if(b.indexOf("+")>-1){k=b.split("+");k=mist.data.streams[k[0]].source+k[1];i=j="";B.addClass("wildcard")}else{k=mist.data.streams[b].source;if(e.indexOf(b)>-1){m=g="";B.addClass("folder")}}f.append($("<div>").append($("<span>").addClass("streamname").text(b)).append(B).append($("<span>").addClass("description").text(k)).append($("<span>").addClass("button_container").append(i).append(j).append(g).append(m)).attr("title",
b).attr("data-stream",b))}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);
c.append(h);h.stupidtable();var q=function(){var a=[],b;for(b in mist.data.active_streams)a.push({streams:[mist.data.active_streams[b]],fields:["clients"],start:-2});mist.send(function(){$.extend(true,z,mist.data.streams);var a=0;l.html("");d.sort();for(var b in d){var c=d[b],g;g=c in mist.data.streams?mist.data.streams[c]:z[c];var e=$("<td>").css("text-align","right").html($("<span>").addClass("description").text("Loading..")),f=0;if(typeof mist.data.totals!="undefined"&&typeof mist.data.totals[c]!=
"undefined"){var h=mist.data.totals[c].all_protocols.clients,f=0;if(h.length){for(a in h)f=f+h[a][1];f=Math.round(f/h.length)}}e.html(UI.format.number(f));if(f==0&&g.online==1)g.online=2;f=$("<td>").css("text-align","right").css("white-space","nowrap");(!("ischild"in g)||!g.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 b={};mist.data.LTS?b.deletestream=[a]:b.streams=mist.data.streams;mist.send(function(){UI.navto("Streams")},b)}}));h=$("<span>").text(g.name);g.ischild&&h.css("padding-left","1em");var Ca=UI.format.status(g),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 z[c]||g.online<0){Ca.html("");
j="";e.html("");k=""}l.append($("<tr>").data("index",c).html($("<td>").html(h).attr("title",g.name=="..."?"The results were truncated":g.name).addClass("overflow_ellipsis")).append($("<td>").text(g.source).attr("title",g.source).addClass("description").addClass("overflow_ellipsis").css("max-width","20em")).append($("<td>").data("sort-value",g.online).html(Ca)).append(e).append($("<td>").css("white-space","nowrap").html(j).append(k)).append(f));a++}},{totals:a,active_streams:true})};if(mist.data.LTS){var n=
a+'"?')){delete mist.data.streams[a];var b={};mist.data.LTS?b.deletestream=[a]:b.streams=mist.data.streams;mist.send(function(){UI.navto("Streams")},b)}}));h=$("<span>").text(g.name);g.ischild&&h.css("padding-left","1em");var Ca=UI.format.status(g),k=$("<button>").text("Preview").click(function(){UI.navto("Preview",$(this).closest("tr").data("index"))}),j=$("<button>").text("Embed").click(function(){UI.navto("Embed",$(this).closest("tr").data("index"))});if("filesfound"in z[c]||g.online<0){Ca.html("");
k="";e.html("");j=""}l.append($("<tr>").data("index",c).html($("<td>").html(h).attr("title",g.name=="..."?"The results were truncated":g.name).addClass("overflow_ellipsis")).append($("<td>").text(g.source).attr("title",g.source).addClass("description").addClass("overflow_ellipsis").css("max-width","20em")).append($("<td>").data("sort-value",g.online).html(Ca)).append(e).append($("<td>").css("white-space","nowrap").html(k).append(j)).append(f));a++}},{totals:a,active_streams:true})};if(mist.data.LTS){var n=
0,o=0;for(e 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[e].source)){z[e].source=z[e].source+"*";z[e].filesfound=null;mist.send(function(a,b){var c=b.stream,d=0,g;a:for(g in a.browse.files){var f;for(f in mist.data.capabilities.inputs)if(!(f.indexOf("Buffer")>=0||f.indexOf("Buffer.exe")>=0||f.indexOf("Folder")>=0||f.indexOf("Folder.exe")>=0)&&mist.inputMatch(mist.data.capabilities.inputs[f].source_match,
"/"+a.browse.files[g])){var e=c+"+"+a.browse.files[g];z[e]=ja(e,mist.data.streams[c]);z[e].source=mist.data.streams[c].source+a.browse.files[g];d++;if(d>=500){z[c+"+zzzzzzzzz"]={ischild:true,name:"...",online:-1};break a}}}"files"in a.browse&&a.browse.files.length?z[c].filesfound=true:mist.data.streams[c].filesfound=false;o++;if(n==o){mist.send(function(){q()},{active_streams:true});UI.interval.set(function(){q()},5E3)}},{browse:mist.data.streams[e].source},{stream:e});n++}}if(n==0){mist.send(function(){q()},
{active_streams:true});UI.interval.set(function(){q()},5E3)}}else{mist.send(function(){q()},{active_streams:true});UI.interval.set(function(){q()},5E3)}}};if(mist.data.LTS){var la=0,Da=0,t={},Ea=[];for(g in mist.data.streams)if(mist.inputMatch((mist.data.capabilities.inputs.Folder||mist.data.capabilities.inputs["Folder.exe"]).source_match,mist.data.streams[g].source))Ea.push(g),mist.send(function(a,c){var d=c.stream,g=0,f;a:for(f in a.browse.files){var e;for(e in mist.data.capabilities.inputs)if(!(e.indexOf("Buffer")>=
@ -126,9 +126,9 @@ j="";e.html("");k=""}l.append($("<tr>").data("index",c).html($("<td>").html(h).a
t.sort();ka(b,t,Ea)},{active_streams:true})},{browse:mist.data.streams[g].source},{stream:g}),la++;0==la&&mist.send(function(){for(var a in mist.data.active_streams){var c=mist.data.active_streams[a].split("+");if(c.length>1&&c[0]in mist.data.streams){t[mist.data.active_streams[a]]=true;z[mist.data.active_streams[a]]=ja(mist.data.active_streams[a],mist.data.streams[c[0]])}}t=Object.keys(t);mist.data.streams&&(t=t.concat(Object.keys(mist.data.streams)));t.sort();ka(b,t)},{active_streams:!0})}else ka(b,
Object.keys(mist.data.streams));break;case "Edit":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,b)},{capabilities:!0});c.append("Loading..");return}K=!1;""!=b&&(K=!0);if(K){var Fa=b,o=mist.data.streams[Fa];c.find("h2").append(' "'+Fa+'"')}else c.html($("<h2>").text("New Stream")),o={};var Ga=[];for(r in mist.data.capabilities.inputs)Ga.push(mist.data.capabilities.inputs[r].source_match);var ca=$("<div>"),Ha=function(a){var c={};if(!mist.data.streams)mist.data.streams=
{};mist.data.streams[o.name]=o;b!=o.name&&delete mist.data.streams[b];c.addstream={};c.addstream[o.name]=o;if(b!=o.name)c.deletestream=[b];if(o.stop_sessions&&b!=""){c.stop_sessions=b;delete o.stop_sessions}mist.send(function(){delete mist.data.streams[o.name].online;delete mist.data.streams[o.name].error;UI.navto(a,a=="Preview"?o.name:"")},c)},Ia=$("<style>").text("button.saveandpreview { display: none; }"),M=$("<span>"),ma=function(){var a=c.find("[name=name]").val();if(a){var b=parseURL(mist.user.host),
d=c.find("[name=source]").val(),g=d.match(/@.*/);g&&(g=g[0].substring(1));var f=d.replace(/(?:.+?):\/\//,""),f=f.split("/"),f=f[0],f=f.split(":"),f=f[0];(d=d.match(/:\d+/))&&(d=d[0]);var e={},h=["RTMP","RTSP","RTMP.exe","RTSP.exe"],j;for(j in h)h[j]in mist.data.capabilities.connectors&&(e[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 e){for(j in mist.data.config.protocols){var i=mist.data.config.protocols[j];
if(i.connector==k){if("port"in i)e[k]=i.port;break}}e[k]=e[k]==h[k]?"":":"+e[k]}e.TS="";e["TS.exe"]="";M.find(".field").closest("label").hide();for(j in e){var B;k=d?d:e[j];switch(j){case "RTMP":case "RTMP.exe":B="rtmp://"+b.host+k+"/"+(g?g:"live")+"/";M.find(".field.RTMPurl").setval(B).closest("label").show();M.find(".field.RTMPkey").setval(a==""?"STREAMNAME":a).closest("label").show();B=B+(a==""?"STREAMNAME":a);break;case "RTSP":case "RTSP.exe":B="rtsp://"+b.host+k+"/"+(a==""?"STREAMNAME":a)+(g?
"?pass="+g:"");break;case "TS":case "TS.exe":B="udp://"+(f==""?b.host:f)+k+"/"}M.find(".field."+j.replace(".exe","")).setval(B).closest("label").show()}}},Ja=$("<div>"),na={},t=[],Ka=$("<div>");for(r in mist.data.capabilities.processes)t.push([r,mist.data.capabilities.processes[r].hrn?mist.data.capabilities.processes[r].hrn:mist.data.capabilities.processes[r].name]);if(t.length){var Za=[{label:"New process",type:"select",select:t,value:t[0][0],pointer:{main:na,index:"process"},"function":function(){var a=
d=c.find("[name=source]").val(),g=d.match(/@.*/);g&&(g=g[0].substring(1));var f=d.replace(/(?:.+?):\/\//,""),f=f.split("/"),f=f[0],f=f.split(":"),f=f[0];(d=d.match(/:\d+/))&&(d=d[0]);var e={},h=["RTMP","RTSP","RTMP.exe","RTSP.exe"],k;for(k in h)h[k]in mist.data.capabilities.connectors&&(e[h[k]]=mist.data.capabilities.connectors[h[k]].optional.port["default"]);var h={RTMP:1935,"RTMP.exe":1935,RTSP:554,"RTSP.exe":554,TS:-1,"TS.exe":-1},j;for(j in e){for(k in mist.data.config.protocols){var i=mist.data.config.protocols[k];
if(i.connector==j){if("port"in i)e[j]=i.port;break}}e[j]=e[j]==h[j]?"":":"+e[j]}e.TS="";e["TS.exe"]="";M.find(".field").closest("label").hide();for(k in e){var B;j=d?d:e[k];switch(k){case "RTMP":case "RTMP.exe":B="rtmp://"+b.host+j+"/"+(g?g:"live")+"/";M.find(".field.RTMPurl").setval(B).closest("label").show();M.find(".field.RTMPkey").setval(a==""?"STREAMNAME":a).closest("label").show();B=B+(a==""?"STREAMNAME":a);break;case "RTSP":case "RTSP.exe":B="rtsp://"+b.host+j+"/"+(a==""?"STREAMNAME":a)+(g?
"?pass="+g:"");break;case "TS":case "TS.exe":B="udp://"+(f==""?b.host:f)+j+"/"}M.find(".field."+k.replace(".exe","")).setval(B).closest("label").show()}}},Ja=$("<div>"),na={},t=[],Ka=$("<div>");for(r in mist.data.capabilities.processes)t.push([r,mist.data.capabilities.processes[r].hrn?mist.data.capabilities.processes[r].hrn:mist.data.capabilities.processes[r].name]);if(t.length){var Za=[{label:"New process",type:"select",select:t,value:t[0][0],pointer:{main:na,index:"process"},"function":function(){var a=
$(this).getval();if(a!=null){var a=mist.data.capabilities.processes[a],b=[$("<h4>").text(a.name+" Process options")];Ka.html(UI.buildUI(b.concat(mist.convertBuildOptions(a,na))))}}},Ka];Ja.append(UI.buildUI([$("<br>"),$("<h3>").text("Stream processes"),{label:"Stream processes",itemLabel:"stream process",type:"sublist",sublist:Za,saveas:na,pointer:{main:o,index:"processes"}}]))}c.append(UI.buildUI([{label:"Stream name",type:"str",validate:["required","streamname"],pointer:{main:o,index:"name"},help:"Set the name this stream will be recognised by for players and/or stream pushing."},
{label:"Source",type:"browse",filetypes:Ga,pointer:{main:o,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:&nbsp;/PATH/FILE<br> Windows:&nbsp;/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:&nbsp;/PATH/<br> Windows:&nbsp;/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>&nbsp;</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>&nbsp;</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();Ia.remove();M.html("");if(a!=""){var b=null,d;for(d in mist.data.capabilities.inputs)if(typeof mist.data.capabilities.inputs[d].source_match!="undefined"&&mist.inputMatch(mist.data.capabilities.inputs[d].source_match,a)){b=d;break}if(b===null)ca.html($("<h3>").text("Unrecognized input").addClass("red")).append($("<span>").text("Please edit the stream source.").addClass("red"));else{b=mist.data.capabilities.inputs[b];ca.html($("<h3>").text(b.name+
@ -145,10 +145,10 @@ style:{"max-width":"30em","flex-flow":"column nowrap"}},{type:"container",classe
onclick:function(){this.reload()}},{type:"button",title:"Switch to the next available player and source combination",label:"Try next combination",onclick:function(){this.nextCombo()}}]},{type:"forcePlayer"},{type:"forceType"},{type:"forceSource"}]},{type:"log"}]}))};if(!(a!="Preview"||!b||b==""||g!=b)){W[0].addEventListener("initialized",f);W[0].addEventListener("initializeFailed",f);MistVideoObject.reference=mistPlay(g,{target:W[0],host:u,skin:"dev",loop:true,MistVideoObject:MistVideoObject})}c[0].removeChild(d)};
MistVideoObject.reference={unload:function(){d.onload=function(){this.parentElement&&this.parentElement.removeChild(this)}}}};Na();var Oa=$("<div>").append($("<h3>").text("Meta information")),da=$("<span>").text("Loading..");Oa.append(da);Q.append(Oa);""!=H&&$.ajax({type:"GET",url:u+"json_"+H+".js",success:function(a){var b=function(a,b){return"maxbps"in a?UI.format.bytes(a[b],1):b=="maxbps"?UI.format.bytes(a.bps,1):"unknown"},c=a.meta;if(!c||!c.tracks)da.html("No meta information available.");else{a=
[];a.push({label:"Type",type:"span",value:c.live?"Live":"Pre-recorded (VoD)"});"format"in c&&a.push({label:"Format",type:"span",value:c.format});c.live&&a.push({label:"Buffer window",type:"span",value:UI.format.addUnit(c.buffer_window,"ms")});var d={audio:{vheader:"Audio",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Channels","Samplerate","Language","Track index"],content:[]},video:{vheader:"Video",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Size","Framerate","Language","Track index",
"Has B-Frames"],content:[]},subtitle:{vheader:"Subtitles",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Language","Track index"],content:[]}},g=Object.keys(c.tracks);g.sort(function(a,b){a=a.split("_").pop();b=b.split("_").pop();return a-b});var f=1,e=1,h=1,j;for(j in g){var k=g[j],i=c.tracks[k];switch(i.type){case "audio":d.audio.content.push({header:"Track "+k.split("_").pop(),body:[i.codec,UI.format.duration((i.lastms-i.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(i.firstms/
1E3)+" to "+UI.format.duration(i.lastms/1E3)+"</span>",b(i,"bps"),b(i,"maxbps"),i.channels,UI.format.addUnit(UI.format.number(i.rate),"Hz"),"language"in i?i.language:"unknown",f]});f++;break;case "video":d.video.content.push({header:"Track "+k.split("_").pop(),body:[i.codec,UI.format.duration((i.lastms-i.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(i.firstms/1E3)+" to "+UI.format.duration(i.lastms/1E3)+"</span>",b(i,"bps"),b(i,"maxbps"),UI.format.addUnit(i.width,"x ")+UI.format.addUnit(i.height,
"px"),UI.format.addUnit(UI.format.number(i.fpks/1E3),"fps"),"language"in i?i.language:"unknown",e,"bframes"in i?"yes":"no"]});e++;break;case "meta":case "subtitle":if(i.codec=="subtitle"||i.type=="subtitle"){d.subtitle.content.push({header:"Track "+k.split("_").pop(),body:[i.codec,UI.format.duration((i.lastms-i.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(i.firstms/1E3)+" to "+UI.format.duration(i.lastms/1E3)+"</span>",b(i,"bps"),b(i,"maxbps"),"language"in i?i.language:"unknown",
h]});h++}}}b=["audio","video","subtitle"];j=$("<div>").css({display:"flex","flex-flow":"row wrap","font-size":"0.9em"});for(k in b)d[b[k]].content.length&&j.append(UI.buildVheaderTable(d[b[k]]).css("width","auto"));a.push($("<span>").text("Tracks:"));a.push(j);da.html(UI.buildUI(a))}},error:function(){da.html("Error while retrieving stream info.")}});break;case "Embed":""==b&&UI.navTo("Streams");V="";-1==b.indexOf("+")&&(V=$("<button>").addClass("settings").text("Settings").click(function(){UI.navto("Edit",
"Has B-Frames"],content:[]},subtitle:{vheader:"Subtitles",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Language","Track index"],content:[]}},g=Object.keys(c.tracks);g.sort(function(a,b){a=a.split("_").pop();b=b.split("_").pop();return a-b});var f=1,e=1,h=1,k;for(k in g){var j=g[k],i=c.tracks[j];switch(i.type){case "audio":d.audio.content.push({header:"Track "+j.split("_").pop(),body:[i.codec,UI.format.duration((i.lastms-i.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(i.firstms/
1E3)+" to "+UI.format.duration(i.lastms/1E3)+"</span>",b(i,"bps"),b(i,"maxbps"),i.channels,UI.format.addUnit(UI.format.number(i.rate),"Hz"),"language"in i?i.language:"unknown",f]});f++;break;case "video":d.video.content.push({header:"Track "+j.split("_").pop(),body:[i.codec,UI.format.duration((i.lastms-i.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(i.firstms/1E3)+" to "+UI.format.duration(i.lastms/1E3)+"</span>",b(i,"bps"),b(i,"maxbps"),UI.format.addUnit(i.width,"x ")+UI.format.addUnit(i.height,
"px"),UI.format.addUnit(UI.format.number(i.fpks/1E3),"fps"),"language"in i?i.language:"unknown",e,"bframes"in i?"yes":"no"]});e++;break;case "meta":case "subtitle":if(i.codec=="subtitle"||i.type=="subtitle"){d.subtitle.content.push({header:"Track "+j.split("_").pop(),body:[i.codec,UI.format.duration((i.lastms-i.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(i.firstms/1E3)+" to "+UI.format.duration(i.lastms/1E3)+"</span>",b(i,"bps"),b(i,"maxbps"),"language"in i?i.language:"unknown",
h]});h++}}}b=["audio","video","subtitle"];k=$("<div>").css({display:"flex","flex-flow":"row wrap","font-size":"0.9em"});for(j in b)d[b[j]].content.length&&k.append(UI.buildVheaderTable(d[b[j]]).css("width","auto"));a.push($("<span>").text("Tracks:"));a.push(k);da.html(UI.buildUI(a))}},error:function(){da.html("Error while retrieving stream info.")}});break;case "Embed":""==b&&UI.navTo("Streams");V="";-1==b.indexOf("+")&&(V=$("<button>").addClass("settings").text("Settings").click(function(){UI.navto("Edit",
b)}));c.html($("<div>").addClass("bigbuttons").append(V).append($("<button>").text("Preview").addClass("preview").click(function(){UI.navto("Preview",b)})).append($("<button>").addClass("cancel").addClass("return").text("Return").click(function(){UI.navto("Streams")}))).append($("<h2>").text('Embed "'+b+'"'));var X=$("<span>");c.append(X);var H=encodeURIComponent(b),N=parseURL(mist.user.host),U=N.protocol,R=N.host,G=":8080",Y,ea={},u={http:U+R+G+"/"};for(r in mist.data.config.protocols)if(s=mist.data.config.protocols[r],
"HTTP"==s.connector||"HTTP.exe"==s.connector)s.pubaddr?("string"==typeof s.pubaddr?u.http=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(u.http=s.pubaddr[0].replace(/\/$/,"")+"/"),ea.http=s.pubaddr):(G=s.port?":"+s.port:":8080",u.http=U+R+G+"/");else if("HTTPS"==s.connector||"HTTPS.exe"==s.connector)s.pubaddr&&s.pubaddr.length?("string"==typeof s.pubaddr?u.https=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(u.https=s.pubaddr[0].replace(/\/$/,"")+"/"),ea.https=s.pubaddr):(Y=s.port?":"+s.port:
":4433",u.https="https://"+R+Y+"/");var O=u.http,A={http:u.http};"https"in u&&(A.https=u.https);if(otherhost.host||otherhost.https){O=(otherhost.https&&Y?"https://":"http://")+(otherhost.host?otherhost.host:N.host)+(otherhost.https&&Y?Y:G)+"/";if(otherhost.host&&("http"in ea||(A.http=parseURL(A.http,{hostname:otherhost.host}).full),"https"in A&&!("https"in ea)))A.https=parseURL(A.https,{hostname:otherhost.host}).full;O=otherhost.https?A.https:A.http}var Z=!1,pa={forcePlayer:"",forceType:"",controls:!0,
@ -171,19 +171,20 @@ value:g.url,readonly:true,qrcode:true,clipboard:true});f=UI.humanMime(g.type);if
$(this).val();$(".embed_code").setval(x(p))});S.append(c);e=="subtitle"?b[e].unshift(["","No "+e]):b[e].push([-1,"No "+e]);for(var i in b[e])c.append($("<option>").val(b[e][i][0]).text(b[e][i][1]));if(e in p.setTracks){c.val(p.setTracks[e]);if(c.val()==null){c.val("");delete p.setTracks[e];$(".embed_code").setval(x(p))}}}}}else S.closest("label").hide();Z=true},error:function(){qa.html("Error while retrieving stream info.");S.closest("label").hide();p.setTracks={}}});var ga=document.createElement("script");
ga.src=u.http+"player.js";document.head.appendChild(ga);ga.onload=function(){var a=X.find(".field.forcePlayer"),b;for(b in mistplayers)a.append($("<option>").text(mistplayers[b].name).val(b));document.head.removeChild(this)};ga.onerror=function(){document.head.removeChild(this)};break;case "Push":var I=$("<div>").text("Loading..");c.append(I);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,
g;for(g in c.push_list)if(a.indexOf(c.push_list[g][0])>-1){d=false;break}}else d=true;if(d)for(g in a)e.find("tr[data-pushid="+a[g]+"]").remove();else b()},{push_list:1})},1E3)}function c(g,f){var h=$("<span>"),i=$("<span>");if(f=="Automatic"&&g.length>=4){h.append($("<span>").text(g[2]));g[3]&&h.append($("<span>").text(", schedule on "+(new Date(g[3]*1E3)).toLocaleString()));g.length>=5&&g[4]&&h.append($("<span>").text(", complete on "+(new Date(g[4]*1E3)).toLocaleString()))}else g.length>=4&&g[2]!=
g[3]?h.append($("<span>").text(g[2])).append($("<span>").html("&#187").addClass("unit").css("margin","0 0.5em")).append($("<span>").text(g[3])):h.append($("<span>").text(g[2]));var j=$("<td>").append($("<button>").text(f=="Automatic"?"Remove":"Stop").click(function(){if(confirm("Are you sure you want to "+$(this).text().toLowerCase()+" this push?\n"+g[1]+" to "+g[2])){var a=$(this).closest("tr");a.html($("<td colspan=99>").html($("<span>").addClass("red").text(f=="Automatic"?"Removing..":"Stopping..")));
if(f=="Automatic"){var c=g.slice(1);mist.send(function(){a.remove()},{push_auto_remove:[c]})}else mist.send(function(){b([g[0]])},{push_stop:[g[0]]})}}));if(f=="Automatic"){j.prepend($("<button>").text("Edit").click(function(){UI.navto("Start Push","auto_"+($(this).closest("tr").index()-1))}));j.append($("<button>").text("Stop pushes").click(function(){if(confirm('Are you sure you want to stop all pushes matching \n"'+g[1]+" to "+g[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 f=[],h;for(h in a.push_list)if(g[1]==a.push_list[h][1]&&g[2]==a.push_list[h][2]){f.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(f)},{push_stop:f,push_settings:{wait:0}})}}))}else{if(g.length>=6){var k=g[5];i.append($("<div>").append("Active for: "+UI.format.duration(k.active_seconds))).append($("<div>").append("Data transfered: "+
UI.format.bytes(k.bytes))).append($("<div>").append("Media time transfered: "+UI.format.duration(k.mediatime*0.001)))}if(g.length>=5)for(var m in g[4]){k=g[4][m];i.append($("<div>").append(UI.format.time(k[0])+" ["+k[1]+"] "+k[2]))}}return $("<tr>").css("vertical-align","top").attr("data-pushid",g[0]).append($("<td>").text(g[1])).append($("<td>").append(h.children())).append($("<td>").addClass("logs").append(i.children())).append(j)}I.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>")).append($("<th>"))),g=e.clone();if("push_list"in a)for(var f in a.push_list)e.append(c(a.push_list[f],"Manual"));if("push_auto_list"in a)for(f in a.push_auto_list){var h=a.push_auto_list[f].slice();h.unshift(-1);g.append(c(h,"Automatic"))}I.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")}));g.find("tr").length==1?I.append($("<div>").text("No automatic pushes have been configured.").addClass("text").css("margin-top","0.5em")):I.append(g);I.append($("<h3>").text("Pushes")).append($("<button>").text("Start a push").click(function(){UI.navto("Start Push")}));if(e.find("tr").length==1)I.append($("<div>").text("No pushes are active.").addClass("text").css("margin-top",
"0.5em"));else{var g=[],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(f in a.push_list){g.indexOf(a.push_list[f][1])==-1&&g.push(a.push_list[f][1]);h.indexOf(a.push_list[f][2])==-1&&h.push(a.push_list[f][2])}g.sort();h.sort();for(f in g)i.append($("<option>").text(g[f]));for(f in h)j.append($("<option>").text(h[f]));I.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 g={},f;for(f in a.push_list)if((c==""||a.push_list[f][1]==c)&&(d==""||a.push_list[f][2]==d))g[a.push_list[f][0]]=a.push_list[f];if(Object.keys(g).length==0)return alert("No matching pushes.");c="Are you sure you want to stop these pushes?\n\n";for(f in g)c=c+(g[f][1]+
" to "+g[f][2]+"\n");if(confirm(c)){g=Object.keys(g);mist.send(function(){b(g)},{push_stop:g});for(f in g)e.find("tr[data-pushid="+g[f]+"]").html($("<td colspan=99>").html($("<span>").addClass("red").text("Stopping..")))}}))).append(e)}UI.interval.set(function(){mist.send(function(a){var b=e.find("tr").first();e.empty();e.append(b);for(var d in a.push_list)e.append(c(a.push_list[d]))},{push_list:1})},5E3)},{push_settings:1,push_list:1,push_auto_list:1});break;case "Start Push":if(!("capabilities"in
mist.data)){c.append("Loading Mist capabilities..");mist.send(function(){UI.navto("Start Push",b)},{capabilities:1});return}var w,ha=function(a){var d=false,g=b.split("_");b=g[0];g.length==2&&(d=g[1]);if(d!==false&&typeof a=="undefined")mist.send(function(a){ha(a.push_auto_list[d])},{push_auto_list:1});else{var e=[],f={},h;for(h in mist.data.capabilities.connectors){g=mist.data.capabilities.connectors[h];if("push_urls"in g){e=e.concat(g.push_urls);f[h]=g.push_urls}}b=="auto"&&c.find("h2").text("Add automatic push");
var i={params:{}};if(b=="auto"&&typeof a!="undefined"){i={stream:a[0],target:a[1],params:{}};g=i.target.split("?");if(g.length>1){params=g.pop();i.target=g.join("?");params=params.split("&");for(h in params){g=params[h].split("=");i.params[g.shift()]=g.join("=")}}}var j=$("<div>").css("margin","1em 0");h=[{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>",
g[3]?h.append($("<span>").text(g[2])).append($("<span>").html("&#187").addClass("unit").css("margin","0 0.5em")).append($("<span>").text(g[3])):h.append($("<span>").text(g[2]));var k=$("<td>").append($("<button>").text(f=="Automatic"?"Remove":"Stop").click(function(){if(confirm("Are you sure you want to "+$(this).text().toLowerCase()+" this push?\n"+g[1]+" to "+g[2])){var a=$(this).closest("tr");a.html($("<td colspan=99>").html($("<span>").addClass("red").text(f=="Automatic"?"Removing..":"Stopping..")));
if(f=="Automatic"){var c=g.slice(1);mist.send(function(){a.remove()},{push_auto_remove:[c]})}else mist.send(function(){b([g[0]])},{push_stop:[g[0]]})}}));if(f=="Automatic"){k.prepend($("<button>").text("Edit").click(function(){UI.navto("Start Push","auto_"+($(this).closest("tr").index()-1))}));k.append($("<button>").text("Stop pushes").click(function(){if(confirm('Are you sure you want to stop all pushes matching \n"'+g[1]+" to "+g[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 f=[],h;for(h in a.push_list)if(g[1]==a.push_list[h][1]&&g[2]==a.push_list[h][2]){f.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(f)},{push_stop:f,push_settings:{wait:0}})}}))}else{if(g.length>=6){var j=g[5];i.append($("<div>").append("Active for: "+UI.format.duration(j.active_seconds))).append($("<div>").append("Data transfered: "+
UI.format.bytes(j.bytes))).append($("<div>").append("Media time transfered: "+UI.format.duration(j.mediatime*0.001)));"pkt_retrans_count"in j&&i.append($("<div>").append("Packets retransmitted: "+UI.format.number(j.pkt_retrans_count||0)));"pkt_loss_count"in j&&i.append($("<div>").append("Packets lost: "+UI.format.number(j.pkt_loss_count||0)+" ("+UI.format.addUnit(UI.format.number(j.pkt_loss_perc||0),"%")+" over the last "+UI.format.addUnit(5,"s")+")"))}if(g.length>=5)for(var m in g[4]){j=g[4][m];
i.append($("<div>").append(UI.format.time(j[0])+" ["+j[1]+"] "+j[2]))}}return $("<tr>").css("vertical-align","top").attr("data-pushid",g[0]).append($("<td>").text(g[1])).append($("<td>").append(h.children())).append($("<td>").addClass("logs").append(i.children())).append(k)}I.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>")).append($("<th>"))),
g=e.clone();if("push_list"in a)for(var f in a.push_list)e.append(c(a.push_list[f],"Manual"));if("push_auto_list"in a)for(f in a.push_auto_list){var h=a.push_auto_list[f].slice();h.unshift(-1);g.append(c(h,"Automatic"))}I.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")}));g.find("tr").length==1?I.append($("<div>").text("No automatic pushes have been configured.").addClass("text").css("margin-top",
"0.5em")):I.append(g);I.append($("<h3>").text("Pushes")).append($("<button>").text("Start a push").click(function(){UI.navto("Start Push")}));if(e.find("tr").length==1)I.append($("<div>").text("No pushes are active.").addClass("text").css("margin-top","0.5em"));else{var g=[],h=[],i=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any stream").val("")),k=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any target").val(""));for(f in a.push_list){g.indexOf(a.push_list[f][1])==
-1&&g.push(a.push_list[f][1]);h.indexOf(a.push_list[f][2])==-1&&h.push(a.push_list[f][2])}g.sort();h.sort();for(f in g)i.append($("<option>").text(g[f]));for(f in h)k.append($("<option>").text(h[f]));I.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(k).append($("<button>").css("margin-left","0.5em").text("Apply").click(function(){var c=i.val(),d=k.val();if(c==""&&d=="")return alert("Looks like you want to stop all pushes. Maybe you should use that button?");var g={},f;for(f in a.push_list)if((c==""||
a.push_list[f][1]==c)&&(d==""||a.push_list[f][2]==d))g[a.push_list[f][0]]=a.push_list[f];if(Object.keys(g).length==0)return alert("No matching pushes.");c="Are you sure you want to stop these pushes?\n\n";for(f in g)c=c+(g[f][1]+" to "+g[f][2]+"\n");if(confirm(c)){g=Object.keys(g);mist.send(function(){b(g)},{push_stop:g});for(f in g)e.find("tr[data-pushid="+g[f]+"]").html($("<td colspan=99>").html($("<span>").addClass("red").text("Stopping..")))}}))).append(e)}UI.interval.set(function(){mist.send(function(a){var b=
e.find("tr").first();e.empty();e.append(b);for(var d in a.push_list)e.append(c(a.push_list[d]))},{push_list:1})},5E3)},{push_settings:1,push_list:1,push_auto_list:1});break;case "Start Push":if(!("capabilities"in mist.data)){c.append("Loading Mist capabilities..");mist.send(function(){UI.navto("Start Push",b)},{capabilities:1});return}var w,ha=function(a){var d=false,g=b.split("_");b=g[0];g.length==2&&(d=g[1]);if(d!==false&&typeof a=="undefined")mist.send(function(a){ha(a.push_auto_list[d])},{push_auto_list:1});
else{var e=[],f={},h;for(h in mist.data.capabilities.connectors){g=mist.data.capabilities.connectors[h];if("push_urls"in g){e=e.concat(g.push_urls);f[h]=g.push_urls}}b=="auto"&&c.find("h2").text("Add automatic push");var i={params:{}};if(b=="auto"&&typeof a!="undefined"){i={stream:a[0],target:a[1],params:{}};g=i.target.split("?");if(g.length>1){params=g.pop();i.target=g.join("?");params=params.split("&");for(h in params){g=params[h].split("=");i.params[g.shift()]=g.join("=")}}}var j=$("<div>").css("margin",
"1em 0");h=[{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:i,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:w,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:i,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"]}}],"function":function(){var a=false;for(connector in f)for(var b in f[connector])if(mist.inputMatch(f[connector][b],$(this).getval())){a=connector;break}if(a){j.html($("<h3>").text(mist.data.capabilities.connectors[a].friendly));j.append(UI.buildUI(mist.convertBuildOptions({desc:mist.data.capabilities.connectors[a].desc,
optional:mist.data.capabilities.connectors[a].push_parameters},i.params)))}else j.html($("<h4>").addClass("red").text("Unrecognized target.")).append($("<span>").text("Please edit the push target."))},LTSonly:1},j];h.push({type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Push")}},{type:"save",label:"Save","function":function(){var c=i.params,d;for(d in c)c[d]===null&&delete c[d];if(Object.keys(c).length){var g="?",e=i.target.split("?");if(e.length>1){g="&";e=e[e.length-
@ -226,8 +227,8 @@ UI.format.time(e[0])+" ["+e[1]+"] "+e[2]))}if("totals"in f){e=function(a,b,c){va
c.data[e][n]]);if(l){d();l--}}if(mist.data.config.time-c.end>20){d();m=(mist.data.config.time-15)*1E3;d()}}else{m=(mist.data.config.time-600)*1E3;d();m=(mist.data.config.time-15)*1E3;d()}d=f;stream=a?a.join(" "):"all_streams";protocol=b?b.join("_"):"all_protocols";stream in mist.data.totals||(mist.data.totals[stream]={});protocol in mist.data.totals[stream]||(mist.data.totals[stream][protocol]={});$.extend(mist.data.totals[stream][protocol],d)};mist.data.totals={};if("fields"in f.totals)e(b.totals.streams,
b.totals.protocols,f.totals);else for(n in f.totals)e(b.totals[n].streams,b.totals[n].protocols,f.totals[n])}a&&a(f,c);break;case "CHALL":if(f.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=f.authorize.challenge;mist.send(a,b,c);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 b.authorize;mist.send(a,b,c);break;default:UI.navto("Login")}}};c.hide||UI.elements.connection.msg.removeClass("red").text("Data sent, waiting for a reply..").append($("<br>")).append($("<a>").text("Cancel request").click(function(){l.abort()}));var l=$.ajax(f)},inputMatch:function(a,b){if(typeof a=="undefined")return false;typeof a=="string"&&(a=[a]);for(var c in a){var d=
a[c].replace(/[^\w\s]/g,"\\$&"),d=d.replace(/\\\*/g,".*");if(RegExp("^(?:[a-zA-Z]:)?"+d+"(?:\\?[^\\?]*)?$","i").test(b))return true}return false},convertBuildOptions:function(a,b){function c(a,c,d){var e={label:UI.format.capital(d.name?d.name:c),pointer:{main:b,index:c},validate:[]};f[a]=="required"&&(!("default"in d)||d["default"]=="")&&e.validate.push("required");if("default"in d){e.placeholder=d["default"];if(d.type=="select")for(var k in d.select)if(d.select[k][0]==d["default"]){e.placeholder=
d.select[k][1];break}}if("help"in d)e.help=d.help;if("unit"in d)e.unit=d.unit;if("placeholder"in d)e.placeholder=d.placeholder;if("type"in d)switch(d.type){case "int":e.type="int";if("max"in d)e.max=d.max;if("min"in d)e.min=d.min;break;case "uint":e.type="int";e.min=0;if("max"in d)e.max=d.max;if("min"in d)e.min=Math.max(e.min,d.min);break;case "debug":e.type="debug";break;case "radioselect":e.type="radioselect";e.radioselect=d.radioselect;break;case "select":e.type="select";e.select=d.select.slice(0);
a[c].replace(/[^\w\s]/g,"\\$&"),d=d.replace(/\\\*/g,".*");if(RegExp("^(?:[a-zA-Z]:)?"+d+"(?:\\?[^\\?]*)?$","i").test(b))return true}return false},convertBuildOptions:function(a,b){function c(a,c,d){var e={label:UI.format.capital(d.name?d.name:c),pointer:{main:b,index:c},validate:[]};f[a]=="required"&&(!("default"in d)||d["default"]=="")&&e.validate.push("required");if("default"in d){e.placeholder=d["default"];if(d.type=="select")for(var j in d.select)if(d.select[j][0]==d["default"]){e.placeholder=
d.select[j][1];break}}if("help"in d)e.help=d.help;if("unit"in d)e.unit=d.unit;if("placeholder"in d)e.placeholder=d.placeholder;if("type"in d)switch(d.type){case "int":e.type="int";if("max"in d)e.max=d.max;if("min"in d)e.min=d.min;break;case "uint":e.type="int";e.min=0;if("max"in d)e.max=d.max;if("min"in d)e.min=Math.max(e.min,d.min);break;case "debug":e.type="debug";break;case "radioselect":e.type="radioselect";e.radioselect=d.radioselect;break;case "select":e.type="select";e.select=d.select.slice(0);
e.validate.indexOf("required")>=0&&e.select.unshift(["","placeholder"in e?"Default ("+e.placeholder+")":""]);break;case "inputlist":e.type="inputlist";break;case "sublist":e.type="sublist";e.saveas={};e.itemLabel=d.itemLabel;e.sublist=mist.convertBuildOptions(d,e.saveas);break;default:e.type="str"}else e.type="checkbox";"influences"in d&&(e["function"]=function(){var a=$(this).closest(".UIelement"),b=a.find("style");if(b.length)b=b[0];else{b=$("<style>").addClass("dependencies")[0];a.append(b)}b.innerHTML=
".UIelement[data-dependent-"+c+"]:not([data-dependent-"+c+'~="'+$(this).getval()+'"]) { display: none; }\n';$(b).data("content",b.innerHTML);$("style.dependencies.hidden").each(function(){$(this).html($(this).data("content")).removeClass("hidden")});$(".UIelement:not(:visible) style.dependencies:not(.hidden)").each(function(){$(this).addClass("hidden");$(this).html("")})});if("dependent"in d)e.dependent=d.dependent;if("value"in d)e.value=d.value;if("validate"in d)e.validate=e.validate.concat(d.validate);
return e}var d=[],f=["required","optional"];"desc"in a&&d.push({type:"help",help:a.desc});if("sort"in a){var l=[],m;for(m in f)if(a[f[m]])for(var e in a[f[m]]){var q=a[f[m]][e];if(Array.isArray(q))for(var n in q){if(!("validate"in q[n]))q[n].validate=[];q[n].validate=f[m];q[n].id=e;l.push(q[n])}else{if(!("validate"in q))q.validate=[];q.validate.push(f[m]);q.id=e;l.push(q)}}l.sort(function(b,c){return(""+b[a.sort]).localeCompare(c[a.sort])});for(e in l){q=l[e];d.push(c(q.validate,q.id,q))}}else for(m in f)if(a[f[m]]){d.push($("<h4>").text(UI.format.capital(f[m])+

View file

@ -1838,7 +1838,7 @@ var UI = {
perc_retrans: {
label: 'Re-transmitted packages',
yaxistype: 'percentage',
basecolor: [255,87,34]
basecolor: [0,0,255]
}
}
},
@ -2055,7 +2055,7 @@ var UI = {
num = Math.round(num * mult) / mult;
//thousand seperation
if (num > 1e4) {
if (num >= 1e4) {
var seperator = ' ';
number = num.toString().split('.');
var regex = /(\d+)(\d{3})/;
@ -5112,6 +5112,20 @@ var UI = {
"Media time transfered: "+UI.format.duration(stats.mediatime*1e-3)
)
);
if ("pkt_retrans_count" in stats) {
$logs.append(
$("<div>").append(
"Packets retransmitted: "+UI.format.number(stats.pkt_retrans_count || 0)
)
);
}
if ("pkt_loss_count" in stats) {
$logs.append(
$("<div>").append(
"Packets lost: "+UI.format.number(stats.pkt_loss_count || 0)+" ("+UI.format.addUnit(UI.format.number(stats.pkt_loss_perc || 0),"%")+" over the last "+UI.format.addUnit(5,"s")+")"
)
);
}
}
if (push.length >= 5) {
//there are logs