← Back
Editing: rules-table-legacy.js
!function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function r(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?e(Object(o),!0).forEach((function(e){n(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function n(e,r,n){return(r=function(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return r};var e,r={},n=Object.prototype,a=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(e){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),u=new A(n||[]);return i(a,"_invoke",{value:L(t,r,u)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var h="suspendedStart",v="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function P(){}var x={};f(x,l,(function(){return this}));var k=Object.getPrototypeOf,_=k&&k(k(T([])));_&&_!==n&&a.call(_,l)&&(x=_);var j=P.prototype=b.prototype=Object.create(x);function E(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function O(e,r){function n(o,i,u,l){var c=d(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==t(f)&&a.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,u,l)}),(function(t){n("throw",t,u,l)})):r.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return n("throw",t,u,l)}))}l(c.arg)}var o;i(this,"_invoke",{value:function(t,e){function a(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(a,a):a()}})}function L(t,r,n){var o=h;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var l=C(u,n);if(l){if(l===g)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var c=d(t,r,n);if("normal"===c.type){if(o=n.done?m:v,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=m,n.method="throw",n.arg=c.arg)}}}function C(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,C(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=d(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function V(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(V,this),this.reset(!0)}function T(r){if(r||""===r){var n=r[l];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function t(){for(;++o<r.length;)if(a.call(r,o))return t.value=r[o],t.done=!1,t;return t.value=e,t.done=!0,t};return i.next=i}}throw new TypeError(t(r)+" is not iterable")}return w.prototype=P,i(j,"constructor",{value:P,configurable:!0}),i(P,"constructor",{value:w,configurable:!0}),w.displayName=f(P,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,P):(t.__proto__=P,f(t,s,"GeneratorFunction")),t.prototype=Object.create(j),t},r.awrap=function(t){return{__await:t}},E(O.prototype),f(O.prototype,c,(function(){return this})),r.AsyncIterator=O,r.async=function(t,e,n,o,a){void 0===a&&(a=Promise);var i=new O(p(t,e,n,o),a);return r.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(j),f(j,s,"Generator"),f(j,l,(function(){return this})),f(j,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:T(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},r}function a(t,e,r,n,o,a,i){try{var u=t[a](i),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,l,"next",t)}function l(t){a(i,n,o,u,l,"throw",t)}u(void 0)}))}}System.register(["./utils-lib-legacy.js?v=VERSION_NUMBER","./api-legacy.js?v=VERSION_NUMBER","./store-legacy7.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER"],(function(t,e){"use strict";var n,a,u,l,c,s,f,p,d,h,v,y,m,g,b,w,P,x,k,_,j,E,O,L,C,V,S;return{setters:[function(t){n=t.L},function(t){a=t.j,u=t.k,l=t.g,c=t.b,s=t.l,f=t.s},function(t){p=t.a,d=t.t},function(t){h=t.c,v=t.x,y=t.r,m=t.k,g=t.p,b=t.G,w=t.q,P=t.v,x=t.M,k=t.A,_=t.B,j=t.C,E=t.e,O=t.y,L=t.H,C=t.P,V=t.F,S=t.a_},null],execute:function(){var A={class:"p-2rem"};t("default",h({__name:"rules-table",props:{dependencies:{default:function(){return{}}}},setup:function(t,h){var T=h.expose,B=t,F=v(B.dependencies.components),I=F.BtDialog,G=F.ElButton,D=F.BtTable,N=F.BtInput,U=F.BtTableGroup,R=F.ElTooltip,q=F.ElForm,H=F.ElFormItem,M=F.ElSelect,Y=F.ElOption,z=v(B.dependencies.hooks),J=z.useAxios,K=z.useMessage,Q=z.useConfirm,W=z.useDialog,X=v(B.dependencies.custom),Z=X.setPortConfig,$=X.useOperate,tt=X.portsPs,et=[{label:"TCP",value:"tcp"},{label:"UDP",value:"udp"}],rt=K(),nt=y(!1),ot=y(!1),at=y(!1),it=y([]),ut=y(!1),lt=y(!1),ct=y(),st=m({Port:"",CidrBlock:"",ps:"",Protocol:""}),ft=y(!1),pt=y(!1),dt=m({Port:[{required:!0,message:"请输入端口",trigger:"blur"}],ps:[{validator:function(t,e,r){e&&(null==e?void 0:e.length)>60?r(new Error("备注不能超过60个字符")):r()},trigger:["blur","change"]}]}),ht=function(){var t=i(o().mark((function t(e){var r,n,i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Q({icon:"warning",title:"删除防火墙规则",content:"删除后可能导致服务无法访问,是否继续操作?"});case 2:return t.prev=2,r=rt.load("正在删除防火墙规则,请稍后..."),delete(n=e).FirewallRuleDescription,t.next=8,a(n);case 8:i=t.sent,r.close(),rt.request(i),i.status&&yt(),t.next=17;break;case 14:t.prev=14,t.t0=t.catch(2);case 17:case"end":return t.stop()}}),t,null,[[2,14]])})));return function(e){return t.apply(this,arguments)}}(),vt=function(){ft.value||pt.value?wt():(ot.value=!0,yt())},yt=function(){var t=i(o().mark((function t(){var e;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ft.value=!1,t.prev=1,at.value=!0,t.next=5,u();case 5:e=t.sent,pt.value=!Array.isArray(e.data.FirewallRuleSet),it.value=Array.isArray(e.data.FirewallRuleSet)?e.data.FirewallRuleSet:[],t.next=14;break;case 10:t.prev=10,t.t0=t.catch(1),ft.value=!0;case 14:return t.prev=14,at.value=!1,t.finish(14);case 17:case"end":return t.stop()}}),t,null,[[1,10,14,17]])})));return function(){return t.apply(this,arguments)}}(),mt=function(){var t=i(o().mark((function t(){var e,r,n,a;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,l();case 3:return e=t.sent,!1===(null==(r=e.data)?void 0:r.status)&&null!=r&&r.msg&&(pt.value=!0),t.next=8,c();case 8:n=t.sent,"lighthouse"===(null==(a=n.data)?void 0:a.server_type)&&(nt.value=!0),p.value=a,d.value="cvm"===a.server_type,t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0);case 18:case"end":return t.stop()}}),t,null,[[0,15]])})));return function(){return t.apply(this,arguments)}}(),gt=function(){return{label:"端口",prop:"Port",renderHeader:function(){return t="防火墙会加载系统所有端口信息,IPV6端口无法与IPV4分开管理,非必要勿删除IPV6端口",E("div",null,[E("span",null,["端口"]),E(R,{content:t,placement:"top"},{default:function(){return[E("span",{class:"ml-4x bt-ico-ask"},["?"])]}})]);var t},width:300,render:function(t){t.brief=t.brief||tt[t.Port];var e=it.value.some((function(e){return e.Port===t.Port})),r=["20","21","22","80","443","8888","3306"].includes(t.Port);return E("div",null,[E("span",{class:"mr-[1rem]"},[t.Port+("ipv6"===t.Family?"(ipv6)":"")]),e||r?"":E("span",{class:"bt-link cursor-pointer",onClick:function(){var e;bt({Port:t.Port,CidrBlock:"all"!==t.Address?t.Address:"",ps:null===(e=t.brief)||void 0===e?void 0:e.substring(0,60),Protocol:t.Protocol})}},[_("点击放行,腾讯云轻量云防火墙端口")])])}}},bt=function(t){ft.value||pt.value?wt():(xt(),lt.value=!!t,t&&Object.assign(st,t),ut.value=!0)},wt=function(t){(t=t||{}).alert=ft.value?"当前密钥错误,请重新关联API密钥":"",W({isAsync:!0,component:function(){return n((function(){return e.import("./config-legacy5.js?v=VERSION_NUMBER")}),void 0,e.meta.url)},title:!1,area:[48],compData:r(r({},t),{},{dependencies:B.dependencies})})},Pt=function(){var t=i(o().mark((function t(){var e,n,a;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,ct.value.validate();case 3:return e=rt.load("正在添加防火墙规则,请稍后..."),n=r(r({},st),{},{Protocol:st.Protocol||"tcp",ActionType:"ACCEPT",CidrBlock:st.CidrBlock||"0.0.0.0/0"}),t.next=7,s(n);case 7:a=t.sent,e.close(),rt.request(a),a.status&&(ut.value=!1,yt()),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(0);case 16:case"end":return t.stop()}}),t,null,[[0,13]])})));return function(){return t.apply(this,arguments)}}(),xt=function(){st.Port="",st.CidrBlock="",st.ps="",st.Protocol="tcp"},kt=y([{label:"应用类型",prop:"AppType"},{label:"来源",prop:"CidrBlock"},{label:"协议",prop:"Protocol",width:150},{label:"端口",prop:"Port",width:120},{label:"策略",prop:"Action",width:60,render:function(t){var e="ACCEPT"===t.Action;return E("span",{class:e?"text-primary":"text-danger"},[e?"允许":"拒绝"])}},$([{onClick:ht,isHide:function(){return 1===it.value.length},title:"删除"}])]);return g(i(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return f(J),t.next=3,mt();case 3:if(nt.value){t.next=5;break}return t.abrupt("return");case 5:return t.next=7,yt();case 7:Z(gt());case 8:case"end":return t.stop()}}),t)})))),T({getPortConfig:gt}),function(t,e){var r=b("bt-loading");return w(),P("div",null,[v(nt)?(w(),x(v(G),{key:0,type:"default",class:"!mr-[1rem]",onClick:vt},{default:k((function(){return e[7]||(e[7]=[_("轻量云防火墙规则")])})),_:1})):j("",!0),E(v(I),{title:"轻量云防火墙规则",modelValue:v(ot),"onUpdate:modelValue":e[1]||(e[1]=function(t){return C(ot)?ot.value=t:null}),area:[80]},{default:k((function(){return[O("div",A,[E(v(U),null,{"header-left":k((function(){return[E(v(G),{type:"primary",onClick:e[0]||(e[0]=function(t){return bt()})},{default:k((function(){return e[8]||(e[8]=[_("添加规则")])})),_:1})]})),"header-right":k((function(){return e[9]||(e[9]=[])})),content:k((function(){return[L(E(v(D),{ref:"ftpTable",column:v(kt),data:v(it),description:"列表为空","max-height":360},null,8,["column","data"]),[[r,v(at)],[r,"正在加载轻量云防火墙规则列表,请稍后...","title"]])]})),_:1})])]})),_:1},8,["modelValue"]),E(v(I),{title:"添加轻量云防火墙规则",modelValue:v(ut),"onUpdate:modelValue":e[6]||(e[6]=function(t){return C(ut)?ut.value=t:null}),"show-footer":!0,area:[48],onConfirm:Pt},{default:k((function(){return[E(v(q),{ref_key:"addRulesformRef",ref:ct,class:"p-2rem",model:v(st),rules:v(dt)},{default:k((function(){return[E(v(H),{label:"端口",prop:"Port"},{default:k((function(){return[E(v(N),{modelValue:v(st).Port,"onUpdate:modelValue":e[2]||(e[2]=function(t){return v(st).Port=t}),width:"30rem",disabled:v(lt),placeholder:"端口范围1到65535之间,支持端口放行范围80-90"},null,8,["modelValue","disabled"])]})),_:1}),E(v(H),{label:"协议",prop:"Protocol"},{default:k((function(){return[E(v(M),{modelValue:v(st).Protocol,"onUpdate:modelValue":e[3]||(e[3]=function(t){return v(st).Protocol=t}),class:"!w-[30rem]"},{default:k((function(){return[(w(),P(V,null,S(et,(function(t){return E(v(Y),{key:t.value,label:t.label,value:t.value},null,8,["label","value"])})),64))]})),_:1},8,["modelValue"])]})),_:1}),E(v(H),{label:"允许访问IP"},{default:k((function(){return[E(v(N),{modelValue:v(st).CidrBlock,"onUpdate:modelValue":e[4]||(e[4]=function(t){return v(st).CidrBlock=t}),width:"30rem",disabled:v(lt),placeholder:"默认为空,表示所有来源,支持IP网段,可为空"},null,8,["modelValue","disabled"])]})),_:1}),E(v(H),{label:"备注",prop:"ps"},{default:k((function(){return[E(v(N),{modelValue:v(st).ps,"onUpdate:modelValue":e[5]||(e[5]=function(t){return v(st).ps=t}),rows:4,type:"textarea",width:"30rem",placeholder:"备注和说明,可为空"},null,8,["modelValue"])]})),_:1}),E(v(H),{label:""},{default:k((function(){return e[10]||(e[10]=[O("ul",{class:"pl-[4rem] list-disc text-[#777] leading-[2.4rem] text-12px"},[O("li",null,"支持添加多个端口,如:80,88"),O("li",null,"支持添加多个端口范围,如:80,88,90-99,110-120")],-1)])})),_:1})]})),_:1},8,["model","rules"])]})),_:1},8,["modelValue"])])}}}))}}}))}();
Save File
Cancel