← Back
Editing: index471.js
import{p as e,K as a,n as t,L as s,x as i,b as r,a2 as l}from"./utils-lib.js?v=VERSION_NUMBER";import{r as n,k as o,c as p,w as c,q as u,M as m,x as _}from"./base-lib.js?v=VERSION_NUMBER";import{proxyGetGlobal as g,clearProxyCache as h,proxyGlobalCache as d,proxyGlobalCompress as b,proxyGlobalAddLimit as v,proxyGlobalSetLogs as y,proxyGlobalSetWebsocket as w,proxyGlobalDelBasic as f,proxyGlobalEditBasic as k,proxyGlobalAddBasic as E,proxyGlobalBatchDelLimit as L,proxyGlobalDelLimit as j}from"./site.js?v=VERSION_NUMBER";import{a as z,u as I,c as P}from"./column.js?v=VERSION_NUMBER";import{f as q}from"./validator.js?v=VERSION_NUMBER";import{u as x}from"./useStore4.js?v=VERSION_NUMBER";const A=r(),{siteInfo:T}=x(),O=n("cache"),R=n({site_name:"",domain_list:[],site_port:[],port_conf:"",ssl_port_conf:"",site_path:"",ssl_info:{},err_age_404:"",err_age_502:"",ip_limit:{ip_black:[],ip_white:[]},basic_auth:[],proxy_cache:{},gzip:{},sub_filter:{},websocket:{},security:{},redirect:{},proxy_log:{},http_block:"",server_block:"",remark:"",proxy_info:[]}),D=async()=>{const e=await g({site_name:T.value.name});e.status?R.value=e.data:A.error(e.msg)},V=n(!1),N=n(!1),B=n(),C=o({status:!1,time:"",unit:"m"}),S=[{label:"分钟",value:"m"},{label:"小时",value:"h"},{label:"天",value:"d"}],U=[{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"}],M={time:[{required:!0,message:"请输入正确的缓存时间",trigger:"blur",validator:(e,a,t)=>{a?isNaN(Number(a))?t(new Error("请输入数字")):Number(a)<1?t(new Error("请输入正确数字")):t():t(new Error("目标URL不能为空"))}},{}]},W=async()=>{await e({title:"清理缓存【".concat(T.value.name,"】"),width:"35rem",icon:"warning-filled",content:"清理后包含所有URL的及站点的缓存都会被清空,是否继续?"}),await a({loading:"正在清理缓存,请稍后...",request:h({site_name:T.value.name}),message:!0})},H=async()=>{let e={site_name:T.value.name,cache_status:C.status?1:0,expires:"".concat(C.time).concat(C.unit)};await B.value.validate(),await a({loading:N,request:d(e),message:!0})},K=n(),X=o({status:!1,type:"",level:1,minLength:"",unit:"m"}),F=[{label:"k",value:"k"},{label:"m",value:"m"}],G=[{content:"用于对 HTTP 响应的内容进行压缩,以减少数据传输量,提高网站性能和加载速度"},{content:"压缩级别1-9,例如:1为压缩速度最快,但压缩率较低;9为压缩速度最慢,但压缩率最高,建议默认"},{content:"如果开启gzip后影响网站正常访问,请关闭此功能 和请求参数组成"}],J={type:[{required:!0,message:"请输入压缩类型",trigger:["blur","change"]}],minLength:[{required:!0,message:"请输入正确的压缩最小长度",trigger:"blur",validator:(e,a,t)=>{a?isNaN(Number(a))?t(new Error("请输入数字")):Number(a)<1?t(new Error("请输入正确数字")):t():t(new Error("压缩最小长度不能为空"))}},{}]},Q=e=>{X.status=e.gzip_status,X.type=e.gzip_types,X.level=e.gzip_comp_level;let a="",t="m";e.gzip_min_length&&e.gzip_min_length.length>1&&(a=e.gzip_min_length.slice(0,-1),t=e.gzip_min_length.slice(-1)),X.minLength=a,X.unit=t},Y=async()=>{const e={site_name:T.value.name,gzip_status:X.status?1:0,gzip_min_length:"".concat(X.minLength).concat(X.unit),gzip_comp_level:X.level,gzip_types:X.type};await K.value.validate();return(await a({loading:N,request:b(e),message:!0})).status},Z=o({loading:!1,type:"black",white:[],black:[]}),$=n(),ee=n(),ae=e=>{Z.type="ipBlackList"===O.value?"black":"white",Z.white=e.ip_white.map((e=>({ip:e,type:"white"}))),Z.black=e.ip_black.map((e=>({ip:e,type:"black"})))},te=async t=>{const s=!!Array.isArray(t);await e({title:"".concat(s?"批量删除IP":"删除".concat("white"===t.type?"白名单":"黑名单","【").concat(t.ip,"】")),content:s?"批量删除选中的IP,是否继续操作?":"删除".concat("white"===t.type?"白名单":"黑名单","【").concat(t.ip,"】,是否继续操作?")});let i={site_name:T.value.name};s?(i.ip_type="ipBlackList"===O.value?"black":"white",i.ips=t.map((e=>e.ip)).join("\n")):(i.ip_type=t.type,i.ip=t.ip);const r=s?L:j;(await a({loading:"正在删除,请稍后...",request:r(i),message:!0})).status&&D()},se=n([z({key:"ip"}),{label:"IP",prop:"ip",minWidth:120},I([{title:"删除",onClick:e=>{te(e)}}])]),ie=[{label:"删除IP",value:"delete",event:async(e,a,t,s,i)=>{const r=async e=>await j({site_name:T.value.name,ip:e.ip,ip_type:"ipBlackList"===O.value?"black":"white"});await e({title:"批量删除",content:"批量删除选中的ip,是否继续操作?",column:[{prop:"ip",label:"IP"},P()],onConfirm:async()=>(await a(r),D(),!1)})}}],re=()=>{le.value.address="",t({isAsync:!0,title:"添加IP".concat("ipBlackList"===O.value?"黑":"白","名单"),area:40,btn:"确认",component:()=>s((()=>import("./add-ip2.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url),compData:{listType:Z.type,refreshEvent:()=>{D()}}})},le=n({types:Z.type,address:""}),ne=[{content:"一行一条配置,多个IP请换行"}],oe=n(),pe={address:[{validator:(e,a,t)=>{a.length>0?t():t(new Error("请输入IP地址"))},trigger:["blur","change"]}]},ce=async()=>{const{address:e}=le.value,t={site_name:T.value.name,ip_type:"ipBlackList"===O.value?"black":"white",ips:e},s=await a({loading:N,request:v(t),message:!0});return s.status&&D(),s.status},ue=n([]),me=e=>{he.value=e||!1,t({isAsync:!0,title:"".concat(e?"编辑":"添加","http认证").concat(e?"【".concat(e.auth_name,"】"):""),area:48,btn:"确认",component:()=>s((()=>import("./http-auth-add2.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url),compData:{refreshEvent:D,proxy_info:R.value.proxy_info,isEdit:!!e,row:e}})},_e=n([{label:"名称",prop:"auth_name"},{label:"路径",prop:"auth_path"},I([{onClick:me,title:"编辑"},{onClick:async t=>{await e({title:"删除http认证【".concat(t.auth_name,"】"),content:"删除http认证【".concat(t.auth_name,"】,是否继续操作?")});(await a({loading:"正在删除http认证,请稍候...",request:f({site_name:T.value.name,auth_path:t.auth_path,name:t.auth_name}),message:!0})).status&&D()},title:"删除"}])]),ge=e=>{ue.value=e||[]},he=n(),de=n({name:i(5),path:"",user:"",password:""}),be=[{content:"例如我设置了加密访问/test/,那我访问http://aaa.com/test/时就要输入账号密码才能访问"}],ve=n(),ye={name:[{required:!0,message:"请输入名称",trigger:["blur","change"]}],path:[{required:!0,message:"请输入路径",trigger:["blur","change"]}],user:[{required:!0,message:"请输入用户名",trigger:["blur","change"]}],password:[{required:!0,message:"请输入密码",trigger:["blur","change"]}]},we=(e,a)=>{const t=R.value.proxy_info.map((e=>({value:e.proxy_path})));a(e?t.filter((a=>a.value.includes(e))):t)},fe=async()=>{let e=de.value;await ve.value.validate();const t={site_name:T.value.name,auth_path:e.path,username:e.user,password:e.password,name:e.name},s=he.value?k:E,i=await a({loading:N,request:s(t)});return i.status&&D(),i.status},ke=()=>{Object.assign(de.value,{name:he.value?he.value.auth_name:i(5),path:he.value?he.value.auth_path:"",user:"",password:""})},Ee=n(),Le=o({type:"default",accessLog:"",address:"",port:"514"}),je={accessLog:[{validator:(e,a,t)=>{"file"!==Le.type||a?t():t(new Error("请选择日志目录"))},trigger:["blur","change"]}],address:[{validator:(e,a,t)=>{"rsyslog"!==Le.type||a?t():t(new Error("请输入接收地址"))},trigger:["blur","change"]}]},ze=[{content:"指定目录可选择自定义的日志存储目录,请注意此目录必须www用户可写"},{content:"发送到远程服务器设置之后本地不会保存日志内容,填写前请确保日志接收端可正常访问"}],Ie=[{label:"默认",value:"default"},{label:"不记录日志",value:"off"},{label:"指定目录",value:"file"},{label:"发送到远程服务器",value:"rsyslog"}],Pe=e=>{q({type:"dir",path:"/www/wwwroot",change:e=>{Le.accessLog=e}})},qe=e=>{e?(Le.type=e.log_type,Le.accessLog=e.log_path,Le.address=e.rsyslog_host):Le.type="default"},xe=async()=>{await Ee.value.validate();const e={site_name:T.value.name,log_type:Le.type,log_path:"file"==Le.type?Le.accessLog:Le.address};return(await a({loading:N,request:y(e),message:!0})).status},Ae=o({websocket:!1}),Te=async e=>{(await a({loading:N,request:w({site_name:T.value.name,websocket_status:e?1:0}),message:!0})).status||(Ae.websocket=!e)},Oe=e=>{Ae.websocket=!!e&&e.websocket_status},Re=p({__name:"index",setup(e){const{BtTabs:a}=l({type:"card",value:O,options:[{label:"缓存",name:"cache",lazy:!0,render:()=>s((()=>import("./cache.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)},{label:"内容压缩",name:"compress",lazy:!0,render:()=>s((()=>import("./content-compression.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)},{label:"IP黑名单",name:"ipBlackList",lazy:!0,render:()=>s((()=>import("./ip-list.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)},{label:"IP白名单",name:"ipWhiteList",lazy:!0,render:()=>s((()=>import("./ip-list.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)},{label:"http认证",name:"basicauth",lazy:!0,render:()=>s((()=>import("./http-auth.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)},{label:"日志",name:"siteLogs",lazy:!0,render:()=>s((()=>import("./log.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)},{label:"websocket",name:"websocket",lazy:!0,render:()=>s((()=>import("./websocket.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)}]});return c((()=>O.value),(e=>{D()})),D(),(e,t)=>(u(),m(_(a)))}}),De=Object.freeze(Object.defineProperty({__proto__:null,default:Re},Symbol.toStringTag,{value:"Module"}));export{De as $,_e as A,me as B,qe as C,xe as D,Le as E,Ie as F,Pe as G,Ee as H,je as I,ze as J,Oe as K,Ae as L,Te as M,ce as N,le as O,ne as P,oe as Q,pe as R,ke as S,ie as T,fe as U,de as V,he as W,we as X,be as Y,ve as Z,ye as _,W as a,B as b,C as c,M as d,N as e,V as f,U as g,R as h,X as i,Y as j,K as k,F as l,J as m,G as n,H as o,O as p,ee as q,$ as r,Q as s,S as t,re as u,ae as v,Z as w,se as x,ge as y,ue as z}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel