← Back
Editing: index448.js
import{K as t,l as e,L as a,o as s,at as r,bU as o,b as n,aM as l,fj as i,a7 as p,W as c}from"./utils-lib.js?v=1765440387";import{_ as u}from"./index93.js?v=1765440387";import{r as _,k as m,g as y,e as d,B as h,F as g,aR as x,c as w,q as v,v as b,A as f,x as k}from"./base-lib.js?v=1765440387";import{u as q,a as E,c as j,g as L}from"./column.js?v=1765440387";import{fd as T,fe as z,ff as A,fg as N,fh as R,fi as I,fj as $,fk as P,fl as U,fm as C,fn as O,fo as B,fp as D}from"./site.js?v=1765440387";import{f as S}from"./validator.js?v=1765440387";import{u as V}from"./useStore3.js?v=1765440387";const W=n(),{siteInfo:M}=V(),X=_({}),F=_(!1),H=[{content:"支持添加多个不同目录的代理"},{content:"如添加后访问异常请尝试清理浏览器缓存"}],K=async()=>{try{const e=await t({request:T({site_name:M.value.name}),data:{data:Array}});return Array.isArray(e.data)?{data:e.data,total:e.data.length}:{data:[],total:0}}catch(e){return{data:[],total:0}}},Z=()=>{e({isAsync:!0,title:"添加URL代理",area:60,btn:"确认",component:()=>a(()=>import("./add-url-proxy2.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)})},G=async(e,a)=>{t({loading:"正在修改URL代理备注,请稍后...",request:z({site_name:M.value.name,proxy_path:e.proxy_path,remark:a}),message:!0})},J=t=>{X.value=t,e({isAsync:!0,title:"URL代理设置【".concat(t.proxy_path,"】"),area:[76,60],component:()=>a(()=>import("./setting3.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),compData:{row:t}})},Q=async e=>{if("/"===e.proxy_path)return void W.error("根目录不能删除");await s({title:"删除反向代理【".concat(e.proxy_path,"】"),width:"35rem",icon:"warning-filled",content:"您真的要删除反向代理【".concat(e.proxy_path,"】吗?")});(await t({loading:"正在删除,请稍后...",request:A({site_name:M.value.name,proxy_path:e.proxy_path}),message:!0})).status&&(F.value=!0)},Y=[{content:"目标:可以填写你需要代理的站点,目标如果选URL地址则必须为可正常访问的URL,如果选UNIX则必须是套接字文件"},{content:"http地址示例:http://127.0.0.1:15700"},{content:"unix地址示例:/tmp/panel.sock"},{content:()=>d("span",null,[h("发送域名:将域名添加到请求头传递到后端服务器,默认为目标URL域名,若设置不当可能导致代理无法正常访问,例如:"),d("br",null,null),h("http://192.168.100.20:19888,则发送域名保持$http_host即可"),d("br",null,null),h("http://www.bt.cn,则发送域名应当改为www.bt.cn"),d("br",null,null),h("上面例子仅为常见情况,请以实际为准")])}],tt=[{label:"URL地址",value:"http"},{label:"UNIX地址",value:"unix"}],et=()=>{S({type:"file",path:gt.proxysite||"/www",change:t=>{gt.proxysite=t}})},at=m({targetType:"http",sitename:"",cachetime:1,proxysite:"http://",todomain:"$http_host",path:"",ps:"",websocket:!1}),st=_(!1),rt=_(!1),ot=_(!1),nt=_(),lt=m({proxyname:[{required:!0,message:"请输入代理名称",trigger:"blur"},{validator:(t,e,a)=>{e.length<3?a(new Error("代理名称必须大于3个字符串")):e.match(/^[a-zA-Z0-9_.-]+$/g)?a():a(new Error("代理名称不能包含特殊字符"))}}],proxysite:[{required:!0,message:"请输入目标地址",trigger:"blur"},{validator:(t,e,a)=>{if(!e)return void a(new Error("http"===at.targetType?"目标地址不能为空":"请选择sock文件"));if("unix"===at.targetType)return void a();let s=e.replace(/^http[s]?:\/\//,"");s=s.replace(/(:|\?|\/|\\)(.*)$/,""),/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(s)?at.todomain="$http_host":at.todomain=s,a()}},{}],todomain:[{required:!0,message:"请输入发送域名",trigger:["blur","change"]}],path:[{required:!0,message:"请输入根目录",trigger:"blur"}]}),it=async()=>{at.proxysite="http"===at.targetType?"http://":""},pt=t=>{if("unix"===at.targetType)return void(at.todomain="$http_host");let e=t.replace(/^http[s]?:\/\//,"");e=e.replace(/(:|\?|\/|\\)(.*)$/,""),at.todomain=e},ct=t=>{if("unix"===gt.targetType)return void(gt.todomain="$http_host");let e=t.replace(/^http[s]?:\/\//,"");e=e.replace(/(:|\?|\/|\\)(.*)$/,""),gt.todomain=e},ut=()=>{S({type:"file",path:at.proxysite,change:t=>{at.proxysite=t}})},_t=async()=>{const{path:e,proxysite:a,todomain:s,targetType:r,ps:o}=at;let n={site_name:M.value.name,proxy_path:e,proxy_pass:a,proxy_host:s,proxy_type:r,remark:o};await nt.value.validate();const l=await t({loading:ot,request:O(n),message:!0});return l.status&&(F.value=!0),l.status},mt=_("proxy"),yt=_({proxy_type:"",proxy_path:"",proxy_pass:"",proxy_host:"$http_host",ip_limit:{},basic_auth:{},proxy_cache:{},gzip:{},sub_filter:{},websocket:{},proxy_log:{},custom_config:[],proxy_conf:"",remark:"",template_proxy_conf:""}),dt=async()=>{try{const t=await T({site_name:M.value.name,proxy_path:X.value.proxy_path});if(!t.status)return void W.error(t.msg);yt.value=t.data.data}catch(t){r(t)}},ht=_(!1),gt=m({targetType:"http",sitename:"",proxysite:"",todomain:"$http_host",path:"",ps:"",websocket:!1,proxy_connect_timeout:30,proxy_send_timeout:30,proxy_read_timeout:30}),xt=y(()=>({proxysite:[{required:!0,message:"http"!==gt.targetType?"请选择sock文件":"请输入目标url",trigger:"blur",validator:(t,e,a)=>{e?a():a(new Error("http"!==gt.targetType?"请选择sock文件":"请输入目标url"))}}],todomain:[{required:!0,message:"请输入发送域名",trigger:["blur","change"]}],proxy_connect_timeout:[{required:!0,message:"请输入连接超时时间",trigger:["blur","change"],validator:(t,e,a)=>{e?isNaN(Number(e))?a(new Error("请输入数字")):a():a(new Error("连接超时时间不能为空"))}}],proxy_send_timeout:[{required:!0,message:"请输入后端请求超时时间",trigger:["blur","change"],validator:(t,e,a)=>{e?isNaN(Number(e))?a(new Error("请输入数字")):a():a(new Error("后端请求超时时间不能为空"))}}],proxy_read_timeout:[{required:!0,message:"请输入代理响应超时时间",trigger:["blur","change"],validator:(t,e,a)=>{e?isNaN(Number(e))?a(new Error("请输入数字")):a():a(new Error("代理响应超时时间不能为空"))}}]})),wt=t=>{const{proxy_type:e,proxy_pass:a,proxy_host:s,proxy_path:r,remark:o,global_websocket:n,websocket:l,timeout:i}=t;gt.targetType=e,gt.proxysite=a,gt.todomain=s,gt.path=r,gt.ps=o,ht.value=n,gt.websocket=null==l?void 0:l.websocket_status,gt.proxy_connect_timeout=null==i?void 0:i.proxy_connect_timeout,gt.proxy_send_timeout=null==i?void 0:i.proxy_send_timeout,gt.proxy_read_timeout=null==i?void 0:i.proxy_read_timeout},vt=async()=>{const{path:e,proxysite:a,todomain:s,targetType:r,ps:o,websocket:n,proxy_connect_timeout:l,proxy_send_timeout:i,proxy_read_timeout:p}=gt,c={site_name:M.value.name,proxy_path:e,proxy_pass:a,proxy_host:s,proxy_type:r,remark:o,websocket:n?1:0,proxy_connect_timeout:l,proxy_send_timeout:i,proxy_read_timeout:p};await nt.value.validate();return(await t({loading:ot,request:N(c),message:!0})).status},bt='一行一条配置,请以;结尾,例如:\nproxy_set_header Cookie "cookie_name=cookie_value";\nallow 192.168.1.0/24;\naccess_log /www/wwwlogs/xxx.log;',ft=m({config:""}),kt=[{content:"注意:一行一条配置,请以;结尾"},{content:()=>d(g,null,[h("案例:"),d("br",null,null),h("重定向请求:return 301 /new-page;"),d("br",null,null),h("重写URL:rewrite ^/blog/(.*)$ /$1 break;"),d("br",null,null),h("文件上传限制:client_max_body_size 10M;"),d("br",null,null),h("处理特定http方法:"),d("br",null,null),h("limit_except POST "),"{",h(" "),d("br",null,null),h(" allow 192.168.1.0/24;"),d("br",null,null),h(" deny all;"),d("br",null,null),"}",d("br",null,null),h("限制请求速率:limit_rate 100k;"),d("br",null,null)])},{content:"保存配置前请核对配置是否正确,错误的配置可能会导致反向代理无法正常访问"}],qt=async t=>{try{let t={site_name:M.value.name,proxy_path:yt.value.proxy_path,custom_conf:ft.config};const e=await R(t);return W.request(e),e.status}catch(e){}},Et=()=>{ft.config=yt.value.custom_conf||""},jt=m({subfilter:[]}),Lt=[{content:"规则解释如下"},{content:"g:替换所有匹配到的关键字"},{content:"i:不区分大小写"},{content:"o:只替换匹配到的第一个"},{content:"r:使用正则表达式"}],Tt=async e=>{await t({loading:"正在删除,请稍后...",request:I({site_name:M.value.name,proxy_path:yt.value.proxy_path,oldstr:e.oldstr,newstr:e.newstr}),message:!0}),dt()},zt=t=>{const e=[t.oldstr,t.newstr],a=t.sub_type.replace(/g/g,""),s=a.includes("i")?"不区分大小写":"",r=a.includes("o")?"只替换第一个":"",o=a.includes("r")?"使用正则表达式":"";switch(a.length){case 0:return"效果:将全部'".concat(e[0],"'替换为'").concat(e[1],"''");case 1:return"效果:将".concat(r?"":"全部","'").concat(e[0],"'替换为'").concat(e[1],"',匹配时").concat(s||r||o);case 2:return"效果:将".concat(r?"":"全部","'").concat(e[0],"'替换为'").concat(e[1],"',匹配时").concat(s||r||o,"并且").concat(o||r||s);case 3:return"效果:将'".concat(e[0],"'替换为'").concat(e[1],"',匹配时").concat(s,"、").concat(r,"并且").concat(o)}},At=t=>{try{jt.subfilter=t.sub_filter_str}catch(e){}},Nt=_([{label:"原关键词",prop:"oldstr"},{label:"替换词",prop:"newstr"},{label:"规则",prop:"mode",width:50,render:t=>d(x,{class:"item",effect:"dark","open-delay":500,content:zt(t),placement:"top-start"},{default:()=>[d("div",{class:"flex items-center"},["".concat(t.sub_type)])]})},q([{title:"删除",onClick:t=>{Tt(t)}}])]),Rt=()=>{Object.assign(It,{oldstr:"",newstr:""}),Pt.value=[],Ut.value="默认效果:将全部'http://www.bt.cn'替换为'https://www.bt.cn'",e({isAsync:!0,title:"添加内容替换【".concat(yt.value.proxy_path,"】"),area:60,btn:"确认",component:()=>a(()=>import("./setting-replace-add2.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),compData:{proxy_path:yt.value.proxy_path,subs_filter:yt.value.subs_filter}})},It=m({oldstr:"",newstr:""}),$t={oldstr:[o({message:"请输入原关键词"})]},Pt=_([]),Ut=_("默认效果:将全部'http://www.bt.cn'替换为'https://www.bt.cn'"),Ct=_(),Ot=t=>{Bt(Pt.value)},Bt=t=>{const e=t.includes("i")?"不区分大小写":"",a=t.includes("o")?"只替换第一个":"",s=t.includes("r")?"使用正则表达式":"";switch(t.length){case 0:Ut.value="默认效果:将全部".concat(It.oldstr,"替换为").concat(It.newstr);break;case 1:Ut.value="效果:将".concat(a?"":"全部").concat(It.oldstr,"替换为").concat(It.newstr,",匹配时").concat(e||a||s);break;case 2:Ut.value="效果:将".concat(a?"":"全部").concat(It.oldstr,"替换为").concat(It.newstr,",匹配时").concat(e||a||s,"并且").concat(s||a||e);break;case 3:Ut.value="效果:将".concat(It.oldstr,"替换为").concat(It.newstr,",匹配时").concat(e,"、").concat(a,"并且").concat(s)}},Dt=async()=>{await Ct.value.validate();const e={site_name:M.value.name,oldstr:It.oldstr,newstr:It.newstr,proxy_path:yt.value.proxy_path,sub_type:Pt.value.length?Pt.value.join(""):"g"},a=await t({loading:ot,request:$(e),message:!0});return a.status&&dt(),a.status},St=_(),Vt=m({status:!1,time:"",unit:"m"}),Wt=[{label:"分钟",value:"m"},{label:"小时",value:"h"},{label:"天",value:"d"}],Mt=[{content:"缓存是一种用于加速网站性能和提高用户体验的技术"},{content:"开启后资源会被缓存,如果影响网站访问请关闭"},{content:"缓存键由主机名、URI 和请求参数组成"},{content:"默认忽略的响应头有:Set-Cookie|Cache-Control|expires|X-Accel-Expires"},{content:"默认缓存的静态资源有:css|js|jpg|jpeg|gif|png|webp|woff|eot|ttf|svg|ico|css.map|js.map"}],Xt=t=>{Ft()},Ft=async()=>{const e={site_name:M.value.name,proxy_path:yt.value.proxy_path,cache_status:Vt.status?1:0,expires:"".concat(Vt.time).concat(Vt.unit)};await St.value.validate();return(await t({loading:ot,request:P(e),message:!0})).status},Ht=_(),Kt=m({status:!1,type:"",level:1,minLength:"",unit:"m"}),Zt=[{label:"k",value:"k"},{label:"m",value:"m"}],Gt=[{content:"用于对 HTTP 响应的内容进行压缩,以减少数据传输量,提高网站性能和加载速度"},{content:"压缩级别1-9,例如:1为压缩速度最快,但压缩率较低;9为压缩速度最慢,但压缩率最高,建议默认"},{content:"如果开启gzip后影响网站正常访问,请关闭此功能 和请求参数组成"}],Jt={type:[{required:!0,message:"请输入压缩类型",trigger:["blur","change"]}],minLength:[{required:!0,message:"请输入正确的压缩最小长度",trigger:"blur",validator:(t,e,a)=>{e?isNaN(Number(e))?a(new Error("请输入数字")):Number(e)<1?a(new Error("请输入正确数字")):a():a(new Error("压缩最小长度不能为空"))}},{}]},Qt=t=>{Kt.status=t.gzip_status,Kt.type=t.gzip_types,Kt.level=t.gzip_comp_level;let e="",a="m";t.gzip_min_length&&t.gzip_min_length.length>1&&(e=t.gzip_min_length.slice(0,-1),a=t.gzip_min_length.slice(-1)),Kt.minLength=e,Kt.unit=a},Yt=t=>{te()},te=async()=>{const e={site_name:M.value.name,proxy_path:yt.value.proxy_path,gzip_status:Kt.status?1:0,gzip_min_length:"".concat(Kt.minLength).concat(Kt.unit),gzip_comp_level:Kt.level,gzip_types:Kt.type};await Ht.value.validate();return(await t({loading:ot,request:U(e),message:!0})).status},ee=_(),ae=_(),se=m({loading:!1,type:"black",white:[],black:[]}),re=t=>{se.white=t.ip_white.map(t=>({ip:t,type:"white"})),se.black=t.ip_black.map(t=>({ip:t,type:"black"}))},oe=async e=>{const a=!!Array.isArray(e);await s({title:"".concat(a?"批量删除":"删除").concat("white"===se.type?"白":"黑","名单"),content:"".concat(a?"批量删除选中的ip,是否继续操作?":"删除".concat("white"===se.type?"白":"黑","名单【").concat(e.ip,"】,是否继续操作?"))});let r={site_name:M.value.name,proxy_path:yt.value.proxy_path};a?(r.ips=e.map(t=>t.ip).join("\n"),r.ip_type=se.type):(r.ip=e.ip,r.ip_type=e.type);const o=a?B:D;(await t({loading:"正在删除,请稍后...",request:o(r),message:!0})).status&&dt()},ne=_([E({key:"ip"}),{label:"IP",prop:"ip",minWidth:120},q([{title:"删除",onClick:t=>{oe(t)}}])]),le=[{label:"删除IP",value:"delete",event:async(t,e,a,s,r)=>{const o=async t=>await D({site_name:M.value.name,proxy_path:yt.value.proxy_path,ip:t.ip,ip_type:"ipBlackList"===mt.value?"black":"white"});await t({title:"批量删除",content:"批量删除选中的ip,是否继续操作?",column:[{prop:"ip",label:"IP"},j()],onConfirm:async()=>(await e(o),dt(),!1)})}}],ie=()=>{se.type="ipBlackList"===mt.value?"black":"white",re(yt.value.ip_limit)},pe=()=>{ce.value.address="",e({isAsync:!0,title:"添加IP".concat("ipBlackList"===mt.value?"黑":"白","名单【").concat(yt.value.proxy_path,"】"),area:40,btn:"确认",component:()=>a(()=>import("./setting-ip-add2.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),compData:{name:M.value.name,proxy_path:yt.value.proxy_path,listType:se.type,refreshEvent:()=>{dt()}}})},ce=_({types:se.type,address:""}),ue=_(),_e=[{content:"一行一条配置,多个IP请换行"}],me={address:[{validator:(t,e,a)=>{e.length>0?a():a(new Error("请输入IP地址"))},trigger:["blur","change"]}]},ye=async()=>{const{address:e}=ce.value,a={site_name:M.value.name,proxy_path:yt.value.proxy_path,ip_type:"ipBlackList"===mt.value?"black":"white",ips:e};await ue.value.validate();const s=await t({loading:ot,request:C(a),message:!0});return s.status&&dt(),s.status},de=w({__name:"index",setup(t){const{BtOperation:e}=l({options:[{label:"添加URL代理",type:"button",active:!0,onClick:Z}]}),{BtTable:a}=i({request:K,columns:[{label:"代理目录",prop:"proxy_path",minWidth:120},{label:"目标",prop:"proxy_pass",minWidth:200},L({request:G,prop:"remark"}),q([{onClick:J,title:"设置"},{onClick:Q,title:"删除"}])],extension:[p(F)]});return(t,s)=>{const r=u,o=c;return v(),b("div",null,[d(r,{class:"h-[59rem]"},{"header-left":f(()=>[d(k(e))]),content:f(()=>[d(k(a),{"max-height":560})]),_:1}),d(o,{class:"mt-[2rem] ml-[1.6rem]",options:k(H)},null,8,["options"])])}}}),he=Object.freeze(Object.defineProperty({__proto__:null,default:de},Symbol.toStringTag,{value:"Module"}));export{Yt as $,ue as A,me as B,wt as C,gt as D,ct as E,et as F,ht as G,vt as H,xt as I,Et as J,ft as K,bt as L,qt as M,kt as N,Rt as O,jt as P,Nt as Q,Lt as R,At as S,Vt as T,Xt as U,Wt as V,Ft as W,St as X,Mt as Y,Qt as Z,Kt as _,ut as a,Zt as a0,te as a1,Ht as a2,Jt as a3,Gt as a4,ae as a5,ee as a6,pe as a7,ie as a8,se as a9,ne as aa,le as ab,re as ac,he as ad,nt as b,lt as c,ot as d,Y as e,rt as f,mt as g,pt as h,dt as i,Dt as j,It as k,Ot as l,yt as m,Bt as n,_t as o,st as p,Ut as q,Pt as r,it as s,tt as t,at as u,Ct as v,$t as w,ye as x,ce as y,_e as z}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel