(function(t){function e(e){for(var a,r,s=e[0],u=e[1],l=e[2],p=0,f=[];p> ~/.netrc 并且添加环境变量GOPRIVATE='+t._s(t.privateHost)+" ")]),n("FormItem",{attrs:{label:"插件配置信息"}},[n("i-input",{attrs:{type:"textarea",placeholder:"请输入toml格式"},model:{value:t.formPlugin.Config,callback:function(e){t.$set(t.formPlugin,"Config",e)},expression:"formPlugin.Config"}})],1)],1)],1),n("Modal",{model:{value:t.showBuiltinPlugin,callback:function(e){t.showBuiltinPlugin=e},expression:"showBuiltinPlugin"}},[n("List",t._l(t.builtinPlugins,(function(e,a){return n("ListItem",{key:a},[n("ListItemMeta",{attrs:{title:a,description:e}}),n("template",{slot:"action"},[n("li",{on:{click:function(n){return t.addBuiltin(a,e)}}},[n("Icon",{attrs:{type:"ios-add"}}),t._v(" 添加 ")],1)])],2)})),1)],1),n("CreateInstance",{attrs:{info:t.createInfo},model:{value:t.showCreate,callback:function(e){t.showCreate=e},expression:"showCreate"}})],1)},d=[],h=(n("99af"),n("a15b"),n("d81d"),n("07ac"),n("ac1f"),n("1276"),function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("Modal",t._g(t._b({attrs:{title:t.info.Path}},"Modal",t.$attrs,!1),t.$listeners),[n("Steps",{attrs:{current:t.currentStep,size:"small",status:t.status}},[n("Step",{attrs:{title:"解析请求"}}),n("Step",{attrs:{title:"创建目录"}}),n("Step",{attrs:{title:"写入文件"}}),n("Step",{attrs:{title:"执行go mod init"}}),n("Step",{attrs:{title:"执行go build"}}),n("Step",{attrs:{title:"启动实例"}}),n("Step",{attrs:{title:"完成"}})],1),n("div",[n("pre",[t._v(t._s(t.log))])]),n("div",{attrs:{slot:"footer"},slot:"footer"},[n("Checkbox",{model:{value:t.clearDir,callback:function(e){t.clearDir=e},expression:"clearDir"}},[t._v("安装前清空目录")]),n("Button",{attrs:{type:"primary",loading:"process"==t.status},on:{click:t.start}},[t._v("开始")])],1)],1)}),g=[],m=n("3835"),v=null,b={name:"CreateInstance",props:{info:Object},methods:{start:function(){var t=this;this.status="process",v=new EventSource("/instance/create?info="+JSON.stringify(this.info)+(this.clearDir?"&clear=true":"")),v.onopen=function(){return t.log=""},v.onmessage=function(e){t.log+=e.data+"\n","success"==e.data&&(t.status="finish",v.close())},v.addEventListener("exception",(function(e){t.log+=e.data+"\n",t.status="error",v.close()})),v.addEventListener("step",(function(e){var n=e.data.split(":"),a=Object(m["a"])(n,2),i=a[0],o=a[1];t.currentStep=0|i,t.log+=o+"\n"}))}},data:function(){return{clearDir:!0,currentStep:0,log:"",status:"wait"}}},P=b,w=Object(u["a"])(P,h,g,!1,null,"5e75e036",null),y=w.exports,_=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("List",{attrs:{border:""}},[t._l(t.instances,(function(e){return n("ListItem",{key:e.Name},[n("ListItemMeta",{attrs:{title:e.Name,description:e.Path}}),t.hasGateway(e)?[t._v(" "+t._s(e.Info)+" ")]:t._e(),n("template",{slot:"action"},[t.hasGateway(e)?n("li",{on:{click:function(n){t.window.open(t.gateWayHref(e),"_blank")}}},[n("Icon",{attrs:{type:"md-browsers"}}),t._v(" 管理界面 ")],1):t._e(),n("li",{on:{click:function(n){return t.restart(e)}}},[n("Icon",{attrs:{type:"ios-refresh"}}),t._v(" 重启 ")],1),n("li",{on:{click:function(n){return t.shutdown(e)}}},[n("Icon",{attrs:{type:"ios-power"}}),t._v(" 关闭 ")],1)])],2)})),n("Modal",{model:{value:t.showRestart,callback:function(e){t.showRestart=e},expression:"showRestart"}},[n("Checkbox",{model:{value:t.update,callback:function(e){t.update=e},expression:"update"}},[t._v("go get -u")]),n("Checkbox",{model:{value:t.build,callback:function(e){t.build=e},expression:"build"}},[t._v("go build")])],1)],2)},S=[],k=n("3f1c"),x=n.n(k),I={name:"InstanceList",data:function(){return{instances:{},showRestart:!1,update:!1,build:!1}},mounted:function(){var t=this;window.ajax.getJSON("/instance/list").then((function(e){var n=function(n){var a=e[n];a.Config=x.a.parse(a.Config),t.hasGateway(a)?window.ajax.getJSON("//"+t.gateWayHref(a)+"/api/sysInfo").then((function(t){a.Info="引擎版本:"+t.Version+"启动时间:"+t.StartTime})).catch((function(){a.Info="无法访问实例"})):a.Info="实例未配置网关插件"};for(var a in e)n(a);t.instances=e}))},methods:{hasGateway:function(t){return t.Config.Plugins.hasOwnProperty("GateWay")},gateWayHref:function(t){return location.hostname+":"+t.Config.Plugins.GateWay.split(":").pop()},restart:function(t){var e=this,n=this.$Message.loading({content:"restart "+t.Name+"...",duration:0}),a=t.Name;this.update&&(a+="&update=true"),this.build&&(a+="&build=true");var i=new EventSource("/instance/restart?instance="+a);i.onmessage=function(t){"success"==t.data?(e.$Message.success("重启成功!"),n()):e.$Message.info(t.data)},i.addEventListener("failed",(function(t){e.$Message.error(t.data),n()})),i.onerror=function(t){t&&e.$Message.error(t),n(),i.close()}},shutdown:function(t){var e=this;window.ajax.get("/instance/shutdown?instance="+t.Name).then((function(t){"success"==t?e.$Message.success("已关闭实例"):e.$Message.error(t)}))}}},C=I,j=Object(u["a"])(C,_,S,!1,null,"21d6dce2",null),O=j.exports,L={components:{CreateInstance:y,InstanceList:O},data:function(){return{instanceName:"",createStep:0,showCreate:!1,createInfo:null,createPath:"/opt/monibuca",plugins:{},showAddPlugin:!1,formPlugin:{},showBuiltinPlugin:!1,builtinPlugins:{Auth:"github.com/langhuihui/monibuca/plugins/auth",Cluster:"github.com/langhuihui/monibuca/plugins/cluster",GateWay:"github.com/langhuihui/monibuca/plugins/gateway",HDL:"github.com/langhuihui/monibuca/plugins/HDL",Jessica:"github.com/langhuihui/monibuca/plugins/jessica",QoS:"github.com/langhuihui/monibuca/plugins/QoS",RecordFlv:"github.com/langhuihui/monibuca/plugins/record",RTMP:"github.com/langhuihui/monibuca/plugins/rtmp"},defaultConfig:{Auth:'Key = "www.monibuca.com"',RecordFlv:'Path="./resource"',QoS:'Suffix = ["high","medium","low"]',Cluster:'Master = "localhost:2019"\nListenAddr = ":2019"',GateWay:'ListenAddr = ":8081"',RTMP:'ListenAddr = ":1935"',Jessica:'ListenAddr = ":8080"',HDL:'ListenAddr = ":2020"'}}},computed:{pluginStr:function(){return Object.values(this.plugins).map((function(t){return t.Path})).join("\n")},configStr:function(){return Object.values(this.plugins).map((function(t){return"[Plugins.".concat(t.Name,"]\n").concat(t.Config||"")})).join("\n")},privateHost:function(){return this.formPlugin.Path&&this.formPlugin.Path.split("/")[0]||"仓库域名"}},methods:{goUp:function(){var t=this.createPath.split("/");t.pop(),this.createPath=t.join("/")},createInstance:function(){this.showCreate=!0,this.createInfo={Name:this.instanceName||this.createPath.split("/").pop(),Path:this.createPath,Plugins:Object.values(this.plugins).map((function(t){return t.Path})),Config:this.configStr}},addPlugin:function(){this.plugins[this.formPlugin.Name]=this.formPlugin,this.formPlugin={}},removePlugin:function(t){delete this.plugins[t],this.$forceUpdate()},addBuiltin:function(t,e){this.formPlugin.Name=t,this.formPlugin.Path=e,this.formPlugin.Config=this.defaultConfig[t],this.showBuiltinPlugin=!1}}},M=L,N=(n("2285"),Object(u["a"])(M,f,d,!1,null,null,null)),$=N.exports;a["default"].use(p["a"]);var B=[{path:"/",name:"instances",component:$}],A=new p["a"]({mode:"history",base:"/",routes:B}),T=A,E=n("2f62");a["default"].use(E["a"]);var G=new E["a"].Store({state:{},mutations:{},actions:{},modules:{}}),H=n("f825"),R=n.n(H);n("f8ce");a["default"].use(R.a),a["default"].config.productionTip=!1,new a["default"]({router:T,store:G,render:function(t){return t(c)}}).$mount("#app")}}); //# sourceMappingURL=app.9b5890f5.js.map