← Back
Editing: add-port-rule-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(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e=function(){return n};var r,n={},o=Object.prototype,a=o.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},l="function"==typeof Symbol?Symbol:{},u=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",s=l.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(r){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),l=new N(n||[]);return i(a,"_invoke",{value:L(t,r,l)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var h="suspendedStart",y="suspendedYield",m="executing",v="completed",g={};function b(){}function w(){}function _(){}var j={};f(j,u,(function(){return this}));var P=Object.getPrototypeOf,x=P&&P(P(U([])));x&&x!==o&&a.call(x,u)&&(j=x);var O=_.prototype=b.prototype=Object.create(j);function k(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function E(e,r){function n(o,i,l,u){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,l,u)}),(function(t){n("throw",t,l,u)})):r.resolve(f).then((function(t){s.value=t,l(s)}),(function(t){return n("throw",t,l,u)}))}u(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,e,n){var o=h;return function(a,i){if(o===m)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:r,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var u=S(l,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=m;var c=d(t,e,n);if("normal"===c.type){if(o=n.done?v:y,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=v,n.method="throw",n.arg=c.arg)}}}function S(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,S(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=d(o,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,g;var i=a.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.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 D(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(V,this),this.reset(!0)}function U(e){if(e||""===e){var n=e[u];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function t(){for(;++o<e.length;)if(a.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=r,t.done=!0,t};return i.next=i}}throw new TypeError(t(e)+" is not iterable")}return w.prototype=_,i(O,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=f(_,s,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,f(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},n.awrap=function(t){return{__await:t}},k(E.prototype),f(E.prototype,c,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,a){void 0===a&&(a=Promise);var i=new E(p(t,e,r,o),a);return n.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},k(O),f(O,s,"Generator"),f(O,u,(function(){return this})),f(O,"toString",(function(){return"[object Generator]"})),n.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}},n.values=U,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(D),!t)for(var e in this)"t"===e.charAt(0)&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},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 e=this;function n(n,o){return l.type="throw",l.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){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),D(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;D(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:U(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),g}},n}function r(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(n,o)}function n(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 o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function a(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}System.register(["./base-lib-legacy.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER","./index-legacy117.js?v=VERSION_NUMBER","./firewall-legacy.js?v=VERSION_NUMBER","./useMethod-legacy6.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER","./validator-legacy.js?v=VERSION_NUMBER","./index-legacy104.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER","./useStore-legacy5.js?v=VERSION_NUMBER"],(function(t,n){"use strict";var a,i,l,u,c,s,f,p,d,h,y,m,v,g,b,w,_,j,P,x,O,k,E,L,S,V,D,N,U,I,T,A,G;return{setters:[function(t){a=t.c,i=t.r,l=t.U,u=t.k,c=t.p,s=t.q,f=t.M,p=t.A,d=t.e,h=t.x,y=t.v,m=t.a_,v=t.F,g=t.C,b=t.P,w=t.a9,_=t.aj,j=t.S,P=t.a7,x=t.ai},function(t){O=t.u,k=t.jz,E=t.K,L=t.ag,S=t.k,V=t.W,D=t.j,N=t.e},function(t){U=t._},function(t){I=t.w,T=t.v},function(t){A=t.a,G=t.g},null,null,null,null,null],execute:function(){var n=a({__name:"add-port-rule",props:{compData:{default:function(){}}},setup:function(t,n){var a=n.expose,N=t,F=O().payment.value.authType,C=i(!1),q=i(),J=l(N.compData.isEdit),M={title:"指定域名-功能介绍",ps:"系统防火墙将会放行/阻止设置域名所解析的A/AAAA记录",source:106,desc:["放行/阻止域名解析记录"],tabImgs:[{title:"防火墙禁止端口",imgSrc:"https://www.bt.cn/Public/new/plugin/introduce/firewall/specify_domain_1.png"},{title:"域名解析已生效",imgSrc:"https://www.bt.cn/Public/new/plugin/introduce/firewall/specify_domain_2.png"},{title:"设置效果",imgSrc:"https://www.bt.cn/Public/new/plugin/introduce/firewall/specify_domain_3.png"}]},R=u({protocol:"tcp",port:"",choose:"all",types:"accept",brief:"",address:"",domain:"",chain:"INPUT"}),Y=[{content:"支持添加多个端口,如:80,88"},{content:"支持添加多个端口范围,如:80,88,90-99,110-120"},{content:"默认配置下防火墙无法管理Docker容器端口"},{content:"此操作将重载防火墙,未持久化的 iptables 规则会清空,请先备份保存!"}],z=[{title:"入站(默认)",key:"INPUT"},{title:"出站",key:"OUTPUT"}],H="请输入指定IP,多个IP请用,隔开或换行。例如192.168.1.1,192.168.1.2",K=[{label:"TCP",value:"tcp"},{label:"UDP",value:"udp"},{label:"TCP/UDP",value:"all"}],W=[{title:"所有IP",key:"all"},{title:"指定IP",key:"point"}],B=[{title:"放行",key:"accept"},{title:"禁止",key:"drop"}],Q={port:[{validator:k,trigger:["blur"],required:!0}],address:[{trigger:["blur","change"],required:!0,message:"请输入指定IP"}],domain:[{trigger:["blur","change"],required:!0,message:"请输入指定域名"}]},X=function(t){try{R.port=t.replace(/[^0-9,-]/g,"")}catch(e){}},Z=function(t){if(q.value.clearValidate(),"ltd"!==F&&"domain"===t)return R.choose="all",void(C.value=!0);R.choose=t},$=function(){var t=o(o({},R),{},{operation:"add",strategy:R.types});if("all"===t.choose&&delete t.address,t.brief||(t.brief=""),J.value&&(t.id=N.compData.id),J.value){var e=o({},N.compData);return e.noNps&&delete e.noNps,{old_data:JSON.stringify(e),new_data:JSON.stringify(t)}}return t},tt=function(){var t,n=(t=e().mark((function t(r){var n,o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,q.value.validate();case 2:return t.next=4,$();case 4:return n=t.sent,o="domain"===R.choose,t.next=8,E({loading:"正在提交,请稍后...",message:!0,request:J.value?I(n,o):T(n,o),success:function(t){t.status&&r()}});case 8:return N.compData.refreshFn(),t.next=11,A();case 11:G(),J.value;case 13:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(o,a){var i=t.apply(e,n);function l(t){r(i,o,a,l,u,"next",t)}function u(t){r(i,o,a,l,u,"throw",t)}l(void 0)}))});return function(t){return n.apply(this,arguments)}}();return c((function(){var t;if(R.port=(null===(t=N.compData)||void 0===t?void 0:t.port)||"",N.compData.isEdit){var e,r="all"===(null===(e=N.compData)||void 0===e?void 0:e.Address);Object.assign(R,{protocol:N.compData.Protocol,port:N.compData.Port,types:N.compData.Strategy,brief:N.compData.brief,chain:N.compData.Chain,address:r?"":N.compData.Address,domain:N.compData.domain}),R.choose=r?"all":""===N.compData.domain?"point":"domain"}})),a({onConfirm:tt}),function(t,e){var r=L,n=w,o=S,a=x,i=_,l=j,u=V,c=U,O=D,k=P;return s(),f(k,{ref_key:"editPortRulesRef",ref:q,rules:Q,model:h(R),class:"p-[2rem] addfrom"},{default:p((function(){return[d(n,{label:"协议"},{default:p((function(){return[d(r,{modelValue:h(R).protocol,"onUpdate:modelValue":e[0]||(e[0]=function(t){return h(R).protocol=t}),class:"!w-[24rem]",options:K},null,8,["modelValue"])]})),_:1}),d(n,{label:"端口",prop:"port"},{default:p((function(){return[d(o,{modelValue:h(R).port,"onUpdate:modelValue":e[1]||(e[1]=function(t){return h(R).port=t}),width:"24rem",placeholder:"请输入端口",disabled:h(J),onInput:X},null,8,["modelValue","disabled"])]})),_:1}),d(n,{label:"来源"},{default:p((function(){return[d(i,{modelValue:h(R).choose,"onUpdate:modelValue":e[2]||(e[2]=function(t){return h(R).choose=t}),onChange:Z,class:"!w-[24rem]"},{default:p((function(){return[(s(),y(v,null,m(W,(function(t,e){return d(a,{key:e,label:t.title,value:t.key},null,8,["label","value"])})),64))]})),_:1},8,["modelValue"])]})),_:1}),"point"===h(R).choose?(s(),f(n,{key:0,label:"指定IP",prop:"address"},{default:p((function(){return[d(o,{type:"textarea",rows:3,width:"24rem",modelValue:h(R).address,"onUpdate:modelValue":e[3]||(e[3]=function(t){return h(R).address=t}),placeholder:H,clearable:""},null,8,["modelValue","placeholder"])]})),_:1})):g("",!0),d(n,{label:"策略"},{default:p((function(){return[d(i,{modelValue:h(R).types,"onUpdate:modelValue":e[4]||(e[4]=function(t){return h(R).types=t}),class:"!w-[24rem]"},{default:p((function(){return[(s(),y(v,null,m(B,(function(t,e){return d(a,{key:e,label:t.title,value:t.key},null,8,["label","value"])})),64))]})),_:1},8,["modelValue"])]})),_:1}),d(n,{label:"方向"},{default:p((function(){return[d(i,{modelValue:h(R).chain,"onUpdate:modelValue":e[5]||(e[5]=function(t){return h(R).chain=t}),class:"!w-[24rem]"},{default:p((function(){return[(s(),y(v,null,m(z,(function(t){return d(a,{key:t.key,label:t.title,value:t.key},null,8,["label","value"])})),64))]})),_:1},8,["modelValue"])]})),_:1}),d(n,{label:"备注"},{default:p((function(){return[d(l,{modelValue:h(R).brief,"onUpdate:modelValue":e[6]||(e[6]=function(t){return h(R).brief=t}),class:"!w-[24rem] special-input",clearable:"",placeholder:"请填写备注,可为空"},null,8,["modelValue"])]})),_:1}),d(u,{options:Y,listStyle:"disc",class:"pl-[6rem] pt-[1.2rem]"}),d(O,{title:"指定域名-功能介绍",area:60,modelValue:h(C),"onUpdate:modelValue":e[7]||(e[7]=function(t){return b(C)?C.value=t:null})},{default:p((function(){return[d(c,{data:M,class:"p-4rem"})]})),_:1},8,["modelValue"])]})),_:1},8,["model"])}}});t("default",N(n,[["__scopeId","data-v-247d5224"]]))}}}))}();
Save File
Cancel