1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-480a0d56"],{"0cb2":function(t,e,n){var i=n("7b0b"),s=Math.floor,r="".replace,a=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,c=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,n,o,l,f){var u=n+t.length,p=o.length,d=c;return void 0!==l&&(l=i(l),d=a),r.call(f,d,(function(i,r){var a;switch(r.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,n);case"'":return e.slice(u);case"<":a=l[r.slice(1,-1)];break;default:var c=+r;if(0===c)return i;if(c>p){var f=s(c/10);return 0===f?i:f<=p?void 0===o[f-1]?r.charAt(1):o[f-1]+r.charAt(1):i}a=o[c-1]}return void 0===a?"":a}))}},"415d":function(t,e,n){"use strict";n("8f0f")},"466d":function(t,e,n){"use strict";var i=n("d784"),s=n("825a"),r=n("50c4"),a=n("1d80"),c=n("8aa5"),o=n("14c3");i("match",1,(function(t,e,n){return[function(e){var n=a(this),i=void 0==e?void 0:e[t];return void 0!==i?i.call(e,n):new RegExp(e)[t](String(n))},function(t){var i=n(e,t,this);if(i.done)return i.value;var a=s(t),l=String(this);if(!a.global)return o(a,l);var f=a.unicode;a.lastIndex=0;var u,p=[],d=0;while(null!==(u=o(a,l))){var h=String(u[0]);p[d]=h,""===h&&(a.lastIndex=c(l,r(a.lastIndex),f)),d++}return 0===d?null:p}]}))},"498a":function(t,e,n){"use strict";var i=n("23e7"),s=n("58a8").trim,r=n("c8d2");i({target:"String",proto:!0,forced:r("trim")},{trim:function(){return s(this)}})},"4d63":function(t,e,n){var i=n("83ab"),s=n("da84"),r=n("94ca"),a=n("7156"),c=n("9bf2").f,o=n("241c").f,l=n("44e7"),f=n("ad6d"),u=n("9f7f"),p=n("6eeb"),d=n("d039"),h=n("69f3").set,_=n("2626"),g=n("b622"),m=g("match"),v=s.RegExp,x=v.prototype,b=/a/g,y=/a/g,k=new v(b)!==b,w=u.UNSUPPORTED_Y,S=i&&r("RegExp",!k||w||d((function(){return y[m]=!1,v(b)!=b||v(y)==y||"/a/i"!=v(b,"i")})));if(S){var $=function(t,e){var n,i=this instanceof $,s=l(t),r=void 0===e;if(!i&&s&&t.constructor===$&&r)return t;k?s&&!r&&(t=t.source):t instanceof $&&(r&&(e=f.call(t)),t=t.source),w&&(n=!!e&&e.indexOf("y")>-1,n&&(e=e.replace(/y/g,"")));var c=a(k?new v(t,e):v(t,e),i?this:x,$);return w&&n&&h(c,{sticky:n}),c},E=function(t){t in $||c($,t,{configurable:!0,get:function(){return v[t]},set:function(e){v[t]=e}})},I=o(v),T=0;while(I.length>T)E(I[T++]);x.constructor=$,$.prototype=x,p(s,"RegExp",$)}_("RegExp")},5319:function(t,e,n){"use strict";var i=n("d784"),s=n("825a"),r=n("50c4"),a=n("a691"),c=n("1d80"),o=n("8aa5"),l=n("0cb2"),f=n("14c3"),u=Math.max,p=Math.min,d=function(t){return void 0===t?t:String(t)};i("replace",2,(function(t,e,n,i){var h=i.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,_=i.REPLACE_KEEPS_$0,g=h?"$":"$0";return[function(n,i){var s=c(this),r=void 0==n?void 0:n[t];return void 0!==r?r.call(n,s,i):e.call(String(s),n,i)},function(t,i){if(!h&&_||"string"===typeof i&&-1===i.indexOf(g)){var c=n(e,t,this,i);if(c.done)return c.value}var m=s(t),v=String(this),x="function"===typeof i;x||(i=String(i));var b=m.global;if(b){var y=m.unicode;m.lastIndex=0}var k=[];while(1){var w=f(m,v);if(null===w)break;if(k.push(w),!b)break;var S=String(w[0]);""===S&&(m.lastIndex=o(v,r(m.lastIndex),y))}for(var $="",E=0,I=0;I<k.length;I++){w=k[I];for(var T=String(w[0]),R=u(p(a(w.index),v.length),0),M=[],D=1;D<w.length;D++)M.push(d(w[D]));var O=w.groups;if(x){var Y=[T].concat(M,R,v);void 0!==O&&Y.push(O);var L=String(i.apply(void 0,Y))}else L=l(T,v,R,M,O,i);R>=E&&($+=v.slice(E,R)+L,E=R+T.length)}return $+v.slice(E)}]}))},7795:function(t,e,n){var i=n("24fb");e=i(!1),e.push([t.i,".ant-collapse{margin:10px}.ant-collapse-content-box{padding:24px!important}",""]),t.exports=e},"857d":function(t,e,n){var i=n("93c4");i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);var s=n("499e").default;s("2840a49a",i,!0,{sourceMap:!1,shadowMode:!1})},"8f0f":function(t,e,n){var i=n("7795");i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);var s=n("499e").default;s("521f5e89",i,!0,{sourceMap:!1,shadowMode:!1})},"93c4":function(t,e,n){var i=n("24fb");e=i(!1),e.push([t.i,".ant-card[data-v-323ce302]{margin:10px}@media (max-width:512px){.ant-card[data-v-323ce302]{margin:10px 0}}",""]),t.exports=e},acb5:function(t,e,n){"use strict";n("857d")},c8d2:function(t,e,n){var i=n("d039"),s=n("5899"),r="
";t.exports=function(t){return i((function(){return!!s[t]()||r[t]()!=r||s[t].name!==t}))}},fd48:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("a-collapse",{attrs:{bordered:!1,"default-active-key":"1"}},[n("a-collapse-panel",{key:"1",attrs:{header:t.name?"编辑站点:"+t.name:"添加站点"}},[n("p",[t._v("您的配置文件中应当有对应的字段时,下列表单中的设置才能生效,配置文件名称创建后不可修改。")]),n("std-data-entry",{attrs:{"data-list":t.columns},on:{change_support_ssl:t.change_support_ssl},model:{value:t.config,callback:function(e){t.config=e},expression:"config"}}),t.name?n("cert-info",{ref:"cert-info",attrs:{domain:t.name}}):t._e(),n("br"),n("a-space",[n("a-button",{attrs:{type:"primary",ghost:""},on:{click:t.issue_cert}},[t._v(" 自动申请 Let's Encrypt 证书 ")])],1)],1)],1),n("a-card",{attrs:{title:"配置文件编辑"}},[n("vue-itextarea",{model:{value:t.configText,callback:function(e){t.configText=e},expression:"configText"}})],1),n("footer-tool-bar",[n("a-space",[n("a-button",{on:{click:function(e){return t.$router.go(-1)}}},[t._v("返回")]),n("a-button",{attrs:{type:"primary"},on:{click:t.save}},[t._v("保存")])],1)],1)],1)},s=[],r=n("1da1"),a=(n("96cf"),n("b0c0"),n("466d"),n("ac1f"),n("498a"),n("5319"),n("4d63"),n("25f0"),n("cb07")),c=n("9c70"),o=n("a002"),l=[{title:"配置文件名称",dataIndex:"name",edit:{type:"input"}},{title:"网站域名 (server_name)",dataIndex:"server_name",edit:{type:"input"}},{title:"网站根目录 (root)",dataIndex:"root",edit:{type:"input"}},{title:"网站首页 (index)",dataIndex:"index",edit:{type:"input"}},{title:"http 监听端口",dataIndex:"http_listen_port",edit:{type:"number",min:80}},{title:"支持 SSL",dataIndex:"support_ssl",edit:{type:"switch",event:"change_support_ssl"}},{title:"https 监听端口",dataIndex:"https_listen_port",edit:{type:"number",min:443}},{title:"SSL 证书路径 (ssl_certificate)",dataIndex:"ssl_certificate",edit:{type:"input"}},{title:"SSL 证书私钥路径 (ssl_certificate_key)",dataIndex:"ssl_certificate_key",edit:{type:"input"}}],f=l,u=function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.ok?n("div",[n("h3",[t._v("证书状态")]),n("p",[t._v("中级证书颁发机构:"+t._s(t.cert.issuer_name))]),n("p",[t._v("证书名称:"+t._s(t.cert.subject_name))]),n("p",[t._v("过期时间:"+t._s(t.moment(t.cert.not_after).format("YYYY-MM-DD HH:mm:ss")))]),n("p",[t._v("在此之前无效:"+t._s(t.moment(t.cert.not_before).format("YYYY-MM-DD HH:mm:ss")))]),(new Date).toISOString()<t.cert.not_before||(new Date).toISOString()>t.cert.not_after?[n("a-icon",{style:{color:"red"},attrs:{type:"close-circle"}}),t._v(" 此证书已过期 ")]:[n("a-icon",{style:{color:"green"},attrs:{type:"check-circle"}}),t._v(" 证书处在有效期内 ")]],2):t._e()},p=[],d=n("c1df"),h=n.n(d),_={name:"CertInfo",data:function(){return{ok:!1,cert:{},moment:h.a}},props:{domain:String},created:function(){this.get()},watch:{domain:function(){this.get()}},methods:{get:function(){var t=this;this.$api.domain.cert_info(this.domain).then((function(e){t.cert=e,t.ok=!0})).catch((function(){t.ok=!1}))}}},g=_,m=n("2877"),v=Object(m["a"])(g,u,p,!1,null,"70bbb47a",null),x=v.exports,b={name:"DomainEdit",components:{CertInfo:x,FooterToolBar:c["a"],StdDataEntry:a["a"],VueItextarea:o["a"]},data:function(){return{name:this.$route.params.name,columns:f,config:{http_listen_port:80,https_listen_port:null,server_name:"",index:"",root:"",ssl_certificate:"",ssl_certificate_key:"",support_ssl:!1},configText:"",ws:null}},watch:{$route:function(){this.init()},config:{handler:function(){this.unparse()},deep:!0}},created:function(){this.init()},destroyed:function(){null!==this.ws&&this.ws.close()},methods:{init:function(){var t=this;this.name?this.$api.domain.get(this.name).then((function(e){t.configText=e.config,t.parse(e)})).catch((function(e){console.log(e),t.$message.error("服务器错误")})):(this.config={http_listen_port:80,https_listen_port:null,server_name:"",index:"",root:"",ssl_certificate:"",ssl_certificate_key:"",support_ssl:!1},this.get_template())},parse:function(t){var e=t.config,n={http_listen_port:/listen[\s](.*);/i,https_listen_port:/listen[\s](.*) ssl/i,server_name:/server_name[\s](.*);/i,index:/index[\s](.*);/i,root:/root[\s](.*);/i,ssl_certificate:/ssl_certificate[\s](.*);/i,ssl_certificate_key:/ssl_certificate_key[\s](.*);/i};for(var i in this.config["name"]=t.name,n){var s=e.match(n[i]);null!==s&&(void 0!==s[1]?this.config[i]=s[1].trim():this.config[i]=s[0].trim())}this.config.https_listen_port&&(this.config.support_ssl=!0)},unparse:function(){var t=this.configText,e={server_name:/server_name[\s](.*);/gi,index:/index[\s](.*);/i,root:/root[\s](.*);/i,ssl_certificate:/ssl_certificate[\s](.*);/i,ssl_certificate_key:/ssl_certificate_key[\s](.*);/i};for(var n in t=t.replace(/listen[\s](.*);/i,"listen\t"+this.config["http_listen_port"]+";"),t=t.replace(/listen[\s](.*) ssl/i,"listen\t"+this.config["https_listen_port"]+" ssl"),t=t.replace(/listen(.*):(.*);/i,"listen\t[::]:"+this.config["http_listen_port"]+";"),t=t.replace(/listen(.*):(.*) ssl/i,"listen\t[::]:"+this.config["https_listen_port"]+" ssl"),e)t=t.replace(new RegExp(e[n]),n+"\t"+(void 0!==this.config[n]?this.config[n]:" ")+";");this.configText=t},get_template:function(){var t=this;return Object(r["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!t.config.support_ssl){e.next=5;break}return e.next=3,t.$api.domain.get_template("https-conf").then((function(e){t.configText=e.template}));case 3:e.next=7;break;case 5:return e.next=7,t.$api.domain.get_template("http-conf").then((function(e){t.configText=e.template}));case 7:return e.next=9,t.unparse();case 9:case"end":return e.stop()}}),e)})))()},change_support_ssl:function(){var t=this;this.$confirm({title:"您已修改 SSL 支持状态,是否需要更换配置文件模板?",content:"更换配置文件模板将会丢失自定义配置",onOk:function(){t.get_template()},onCancel:function(){}})},save:function(){var t=this;this.$api.domain.save(this.name?this.name:this.config.name,{content:this.configText}).then((function(e){t.parse(e),t.$message.success("保存成功"),t.$refs["cert-info"].get()})).catch((function(e){console.log(e),t.$message.error("保存错误"+e.message!==void 0?" "+e.message:null,10)}))},issue_cert:function(){var t=this;this.$message.info("请注意,当前配置中 server_name 必须为需要申请证书的域名,否则无法申请",15),this.$message.info("正在申请,请稍后",15),this.ws=new WebSocket(this.getWebSocketRoot()+"/cert/issue/"+this.config.server_name+"?token="+btoa(this.$store.state.user.token)),this.ws.onopen=function(){t.ws.send("go")},this.ws.onmessage=function(e){var n=JSON.parse(e.data);switch(n.status){case"success":t.$message.success(n.message,10);break;case"info":t.$message.info(n.message,10);break;case"error":t.$message.error(n.message,10);break}"success"===n.status&&void 0!==n.ssl_certificate&&void 0!==n.ssl_certificate_key&&(t.config.ssl_certificate=n.ssl_certificate,t.config.ssl_certificate_key=n.ssl_certificate_key)}}}},y=b,k=(n("415d"),n("acb5"),Object(m["a"])(y,i,s,!1,null,"323ce302",null));e["default"]=k.exports}}]);
|