diff --git a/web/public/js/components.js b/web/public/js/components.js index 3ee9069e..68fa7f61 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -312,7 +312,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
- 查看证书  |  查看任务» + 查看证书  |  查看任务»
@@ -1291,7 +1291,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio -`}),Vue.component("ssl-config-box",{props:["v-ssl-policy","v-protocol","v-server-id"],created:function(){let e=this;setTimeout(function(){e.sortableCipherSuites()},100)},data:function(){let e=this.vSslPolicy,t=(null==e?e={id:0,isOn:!0,certRefs:[],certs:[],clientCARefs:[],clientCACerts:[],clientAuthType:0,minVersion:"TLS 1.1",hsts:null,cipherSuitesIsOn:!1,cipherSuites:[],http2Enabled:!0,ocspIsOn:!1}:(null==e.certRefs&&(e.certRefs=[]),null==e.certs&&(e.certs=[]),null==e.clientCARefs&&(e.clientCARefs=[]),null==e.clientCACerts&&(e.clientCACerts=[]),null==e.cipherSuites&&(e.cipherSuites=[])),e.hsts),i="31536000";return null!=(t=null==t?{isOn:!1,maxAge:31536e3,includeSubDomains:!1,preload:!1,domains:[]}:t).maxAge&&(i=t.maxAge.toString()),{policy:e,hsts:t,hstsOptionsVisible:!1,hstsDomainAdding:!1,hstsMaxAgeString:i,addingHstsDomain:"",hstsDomainEditingIndex:-1,allVersions:window.SSL_ALL_VERSIONS,allCipherSuites:window.SSL_ALL_CIPHER_SUITES.$copy(),modernCipherSuites:window.SSL_MODERN_CIPHER_SUITES,intermediateCipherSuites:window.SSL_INTERMEDIATE_CIPHER_SUITES,allClientAuthTypes:window.SSL_ALL_CLIENT_AUTH_TYPES,cipherSuitesVisible:!1,moreOptionsVisible:!1}},watch:{hsts:{deep:!0,handler:function(){this.policy.hsts=this.hsts}}},methods:{removeCert:function(e){let t=this;teaweb.confirm("确定删除此证书吗?证书数据仍然保留,只是当前服务不再使用此证书。",function(){t.policy.certRefs.$remove(e),t.policy.certs.$remove(e)})},selectCert:function(){let t=this,i=[];null!=this.policy&&0$1')},addCipherSuite:function(e){this.policy.cipherSuites.$contains(e)||this.policy.cipherSuites.push(e),this.allCipherSuites.$removeValue(e)},removeCipherSuite:function(e){let i=this;teaweb.confirm("确定要删除此套件吗?",function(){i.policy.cipherSuites.$removeValue(e),i.allCipherSuites=window.SSL_ALL_CIPHER_SUITES.$findAll(function(e,t){return!i.policy.cipherSuites.$contains(t)})})},clearCipherSuites:function(){let e=this;teaweb.confirm("确定要清除所有已选套件吗?",function(){e.policy.cipherSuites=[],e.allCipherSuites=window.SSL_ALL_CIPHER_SUITES.$copy()})},addBatchCipherSuites:function(e){var i=this;teaweb.confirm("确定要批量添加套件?",function(){e.$each(function(e,t){i.policy.cipherSuites.$contains(t)||i.policy.cipherSuites.push(t)})})},sortableCipherSuites:function(){var e=document.querySelector(".cipher-suites-box");Sortable.create(e,{draggable:".label",handle:".icon.handle",onStart:function(){},onUpdate:function(e){}})},showAllCipherSuites:function(){this.cipherSuitesVisible=!this.cipherSuitesVisible},showMoreHSTS:function(){this.hstsOptionsVisible=!this.hstsOptionsVisible,this.hstsOptionsVisible&&this.changeHSTSMaxAge()},changeHSTSMaxAge:function(){var e=parseInt(this.hstsMaxAgeString);if(isNaN(e)||e<0)return this.hsts.maxAge=0,void(this.hsts.days="-");this.hsts.maxAge=e,this.hsts.days=e/86400,0==this.hsts.days&&(this.hsts.days="-")},setHSTSMaxAge:function(e){this.hstsMaxAgeString=e.toString(),this.changeHSTSMaxAge()},addHstsDomain:function(){this.hstsDomainAdding=!0,this.hstsDomainEditingIndex=-1;let e=this;setTimeout(function(){e.$refs.addingHstsDomain.focus()},100)},editHstsDomain:function(e){this.hstsDomainEditingIndex=e,this.addingHstsDomain=this.hsts.domains[e],this.hstsDomainAdding=!0;let t=this;setTimeout(function(){t.$refs.addingHstsDomain.focus()},100)},confirmAddHstsDomain:function(){this.addingHstsDomain=this.addingHstsDomain.trim(),0!=this.addingHstsDomain.length&&(-1 +`}),Vue.component("ssl-config-box",{props:["v-ssl-policy","v-protocol","v-server-id"],created:function(){let e=this;setTimeout(function(){e.sortableCipherSuites()},100)},data:function(){let e=this.vSslPolicy,t=(null==e?e={id:0,isOn:!0,certRefs:[],certs:[],clientCARefs:[],clientCACerts:[],clientAuthType:0,minVersion:"TLS 1.1",hsts:null,cipherSuitesIsOn:!1,cipherSuites:[],http2Enabled:!0,ocspIsOn:!1}:(null==e.certRefs&&(e.certRefs=[]),null==e.certs&&(e.certs=[]),null==e.clientCARefs&&(e.clientCARefs=[]),null==e.clientCACerts&&(e.clientCACerts=[]),null==e.cipherSuites&&(e.cipherSuites=[])),e.hsts),i="31536000";return null!=(t=null==t?{isOn:!1,maxAge:31536e3,includeSubDomains:!1,preload:!1,domains:[]}:t).maxAge&&(i=t.maxAge.toString()),{policy:e,hsts:t,hstsOptionsVisible:!1,hstsDomainAdding:!1,hstsMaxAgeString:i,addingHstsDomain:"",hstsDomainEditingIndex:-1,allVersions:window.SSL_ALL_VERSIONS,allCipherSuites:window.SSL_ALL_CIPHER_SUITES.$copy(),modernCipherSuites:window.SSL_MODERN_CIPHER_SUITES,intermediateCipherSuites:window.SSL_INTERMEDIATE_CIPHER_SUITES,allClientAuthTypes:window.SSL_ALL_CLIENT_AUTH_TYPES,cipherSuitesVisible:!1,moreOptionsVisible:!1}},watch:{hsts:{deep:!0,handler:function(){this.policy.hsts=this.hsts}}},methods:{removeCert:function(e){let t=this;teaweb.confirm("确定删除此证书吗?证书数据仍然保留,只是当前服务不再使用此证书。",function(){t.policy.certRefs.$remove(e),t.policy.certs.$remove(e)})},selectCert:function(){let t=this,i=[],e=(null!=this.policy&&0$1')},addCipherSuite:function(e){this.policy.cipherSuites.$contains(e)||this.policy.cipherSuites.push(e),this.allCipherSuites.$removeValue(e)},removeCipherSuite:function(e){let i=this;teaweb.confirm("确定要删除此套件吗?",function(){i.policy.cipherSuites.$removeValue(e),i.allCipherSuites=window.SSL_ALL_CIPHER_SUITES.$findAll(function(e,t){return!i.policy.cipherSuites.$contains(t)})})},clearCipherSuites:function(){let e=this;teaweb.confirm("确定要清除所有已选套件吗?",function(){e.policy.cipherSuites=[],e.allCipherSuites=window.SSL_ALL_CIPHER_SUITES.$copy()})},addBatchCipherSuites:function(e){var i=this;teaweb.confirm("确定要批量添加套件?",function(){e.$each(function(e,t){i.policy.cipherSuites.$contains(t)||i.policy.cipherSuites.push(t)})})},sortableCipherSuites:function(){var e=document.querySelector(".cipher-suites-box");Sortable.create(e,{draggable:".label",handle:".icon.handle",onStart:function(){},onUpdate:function(e){}})},showAllCipherSuites:function(){this.cipherSuitesVisible=!this.cipherSuitesVisible},showMoreHSTS:function(){this.hstsOptionsVisible=!this.hstsOptionsVisible,this.hstsOptionsVisible&&this.changeHSTSMaxAge()},changeHSTSMaxAge:function(){var e=parseInt(this.hstsMaxAgeString);if(isNaN(e)||e<0)return this.hsts.maxAge=0,void(this.hsts.days="-");this.hsts.maxAge=e,this.hsts.days=e/86400,0==this.hsts.days&&(this.hsts.days="-")},setHSTSMaxAge:function(e){this.hstsMaxAgeString=e.toString(),this.changeHSTSMaxAge()},addHstsDomain:function(){this.hstsDomainAdding=!0,this.hstsDomainEditingIndex=-1;let e=this;setTimeout(function(){e.$refs.addingHstsDomain.focus()},100)},editHstsDomain:function(e){this.hstsDomainEditingIndex=e,this.addingHstsDomain=this.hsts.domains[e],this.hstsDomainAdding=!0;let t=this;setTimeout(function(){t.$refs.addingHstsDomain.focus()},100)},confirmAddHstsDomain:function(){this.addingHstsDomain=this.addingHstsDomain.trim(),0!=this.addingHstsDomain.length&&(-1

SSL/TLS相关配置

@@ -1319,7 +1319,10 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
  + |     +   + |   @@ -1475,7 +1478,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
客户端认证CA证书
-
+
{{cert.name}} / {{cert.dnsNames}} / 有效至{{formatTime(cert.timeEndAt)}}  
@@ -1580,7 +1583,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
-`}),Vue.component("ssl-certs-box",{props:["v-certs","v-cert","v-protocol","v-view-size","v-single-mode","v-description"],data:function(){let e=this.vCerts,t=(null==e&&(e=[]),null!=this.vCert&&e.push(this.vCert),this.vDescription);return null!=t&&"string"==typeof t||(t=""),{certs:e,description:t}},methods:{certIds:function(){return this.certs.map(function(e){return e.id})},removeCert:function(e){let t=this;teaweb.confirm("确定删除此证书吗?证书数据仍然保留,只是当前服务不再使用此证书。",function(){t.certs.$remove(e)})},selectCert:function(){let t=this,e="50em",i="30em",n=this.vViewSize;"mini"==(n=null==n?"normal":n)&&(e="35em",i="20em"),teaweb.popup("/servers/certs/selectPopup?viewSize="+n,{width:e,height:i,callback:function(e){t.certs.push(e.data.cert)}})},uploadCert:function(){let t=this;teaweb.popup("/servers/certs/uploadPopup",{height:"28em",callback:function(e){teaweb.success("上传成功",function(){t.certs.push(e.data.cert)})}})},formatTime:function(e){return new Date(1e3*e).format("Y-m-d")},buttonsVisible:function(){return null==this.vSingleMode||!this.vSingleMode||null==this.certs||0==this.certs.length}},template:`
+
`}),Vue.component("ssl-certs-box",{props:["v-certs","v-cert","v-protocol","v-view-size","v-single-mode","v-description","v-domains","v-user-id"],data:function(){let e=this.vCerts,t=(null==e&&(e=[]),null!=this.vCert&&e.push(this.vCert),this.vDescription);return null!=t&&"string"==typeof t||(t=""),{certs:e,description:t}},methods:{certIds:function(){return this.certs.map(function(e){return e.id})},removeCert:function(e){let t=this;teaweb.confirm("确定删除此证书吗?证书数据仍然保留,只是当前服务不再使用此证书。",function(){t.certs.$remove(e)})},selectCert:function(){let t=this,e="54em",i="32em",n=this.vViewSize,s=("mini"==(n=null==n?"normal":n)&&(e="35em",i="20em"),[]);var o;null!=this.vDomains&&("function"==typeof this.vDomains?null!=(o=this.vDomains())&&"object"==typeof o&&o instanceof Array&&(s=o):"object"==typeof this.vDomains&&this.vDomains instanceof Array&&(s=this.vDomains),1e4
@@ -1595,7 +1598,9 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
  + |     +  
`}),Vue.component("http-host-redirect-box",{props:["v-redirects"],mounted:function(){let n=this;sortTable(function(e){let i=[];e.forEach(function(t){n.redirects.forEach(function(e){e.id==t&&i.push(e)})}),n.updateRedirects(i)})},data:function(){let e=this.vRedirects,t=(null==e&&(e=[]),0);return e.forEach(function(e){t++,e.id=t}),{redirects:e,statusOptions:[{code:301,text:"Moved Permanently"},{code:308,text:"Permanent Redirect"},{code:302,text:"Found"},{code:303,text:"See Other"},{code:307,text:"Temporary Redirect"}],id:t}},methods:{add:function(){let t=this;window.UPDATING_REDIRECT=null,teaweb.popup("/servers/server/settings/redirects/createPopup",{width:"50em",height:"30em",callback:function(e){t.id++,e.data.redirect.id=t.id,t.redirects.push(e.data.redirect),t.change()}})},update:function(t,i){let n=this;window.UPDATING_REDIRECT=i,teaweb.popup("/servers/server/settings/redirects/createPopup",{width:"50em",height:"30em",callback:function(e){e.data.redirect.id=i.id,Vue.set(n.redirects,t,e.data.redirect),n.change()}})},remove:function(e){let t=this;teaweb.confirm("确定要删除这条跳转规则吗?",function(){t.redirects.$remove(e),t.change()})},change:function(){let e=this;setTimeout(function(){e.$emit("change",e.redirects)},100)},updateRedirects:function(e){this.redirects=e,this.change()}},template:`
@@ -2416,7 +2421,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio

拖动左侧的图标可以对重写规则进行排序。

-
`}),Vue.component("http-rewrite-labels-label",{props:["v-class"],template:''}),Vue.component("server-name-box",{props:["v-server-names"],data:function(){let e=this.vServerNames;return{serverNames:e=null==e?[]:e,isSearching:!1,keyword:""}},methods:{addServerName:function(){window.UPDATING_SERVER_NAME=null;let t=this;teaweb.popup("/servers/addServerNamePopup",{callback:function(e){e=e.data.serverName;t.serverNames.push(e)}})},removeServerName:function(e){this.serverNames.$remove(e)},updateServerName:function(t,e){window.UPDATING_SERVER_NAME=teaweb.clone(e);let i=this;teaweb.popup("/servers/addServerNamePopup",{callback:function(e){e=e.data.serverName;Vue.set(i.serverNames,t,e)}})},showSearchBox:function(){if(this.isSearching=!this.isSearching,this.isSearching){let e=this;setTimeout(function(){e.$refs.keywordRef.focus()},200)}else this.keyword=""}},watch:{keyword:function(i){this.serverNames.forEach(function(e){if(0==i.length)e.isShowing=!0;else if(null==e.subNames||0==e.subNames.length)teaweb.match(e.name,i)||(e.isShowing=!1);else{let t=!1;e.subNames.forEach(function(e){teaweb.match(e,i)&&(t=!0)}),e.isShowing=t}})}},template:`
+
`}),Vue.component("http-rewrite-labels-label",{props:["v-class"],template:''}),Vue.component("server-name-box",{props:["v-server-names"],data:function(){let e=this.vServerNames;return{serverNames:e=null==e?[]:e,isSearching:!1,keyword:""}},methods:{addServerName:function(){window.UPDATING_SERVER_NAME=null;let t=this;teaweb.popup("/servers/addServerNamePopup",{callback:function(e){e=e.data.serverName;t.serverNames.push(e)}})},removeServerName:function(e){this.serverNames.$remove(e)},updateServerName:function(t,e){window.UPDATING_SERVER_NAME=teaweb.clone(e);let i=this;teaweb.popup("/servers/addServerNamePopup",{callback:function(e){e=e.data.serverName;Vue.set(i.serverNames,t,e)}})},showSearchBox:function(){if(this.isSearching=!this.isSearching,this.isSearching){let e=this;setTimeout(function(){e.$refs.keywordRef.focus()},200)}else this.keyword=""},allServerNames:function(){if(null==this.serverNames)return[];let t=[];return this.serverNames.forEach(function(e){null!=e.subNames&&0
@@ -3427,7 +3432,7 @@ example2.com 启用CC无感防护 -

启用后,自动检测并拦截CC攻击,此功能不需要开启WAF功能。

+

启用后,自动检测并拦截CC攻击。

@@ -5307,7 +5312,7 @@ example2.com `}),Vue.component("second-menu",{template:' \t\t
\t\t\t \t\t\t
\t\t
'}),Vue.component("loading-message",{template:`
  -
`}),Vue.component("file-textarea",{props:["value"],data:function(){let e=this.value;return{realValue:e="string"!=typeof e?"":e}},mounted:function(){},methods:{dragover:function(){},drop:function(e){let t=this;e.dataTransfer.items[0].getAsFile().text().then(function(e){t.setValue(e)})},setValue:function(e){this.realValue=e}},template:''}),Vue.component("more-options-angle",{data:function(){return{isVisible:!1}},methods:{show:function(){this.isVisible=!this.isVisible,this.$emit("change",this.isVisible)}},template:'更多选项收起选项'}),Vue.component("columns-grid",{props:[],mounted:function(){this.columns=this.calculateColumns();let e=this;window.addEventListener("resize",function(){e.columns=e.calculateColumns()})},data:function(){return{columns:"four"}},methods:{calculateColumns:function(){var e=window.innerWidth;let i=Math.floor(e/250);0==i&&(i=1);var n=this.$el.getElementsByClassName("column");if(0!=n.length){e=n.length;i>e&&(i=e);for(let t=0;t +
`}),Vue.component("file-textarea",{props:["value"],data:function(){let e=this.value;return{realValue:e="string"!=typeof e?"":e}},mounted:function(){},methods:{dragover:function(){},drop:function(e){let t=this;e.dataTransfer.items[0].getAsFile().text().then(function(e){t.setValue(e)})},setValue:function(e){this.realValue=e},focus:function(){this.$refs.textarea.focus()}},template:''}),Vue.component("more-options-angle",{data:function(){return{isVisible:!1}},methods:{show:function(){this.isVisible=!this.isVisible,this.$emit("change",this.isVisible)}},template:'更多选项收起选项'}),Vue.component("columns-grid",{props:[],mounted:function(){this.columns=this.calculateColumns();let e=this;window.addEventListener("resize",function(){e.columns=e.calculateColumns()})},data:function(){return{columns:"four"}},methods:{calculateColumns:function(){var e=window.innerWidth;let i=Math.floor(e/250);0==i&&(i=1);var n=this.$el.getElementsByClassName("column");if(0!=n.length){e=n.length;i>e&&(i=e);for(let t=0;t
`}),Vue.component("inner-menu-item",{props:["href","active","code"],data:function(){var e,t=this.active;return void 0===t&&(e="",t=(e=void 0!==window.TEA.ACTION.data.firstMenuItem?window.TEA.ACTION.data.firstMenuItem:e)==this.code),{vHref:null==this.href?"":this.href,vActive:t}},template:'\t\t[] \t\t'}),Vue.component("health-check-config-box",{props:["v-health-check-config","v-check-domain-url"],data:function(){let t=this.vHealthCheckConfig,i="http",n="",s="/",o="";if(null==t){t={isOn:!1,url:"",interval:{count:60,unit:"second"},statusCodes:[200],timeout:{count:10,unit:"second"},countTries:3,tryDelay:{count:100,unit:"ms"},autoDown:!0,countUp:1,countDown:3,userAgent:"",onlyBasicRequest:!0,accessLogIsOn:!0};let e=this;setTimeout(function(){e.changeURL()},500)}else{try{let e=new URL(t.url);i=e.protocol.substring(0,e.protocol.length-1);var a=(o="%24%7Bhost%7D"==(o=e.host)?"${host}":o).indexOf(":");0 @@ -5467,9 +5472,9 @@ example2.com
- {{title}}:{{selectedItem.name}} - - + {{title}}:{{selectedItem.name}} + +
diff --git a/web/public/js/components.src.js b/web/public/js/components.src.js index f3b69a38..6941accd 100755 --- a/web/public/js/components.src.js +++ b/web/public/js/components.src.js @@ -1139,7 +1139,7 @@ Vue.component("message-row", { @@ -3616,7 +3616,11 @@ Vue.component("http-request-conds-box", { }) Vue.component("ssl-config-box", { - props: ["v-ssl-policy", "v-protocol", "v-server-id"], + props: [ + "v-ssl-policy", + "v-protocol", + "v-server-id" + ], created: function () { let that = this setTimeout(function () { @@ -3724,12 +3728,23 @@ Vue.component("ssl-config-box", { selectedCertIds.push(cert.id.toString()) }) } - teaweb.popup("/servers/certs/selectPopup?selectedCertIds=" + selectedCertIds, { + let serverId = this.vServerId + if (serverId == null) { + serverId = 0 + } + teaweb.popup("/servers/certs/selectPopup?selectedCertIds=" + selectedCertIds + "&serverId=" + serverId, { width: "50em", height: "30em", callback: function (resp) { - that.policy.certRefs.push(resp.data.certRef) - that.policy.certs.push(resp.data.cert) + if (resp.data.cert != null && resp.data.certRef != null) { + that.policy.certRefs.push(resp.data.certRef) + that.policy.certs.push(resp.data.cert) + } + if (resp.data.certs != null && resp.data.certRefs != null) { + that.policy.certRefs.$pushAll(resp.data.certRefs) + that.policy.certs.$pushAll(resp.data.certs) + } + that.$forceUpdate() } }) }, @@ -3737,8 +3752,12 @@ Vue.component("ssl-config-box", { // 上传证书 uploadCert: function () { let that = this - teaweb.popup("/servers/certs/uploadPopup", { - height: "28em", + let serverId = this.vServerId + if (typeof serverId != "number" && typeof serverId != "string") { + serverId = 0 + } + teaweb.popup("/servers/certs/uploadPopup?serverId=" + serverId, { + height: "30em", callback: function (resp) { teaweb.success("上传成功", function () { that.policy.certRefs.push(resp.data.certRef) @@ -3748,6 +3767,28 @@ Vue.component("ssl-config-box", { }) }, + // 批量上传 + uploadBatch: function () { + let that = this + let serverId = this.vServerId + if (typeof serverId != "number" && typeof serverId != "string") { + serverId = 0 + } + teaweb.popup("/servers/certs/uploadBatchPopup?serverId=" + serverId, { + callback: function (resp) { + if (resp.data.cert != null) { + that.policy.certRefs.push(resp.data.certRef) + that.policy.certs.push(resp.data.cert) + } + if (resp.data.certs != null) { + that.policy.certRefs.$pushAll(resp.data.certRefs) + that.policy.certs.$pushAll(resp.data.certs) + } + that.$forceUpdate() + } + }) + }, + // 申请证书 requestCert: function () { // 已经在证书中的域名 @@ -3929,8 +3970,15 @@ Vue.component("ssl-config-box", { width: "50em", height: "30em", callback: function (resp) { - that.policy.clientCARefs.push(resp.data.certRef) - that.policy.clientCACerts.push(resp.data.cert) + if (resp.data.cert != null && resp.data.certRef != null) { + that.policy.clientCARefs.push(resp.data.certRef) + that.policy.clientCACerts.push(resp.data.cert) + } + if (resp.data.certs != null && resp.data.certRefs != null) { + that.policy.clientCARefs.$pushAll(resp.data.certRefs) + that.policy.clientCACerts.$pushAll(resp.data.certs) + } + that.$forceUpdate() } }) }, @@ -3986,7 +4034,10 @@ Vue.component("ssl-config-box", {
  + |     +   + |   @@ -4142,7 +4193,7 @@ Vue.component("ssl-config-box", { 客户端认证CA证书
-
+
{{cert.name}} / {{cert.dnsNames}} / 有效至{{formatTime(cert.timeEndAt)}}  
@@ -4352,7 +4403,9 @@ Vue.component("ssl-certs-box", { "v-protocol", // 协议:https|tls "v-view-size", // 弹窗尺寸:normal, mini "v-single-mode", // 单证书模式 - "v-description" // 描述文字 + "v-description", // 描述文字 + "v-domains", // 搜索的域名列表或者函数 + "v-user-id" // 用户ID ], data: function () { let certs = this.vCerts @@ -4390,8 +4443,8 @@ Vue.component("ssl-certs-box", { // 选择证书 selectCert: function () { let that = this - let width = "50em" - let height = "30em" + let width = "54em" + let height = "32em" let viewSize = this.vViewSize if (viewSize == null) { viewSize = "normal" @@ -4400,11 +4453,41 @@ Vue.component("ssl-certs-box", { width = "35em" height = "20em" } - teaweb.popup("/servers/certs/selectPopup?viewSize=" + viewSize, { + + let searchingDomains = [] + if (this.vDomains != null) { + if (typeof this.vDomains == "function") { + let resultDomains = this.vDomains() + if (resultDomains != null && typeof resultDomains == "object" && (resultDomains instanceof Array)) { + searchingDomains = resultDomains + } + } else if (typeof this.vDomains == "object" && (this.vDomains instanceof Array)) { + searchingDomains = this.vDomains + } + if (searchingDomains.length > 10000) { + searchingDomains = searchingDomains.slice(0, 10000) + } + } + + let selectedCertIds = this.certs.map(function (cert) { + return cert.id + }) + let userId = this.vUserId + if (userId == null) { + userId = 0 + } + + teaweb.popup("/servers/certs/selectPopup?viewSize=" + viewSize + "&searchingDomains=" + window.encodeURIComponent(searchingDomains.join(",")) + "&selectedCertIds=" + selectedCertIds.join(",") + "&userId=" + userId, { width: width, height: height, callback: function (resp) { - that.certs.push(resp.data.cert) + if (resp.data.cert != null) { + that.certs.push(resp.data.cert) + } + if (resp.data.certs != null) { + that.certs.$pushAll(resp.data.certs) + } + that.$forceUpdate() } }) }, @@ -4412,16 +4495,46 @@ Vue.component("ssl-certs-box", { // 上传证书 uploadCert: function () { let that = this - teaweb.popup("/servers/certs/uploadPopup", { + let userId = this.vUserId + if (typeof userId != "number" && typeof userId != "string") { + userId = 0 + } + teaweb.popup("/servers/certs/uploadPopup?userId=" + userId, { height: "28em", callback: function (resp) { teaweb.success("上传成功", function () { - that.certs.push(resp.data.cert) + if (resp.data.cert != null) { + that.certs.push(resp.data.cert) + } + if (resp.data.certs != null) { + that.certs.$pushAll(resp.data.certs) + } + that.$forceUpdate() }) } }) }, + // 批量上传 + uploadBatch: function () { + let that = this + let userId = this.vUserId + if (typeof userId != "number" && typeof userId != "string") { + userId = 0 + } + teaweb.popup("/servers/certs/uploadBatchPopup?userId=" + userId, { + callback: function (resp) { + if (resp.data.cert != null) { + that.certs.push(resp.data.cert) + } + if (resp.data.certs != null) { + that.certs.$pushAll(resp.data.certs) + } + that.$forceUpdate() + } + }) + }, + // 格式化时间 formatTime: function (timestamp) { return new Date(timestamp * 1000).format("Y-m-d") @@ -4447,7 +4560,9 @@ Vue.component("ssl-certs-box", {
  + |     +  
` }) @@ -7026,80 +7141,102 @@ Vue.component("http-rewrite-labels-label", { }) Vue.component("server-name-box", { - props: ["v-server-names"], - data: function () { - let serverNames = this.vServerNames; - if (serverNames == null) { - serverNames = [] - } - return { - serverNames: serverNames, - isSearching: false, - keyword: "" - } - }, - methods: { - addServerName: function () { - window.UPDATING_SERVER_NAME = null - let that = this - teaweb.popup("/servers/addServerNamePopup", { - callback: function (resp) { - var serverName = resp.data.serverName - that.serverNames.push(serverName) - } - }); - }, + props: ["v-server-names"], + data: function () { + let serverNames = this.vServerNames; + if (serverNames == null) { + serverNames = [] + } + return { + serverNames: serverNames, + isSearching: false, + keyword: "" + } + }, + methods: { + addServerName: function () { + window.UPDATING_SERVER_NAME = null + let that = this + teaweb.popup("/servers/addServerNamePopup", { + callback: function (resp) { + var serverName = resp.data.serverName + that.serverNames.push(serverName) + } + }); + }, - removeServerName: function (index) { - this.serverNames.$remove(index) - }, + removeServerName: function (index) { + this.serverNames.$remove(index) + }, - updateServerName: function (index, serverName) { - window.UPDATING_SERVER_NAME = teaweb.clone(serverName) - let that = this - teaweb.popup("/servers/addServerNamePopup", { - callback: function (resp) { - var serverName = resp.data.serverName - Vue.set(that.serverNames, index, serverName) - } - }); - }, - showSearchBox: function () { - this.isSearching = !this.isSearching - if (this.isSearching) { - let that = this - setTimeout(function () { - that.$refs.keywordRef.focus() - }, 200) - } else { - this.keyword = "" - } - }, - }, - watch: { - keyword: function (v) { - this.serverNames.forEach(function (serverName) { - if (v.length == 0) { - serverName.isShowing = true - return - } - if (serverName.subNames == null || serverName.subNames.length == 0) { - if (!teaweb.match(serverName.name, v)) { - serverName.isShowing = false - } - } else { - let found = false - serverName.subNames.forEach(function (subName) { - if (teaweb.match(subName, v)) { - found = true - } - }) - serverName.isShowing = found - } - }) - } - }, - template: `
+ updateServerName: function (index, serverName) { + window.UPDATING_SERVER_NAME = teaweb.clone(serverName) + let that = this + teaweb.popup("/servers/addServerNamePopup", { + callback: function (resp) { + var serverName = resp.data.serverName + Vue.set(that.serverNames, index, serverName) + } + }); + }, + showSearchBox: function () { + this.isSearching = !this.isSearching + if (this.isSearching) { + let that = this + setTimeout(function () { + that.$refs.keywordRef.focus() + }, 200) + } else { + this.keyword = "" + } + }, + allServerNames: function () { + if (this.serverNames == null) { + return [] + } + let result = [] + this.serverNames.forEach(function (serverName) { + if (serverName.subNames != null && serverName.subNames.length > 0) { + serverName.subNames.forEach(function (subName) { + if (subName != null && subName.length > 0) { + if (!result.$contains(subName)) { + result.push(subName) + } + } + }) + } else if (serverName.name != null && serverName.name.length > 0) { + if (!result.$contains(serverName.name)) { + result.push(serverName.name) + } + } + }) + return result + } + }, + watch: { + keyword: function (v) { + this.serverNames.forEach(function (serverName) { + if (v.length == 0) { + serverName.isShowing = true + return + } + if (serverName.subNames == null || serverName.subNames.length == 0) { + if (!teaweb.match(serverName.name, v)) { + serverName.isShowing = false + } + } else { + let found = false + serverName.subNames.forEach(function (subName) { + if (teaweb.match(subName, v)) { + found = true + } + }) + serverName.isShowing = found + } + }) + } + }, + template: `
@@ -9621,8 +9758,6 @@ Vue.component("http-compression-config-box", { Vue.component("http-cc-config-box", { props: ["v-cc-config", "v-is-location", "v-is-group"], data: function () { - - let config = this.vCcConfig if (config == null) { config = { @@ -9667,7 +9802,7 @@ Vue.component("http-cc-config-box", { 启用CC无感防护 -

启用后,自动检测并拦截CC攻击,此功能不需要开启WAF功能。

+

启用后,自动检测并拦截CC攻击。

@@ -15685,6 +15820,9 @@ Vue.component("file-textarea", { }, setValue: function (value) { this.realValue = value + }, + focus: function () { + this.$refs.textarea.focus() } }, template: `` @@ -16417,9 +16555,9 @@ Vue.component("combo-box", {
- {{title}}:{{selectedItem.name}} - - + {{title}}:{{selectedItem.name}} + +