chunk-b508de6a-legacy.b421b1eb.js 14 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-b508de6a"],{"0cb2":function(t,e,n){var i=n("7b0b"),r=Math.floor,a="".replace,s=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,c=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,n,o,u,f){var l=n+t.length,p=o.length,d=c;return void 0!==u&&(u=i(u),d=s),a.call(f,d,(function(i,a){var s;switch(a.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,n);case"'":return e.slice(l);case"<":s=u[a.slice(1,-1)];break;default:var c=+a;if(0===c)return i;if(c>p){var f=r(c/10);return 0===f?i:f<=p?void 0===o[f-1]?a.charAt(1):o[f-1]+a.charAt(1):i}s=o[c-1]}return void 0===s?"":s}))}},"0fc9":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},model:{value:t.config,callback:function(e){t.config=e},expression:"config"}}),t.config.support_ssl?[t.name?n("cert-info",{ref:"cert-info",attrs:{domain:t.name}}):t._e(),n("br"),n("a-button",{attrs:{type:"primary",ghost:""},on:{click:t.issue_cert}},[t._v(" 自动申请 Let's Encrypt 证书 ")]),n("p",[n("br"),t._v("点击自动申请证书将会从 Let's Encrypt 获得签发证书 在获取签发证书前,请确保配置文件中已为 "),n("code",[t._v("/.well-known")]),t._v(" 目录反向代理到后端的 "),n("code",[t._v("HTTPChallengePort (default:9180)")])])]:t._e()],2)],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.push("/domain/list")}}},[t._v("返回")]),n("a-button",{attrs:{type:"primary"},on:{click:t.save}},[t._v("保存")])],1)],1)],1)},r=[],a=n("2909"),s=n("1da1"),c=(n("96cf"),n("d3b7"),n("25f0"),n("b0c0"),n("466d"),n("ac1f"),n("498a"),n("99af"),n("cb07")),o=n("9c70"),u=n("a002"),f=n("f19a"),l=n("a1ab"),p=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()},d=[],_=n("c1df"),h=n.n(_),m={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,v=n("2877"),x=Object(v["a"])(g,p,d,!1,null,"5c657da0",null),b=x.exports,k={name:"DomainEdit",components:{CertInfo:b,FooterToolBar:o["a"],StdDataEntry:c["a"],VueItextarea:u["a"]},data:function(){return{name:this.$route.params.name.toString(),config:{http_listen_port:80,https_listen_port:null,server_name:"",index:"",root:"",ssl_certificate:"",ssl_certificate_key:"",support_ssl:!1,auto_cert:!1},configText:"",ws:null,ok:!1}},watch:{$route:function(){this.init()},config:{handler:function(){this.unparse()},deep:!0},"config.support_ssl":function(){this.ok&&this.change_support_ssl()},"config.auto_cert":function(){this.ok&&this.change_auto_cert()}},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.config.auto_cert=e.auto_cert,t.parse(e).then((function(){t.ok=!0}))})).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,auto_cert:!1},this.get_template())},parse:function(t){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function n(){var i,r,a,s;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:for(a in i=t.config,r={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},e.config["name"]=t.name,r)s=i.match(r[a]),null!==s&&(void 0!==s[1]?e.config[a]=s[1].trim():e.config[a]=s[0].trim());e.config.https_listen_port&&(e.config.support_ssl=!0);case 5:case"end":return n.stop()}}),n)})))()},unparse:function(){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.configText=Object(l["a"])(t.configText,t.config);case 1:case"end":return e.stop()}}),e)})))()},get_template:function(){var t=this;return Object(s["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,{content:this.configText}).then((function(e){t.parse(e),t.$message.success("保存成功"),t.name&&t.$refs["cert-info"]&&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,t.$refs["cert-info"]&&t.$refs["cert-info"].get())}},change_auto_cert:function(){var t=this;this.config.auto_cert?this.$api.domain.add_auto_cert(this.name).then((function(){t.$message.success(t.name+" 加入自动续签列表成功")})).catch((function(e){var n;t.$message.error(null!==(n=e.message)&&void 0!==n?n:t.name+" 加入自动续签列表失败")})):this.$api.domain.remove_auto_cert(this.name).then((function(){t.$message.success("从自动续签列表中删除 "+t.name+" 成功")})).catch((function(e){var n;t.$message.error(null!==(n=e.message)&&void 0!==n?n:"从自动续签列表中删除 "+t.name+" 失败")}))}},computed:{columns:{get:function(){return this.config.support_ssl?[].concat(Object(a["a"])(f["a"]),Object(a["a"])(f["b"])):Object(a["a"])(f["a"])}}}},y=k,w=(n("6216"),n("f47f"),Object(v["a"])(y,i,r,!1,null,"300e6f62",null));e["default"]=w.exports},"17ee":function(t,e,n){var i=n("4524");i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);var r=n("499e").default;r("7be18310",i,!0,{sourceMap:!1,shadowMode:!1})},"31fc":function(t,e,n){var i=n("a3dd");i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);var r=n("499e").default;r("4215a670",i,!0,{sourceMap:!1,shadowMode:!1})},4524:function(t,e,n){var i=n("24fb");e=i(!1),e.push([t.i,".ant-collapse{margin-bottom:20px}.ant-collapse .ant-collapse-item{border-bottom:unset}.ant-collapse-content-box{padding:24px!important}",""]),t.exports=e},"466d":function(t,e,n){"use strict";var i=n("d784"),r=n("825a"),a=n("50c4"),s=n("1d80"),c=n("8aa5"),o=n("14c3");i("match",1,(function(t,e,n){return[function(e){var n=s(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 s=r(t),u=String(this);if(!s.global)return o(s,u);var f=s.unicode;s.lastIndex=0;var l,p=[],d=0;while(null!==(l=o(s,u))){var _=String(l[0]);p[d]=_,""===_&&(s.lastIndex=c(u,a(s.lastIndex),f)),d++}return 0===d?null:p}]}))},"498a":function(t,e,n){"use strict";var i=n("23e7"),r=n("58a8").trim,a=n("c8d2");i({target:"String",proto:!0,forced:a("trim")},{trim:function(){return r(this)}})},"4d63":function(t,e,n){var i=n("83ab"),r=n("da84"),a=n("94ca"),s=n("7156"),c=n("9bf2").f,o=n("241c").f,u=n("44e7"),f=n("ad6d"),l=n("9f7f"),p=n("6eeb"),d=n("d039"),_=n("69f3").set,h=n("2626"),m=n("b622"),g=m("match"),v=r.RegExp,x=v.prototype,b=/a/g,k=/a/g,y=new v(b)!==b,w=l.UNSUPPORTED_Y,$=i&&a("RegExp",!y||w||d((function(){return k[g]=!1,v(b)!=b||v(k)==k||"/a/i"!=v(b,"i")})));if($){var S=function(t,e){var n,i=this instanceof S,r=u(t),a=void 0===e;if(!i&&r&&t.constructor===S&&a)return t;y?r&&!a&&(t=t.source):t instanceof S&&(a&&(e=f.call(t)),t=t.source),w&&(n=!!e&&e.indexOf("y")>-1,n&&(e=e.replace(/y/g,"")));var c=s(y?new v(t,e):v(t,e),i?this:x,S);return w&&n&&_(c,{sticky:n}),c},E=function(t){t in S||c(S,t,{configurable:!0,get:function(){return v[t]},set:function(e){v[t]=e}})},I=o(v),R=0;while(I.length>R)E(I[R++]);x.constructor=S,S.prototype=x,p(r,"RegExp",S)}h("RegExp")},5319:function(t,e,n){"use strict";var i=n("d784"),r=n("825a"),a=n("50c4"),s=n("a691"),c=n("1d80"),o=n("8aa5"),u=n("0cb2"),f=n("14c3"),l=Math.max,p=Math.min,d=function(t){return void 0===t?t:String(t)};i("replace",2,(function(t,e,n,i){var _=i.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,h=i.REPLACE_KEEPS_$0,m=_?"$":"$0";return[function(n,i){var r=c(this),a=void 0==n?void 0:n[t];return void 0!==a?a.call(n,r,i):e.call(String(r),n,i)},function(t,i){if(!_&&h||"string"===typeof i&&-1===i.indexOf(m)){var c=n(e,t,this,i);if(c.done)return c.value}var g=r(t),v=String(this),x="function"===typeof i;x||(i=String(i));var b=g.global;if(b){var k=g.unicode;g.lastIndex=0}var y=[];while(1){var w=f(g,v);if(null===w)break;if(y.push(w),!b)break;var $=String(w[0]);""===$&&(g.lastIndex=o(v,a(g.lastIndex),k))}for(var S="",E=0,I=0;I<y.length;I++){w=y[I];for(var R=String(w[0]),T=l(p(s(w.index),v.length),0),O=[],M=1;M<w.length;M++)O.push(d(w[M]));var D=w.groups;if(x){var j=[R].concat(O,T,v);void 0!==D&&j.push(D);var L=String(i.apply(void 0,j))}else L=u(R,v,T,O,D,i);T>=E&&(S+=v.slice(E,T)+L,E=T+R.length)}return S+v.slice(E)}]}))},6216:function(t,e,n){"use strict";n("17ee")},a1ab:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));n("5319"),n("ac1f"),n("4d63"),n("25f0");var i=function(t,e){var n={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 i in t=t.replace(/listen[\s](.*);/i,"listen\t"+e["http_listen_port"]+";"),t=t.replace(/listen[\s](.*) ssl/i,"listen\t"+e["https_listen_port"]+" ssl"),t=t.replace(/listen(.*):(.*);/i,"listen\t[::]:"+e["http_listen_port"]+";"),t=t.replace(/listen(.*):(.*) ssl/i,"listen\t[::]:"+e["https_listen_port"]+" ssl"),n)t=t.replace(new RegExp(n[i]),i+"\t"+(void 0!==e[i]?e[i]:" ")+";");return t}},a3dd:function(t,e,n){var i=n("24fb");e=i(!1),e.push([t.i,"@media (max-width:512px){.ant-card[data-v-300e6f62]{margin:10px 0}}",""]),t.exports=e},c8d2:function(t,e,n){var i=n("d039"),r=n("5899"),a="​…᠎";t.exports=function(t){return i((function(){return!!r[t]()||a[t]()!=a||r[t].name!==t}))}},f19a:function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return r}));var i=[{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"}}],r=[{title:"自动续签",dataIndex:"auto_cert",edit:{type:"switch",event:"change_auto_cert"},description:"启用自动续签后,系统将会每小时检测一次该域名证书的信息,如果距离上次签发已超过1个月,则将执行自动续签。<br/>启用前先点击下方「自动申请 Let's Encrypt 证书」即可获得证书路径。"},{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"}}]},f47f:function(t,e,n){"use strict";n("31fc")}}]);