LSP: fixed merge issue with form split on general tab; added validation rules for URI protocols on the Edit external writer-tab
This commit is contained in:
parent
c2bb0e62b7
commit
98316bb11a
2 changed files with 95 additions and 62 deletions
|
@ -98,16 +98,16 @@ $("<table>").css("text-indent","0");o.html(k);k.append($("<tr>").append($("<th>"
|
|||
"∞")).append($("<td>").append(G.amount?G.amount:"∞")))}}else o.text("None. ");o.append($("<a>").text("More details").attr("href","https://shop.mistserver.org/myinvoices").attr("target","_blank"))}}else f.text("");var Da=function(){var a={totals:{fields:["clients"],start:-10},active_streams:true};if(!("cabailities"in mist.data))a.capabilities=true;mist.send(function(){Ea()},a)},Ea=function(){i.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..";e.text(a);t.text(UI.format.dateTime(mist.data.config.time,"long"));m.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 b in mist.data.log){var c=mist.data.log[b];if(["FAIL","ERROR"].indexOf(c[1])>
|
||||
-1){a++;var d=$("<span>").addClass("content").addClass("red"),f=c[2].split("|");for(b in f)d.append($("<span>").text(f[b]));m.append($("<div>").append($("<span>").append(UI.format.time(c[0]))).append(d));if(a==5)break}}a==0&&m.html("None.");a=[];c=[];for(b in mist.data.config.protocols){d=mist.data.config.protocols[b];a.indexOf(d.connector)>-1||a.push(d.connector)}l.text(a.length?a.join(", "):"None.");if("capabilities"in mist.data){for(b in mist.data.capabilities.connectors)a.indexOf(b)==-1&&c.push(b);
|
||||
x.text(c.length?c.join(", "):"None.")}else x.text("Loading..")};Da();Ea();UI.interval.set(Da,3E4);break;case "General":var U={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},J={sessionViewerMode:mist.data.config.sessionViewerMode,sessionInputMode:mist.data.config.sessionInputMode,sessionOutputMode:mist.data.config.sessionOutputMode,sessionUnspecifiedMode:mist.data.config.sessionUnspecifiedMode,
|
||||
tknMode:mist.data.config.tknMode,sessionStreamInfoMode:mist.data.config.sessionStreamInfoMode,trustedproxy:mist.data.config.trustedproxy},ea={location:"location"in mist.data.config?mist.data.config.location:{}},E={limit:""};"bandwidth"in mist.data&&(E=mist.data.bandwidth,null==E&&(E={}),E.limit||(E.limit=""));var Ga=$("<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"));
|
||||
c.html(UI.buildUI([$("<h2>").text("General settings"),{type:"help",help:"These are settings that apply to your MistServer instance in general."},{type:"str",label:"Human readable name",pointer:{main:U,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:U,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:U,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:U,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.",pointer:{main:g,index:"trustedproxy"}},{type:"str",validate:["streamname_with_wildcard_and_variables"],label:"Fallback stream",pointer:{main:U,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},$("<h3>").text("Sessions"),{type:"bitmask",label:"Bundle viewer sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:J,index:"sessionViewerMode"},help:"Change the way viewer connections are bundled into sessions.<br>Default: stream name, viewer IP and token"},{type:"bitmask",label:"Bundle input sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:J,index:"sessionInputMode"},help:"Change the way input connections are bundled into sessions.<br>Default: stream name, input IP, token and protocol"},
|
||||
{type:"bitmask",label:"Bundle output sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:J,index:"sessionOutputMode"},help:"Change the way output connections are bundled into sessions.<br>Default: stream name, output IP, token and protocol"},{type:"bitmask",label:"Bundle unspecified sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:J,index:"sessionUnspecifiedMode"},help:"Change the way unspecified connections are bundled into sessions.<br>Default: none"},
|
||||
{type:"select",label:"Treat HTTP-only sessions as",select:[[1,"A viewer session"],[2,"An output session: skip executing the USER_NEW and USER_END triggers"],[4,"A separate 'unspecified' session: skip executing the USER_NEW and USER_END triggers"],[3,"Do not start a session: skip executing the USER_NEW and USER_END triggers and do not count for statistics"]],pointer:{main:J,index:"sessionStreamInfoMode"},help:"Change the way the stream info connection gets treated.<br>Default: as a viewer session"},
|
||||
{type:"bitmask",label:"Communicate session token",bitmask:[[8,"Write to cookie"],[4,"Write to URL parameter"],[2,"Read from cookie"],[1,"Read from URL parameter"]],pointer:{main:J,index:"tknMode"},help:"Change the way the session token gets passed to and from MistServer, which can be set as a cookie or URL parameter named `tkn`. Reading the session token as a URL parameter takes precedence over reading from the cookie.<br>Default: all"},{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:J,index:"trustedproxy"}},{type:"buttons",buttons:[{type:"save",label:"Save","function":function(a){$(a).text("Saving..");mist.send(function(){UI.navto("General")},{config:J})}}]}]));var ma=$("<div>").html("Loading..");mist.send(function(a){if(a.variable_list){var b=$("<tbody>");ma.html($("<table>").html($("<thead>").html($("<tr>").append($("<th>").text("Variable")).append($("<th>").text("Latest value")).append($("<th>").text("Command")).append($("<th>").text("Check interval")).append($("<th>").text("Last checked")).append($("<th>")))).append(b));
|
||||
x.text(c.length?c.join(", "):"None.")}else x.text("Loading..")};Da();Ea();UI.interval.set(Da,3E4);break;case "General":var M={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},N={sessionViewerMode:mist.data.config.sessionViewerMode,sessionInputMode:mist.data.config.sessionInputMode,sessionOutputMode:mist.data.config.sessionOutputMode,
|
||||
sessionUnspecifiedMode:mist.data.config.sessionUnspecifiedMode,tknMode:mist.data.config.tknMode,sessionStreamInfoMode:mist.data.config.sessionStreamInfoMode},ea={location:"location"in mist.data.config?mist.data.config.location:{}},E={limit:""};"bandwidth"in mist.data&&(E=mist.data.bandwidth,null==E&&(E={}),E.limit||(E.limit=""));var Ga=$("<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"));
|
||||
c.html(UI.buildUI([$("<h2>").text("General settings"),{type:"help",help:"These are settings that apply to your MistServer instance in general."},{type:"str",label:"Human readable name",pointer:{main:M,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:M,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:M,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:M,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.",pointer:{main:M,index:"trustedproxy"}},{type:"str",validate:["streamname_with_wildcard_and_variables"],label:"Fallback stream",pointer:{main:M,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:"buttons",buttons:[{type:"save",label:"Save","function":function(a){$(a).text("Saving..");mist.send(function(){UI.navto("General")},{config:M})}}]}]));c.append(UI.buildUI([$("<h3>").text("Sessions"),{type:"bitmask",label:"Bundle viewer sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:N,index:"sessionViewerMode"},help:"Change the way viewer connections are bundled into sessions.<br>Default: stream name, viewer IP and token"},{type:"bitmask",
|
||||
label:"Bundle input sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:N,index:"sessionInputMode"},help:"Change the way input connections are bundled into sessions.<br>Default: stream name, input IP, token and protocol"},{type:"bitmask",label:"Bundle output sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:N,index:"sessionOutputMode"},help:"Change the way output connections are bundled into sessions.<br>Default: stream name, output IP, token and protocol"},
|
||||
{type:"bitmask",label:"Bundle unspecified sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:N,index:"sessionUnspecifiedMode"},help:"Change the way unspecified connections are bundled into sessions.<br>Default: none"},{type:"select",label:"Treat HTTP-only sessions as",select:[[1,"A viewer session"],[2,"An output session: skip executing the USER_NEW and USER_END triggers"],[4,"A separate 'unspecified' session: skip executing the USER_NEW and USER_END triggers"],
|
||||
[3,"Do not start a session: skip executing the USER_NEW and USER_END triggers and do not count for statistics"]],pointer:{main:N,index:"sessionStreamInfoMode"},help:"Change the way the stream info connection gets treated.<br>Default: as a viewer session"},{type:"bitmask",label:"Communicate session token",bitmask:[[8,"Write to cookie"],[4,"Write to URL parameter"],[2,"Read from cookie"],[1,"Read from URL parameter"]],pointer:{main:N,index:"tknMode"},help:"Change the way the session token gets passed to and from MistServer, which can be set as a cookie or URL parameter named `tkn`. Reading the session token as a URL parameter takes precedence over reading from the cookie.<br>Default: all"},
|
||||
{type:"buttons",buttons:[{type:"save",label:"Save","function":function(a){$(a).text("Saving..");mist.send(function(){UI.navto("General")},{config:N})}}]}]));var ma=$("<div>").html("Loading..");mist.send(function(a){if(a.variable_list){var b=$("<tbody>");ma.html($("<table>").html($("<thead>").html($("<tr>").append($("<th>").text("Variable")).append($("<th>").text("Latest value")).append($("<th>").text("Command")).append($("<th>").text("Check interval")).append($("<th>").text("Last checked")).append($("<th>")))).append(b));
|
||||
for(var c in a.variable_list){var d=a.variable_list[c];b.append($("<tr>").addClass("variable").attr("data-name",c).html($("<td>").text("$"+c)).append($("<td>").html($("<code>").text(typeof d=="string"?JSON.stringify(d):d[2]>0?JSON.stringify(d[3]):""))).append($("<td>").text(typeof d=="string"?"":d[0])).append($("<td>").html(typeof d=="string"?"Never":d[1]==0?"Once":UI.format.duration(d[1]))).append($("<td>").attr("title",d[2]>0?typeof d=="string"?"":"At "+UI.format.dateTime(new Date(d[2]),"long"):
|
||||
"Not yet").html(typeof d=="string"?"":d[2]>0?UI.format.duration((new Date).getTime()*0.001-d[2])+" ago":"Not yet")).append($("<td>").html($("<button>").text("Edit").click(function(){var a=$(this).closest("tr").attr("data-name");UI.navto("Edit variable",a)})).append($("<button>").text("Remove").click(function(){var a=$(this).closest("tr").attr("data-name");confirm("Are you sure you want to remove the custom variable $"+a+"?")&&mist.send(function(){UI.showTab("General")},{variable_remove:a})}))))}}else ma.html("None configured.")},
|
||||
{variable_list:!0});c.append(UI.buildUI([$("<h3>").text("Custom variables"),{type:"help",help:"In certain places, like target URL's and pushes, variable substitution is applied in order to replace a $variable with their corresponding value. Here you can define your own constants and variables which will be used when variable substitution is applied. Variables can be used within variables but will not be reflected in their latest value on this page."},$("<div>").addClass("button_container").css("text-align",
|
||||
|
@ -118,10 +118,11 @@ for(var c in a.variable_list){var d=a.variable_list[c];b.append($("<tr>").addCla
|
|||
$("<div>").addClass("button_container").css("text-align","right").html($("<button>").text("New external writer").click(function(){UI.navto("Edit external writer","")})),na]));mist.send(function(a){if(a.external_writer_list){var b=$("<tbody>");na.html($("<table>").html($("<thead>").html($("<tr>").append($("<th>").text("Name")).append($("<th>").text("Command line")).append($("<th>").text("URI protocols handled")).append($("<th>")))).append(b));for(var c in a.external_writer_list){var d=a.external_writer_list[c];
|
||||
b.append($("<tr>").addClass("uploader").attr("data-name",c).html($("<td>").text(d[0])).append($("<td>").html($("<code>").html(d[1]))).append($("<td>").text(d[2]?d[2].join(", "):"none").addClass("desc")).append($("<td>").html($("<button>").text("Edit").click(function(){var a=$(this).closest("tr").attr("data-name");UI.navto("Edit external writer",a)})).append($("<button>").text("Remove").click(function(){var a=$(this).closest("tr").attr("data-name");confirm("Are you sure you want to remove the Uploader '"+
|
||||
a+"'?")&&mist.send(function(){UI.showTab("General")},{external_writer_remove:a})}))))}}else na.html("None configured.")},{external_writer_list:!0});break;case "Edit external writer":var z=!1;""!=b&&(z=!0);var Ia=function(){z?c.html($("<h2>").text("Edit external writer '"+b+"'")):c.html($("<h2>").text("New external writer"));var a={};if(mist.data.external_writer_list&&b in mist.data.external_writer_list){var d=mist.data.external_writer_list[b];a.name=d[0];a.cmdline=d[1];a.protocols=d[2]}c.append(UI.buildUI([{type:"str",
|
||||
label:"Human readable name",help:"A human readable name for the external writer.",validate:["required"],pointer:{main:a,index:"name"}},{type:"str",label:"Command line",help:"Command line for a local command (with optional arguments) which will write media data to the target.",validate:["required"],pointer:{main:a,index:"cmdline"}},{type:"inputlist",label:"URI protocols handled",help:"URI protocols which the external writer will be handling.",validate:["required"],pointer:{main:a,index:"protocols"}},
|
||||
{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("General")}},{type:"save",label:"Save","function":function(){var c={external_writer_add:a};if(a.name!=b)c.external_writer_remove=b;mist.send(function(){UI.navto("General")},c)}}]}]))};"external_writer_list"in mist.data?Ia():mist.send(function(){Ia()},{external_writer_list:!0});break;case "Edit variable":z=!1;""!=b&&(z=!0);var Fa=function(a,d){z?c.html($("<h2>").text('Edit Variable "$'+b+'"')):c.html($("<h2>").text("New Variable"));
|
||||
var f=$("<div>");c.append(UI.buildUI([{type:"str",maxlength:31,label:"Variable name",prefix:"$",help:"What should the variable be called? A dollar sign will automatically be prepended.",pointer:{main:a,index:"name"},validate:["required",function(a){if(a.length&&a[0]=="$")return{msg:"The dollar sign will automatically be prepended. You don't need to type it here.",classes:["red"]};if(a.indexOf("{")!==-1||a.indexOf("}")!==-1||a.indexOf("$")!==-1)return{msg:'The following symbols are not permitted: "$ { }".',
|
||||
classes:["red"]}}]},{type:"select",label:"Type",help:"What kind of variable is this? It can either be a static value that you can enter below, or a dynamic one that is returned by a command.",select:[["value","Static value"],["command","Dynamic through command"]],value:"value",pointer:{main:d,index:"type"},"function":function(){var a=[$("Invalid variable type")];switch($(this).val()){case "value":a=[{type:"str",label:"Value",pointer:{main:d,index:"value"},help:"The static value that this variable should be replaced with. There is a character limit of 63 characters.",
|
||||
label:"Human readable name",help:"A human readable name for the external writer.",validate:["required"],pointer:{main:a,index:"name"}},{type:"str",label:"Command line",help:"Command line for a local command (with optional arguments) which will write media data to the target.",validate:["required"],pointer:{main:a,index:"cmdline"}},{type:"inputlist",label:"URI protocols handled",help:"URI protocols which the external writer will be handling.",validate:["required",function(a){for(var b in a){var c=
|
||||
a[b];if(c.match(/^([a-z\d\+\-\.])+?$/)===null)return{classes:["red"],msg:"There was a problem with the protocol URI '"+$("<div>").text(c).html()+"':<br>A protocol URI may only contain lower case letters, digits, and the following special characters . + and -"}}}],input:{type:"str",unit:"://",validate:[function(a){if(a.indexOf("://")!=-1)return{classes:["red"],msg:"Don't include '://' here.","break":true}}]},pointer:{main:a,index:"protocols"}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel",
|
||||
"function":function(){UI.navto("General")}},{type:"save",label:"Save","function":function(){var c={external_writer_add:a};if(a.name!=b)c.external_writer_remove=b;mist.send(function(){UI.navto("General")},c)}}]}]))};"external_writer_list"in mist.data?Ia():mist.send(function(){Ia()},{external_writer_list:!0});break;case "Edit variable":z=!1;""!=b&&(z=!0);var Fa=function(a,d){z?c.html($("<h2>").text('Edit Variable "$'+b+'"')):c.html($("<h2>").text("New Variable"));var f=$("<div>");c.append(UI.buildUI([{type:"str",
|
||||
maxlength:31,label:"Variable name",prefix:"$",help:"What should the variable be called? A dollar sign will automatically be prepended.",pointer:{main:a,index:"name"},validate:["required",function(a){if(a.length&&a[0]=="$")return{msg:"The dollar sign will automatically be prepended. You don't need to type it here.",classes:["red"]};if(a.indexOf("{")!==-1||a.indexOf("}")!==-1||a.indexOf("$")!==-1)return{msg:'The following symbols are not permitted: "$ { }".',classes:["red"]}}]},{type:"select",label:"Type",
|
||||
help:"What kind of variable is this? It can either be a static value that you can enter below, or a dynamic one that is returned by a command.",select:[["value","Static value"],["command","Dynamic through command"]],value:"value",pointer:{main:d,index:"type"},"function":function(){var a=[$("Invalid variable type")];switch($(this).val()){case "value":a=[{type:"str",label:"Value",pointer:{main:d,index:"value"},help:"The static value that this variable should be replaced with. There is a character limit of 63 characters.",
|
||||
validate:["required"]}];break;case "command":a=[{type:"str",label:"Command",help:"The command that should be executed to retrieve the value for this variable.<br>For example:<br><code>/usr/bin/date +%A</code><br>There is a character limit of 511 characters.",validate:["required"],pointer:{main:d,index:"target"}},{type:"int",min:0,max:4294967295,"default":0,label:"Checking interval",unit:"s",help:"At what interval, in seconds, MistServer should execute the command and update the value.<br>To execute the command once when MistServer starts up (and then never update), set the interval to 0.",
|
||||
pointer:{main:d,index:"interval"}},{type:"int",min:0,max:4294967295,"default":1,label:"Wait time",unit:"s",help:"Specifies the maximum time, in seconds, MistServer should wait for data when executing the variable target. If set to 0 this variable takes on the same value as the interval.<br>MistServer only updates one variable at a time, so setting this value too high can block other variables from updating.",pointer:{main:d,index:"waitTime"}}]}f.html(UI.buildUI(a))}},f,{type:"buttons",buttons:[{type:"cancel",
|
||||
label:"Cancel","function":function(){UI.navto("General")}},{type:"save",label:"Save","function":function(){var c={variable_add:a};switch(d.type){case "value":a.value=d.value;break;case "command":a.target=d.target;a.interval=d.interval;a.waitTime=d.waitTime}if(a.name!=b)c.variable_remove=b;mist.send(function(){UI.navto("General")},c)}}]}]))};c.html("Loading..");z?mist.send(function(a){if(b in a.variable_list){a=a.variable_list[b];Fa({name:b},typeof a=="string"?{value:a,type:"value"}:{target:a[0],interval:a[1],
|
||||
|
@ -133,10 +134,10 @@ F.html("");for(var b in mist.data.config.protocols){var c=mist.data.config.proto
|
|||
$(this).closest("tr").data("index");if(confirm('Are you sure you want to delete the protocol "'+mist.data.config.protocols[a].connector+'"?')){mist.send(function(){UI.navto("Protocols")},{deleteprotocol:mist.data.config.protocols[a]});mist.data.config.protocols.splice(a,1)}}))))}};Ha();UI.interval.set(function(){mist.send(function(){Ha()})},1E4);break;case "Edit Protocol":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,b)},{capabilities:!0});c.append("Loading..");return}z=
|
||||
!1;""!=b&&0<=b&&(z=!0);var V={};for(q in mist.data.config.protocols)V[mist.data.config.protocols[q].connector]=1;var Ja=function(a){var b=mist.data.capabilities.connectors[a],c=mist.convertBuildOptions(b,p);if(z)var d=$.extend({},p);c.push({type:"hidden",pointer:{main:p,index:"connector"},value:a});c.push({type:"buttons",buttons:[{type:"save",label:"Save","function":function(){var a={};z?a.updateprotocol=[d,p]:a.addprotocol=p;mist.send(function(){UI.navto("Protocols")},a)}},{type:"cancel",label:"Cancel",
|
||||
"function":function(){UI.navto("Protocols")}}]});if("deps"in b&&b.deps!=""){k=$("<span>").text("Dependencies:");$ul=$("<ul>");k.append($ul);if(typeof b.deps=="string")b.deps=b.deps.split(", ");for(var f in b.deps){a=$("<li>").text(b.deps[f]+" ");$ul.append(a);typeof V[b.deps[f]]!="undefined"||typeof V[b.deps[f]+".exe"]!="undefined"?a.append($("<span>").addClass("green").text("(Configured)")):a.append($("<span>").addClass("red").text("(Not yet configured)"))}c.unshift({type:"text",text:k[0].innerHTML})}return UI.buildUI(c)},
|
||||
V={};for(q in mist.data.config.protocols)V[mist.data.config.protocols[q].connector]=1;if(z){var s=mist.data.config.protocols[b],p=s;c.find("h2").append(' "'+s.connector+'"');c.append(Ja(s.connector))}else{c.html($("<h2>").text("New Protocol"));var p={},u=[["",""]];for(q in mist.data.capabilities.connectors)u.push([q,mist.data.capabilities.connectors[q].friendly?mist.data.capabilities.connectors[q].friendly:q]);var R=$("<span>");c.append(UI.buildUI([{label:"Protocol",type:"select",select:u,"function":function(){$(this).getval()!=
|
||||
""&&R.html(Ja($(this).getval()))}}])).append(R)}break;case "Streams":if(!("capabilities"in mist.data)){c.html("Loading..");mist.send(function(){UI.navto(a)},{capabilities:!0});return}var La=$("<button>"),N=$("<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(La).append($("<button>").text("Create a new stream").click(function(){UI.navto("Edit")}))])).append(N);
|
||||
""==b&&(g=mist.stored.get(),"viewmode"in g&&(b=g.viewmode));La.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 C=$.extend(!0,{},mist.data.streams),oa=function(a,b){var c=$.extend({},b);delete c.meta;delete c.error;c.online=2;c.name=a;c.ischild=true;return c},pa=function(b,d,f){N.remove();switch(b){case "thumbnails":var g=$("<div>").addClass("preview_icons"),
|
||||
e;e=f||[];d.sort();d.unshift("");N.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();g.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(g);
|
||||
V={};for(q in mist.data.config.protocols)V[mist.data.config.protocols[q].connector]=1;if(z){var s=mist.data.config.protocols[b],p=s;c.find("h2").append(' "'+s.connector+'"');c.append(Ja(s.connector))}else{c.html($("<h2>").text("New Protocol"));var p={},u=[["",""]];for(q in mist.data.capabilities.connectors)u.push([q,mist.data.capabilities.connectors[q].friendly?mist.data.capabilities.connectors[q].friendly:q]);var S=$("<span>");c.append(UI.buildUI([{label:"Protocol",type:"select",select:u,"function":function(){$(this).getval()!=
|
||||
""&&S.html(Ja($(this).getval()))}}])).append(S)}break;case "Streams":if(!("capabilities"in mist.data)){c.html("Loading..");mist.send(function(){UI.navto(a)},{capabilities:!0});return}var La=$("<button>"),O=$("<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(La).append($("<button>").text("Create a new stream").click(function(){UI.navto("Edit")}))])).append(O);
|
||||
""==b&&(g=mist.stored.get(),"viewmode"in g&&(b=g.viewmode));La.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 C=$.extend(!0,{},mist.data.streams),oa=function(a,b){var c=$.extend({},b);delete c.meta;delete c.error;c.online=2;c.name=a;c.ischild=true;return c},pa=function(b,d,f){O.remove();switch(b){case "thumbnails":var g=$("<div>").addClass("preview_icons"),
|
||||
e;e=f||[];d.sort();d.unshift("");O.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();g.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(g);
|
||||
for(var h in d){var b=d[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 b={};b.deletestream=[a];mist.send(function(){UI.navto("Streams")},b)}}),l=$("<button>").text("Settings").click(function(){UI.navto("Edit",$(this).closest("div").attr("data-stream"))}),f=$("<button>").text("Preview").click(function(){UI.navto("Preview",$(this).closest("div").attr("data-stream"))}),
|
||||
Ka=$("<button>").text("Embed").click(function(){UI.navto("Embed",$(this).closest("div").attr("data-stream"))}),r=$("<span>").addClass("image");if(b.indexOf("+")>-1){j=b.split("+");j=mist.data.streams[j[0]].source+j[1];l=k="";r.addClass("wildcard")}else{j=mist.data.streams[b].source;if(e.indexOf(b)>-1){Ka=f="";r.addClass("folder")}}g.append($("<div>").append($("<span>").addClass("streamname").text(b)).append(r).append($("<span>").addClass("description").text(j)).append($("<span>").addClass("button_container").append(l).append(k).append(f).append(Ka)).attr("title",
|
||||
b).attr("data-stream",b))}break;default:var i=$("<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(i);
|
||||
|
@ -150,24 +151,24 @@ j="";g.html("");r=""}i.append($("<tr>").data("index",c).html($("<td>").html(e).a
|
|||
0||e.indexOf("Folder")>=0)&&mist.inputMatch(mist.data.capabilities.inputs[e].source_match,"/"+a.browse.files[g])){u[d+"+"+a.browse.files[g]]=true;f++;if(f>=500){u[d+"+zzzzzzzzz"]=true;break a}}}Na++;qa==Na&&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){u[mist.data.active_streams[a]]=true;C[mist.data.active_streams[a]]=oa(mist.data.active_streams[a],mist.data.streams[c[0]])}}u=Object.keys(u);u=u.concat(Object.keys(mist.data.streams));
|
||||
u.sort();pa(b,u,Oa)},{active_streams:true})},{browse:mist.data.streams[g].source},{stream:g}),qa++;0==qa&&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){u[mist.data.active_streams[a]]=true;C[mist.data.active_streams[a]]=oa(mist.data.active_streams[a],mist.data.streams[c[0]])}}u=Object.keys(u);mist.data.streams&&(u=u.concat(Object.keys(mist.data.streams)));u.sort();pa(b,u)},{active_streams:!0})}else pa(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}z=!1;""!=b&&(z=!0);if(z){var Pa=b,p=mist.data.streams[Pa];c.find("h2").append(' "'+Pa+'"')}else c.html($("<h2>").text("New Stream")),p={};var Qa=[];for(q in mist.data.capabilities.inputs)Qa.push(mist.data.capabilities.inputs[q].source_match);var fa=$("<div>"),Ra=function(a){var c={};if(!mist.data.streams)mist.data.streams=
|
||||
{};mist.data.streams[p.name]=p;b!=p.name&&delete mist.data.streams[b];c.addstream={};c.addstream[p.name]=p;if(b!=p.name)c.deletestream=[b];if(p.stop_sessions&&b!=""){c.stop_sessions=b;delete p.stop_sessions}mist.send(function(){delete mist.data.streams[p.name].online;delete mist.data.streams[p.name].error;UI.navto(a,a=="Preview"?p.name:"")},c)},Sa=$("<style>").text("button.saveandpreview { display: none; }"),O=$("<span>"),ra=function(){var a=c.find("[name=name]").val();if(a){var b=parseURL(mist.user.host),
|
||||
{};mist.data.streams[p.name]=p;b!=p.name&&delete mist.data.streams[b];c.addstream={};c.addstream[p.name]=p;if(b!=p.name)c.deletestream=[b];if(p.stop_sessions&&b!=""){c.stop_sessions=b;delete p.stop_sessions}mist.send(function(){delete mist.data.streams[p.name].online;delete mist.data.streams[p.name].error;UI.navto(a,a=="Preview"?p.name:"")},c)},Sa=$("<style>").text("button.saveandpreview { display: none; }"),P=$("<span>"),ra=function(){var a=c.find("[name=name]").val();if(a){var b=parseURL(mist.user.host),
|
||||
d=c.find("[name=source]").val(),f=d.match(/@.*/);f&&(f=f[0].substring(1));var g=d.replace(/(?:.+?):\/\//,""),g=g.split("/"),g=g[0],g=g.split(":"),g=g[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 l=mist.data.config.protocols[j];
|
||||
if(l.connector==k){if("port"in l)e[k]=l.port;break}}e[k]=e[k]==h[k]?"":":"+e[k]}e.TS="";e["TS.exe"]="";O.find(".field").closest("label").hide();for(j in e){var r;k=d?d:e[j];switch(j){case "RTMP":case "RTMP.exe":r="rtmp://"+b.host+k+"/"+(f?f:"live")+"/";O.find(".field.RTMPurl").setval(r).closest("label").show();O.find(".field.RTMPkey").setval(a==""?"STREAMNAME":a).closest("label").show();r=r+(a==""?"STREAMNAME":a);break;case "RTSP":case "RTSP.exe":r="rtsp://"+b.host+k+"/"+(a==""?"STREAMNAME":a)+(f?
|
||||
"?pass="+f:"");break;case "TS":case "TS.exe":r="udp://"+(g==""?b.host:g)+k+"/"}O.find(".field."+j.replace(".exe","")).setval(r).closest("label").show()}}},Ta=$("<div>"),sa={},u=[],Ua=$("<div>");for(q in mist.data.capabilities.processes)u.push([q,mist.data.capabilities.processes[q].hrn?mist.data.capabilities.processes[q].hrn:mist.data.capabilities.processes[q].name]);if(u.length){var jb=[{label:"New process",type:"select",select:u,value:u[0][0],pointer:{main:sa,index:"process"},"function":function(){var a=
|
||||
if(l.connector==k){if("port"in l)e[k]=l.port;break}}e[k]=e[k]==h[k]?"":":"+e[k]}e.TS="";e["TS.exe"]="";P.find(".field").closest("label").hide();for(j in e){var r;k=d?d:e[j];switch(j){case "RTMP":case "RTMP.exe":r="rtmp://"+b.host+k+"/"+(f?f:"live")+"/";P.find(".field.RTMPurl").setval(r).closest("label").show();P.find(".field.RTMPkey").setval(a==""?"STREAMNAME":a).closest("label").show();r=r+(a==""?"STREAMNAME":a);break;case "RTSP":case "RTSP.exe":r="rtsp://"+b.host+k+"/"+(a==""?"STREAMNAME":a)+(f?
|
||||
"?pass="+f:"");break;case "TS":case "TS.exe":r="udp://"+(g==""?b.host:g)+k+"/"}P.find(".field."+j.replace(".exe","")).setval(r).closest("label").show()}}},Ta=$("<div>"),sa={},u=[],Ua=$("<div>");for(q in mist.data.capabilities.processes)u.push([q,mist.data.capabilities.processes[q].hrn?mist.data.capabilities.processes[q].hrn:mist.data.capabilities.processes[q].name]);if(u.length){var jb=[{label:"New process",type:"select",select:u,value:u[0][0],pointer:{main:sa,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")];Ua.html(UI.buildUI(b.concat(mist.convertBuildOptions(a,sa))))}}},Ua];Ta.append(UI.buildUI([$("<br>"),$("<h3>").text("Stream processes"),{label:"Stream processes",itemLabel:"stream process",type:"sublist",sublist:jb,saveas:sa,pointer:{main:p,index:"processes"}}]))}c.append(UI.buildUI([{label:"Stream name",type:"str",validate:["required","streamname"],pointer:{main:p,index:"name"},help:"Set the name this stream will be recognised by for players and/or stream pushing."},
|
||||
{label:"Source",type:"browse",filetypes:Qa,pointer:{main:p,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> 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>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> 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>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> 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>",
|
||||
"function":function(){var a=$(this).val();Sa.remove();O.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)fa.html($("<h3>").text("Unrecognized input").addClass("red")).append($("<span>").text("Please edit the stream source.").addClass("red"));else{b=mist.data.capabilities.inputs[b];fa.html($("<h3>").text(b.name+" Input options"));
|
||||
"function":function(){var a=$(this).val();Sa.remove();P.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)fa.html($("<h3>").text("Unrecognized input").addClass("red")).append($("<span>").text("Please edit the stream source.").addClass("red"));else{b=mist.data.capabilities.inputs[b];fa.html($("<h3>").text(b.name+" Input options"));
|
||||
var f=mist.convertBuildOptions(b,p);"always_match"in mist.data.capabilities.inputs[d]&&mist.inputMatch(mist.data.capabilities.inputs[d].always_match,a)&&f.push({label:"Always on",type:"checkbox",help:"Keep this input available at all times, even when there are no active viewers.",pointer:{main:p,index:"always_on"}});fa.append(UI.buildUI(f));if(b.name=="Folder")c.append(Sa);else if(["Buffer","Buffer.exe","TS","TS.exe"].indexOf(b.name)>-1){d=[$("<br>"),$("<span>").text("Configure your source to push to:")];
|
||||
switch(b.name){case "Buffer":case "Buffer.exe":d.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"});d.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"});d.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"});
|
||||
d.push({label:"RTSP",type:"span",clipboard:true,readonly:true,classes:["RTSP"]});break;case "TS":case "TS.exe":a.charAt(0)=="/"?d=[]:d.push({label:"TS",type:"span",clipboard:true,readonly:true,classes:["TS"]})}O.html(UI.buildUI(d));ra()}}}}},{label:"Stop sessions",type:"checkbox",help:"When saving these stream settings, kill this stream's current connections.",pointer:{main:p,index:"stop_sessions"}},O,$("<br>"),{type:"custom",custom:fa},Ta,{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Streams")}},
|
||||
{type:"save",label:"Save","function":function(){Ra("Streams")}},{type:"save",label:"Save and Preview","function":function(){Ra("Preview")},classes:["saveandpreview"]}]}]));c.find("[name=name]").keyup(function(){ra()});ra();break;case "Preview":""==b&&UI.navto("Streams");var P=parseURL(mist.user.host),W=P.protocol,S=P.host,K=":8080",v=W+S+K+"/";for(q in mist.data.config.protocols)if(s=mist.data.config.protocols[q],"HTTP"==s.connector||"HTTP.exe"==s.connector){s.pubaddr&&s.pubaddr.length?"string"==
|
||||
typeof s.pubaddr?v=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(v=s.pubaddr[0].replace(/\/$/,"")+"/"):(K=s.port?":"+s.port:":8080",v=W+S+K+"/");break}var R=$("<div>").css({display:"flex","flex-flow":"row wrap","flex-shrink":1,"min-width":"auto"}),X="";-1==b.indexOf("+")&&(X=$("<button>").text("Settings").addClass("settings").click(function(){UI.navto("Edit",b)}));c.html($("<div>").addClass("bigbuttons").append(X).append($("<button>").text("Embed").addClass("embed").click(function(){UI.navto("Embed",
|
||||
b)})).append($("<button>").addClass("cancel").addClass("return").text("Return").click(function(){UI.navto("Streams")}))).append($("<h2>").text('Preview of "'+b+'"')).append(R);var L=encodeURIComponent(b),Va=$("<div>").css("flex-shrink","1").css("min-width","auto").css("max-width","100%");R.append(Va);var Wa=$("<div>"),Y=$("<div>").text("Loading player..").css("max-width","100%").css("flex-shrink","1").css("min-width","auto"),ta=$("<div>").addClass("controls");Va.append(Y).append(Wa).append(ta);$("link#devcss").length||
|
||||
d.push({label:"RTSP",type:"span",clipboard:true,readonly:true,classes:["RTSP"]});break;case "TS":case "TS.exe":a.charAt(0)=="/"?d=[]:d.push({label:"TS",type:"span",clipboard:true,readonly:true,classes:["TS"]})}P.html(UI.buildUI(d));ra()}}}}},{label:"Stop sessions",type:"checkbox",help:"When saving these stream settings, kill this stream's current connections.",pointer:{main:p,index:"stop_sessions"}},P,$("<br>"),{type:"custom",custom:fa},Ta,{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Streams")}},
|
||||
{type:"save",label:"Save","function":function(){Ra("Streams")}},{type:"save",label:"Save and Preview","function":function(){Ra("Preview")},classes:["saveandpreview"]}]}]));c.find("[name=name]").keyup(function(){ra()});ra();break;case "Preview":""==b&&UI.navto("Streams");var Q=parseURL(mist.user.host),W=Q.protocol,T=Q.host,J=":8080",v=W+T+J+"/";for(q in mist.data.config.protocols)if(s=mist.data.config.protocols[q],"HTTP"==s.connector||"HTTP.exe"==s.connector){s.pubaddr&&s.pubaddr.length?"string"==
|
||||
typeof s.pubaddr?v=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(v=s.pubaddr[0].replace(/\/$/,"")+"/"):(J=s.port?":"+s.port:":8080",v=W+T+J+"/");break}var S=$("<div>").css({display:"flex","flex-flow":"row wrap","flex-shrink":1,"min-width":"auto"}),X="";-1==b.indexOf("+")&&(X=$("<button>").text("Settings").addClass("settings").click(function(){UI.navto("Edit",b)}));c.html($("<div>").addClass("bigbuttons").append(X).append($("<button>").text("Embed").addClass("embed").click(function(){UI.navto("Embed",
|
||||
b)})).append($("<button>").addClass("cancel").addClass("return").text("Return").click(function(){UI.navto("Streams")}))).append($("<h2>").text('Preview of "'+b+'"')).append(S);var K=encodeURIComponent(b),Va=$("<div>").css("flex-shrink","1").css("min-width","auto").css("max-width","100%");S.append(Va);var Wa=$("<div>"),Y=$("<div>").text("Loading player..").css("max-width","100%").css("flex-shrink","1").css("min-width","auto"),ta=$("<div>").addClass("controls");Va.append(Y).append(Wa).append(ta);$("link#devcss").length||
|
||||
c.append($("<link>").attr("rel","stylesheet").attr("type","text/css").attr("href",v+"skins/dev.css").attr("id","devcss"));var Xa=function(){Wa.text("");var d=document.createElement("script");c.append(d);d.src=v+"player.js";d.onerror=function(){Y.html($("<p>").append('Failed to load <a href="'+v+'player.js">'+v+"player.js</a>.")).append($("<p>").append("Please check if you've activated the HTTP protocol, if your http port is blocked, or if you're trying to load HTTPS on an HTTP page.")).append($("<button>").text("Reload").css("display",
|
||||
"block").click(function(){Xa()}))};d.onload=function(){var f=b,g=function(){var a=MistVideoObject.reference;ta.html("");ta.append(a.UI.buildStructure({type:"container",classes:["mistvideo-column"],style:{flexShrink:1},children:[{"if":function(){return this.playerName&&this.source},then:{type:"container",classes:["mistvideo-description"],style:{display:"block"},children:[{type:"playername",style:{display:"inline"}},{type:"text",text:"is playing",style:{margin:"0 0.2em"}},{type:"mimetype"}]}},{type:"decodingIssues",
|
||||
style:{"max-width":"30em","flex-flow":"column nowrap"}},{type:"container",classes:["mistvideo-column","mistvideo-devcontrols"],children:[{type:"text",text:"Player control"},{type:"container",classes:["mistvideo-devbuttons"],style:{"flex-wrap":"wrap"},children:[{"if":function(){return!(!this.player||!this.player.api)},then:{type:"button",title:"Reload the video source",label:"Reload video",onclick:function(){this.player.api.load()}}},{type:"button",title:"Build MistVideo again",label:"Reload player",
|
||||
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==""||f!=b)){Y[0].addEventListener("initialized",g);Y[0].addEventListener("initializeFailed",g);MistVideoObject.reference=mistPlay(f,{target:Y[0],host:v,skin:"dev",loop:true,MistVideoObject:MistVideoObject})}c[0].removeChild(d)};
|
||||
MistVideoObject.reference={unload:function(){d.onload=function(){this.parentElement&&this.parentElement.removeChild(this)}}}};Xa();var ua=$("<div>").append($("<h3>").text("Meta information")),ga=$("<span>").text("Loading..");ua.append(ga);var Ya=$("<div>").addClass("process_info");ua.append(Ya);R.append(ua);if(""!=L){$.ajax({type:"GET",url:v+"json_"+L+".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||
|
||||
MistVideoObject.reference={unload:function(){d.onload=function(){this.parentElement&&this.parentElement.removeChild(this)}}}};Xa();var ua=$("<div>").append($("<h3>").text("Meta information")),ga=$("<span>").text("Loading..");ua.append(ga);var Ya=$("<div>").addClass("process_info");ua.append(Ya);S.append(ua);if(""!=K){$.ajax({type:"GET",url:v+"json_"+K+".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)ga.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:[]}},f=Object.keys(c.tracks);f.sort(function(a,b){a=a.split("_").pop();b=b.split("_").pop();return a-b});var g=1,e=1,h=1,j;for(j in f){var k=f[j],r=c.tracks[k];switch(r.type){case "audio":d.audio.content.push({header:"Track "+k.split("_").pop(),body:[r.codec,UI.format.duration((r.lastms-r.firstms)/
|
||||
1E3)+"<br><span class=description>"+UI.format.duration(r.firstms/1E3)+" to "+UI.format.duration(r.lastms/1E3)+"</span>",b(r,"bps"),b(r,"maxbps"),r.channels,UI.format.addUnit(UI.format.number(r.rate),"Hz"),"language"in r?r.language:"unknown",g]});g++;break;case "video":d.video.content.push({header:"Track "+k.split("_").pop(),body:[r.codec,UI.format.duration((r.lastms-r.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(r.firstms/1E3)+" to "+UI.format.duration(r.lastms/1E3)+"</span>",b(r,
|
||||
|
@ -177,38 +178,38 @@ true;mist.send(function(a){if(a.proc_list){var b=$("<table>").css("width","auto"
|
|||
a.sink_tracks.slice(0,-2).concat(a.sink_tracks.slice(-2).join(" and ")).join(", ")));return b},"Active for:":function(a){var b=(new Date).setSeconds((new Date).getSeconds()-a.active_seconds);return $("<span>").append($("<span>").text(UI.format.duration(a.active_seconds))).append($("<span>").addClass("description").text(" since "+UI.format.time(b/1E3)))},"Pid:":function(a,b){return b},"Logs:":function(a){var b=$("<div>").text("None.");if(a.logs&&a.logs.length){b.html("").addClass("description").css({overflow:"auto",
|
||||
maxHeight:"6em",display:"flex",flexFlow:"column-reverse nowrap"});for(var c in a.logs){var d=a.logs[c];b.prepend($("<div>").append(UI.format.time(d[0])+" ["+d[1]+"] "+d[2]))}}return b},"Additional info:":function(a){var b;if(a.ainfo&&Object.keys(a.ainfo).length){b=$("<table>");for(var c in a.ainfo){var d=mist.data.capabilities.processes[a.process].ainfo[c];d||(d={name:c});b.append($("<tr>").append($("<th>").text(d.name+":")).append($("<td>").html(a.ainfo[c]).append(d.unit?$("<span>").addClass("unit").text(d.unit):
|
||||
"")))}}else b=$("<span>").addClass("description").text("N/A");return b}};Ya.html($("<h4>").text("Stream processes")).append(b);for(var d in c){var f=$("<tr>");b.append(f);f.append($("<th>").text(d).css("vertical-align","top"));for(var g in a.proc_list){$out=c[d](a.proc_list[g],g);f.append($("<td>").html($out).css("vertical-align","top"))}}}},a)};UI.interval.set(function(){Za()},5E3);Za()}break;case "Embed":""==b&&UI.navTo("Streams");X="";-1==b.indexOf("+")&&(X=$("<button>").addClass("settings").text("Settings").click(function(){UI.navto("Edit",
|
||||
b)}));c.html($("<div>").addClass("bigbuttons").append(X).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 Z=$("<span>");c.append(Z);var L=encodeURIComponent(b),P=parseURL(mist.user.host),W=P.protocol,S=P.host,K=":8080",aa,ha={},v={http:W+S+K+"/"};for(q in mist.data.config.protocols)if(s=mist.data.config.protocols[q],
|
||||
"HTTP"==s.connector||"HTTP.exe"==s.connector)s.pubaddr?("string"==typeof s.pubaddr?v.http=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(v.http=s.pubaddr[0].replace(/\/$/,"")+"/"),ha.http=s.pubaddr):(K=s.port?":"+s.port:":8080",v.http=W+S+K+"/");else if("HTTPS"==s.connector||"HTTPS.exe"==s.connector)s.pubaddr&&s.pubaddr.length?("string"==typeof s.pubaddr?v.https=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(v.https=s.pubaddr[0].replace(/\/$/,"")+"/"),ha.https=s.pubaddr):(aa=s.port?":"+s.port:
|
||||
":4433",v.https="https://"+S+aa+"/");var Q=v.http,D={http:v.http};"https"in v&&(D.https=v.https);if(otherhost.host||otherhost.https){Q=(otherhost.https&&aa?"https://":"http://")+(otherhost.host?otherhost.host:P.host)+(otherhost.https&&aa?aa:K)+"/";if(otherhost.host&&("http"in ha||(D.http=parseURL(D.http,{hostname:otherhost.host}).full),"https"in D&&!("https"in ha)))D.https=parseURL(D.https,{hostname:otherhost.host}).full;Q=otherhost.https?D.https:D.http}var ba=!1,va={forcePlayer:"",forceType:"",controls:!0,
|
||||
b)}));c.html($("<div>").addClass("bigbuttons").append(X).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 Z=$("<span>");c.append(Z);var K=encodeURIComponent(b),Q=parseURL(mist.user.host),W=Q.protocol,T=Q.host,J=":8080",aa,ha={},v={http:W+T+J+"/"};for(q in mist.data.config.protocols)if(s=mist.data.config.protocols[q],
|
||||
"HTTP"==s.connector||"HTTP.exe"==s.connector)s.pubaddr?("string"==typeof s.pubaddr?v.http=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(v.http=s.pubaddr[0].replace(/\/$/,"")+"/"),ha.http=s.pubaddr):(J=s.port?":"+s.port:":8080",v.http=W+T+J+"/");else if("HTTPS"==s.connector||"HTTPS.exe"==s.connector)s.pubaddr&&s.pubaddr.length?("string"==typeof s.pubaddr?v.https=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(v.https=s.pubaddr[0].replace(/\/$/,"")+"/"),ha.https=s.pubaddr):(aa=s.port?":"+s.port:
|
||||
":4433",v.https="https://"+T+aa+"/");var R=v.http,D={http:v.http};"https"in v&&(D.https=v.https);if(otherhost.host||otherhost.https){R=(otherhost.https&&aa?"https://":"http://")+(otherhost.host?otherhost.host:Q.host)+(otherhost.https&&aa?aa:J)+"/";if(otherhost.host&&("http"in ha||(D.http=parseURL(D.http,{hostname:otherhost.host}).full),"https"in D&&!("https"in ha)))D.https=parseURL(D.https,{hostname:otherhost.host}).full;R=otherhost.https?D.https:D.http}var ba=!1,va={forcePlayer:"",forceType:"",controls:!0,
|
||||
autoplay:!0,loop:!1,muted:!1,fillSpace:!1,poster:"",urlappend:"",setTracks:{}},n=$.extend({},va),$a=UI.stored.getOpts();"embedoptions"in $a&&(n=$.extend(n,$a.embedoptions,!0),"object"!=typeof n.setTracks&&(n.setTracks={}));var ia={};switch(n.controls){case "stock":ia.controls="stock";break;case !0:ia.controls=1;break;case !1:ia.controls=0}var A=function(){function a(b){switch(typeof b){case "string":return $.isNumeric(b)?b:'"'+b+'"';case "object":return JSON.stringify(b);default:return b}}ba&&UI.stored.saveOpt("embedoptions",
|
||||
n);for(var c=b+"_",d=12,f="";d--;){var g;g=Math.floor(Math.random()*62);g=g<10?g:g<36?String.fromCharCode(g+55):String.fromCharCode(g+61);f=f+g}var c=c+f,d=['target: document.getElementById("'+c+'")'],e;for(e in n)e=="prioritize_type"?n[e]&&n[e]!=""&&d.push("forcePriority: "+JSON.stringify({source:[["type",[n[e]]]]})):e=="monitor_action"?n[e]&&n[e]!=""&&n[e]=="nextCombo"&&d.push('monitor: {\n action: function(){\n this.MistVideo.log("Switching to nextCombo because of poor playback in "+this.MistVideo.source.type+" ("+Math.round(this.vars.score*1000)/10+"%)");\n this.MistVideo.nextCombo();\n }\n }'):
|
||||
n[e]!=va[e]&&(n[e]!=null&&(typeof n[e]!="object"||JSON.stringify(n[e])!=JSON.stringify(va[e])))&&d.push(e+": "+a(n[e]));e=[];e.push('<div class="mistvideo" id="'+c+'">');e.push(" <noscript>");e.push(' <a href="'+(otherhost.https?D.https:D.http)+L+'.html" target="_blank">');e.push(" Click here to play this video");e.push(" </a>");e.push(" </noscript>");e.push(" <script>");e.push(" var a = function(){");e.push(' mistPlay("'+b+'",{');e.push(" "+d.join(",\n "));e.push(" });");
|
||||
e.push(" };");e.push(" if (!window.mistplayers) {");e.push(' var p = document.createElement("script");');if("https"in v&&parseURL(v.http).protocol!="https://"){e.push(' if (location.protocol == "https:") { p.src = "'+D.https+'player.js" } ');e.push(' else { p.src = "'+D.http+'player.js" } ')}else e.push(' p.src = "'+Q+'player.js"');e.push(" document.head.appendChild(p);");e.push(" p.onload = a;");e.push(" }");e.push(" else { a(); }");e.push(" <\/script>");
|
||||
e.push("</div>");return e.join("\n")},wa=$("<span>").text("Loading.."),ab=A(n),T=$("<div>").text("Loading..").css("display","flex").css("flex-flow","column nowrap"),bb="";"https"in v&&(bb=UI.buildUI([{label:"Use HTTPS",type:"checkbox","function":function(){if($(this).getval()!=otherhost.https){otherhost.https=$(this).getval();UI.navto("Embed",b)}},value:otherhost.https}]).find("label"));Z.append($("<span>").addClass("input_container").append($("<label>").addClass("UIelement").append($("<span>").addClass("label").text("Use a different host:")).append($("<span>").addClass("field_container").append($("<input>").attr("type",
|
||||
"text").addClass("field").val(otherhost.host?otherhost.host:P.host)).append($("<span>").addClass("unit").append($("<button>").text("Apply").click(function(){otherhost.host=$(this).closest("label").find("input").val();UI.navto("Embed",b)}))))).append(bb)).append(UI.buildUI([$("<h3>").text("Urls"),{label:"Stream info json",type:"str",value:Q+"json_"+L+".js",readonly:!0,clipboard:!0,help:"Information about this stream as a json page."},{label:"Stream info script",type:"str",value:Q+"info_"+L+".js",readonly:!0,
|
||||
clipboard:!0,help:"This script loads information about this stream into a mistvideo javascript object."},{label:"HTML page",type:"str",value:Q+L+".html",readonly:!0,qrcode:!0,clipboard:!0,help:"A basic html containing the embedded stream."},$("<h3>").text("Embed code"),{label:"Embed code",type:"textarea",value:ab,rows:ab.split("\n").length+3,readonly:!0,classes:["embed_code"],clipboard:!0,help:"Include this code on your webpage to embed the stream. The options below can be used to configure how your content is displayed."},
|
||||
n[e]!=va[e]&&(n[e]!=null&&(typeof n[e]!="object"||JSON.stringify(n[e])!=JSON.stringify(va[e])))&&d.push(e+": "+a(n[e]));e=[];e.push('<div class="mistvideo" id="'+c+'">');e.push(" <noscript>");e.push(' <a href="'+(otherhost.https?D.https:D.http)+K+'.html" target="_blank">');e.push(" Click here to play this video");e.push(" </a>");e.push(" </noscript>");e.push(" <script>");e.push(" var a = function(){");e.push(' mistPlay("'+b+'",{');e.push(" "+d.join(",\n "));e.push(" });");
|
||||
e.push(" };");e.push(" if (!window.mistplayers) {");e.push(' var p = document.createElement("script");');if("https"in v&&parseURL(v.http).protocol!="https://"){e.push(' if (location.protocol == "https:") { p.src = "'+D.https+'player.js" } ');e.push(' else { p.src = "'+D.http+'player.js" } ')}else e.push(' p.src = "'+R+'player.js"');e.push(" document.head.appendChild(p);");e.push(" p.onload = a;");e.push(" }");e.push(" else { a(); }");e.push(" <\/script>");
|
||||
e.push("</div>");return e.join("\n")},wa=$("<span>").text("Loading.."),ab=A(n),U=$("<div>").text("Loading..").css("display","flex").css("flex-flow","column nowrap"),bb="";"https"in v&&(bb=UI.buildUI([{label:"Use HTTPS",type:"checkbox","function":function(){if($(this).getval()!=otherhost.https){otherhost.https=$(this).getval();UI.navto("Embed",b)}},value:otherhost.https}]).find("label"));Z.append($("<span>").addClass("input_container").append($("<label>").addClass("UIelement").append($("<span>").addClass("label").text("Use a different host:")).append($("<span>").addClass("field_container").append($("<input>").attr("type",
|
||||
"text").addClass("field").val(otherhost.host?otherhost.host:Q.host)).append($("<span>").addClass("unit").append($("<button>").text("Apply").click(function(){otherhost.host=$(this).closest("label").find("input").val();UI.navto("Embed",b)}))))).append(bb)).append(UI.buildUI([$("<h3>").text("Urls"),{label:"Stream info json",type:"str",value:R+"json_"+K+".js",readonly:!0,clipboard:!0,help:"Information about this stream as a json page."},{label:"Stream info script",type:"str",value:R+"info_"+K+".js",readonly:!0,
|
||||
clipboard:!0,help:"This script loads information about this stream into a mistvideo javascript object."},{label:"HTML page",type:"str",value:R+K+".html",readonly:!0,qrcode:!0,clipboard:!0,help:"A basic html containing the embedded stream."},$("<h3>").text("Embed code"),{label:"Embed code",type:"textarea",value:ab,rows:ab.split("\n").length+3,readonly:!0,classes:["embed_code"],clipboard:!0,help:"Include this code on your webpage to embed the stream. The options below can be used to configure how your content is displayed."},
|
||||
$("<h4>").text("Embed code options (optional)").css("margin-top",0),{type:"help",help:"Use these controls to customise what this embedded video will look like.<br>Not all players have all of these options."},{label:"Prioritize type",type:"select",select:[["","Automatic"]],pointer:{main:n,index:"prioritize_type"},classes:["prioritize_type"],"function":function(){if(ba){n.prioritize_type=$(this).getval();$(".embed_code").setval(A(n))}},help:"Try to use this source type first, but full back to something else if it is not available."},
|
||||
{label:"Force type",type:"select",select:[["","Automatic"]],pointer:{main:n,index:"forceType"},classes:["forceType"],"function":function(){if(ba){n.forceType=$(this).getval();$(".embed_code").setval(A(n))}},help:"Only use this particular source."},{label:"Force player",type:"select",select:[["","Automatic"]],pointer:{main:n,index:"forcePlayer"},classes:["forcePlayer"],"function":function(){if(ba){n.forcePlayer=$(this).getval();$(".embed_code").setval(A(n))}},help:"Only use this particular player."},
|
||||
{label:"Controls",type:"select",select:[["1","MistServer Controls"],["stock","Player controls"],["0","None"]],pointer:{main:ia,index:"controls"},"function":function(){n.controls=$(this).getval()==1;switch($(this).getval()){case 0:n.controls=false;break;case 1:n.controls=true;break;case "stock":n.controls="stock"}$(".embed_code").setval(A(n))},help:"The type of controls that should be shown."},{label:"Autoplay",type:"checkbox",pointer:{main:n,index:"autoplay"},"function":function(){n.autoplay=$(this).getval();
|
||||
$(".embed_code").setval(A(n))},help:"Whether or not the video should play as the page is loaded."},{label:"Loop",type:"checkbox",pointer:{main:n,index:"loop"},"function":function(){n.loop=$(this).getval();$(".embed_code").setval(A(n))},help:"If the video should restart when the end is reached."},{label:"Start muted",type:"checkbox",pointer:{main:n,index:"muted"},"function":function(){n.muted=$(this).getval();$(".embed_code").setval(A(n))},help:"If the video should restart when the end is reached."},
|
||||
{label:"Fill available space",type:"checkbox",pointer:{main:n,index:"fillSpace"},"function":function(){n.fillSpace=$(this).getval();$(".embed_code").setval(A(n))},help:"The video will fit the available space in its container, even if the video stream has a smaller resolution."},{label:"Poster",type:"str",pointer:{main:n,index:"poster"},"function":function(){n.poster=$(this).getval();$(".embed_code").setval(A(n))},help:"URL to an image that is displayed when the video is not playing."},{label:"Video URL addition",
|
||||
type:"str",pointer:{main:n,index:"urlappend"},help:"The embed script will append this string to the video url, useful for sending through params.",classes:["embed_code_forceprotocol"],"function":function(){n.urlappend=$(this).getval();$(".embed_code").setval(A(n))}},{label:"Preselect tracks",type:"DOMfield",DOMfield:T,help:"Pre-select these tracks."},{label:"Monitoring action",type:"select",select:[["","Ask the viewer what to do"],["nextCombo","Try the next source / player combination"]],pointer:{main:n,
|
||||
index:"monitor_action"},"function":function(){n.monitor_action=$(this).getval();$(".embed_code").setval(A(n))},help:"What the player should do when playback is poor."},$("<h3>").text("Protocol stream urls"),wa]));$.ajax({type:"GET",url:Q+"json_"+L+".js",success:function(a){var b=[],c=Z.find(".field.forceType"),d=Z.find(".field.prioritize_type"),f;for(f in a.source){var e=a.source[f],g=UI.humanMime(e.type);b.push({label:g?g+" <span class=description>("+e.type+")</span>":UI.format.capital(e.type),type:"str",
|
||||
value:e.url,readonly:true,qrcode:true,clipboard:true});g=UI.humanMime(e.type);if(c.children('option[value="'+e.type+'"]').length==0){c.append($("<option>").text(g?g+" ("+e.type+")":UI.format.capital(e.type)).val(e.type));d.append($("<option>").text(g?g+" ("+e.type+")":UI.format.capital(e.type)).val(e.type))}}c.val(n.forceType);d.val(n.prioritize_type);wa.html(UI.buildUI(b));T.html("");b={};for(f in a.meta.tracks){c=a.meta.tracks[f];if(c.codec=="subtitle")c.type="subtitle";if(!(c.type!="audio"&&c.type!=
|
||||
"video"&&c.type!="subtitle")){c.type in b||(b[c.type]=c.type=="subtitle"?[]:[["","Autoselect "+c.type]]);b[c.type].push([c.trackid,UI.format.capital(c.type)+" track "+(b[c.type].length+(c.type=="subtitle"?1:0))])}}if(Object.keys(b).length){T.closest("label").show();var a=["audio","video","subtitle"],h;for(h in a){f=a[h];if(b[f]&&b[f].length){c=$("<select>").attr("data-type",f).css("flex-grow","1").change(function(){$(this).val()==""?delete n.setTracks[$(this).attr("data-type")]:n.setTracks[$(this).attr("data-type")]=
|
||||
$(this).val();$(".embed_code").setval(A(n))});T.append(c);f=="subtitle"?b[f].unshift(["","No "+f]):b[f].push([-1,"No "+f]);for(var j in b[f])c.append($("<option>").val(b[f][j][0]).text(b[f][j][1]));if(f in n.setTracks){c.val(n.setTracks[f]);if(c.val()==null){c.val("");delete n.setTracks[f];$(".embed_code").setval(A(n))}}}}}else T.closest("label").hide();ba=true},error:function(){wa.html("Error while retrieving stream info.");T.closest("label").hide();n.setTracks={}}});var ja=document.createElement("script");
|
||||
ja.src=v.http+"player.js";document.head.appendChild(ja);ja.onload=function(){var a=Z.find(".field.forcePlayer"),b;for(b in mistplayers)a.append($("<option>").text(mistplayers[b].name).val(b));document.head.removeChild(this)};ja.onerror=function(){document.head.removeChild(this)};break;case "Push":var M=$("<div>").text("Loading..");c.append(M);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,
|
||||
type:"str",pointer:{main:n,index:"urlappend"},help:"The embed script will append this string to the video url, useful for sending through params.",classes:["embed_code_forceprotocol"],"function":function(){n.urlappend=$(this).getval();$(".embed_code").setval(A(n))}},{label:"Preselect tracks",type:"DOMfield",DOMfield:U,help:"Pre-select these tracks."},{label:"Monitoring action",type:"select",select:[["","Ask the viewer what to do"],["nextCombo","Try the next source / player combination"]],pointer:{main:n,
|
||||
index:"monitor_action"},"function":function(){n.monitor_action=$(this).getval();$(".embed_code").setval(A(n))},help:"What the player should do when playback is poor."},$("<h3>").text("Protocol stream urls"),wa]));$.ajax({type:"GET",url:R+"json_"+K+".js",success:function(a){var b=[],c=Z.find(".field.forceType"),d=Z.find(".field.prioritize_type"),f;for(f in a.source){var e=a.source[f],g=UI.humanMime(e.type);b.push({label:g?g+" <span class=description>("+e.type+")</span>":UI.format.capital(e.type),type:"str",
|
||||
value:e.url,readonly:true,qrcode:true,clipboard:true});g=UI.humanMime(e.type);if(c.children('option[value="'+e.type+'"]').length==0){c.append($("<option>").text(g?g+" ("+e.type+")":UI.format.capital(e.type)).val(e.type));d.append($("<option>").text(g?g+" ("+e.type+")":UI.format.capital(e.type)).val(e.type))}}c.val(n.forceType);d.val(n.prioritize_type);wa.html(UI.buildUI(b));U.html("");b={};for(f in a.meta.tracks){c=a.meta.tracks[f];if(c.codec=="subtitle")c.type="subtitle";if(!(c.type!="audio"&&c.type!=
|
||||
"video"&&c.type!="subtitle")){c.type in b||(b[c.type]=c.type=="subtitle"?[]:[["","Autoselect "+c.type]]);b[c.type].push([c.trackid,UI.format.capital(c.type)+" track "+(b[c.type].length+(c.type=="subtitle"?1:0))])}}if(Object.keys(b).length){U.closest("label").show();var a=["audio","video","subtitle"],h;for(h in a){f=a[h];if(b[f]&&b[f].length){c=$("<select>").attr("data-type",f).css("flex-grow","1").change(function(){$(this).val()==""?delete n.setTracks[$(this).attr("data-type")]:n.setTracks[$(this).attr("data-type")]=
|
||||
$(this).val();$(".embed_code").setval(A(n))});U.append(c);f=="subtitle"?b[f].unshift(["","No "+f]):b[f].push([-1,"No "+f]);for(var j in b[f])c.append($("<option>").val(b[f][j][0]).text(b[f][j][1]));if(f in n.setTracks){c.val(n.setTracks[f]);if(c.val()==null){c.val("");delete n.setTracks[f];$(".embed_code").setval(A(n))}}}}}else U.closest("label").hide();ba=true},error:function(){wa.html("Error while retrieving stream info.");U.closest("label").hide();n.setTracks={}}});var ja=document.createElement("script");
|
||||
ja.src=v.http+"player.js";document.head.appendChild(ja);ja.onload=function(){var a=Z.find(".field.forcePlayer"),b;for(b in mistplayers)a.append($("<option>").text(mistplayers[b].name).val(b));document.head.removeChild(this)};ja.onerror=function(){document.head.removeChild(this)};break;case "Push":var L=$("<div>").text("Loading..");c.append(L);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,
|
||||
e;for(e in c.push_list)if(a.indexOf(c.push_list[e][0])>-1){d=false;break}}else d=true;if(d)for(e in a)f.find("tr[data-pushid="+a[e]+"]").remove();else b()},{push_list:1})},1E3)}function c(e,g){var h=$("<span>"),j=$("<span>");if(g=="Automatic"&&e.length>=4){var k=function(a,b,c){a=""+("$"+a+" ");switch(Number(b)){case 0:a=a+"is true";break;case 1:a=a+"is false";break;case 2:a=a+("== "+c);break;case 3:a=a+("!= "+c);break;case 10:a=a+("> (numerical) "+c);break;case 11:a=a+(">= (numerical) "+c);break;
|
||||
case 12:a=a+("< (numerical) "+c);break;case 13:a=a+("<= (numerical) "+c);break;case 20:a=a+("> (lexical) "+c);break;case 21:a=a+(">= (lexical) "+c);break;case 22:a=a+("< (lexical) "+c);break;case 23:a=a+("<= (lexical) "+c);break;default:a=a+"comparison operator unknown"}return a};h.append($("<span>").text(e[2]));e[3]&&h.append($("<span>").text(", schedule on "+(new Date(e[3]*1E3)).toLocaleString()));e.length>=5&&e[4]&&h.append($("<span>").text(", complete on "+(new Date(e[4]*1E3)).toLocaleString()));
|
||||
e.length>=8&&e[5]&&h.append($("<span>").text(", starts if "+k(e[5],e[6],e[7])));e.length>=11&&e[8]&&h.append($("<span>").text(", stops if "+k(e[8],e[9],e[10])))}else e.length>=4&&e[2]!=e[3]?h.append($("<span>").text(e[2])).append($("<span>").html("»").addClass("unit").css("margin","0 0.5em")).append($("<span>").text(e[3])):h.append($("<span>").text(e[2]));k=$("<td>").append($("<button>").text(g=="Automatic"?"Remove":"Stop").click(function(){if(confirm("Are you sure you want to "+$(this).text().toLowerCase()+
|
||||
" this push?\n"+e[1]+" to "+e[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=e.slice(1);mist.send(function(){a.remove()},{push_auto_remove:[c]})}else mist.send(function(){b([e[0]])},{push_stop:[e[0]]})}}));if(g=="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"'+
|
||||
e[1]+" to "+e[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(e[1]==a.push_list[h][1]&&e[2]==a.push_list[h][2]){g.push(a.push_list[h][0]);f.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}})}}))}else{if(e.length>=6){var l=
|
||||
e[5];j.append($("<div>").append("Active for: "+UI.format.duration(l.active_seconds))).append($("<div>").append("Data transfered: "+UI.format.bytes(l.bytes))).append($("<div>").append("Media time transfered: "+UI.format.duration(l.mediatime*0.001)));"pkt_retrans_count"in l&&j.append($("<div>").append("Packets retransmitted: "+UI.format.number(l.pkt_retrans_count||0)));"pkt_loss_count"in l&&j.append($("<div>").append("Packets lost: "+UI.format.number(l.pkt_loss_count||0)+" ("+UI.format.addUnit(UI.format.number(l.pkt_loss_perc||
|
||||
0),"%")+" over the last "+UI.format.addUnit(5,"s")+")"))}if(e.length>=5)for(var i in e[4]){l=e[4][i];j.append($("<div>").append(UI.format.time(l[0])+" ["+l[1]+"] "+l[2]))}}return $("<tr>").css("vertical-align","top").attr("data-pushid",e[0]).append($("<td>").text(e[1])).append($("<td>").append(h.children())).append($("<td>").addClass("logs").append(j.children())).append(k)}M.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 f=$("<table>").append($("<tr>").append($("<th>").text("Stream")).append($("<th>").text("Target")).append($("<th>")).append($("<th>"))),e=f.clone();if("push_list"in a)for(var g in a.push_list)f.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);e.append(c(h,"Automatic"))}M.append($("<h3>").text("Automatic push settings")).append(UI.buildUI([{label:"Delay before retry",unit:"s",type:"int",
|
||||
0),"%")+" over the last "+UI.format.addUnit(5,"s")+")"))}if(e.length>=5)for(var i in e[4]){l=e[4][i];j.append($("<div>").append(UI.format.time(l[0])+" ["+l[1]+"] "+l[2]))}}return $("<tr>").css("vertical-align","top").attr("data-pushid",e[0]).append($("<td>").text(e[1])).append($("<td>").append(h.children())).append($("<td>").addClass("logs").append(j.children())).append(k)}L.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 f=$("<table>").append($("<tr>").append($("<th>").text("Stream")).append($("<th>").text("Target")).append($("<th>")).append($("<th>"))),e=f.clone();if("push_list"in a)for(var g in a.push_list)f.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);e.append(c(h,"Automatic"))}L.append($("<h3>").text("Automatic push settings")).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":3,pointer:{main:d,index:"wait"}},{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"}},{type:"buttons",buttons:[{type:"save",label:"Save","function":function(){mist.send(function(){UI.navto("Push")},{push_settings:d})}}]}])).append($("<h3>").text("Automatic push settings")).append($("<button>").text("Add an automatic push").click(function(){UI.navto("Start Push",
|
||||
"auto")}));e.find("tr").length==1?M.append($("<div>").text("No automatic pushes have been configured.").addClass("text").css("margin-top","0.5em")):M.append(e);M.append($("<h3>").text("Pushes")).append($("<button>").text("Start a push").click(function(){UI.navto("Start Push")}));if(f.find("tr").length==1)M.append($("<div>").text("No pushes are active.").addClass("text").css("margin-top","0.5em"));else{var e=[],h=[],j=$("<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(g in a.push_list){e.indexOf(a.push_list[g][1])==-1&&e.push(a.push_list[g][1]);h.indexOf(a.push_list[g][2])==-1&&h.push(a.push_list[g][2])}e.sort();h.sort();for(g in e)j.append($("<option>").text(e[g]));for(g in h)k.append($("<option>").text(h[g]));M.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)},
|
||||
"auto")}));e.find("tr").length==1?L.append($("<div>").text("No automatic pushes have been configured.").addClass("text").css("margin-top","0.5em")):L.append(e);L.append($("<h3>").text("Pushes")).append($("<button>").text("Start a push").click(function(){UI.navto("Start Push")}));if(f.find("tr").length==1)L.append($("<div>").text("No pushes are active.").addClass("text").css("margin-top","0.5em"));else{var e=[],h=[],j=$("<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(g in a.push_list){e.indexOf(a.push_list[g][1])==-1&&e.push(a.push_list[g][1]);h.indexOf(a.push_list[g][2])==-1&&h.push(a.push_list[g][2])}e.sort();h.sort();for(g in e)j.append($("<option>").text(e[g]));for(g in h)k.append($("<option>").text(h[g]));L.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});f.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(j).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=j.val(),d=k.val();if(c==""&&d=="")return alert("Looks like you want to stop all pushes. Maybe you should use that button?");
|
||||
var e={},g;for(g in a.push_list)if((c==""||a.push_list[g][1]==c)&&(d==""||a.push_list[g][2]==d))e[a.push_list[g][0]]=a.push_list[g];if(Object.keys(e).length==0)return alert("No matching pushes.");c="Are you sure you want to stop these pushes?\n\n";for(g in e)c=c+(e[g][1]+" to "+e[g][2]+"\n");if(confirm(c)){e=Object.keys(e);mist.send(function(){b(e)},{push_stop:e});for(g in e)f.find("tr[data-pushid="+e[g]+"]").html($("<td colspan=99>").html($("<span>").addClass("red").text("Stopping..")))}}))).append(f)}UI.interval.set(function(){mist.send(function(a){var b=
|
||||
f.find("tr").first();f.empty();f.append(b);for(var d in a.push_list)f.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)||!("variable_list"in mist.data)||!("external_writer_list"in mist.data)){c.append("Loading Mist capabilities..");mist.send(function(){UI.navto("Start Push",b)},{capabilities:1,variable_list:!0,external_writer_list:!0});return}var y,ka=function(a){var d=false,e=b.split("_");b=e[0];
|
||||
|
@ -254,10 +255,10 @@ classes:["red"]}:false}]},{label:"Axis type",type:"select",select:[["time","Time
|
|||
'"]: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"],["perc_lost","Lost packages"],["perc_retrans","Re-transmitted packages"]],pointer:{main:p,index:"datatype"},classes:["graph_datatype"],"function":function(){$s=H.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:",da],["protocol","The protocol:",Ba]],pointer:{main:p,index:"origin"},value:["total"],classes:["graph_origin"]},{type:"buttons",buttons:[{label:"Add data set",type:"save","function":function(){var a;if(p.graph=="new"){a=UI.plot.addGraph(p,b);B[a.id]=a;H.find("input.graph_id").val("");
|
||||
H.find("select.graph_ids").append($("<option>").text(a.id)).val(a.id).trigger("change")}else a=B[p.graph];var c=UI.plot.datatype.getOptions({datatype:p.datatype,origin:p.origin});a.datasets.push(c);UI.plot.save(a);UI.plot.go(B)}}]}]));var b=$("<div>").addClass("graph_container");c.append(b);var d=H.find("select.graph_ids");for(a in B){var e=UI.plot.addGraph(B[a],b);d.append($("<option>").text(e.id)).val(e.id);var f=[],g;for(g in B[a].datasets){var h=UI.plot.datatype.getOptions({datatype:B[a].datasets[g].datatype,
|
||||
origin:B[a].datasets[g].origin});f.push(h)}e.datasets=f;B[e.id]=e}d.trigger("change");UI.plot.go(B);UI.interval.set(function(){UI.plot.go(B)},1E4)},{active_streams:!0,capabilities:!0});break;case "Server Stats":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a)},{capabilities:!0});c.append("Loading..");return}var Ca=$("<table>"),N=$("<table>"),hb={vheader:"CPUs",labels:["Model","Processor speed","Amount of cores","Amount of threads"],content:[]};for(q in mist.data.capabilities.cpu){var la=
|
||||
origin:B[a].datasets[g].origin});f.push(h)}e.datasets=f;B[e.id]=e}d.trigger("change");UI.plot.go(B);UI.interval.set(function(){UI.plot.go(B)},1E4)},{active_streams:!0,capabilities:!0});break;case "Server Stats":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a)},{capabilities:!0});c.append("Loading..");return}var Ca=$("<table>"),O=$("<table>"),hb={vheader:"CPUs",labels:["Model","Processor speed","Amount of cores","Amount of threads"],content:[]};for(q in mist.data.capabilities.cpu){var la=
|
||||
mist.data.capabilities.cpu[q];hb.content.push({header:"CPU #"+(Number(q)+1),body:[la.model,UI.format.addUnit(UI.format.number(la.mhz),"MHz"),la.cores,la.threads]})}var lb=UI.buildVheaderTable(hb),ib=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);Ca.replaceWith(a);Ca=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/
|
||||
100),UI.format.number(b.fifteen/100)]}]};b=UI.buildVheaderTable(b);N.replaceWith(b);N=b};ib();c.append(UI.buildUI([{type:"help",help:"You can find general server statistics here. Note that memory and CPU usage is for your entire machine, not just MistServer."}])).append($("<table>").css("width","auto").addClass("nolay").append($("<tr>").append($("<td>").append(Ca)).append($("<td>").append(N))).append($("<tr>").append($("<td>").append(lb).attr("colspan",2))));UI.interval.set(function(){mist.send(function(){ib()},
|
||||
100),UI.format.number(b.fifteen/100)]}]};b=UI.buildVheaderTable(b);O.replaceWith(b);O=b};ib();c.append(UI.buildUI([{type:"help",help:"You can find general server statistics here. Note that memory and CPU usage is for your entire machine, not just MistServer."}])).append($("<table>").css("width","auto").addClass("nolay").append($("<tr>").append($("<td>").append(Ca)).append($("<td>").append(O))).append($("<tr>").append($("<td>").append(lb).attr("colspan",2))));UI.interval.set(function(){mist.send(function(){ib()},
|
||||
{capabilities:true})},3E4);break;case "Email for Help":var I=$.extend({},mist.data);delete I.statistics;delete I.totals;delete I.clients;delete I.capabilities;I=JSON.stringify(I);I="Version: "+mist.data.config.version+"\n\nConfig:\n"+I;p={};c.append(UI.buildUI([{type:"help",help:"You can use this form to email MistServer support if you're having difficulties.<br>A copy of your server config file will automatically be included."},{type:"str",label:"Your name",validate:["required"],pointer:{main:p,
|
||||
index:"name"},value:mist.user.name},{type:"email",label:"Your email address",validate:["required"],pointer:{main:p,index:"email"}},{type:"hidden",value:"Integrated Help",pointer:{main:p,index:"subject"}},{type:"hidden",value:"-",pointer:{main:p,index:"company"}},{type:"textarea",rows:20,label:"Your message",validate:["required"],pointer:{main:p,index:"message"}},{type:"textarea",rows:20,label:"Your config file",readonly:!0,value:I,pointer:{main:p,index:"configfile"}},{type:"buttons",buttons:[{type:"save",
|
||||
label:"Send","function":function(a){$(a).text("Sending..");$.ajax({type:"POST",url:"https://mistserver.org/contact?skin=plain",data:p,success:function(a){a=$("<span>").html(a);a.find("script").remove();c.html(a[0].innerHTML)}})}}]}]));break;case "Disconnect":mist.user.password="";delete mist.user.authstring;delete mist.user.loggedin;sessionStorage.removeItem("mistLogin");UI.navto("Login");break;default:c.append($("<p>").text("This tab does not exist."))}c.find(".field").filter(function(){var a=$(this).getval();
|
||||
|
|
62
lsp/mist.js
62
lsp/mist.js
|
@ -2758,7 +2758,8 @@ var UI = {
|
|||
debug: mist.data.config.debug,
|
||||
accesslog: mist.data.config.accesslog,
|
||||
prometheus: mist.data.config.prometheus,
|
||||
defaultStream: mist.data.config.defaultStream
|
||||
defaultStream: mist.data.config.defaultStream,
|
||||
trustedproxy: mist.data.config.trustedproxy
|
||||
};
|
||||
var s_sessions = {
|
||||
sessionViewerMode: mist.data.config.sessionViewerMode,
|
||||
|
@ -2766,8 +2767,7 @@ var UI = {
|
|||
sessionOutputMode: mist.data.config.sessionOutputMode,
|
||||
sessionUnspecifiedMode: mist.data.config.sessionUnspecifiedMode,
|
||||
tknMode: mist.data.config.tknMode,
|
||||
sessionStreamInfoMode: mist.data.config.sessionStreamInfoMode,
|
||||
trustedproxy: mist.data.config.trustedproxy
|
||||
sessionStreamInfoMode: mist.data.config.sessionStreamInfoMode
|
||||
};
|
||||
var s_balancer = {
|
||||
location: "location" in mist.data.config ? mist.data.config.location : {}
|
||||
|
@ -2852,7 +2852,7 @@ var UI = {
|
|||
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.",
|
||||
pointer: {
|
||||
main: s,
|
||||
main: s_general,
|
||||
index: "trustedproxy"
|
||||
}
|
||||
},{
|
||||
|
@ -2865,10 +2865,27 @@ var UI = {
|
|||
},
|
||||
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: true
|
||||
},
|
||||
},{
|
||||
type: 'buttons',
|
||||
buttons: [{
|
||||
type: 'save',
|
||||
label: 'Save',
|
||||
'function': function(ele){
|
||||
$(ele).text("Saving..");
|
||||
|
||||
var save = {config: s_general};
|
||||
|
||||
mist.send(function(){
|
||||
UI.navto('General');
|
||||
},save)
|
||||
}
|
||||
}]
|
||||
}
|
||||
]));
|
||||
|
||||
|
||||
|
||||
$main.append(UI.buildUI([
|
||||
$("<h3>").text("Sessions"),
|
||||
{
|
||||
type: 'bitmask',
|
||||
|
@ -2954,15 +2971,6 @@ var UI = {
|
|||
index: "tknMode"
|
||||
},
|
||||
help: "Change the way the session token gets passed to and from MistServer, which can be set as a cookie or URL parameter named `tkn`. Reading the session token as a URL parameter takes precedence over reading from the cookie.<br>Default: all"
|
||||
},{
|
||||
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: true,
|
||||
pointer: {
|
||||
main: s_sessions,
|
||||
index: "trustedproxy"
|
||||
}
|
||||
},{
|
||||
type: 'buttons',
|
||||
buttons: [{
|
||||
|
@ -3269,7 +3277,31 @@ var UI = {
|
|||
type: "inputlist",
|
||||
label: "URI protocols handled",
|
||||
help: "URI protocols which the external writer will be handling.",
|
||||
validate: ['required'],
|
||||
validate: ['required',function(val){
|
||||
for (var i in val) {
|
||||
var v = val[i];
|
||||
if (v.match(/^([a-z\d\+\-\.])+?$/) === null) {
|
||||
return {
|
||||
classes: ["red"],
|
||||
msg: "There was a problem with the protocol URI '"+function(s){ return $("<div>").text(s).html() }(v)+"':<br>A protocol URI may only contain lower case letters, digits, and the following special characters . + and -"
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}],
|
||||
input: {
|
||||
type: "str",
|
||||
unit: "://",
|
||||
validate: [function(v){//cijfers lowercase letters az + - .
|
||||
if (v.indexOf("://") != -1) {
|
||||
return {
|
||||
classes: ["red"],
|
||||
msg: "Don't include '://' here.",
|
||||
"break": true
|
||||
};
|
||||
}
|
||||
}]
|
||||
},
|
||||
pointer: {
|
||||
main: saveas,
|
||||
index: "protocols"
|
||||
|
|
Loading…
Add table
Reference in a new issue