← Back
Editing: index421.js
import{_ as a}from"./index120.js?v=1765440387";import{u as e,M as t,o as s,l as o,L as n,K as l,at as i,aq as p,c as r,j as c,W as d,_ as u,e as m}from"./utils-lib.js?v=1765440387";import{j as h,r as v,s as y,k as f,c as _,p as g,G as w,H as P,x,q as k,v as b,y as T,e as C,A as I,F as V,a$ as H,I as j,M as S,B as L,C as q,z as A,ak as O,D as R,am as D,aX as E,aj as U}from"./base-lib.js?v=1765440387";import{_ as N}from"./index92.js?v=1765440387";import{k as z,p as M}from"./validator.js?v=1765440387";import{cH as B,dC as F,dD as G,dE as K,dF as W,dG as $,dH as J,cE as X,dI as Q,v as Y,dJ as Z,dK as aa,dL as ea}from"./site.js?v=1765440387";import{u as ta,S as sa}from"./useStore3.js?v=1765440387";import{u as oa}from"./useController5.js?v=1765440387";import"./useController6.js?v=1765440387";const na=h("WP-LOCAL-Config-STORE",()=>({tabActive:v("domain"),isRefreshDomain:v(!1),domain:v(""),showSSLTips:v(!1),sslTabActive:v("current")})),{localRow:la}=y(oa());y(na());const{payment:ia}=e(),{authType:pa}=ia.value,{siteInfo:ra,isRefreshList:ca}=ta(),{setSiteInfo:da}=sa(),{isRefreshLocalList:ua}=y(oa()),ma=v(null),ha=f({phpVersion:"",other:"",options:[],helpIndex:0,toggleShow:!1,noInstall:!1}),va=v(""),ya=f({status:!1}),fa=f({status:!1,version:"",deCompatible:!1,today:0,total:0,tips:!0,tipsIndex:0,safeTip:{show:!1,alarmTip:!1,safeTip:!1,allTip:!1}}),_a=f({list:[],path:""}),ga=v(!1),wa=[[{content:"请根据您的程序需求选择版本"}],[{content:"请根据您的程序需求选择版本"},{content:"【自定义】可自定义PHP连接信息,选择此项需填写可用的PHP连接配置"},{content:"【自定义】当前仅支持nginx,可配合[宝塔负载均衡 - 重构版]插件的TCP负载功能实现PHP负载集群"},{content:"【PHP连接配置】支持TCP或Unix配置,示例:192.168.1.25:9001 或 unix:/tmp/php8.sock"}],[{content:"请根据您的程序需求选择版本"},{content:"PHP7不支持mysql扩展,默认安装mysqli以及mysql-pdo。"}],[{content:"请根据您的程序需求选择版本"},{content:"若非必要,请尽量不要使用PHP5.2,这会降低您的服务器安全性;"}]],Pa=[{content:"开启后将会把session文件存放到独立文件夹,不与其他站点公用存储位置"},{content:"若您在PHP配置中将session保存到memcache/redis等缓存器时,请不要开启此选项"}],xa=[{content:"基于PHP内核的监控工具,实时监控网站木马、漏洞等其他入侵行为,发现木马支持自动隔离"},{content:"安全告警默认会监视当前网站访问非当前网站文件的行为(例:你的站点A.com访问了站点B.com的文件或者目录),通过添加监视器路径,当路径被访问时发送告警/redis等缓存器时,请不要开启此选项"}],ka=a=>{ha.phpVersion=a,ha.toggleShow=a!==fa.version,ha.noInstall=ha.options.some(e=>e.key===a&&(null==e?void 0:e.noInstall)),ba(a)},ba=a=>{switch(a){case"other":ha.helpIndex=1;break;case"52":ha.helpIndex=3;break;default:"7"===a[0]?ha.helpIndex=2:ha.helpIndex=0}},Ta=async()=>{try{const{data:a}=await X({sitename:ra.value.name});a.data.is_power_on=1===a.data.is_power_on,da(a.data)}catch(a){}},Ca=a=>{ha.other=a,a!==va.value?ha.toggleShow=!0:ha.toggleShow=!1},Ia=async()=>{var a;if("phpasync"===(null==(a=ra.value)?void 0:a.project_type)){let a=t.load("正在保存,请稍后..."),e={sitename:ra.value.name,...ra.value,is_power_on:ra.value.is_power_on?1:0,...ra.value.project_config,php_version:ha.phpVersion};delete e.status,delete e.ps,delete e.project_config;const s=await B(e);return a.close(),t.request(s),void(s.status&&(Ta(),ca.value=!0,ha.toggleShow=!1))}if("other"===ha.phpVersion&&""===ha.other)return t.error("自定义PHP版本时,PHP连接配置不能为空"),void ma.value.$refs.inputRef.focus();const e=await F({siteName:ra.value.name,version:ha.phpVersion,other:ha.other});e.status?(t.request(e),ca.value=!0,ua.value=!0,ha.toggleShow=!1):t.msg({customClass:"bt-message-error-html",dangerouslyUseHTMLString:!0,message:e.msg||e,type:"error",duration:0,showClose:!0}),e.status&&(za(),(async()=>{la.value.php_version_status=!0})())},Va=async a=>{const e=a?1:0,s=await G({id:ra.value.id,act:e});t.request(s),Oa()},Ha=async a=>{fa.tips=!0,fa.version=a;if(fa.tips=["52","00","82"].includes(a),fa.tips)return void(fa.tipsIndex=0);const{data:e}=await p({sName:"security_notice"});fa.tips=!0,!(null==e?void 0:e.setup)&&e.endtime>=0?fa.tipsIndex=1:e.endtime<0?fa.tipsIndex=2:(fa.tips=!1,await Ra())},ja=async a=>{try{if(fa.safeTip.safeTip)return fa.status=!fa.status,void t.error("请先开启PHP-".concat(fa.version,"防护"));if(fa.deCompatible)return fa.status=!fa.status,t.error("当前版本不兼容安全防护功能");await s({title:"".concat(a?"开启":"关闭","站点安全告警"),width:"35rem",icon:"warning-filled",content:a?"开启后,检测到安全问题时将会发送告警通知,是否继续?":"关闭后,该网站将不再接收安全告警,是否继续?"});const e=await K({siteName:ra.value.name},a);e.status?t.request(e):(fa.status=!fa.status,t.error("当前PHP版本未开启防护,无法设置该站点!"))}catch(e){fa.status=!fa.status}},Sa=()=>{o({area:93,isAsync:!0,title:"【".concat(ra.value.name,"】监视器"),component:()=>n(()=>import("./index460.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),compData:{data:_a.list,name:ra.value.name,path:_a.path}})},La=async()=>{const a=await W({siteName:ra.value.name,page:1,limit:10});a.status?0!=a.data.data.length?o({area:93,isAsync:!0,title:"【".concat(ra.value.name,"】网站安全日志"),component:()=>n(()=>import("./index461.js?v=1765440387").then(a=>a.f),__vite__mapDeps([]),import.meta.url),compData:{data:a.data.data,page:a.data.page}}):t.error("暂无日志"):t.error(a.msg)},qa=async()=>{},Aa=async()=>{await s({title:"开启【PHP-".concat(fa.version,"】防护"),width:"35rem",icon:"warning-filled",content:"开启后,该版本下的所有站点将受到安全防护,是否继续?"}),await l({loading:"正在开启防护,请稍后...",request:$({php_version:fa.version,enable:1}),message:!0}),za()},Oa=async()=>{try{const a=await J({id:ra.value.id});a.status&&(ya.status=a.data)}catch(a){i(a)}},Ra=async()=>{var a,e,s,o;try{const n=await Z();if((null==(a=n.data.msg)?void 0:a.includes("插件不存在"))||(null==(e=n.data.msg)?void 0:e.includes("未购买"))||(null==(s=n.data.msg)?void 0:s.includes("已到期")))return fa.tips=!0,fa.tipsIndex=1,"ltd"!==pa&&(fa.tipsIndex=2),t.error(n.data.msg),!1;const l=n.data.send,i=await aa();!1===i.status&&t.error(i.msg);const p=i.data.php_versions.filter(a=>a.v===fa.version)||[],r=p.length>0&&1!==(null==(o=null==p?void 0:p.at(0))?void 0:o.state);!r&&l||(!l&&(fa.safeTip.alarmTip=!0),r&&!l&&(fa.safeTip.allTip=!0),r&&(fa.safeTip.safeTip=!0),fa.safeTip.show=!0),r||(fa.safeTip.safeTip=!1,fa.safeTip.allTip=!1),l&&(fa.safeTip.alarmTip=!1,fa.safeTip.allTip=!1),!r&&l&&(fa.safeTip.show=!1);const c=await ea();c.status||t.error(c.msg);const d=c.data.sites.find(a=>a.path===ra.value.path&&a.site_name===ra.value.name);d&&(fa.today=d.total.day_total||0,fa.total=d.total.total||0,fa.status=d.open,fa.deCompatible=-1!=d.version.indexOf("暂不兼容"),Da(d.config.file_info),_a.path=d.path)}catch(n){i(n)}},Da=a=>{const e=[];for(const t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push({...a[t],path:t});_a.list=e},Ea=async a=>{try{const e=(a||ha.phpVersion).split(""),t="php-".concat(e[0],".").concat(e[1]);z({type:"i",name:t})}catch(e){}},Ua=async()=>{try{await z({type:"i",name:"security_notice"})}catch(a){}},Na=()=>{M({sourceId:114})},za=async()=>{var a;ga.value=!0;try{"phpasync"===(null==(a=ra.value)?void 0:a.project_type)&&await Ta(),await(async()=>{var a;if("phpasync"===(null==(a=ra.value)?void 0:a.project_type))ha.phpVersion=ra.value.php_version.replace(".",""),Ha(ha.phpVersion);else{const a=await Q({siteName:ra.value.name});a.status&&(ha.phpVersion=a.data.phpversion,"other"==ha.phpVersion&&(va.value=a.data.php_other,ha.other=a.data.php_other),Ha(a.data.phpversion))}})(),await(async()=>{var a,e,t;let s={s_type:1,all:1};"phpasync"===(null==(a=ra.value)?void 0:a.project_type)&&delete s.s_type;const o=await Y(s);if(o.status&&o.data.length>0){const a="phpasync"===(null==(e=ra.value)?void 0:e.project_type)?null==(t=o.data)?void 0:t.filter(a=>"纯静态"!==a.name):o.data;ha.options=a.map(a=>({title:a.name+(a.status?"":" (未安装)"),label:a.name,key:a.version,status:a.status}));const s=ha.options.find(a=>a.key===ha.phpVersion);ha.toggleShow=!1,ha.noInstall=!s.status,s||(ha.options.push({title:"PHP-".concat(ha.phpVersion,"(未安装)"),key:ha.phpVersion,noInstall:!0}),ha.noInstall=!0)}})(),await Oa()}catch(e){}finally{ga.value=!1}},Ma={class:"border-b border-dashed border-[#ccc] mb-[2.2rem] pb-[2.2rem]"},Ba={class:"flex mb-[20px]"},Fa={class:"border-b border-dashed border-[#ccc] my-[2.2rem] pb-[2.2rem]"},Ga={class:"flex mb-[20px]"},Ka={class:"my-[2.2rem] relative"},Wa={class:"flex mb-[20px] items-center"},$a={class:"title-span"},Ja={class:"ml-[2rem]"},Xa={class:"ml-[2rem]"},Qa={class:"w-[37rem] ml-[2rem]"},Ya={key:1},Za={class:"flex mb-[20px]"},ae={class:"text-[1.2rem] flex items-center font-bold"},ee=m(_({__name:"index",setup:(e,{expose:t})=>(g(za),t({init:za}),(e,t)=>{const s=r,o=U,n=O,l=c,i=R,p=d,m=D,h=N,v=E,y=u,f=a,_=w("bt-loading");return P((k(),b("div",null,[T("div",Ma,[T("div",Ba,[t[10]||(t[10]=T("div",{class:"title-span"},"PHP版本",-1)),C(n,{modelValue:x(ha).phpVersion,"onUpdate:modelValue":t[0]||(t[0]=a=>x(ha).phpVersion=a),placeholder:"请选择PHP版本",class:"!w-[14rem] mr-1rem",onChange:x(ka)},{default:I(()=>[(k(!0),b(V,null,H(x(ha).options,(a,e)=>(k(),S(o,{key:e,label:a.title,value:a.key,disabled:!a.status},{default:I(()=>[T("span",null,[T("span",null,A(a.label),1),a.status?q("",!0):(k(),b(V,{key:0},[t[6]||(t[6]=L(" [ ",-1)),C(s,{class:"my-[4px]",onClick:e=>x(Ea)(a.key)},{default:I(()=>[...t[5]||(t[5]=[L("未安装",-1)])]),_:1},8,["onClick"]),t[7]||(t[7]=L(" ] ",-1))],64))])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","onChange"]),P(C(l,{modelValue:x(ha).other,"onUpdate:modelValue":[t[1]||(t[1]=a=>x(ha).other=a),x(Ca)],ref:"otherInput",class:"mr-[.5rem]",width:"30rem",placeholder:"连接配置,如:1.1.1.1:9001或unix:/tmp/php.sock"},null,8,["modelValue","onUpdate:modelValue"]),[[j,"other"===x(ha).phpVersion]]),x(ha).toggleShow?(k(),S(i,{key:0,type:"primary",class:"mr-1rem",onClick:x(Ia)},{default:I(()=>[...t[8]||(t[8]=[L("切换",-1)])]),_:1},8,["onClick"])):q("",!0),x(ha).noInstall?(k(),S(i,{key:1,type:"primary",onClick:t[2]||(t[2]=a=>x(Ea)())},{default:I(()=>[...t[9]||(t[9]=[L("安装",-1)])]),_:1})):q("",!0)]),C(p,{options:x(wa)[x(ha).helpIndex],class:"ml-[20px] mt-[20px]"},null,8,["options"])]),T("div",Fa,[T("div",Ga,[t[11]||(t[11]=T("div",{class:"title-span"},"session隔离",-1)),C(m,{modelValue:x(ya).status,"onUpdate:modelValue":t[3]||(t[3]=a=>x(ya).status=a),onChange:x(Va)},null,8,["modelValue","onChange"])]),C(p,{options:x(Pa),class:"ml-[20px] mt-[20px]"},null,8,["options"])]),T("div",Ka,[T("div",Wa,[T("div",$a,[C(h,{name:"icon-ltd",size:"1.6",class:"mr-[4px]"}),t[12]||(t[12]=L(" 站点防护 ",-1))]),C(m,{modelValue:x(fa).status,"onUpdate:modelValue":t[4]||(t[4]=a=>x(fa).status=a),onChange:x(ja)},null,8,["modelValue","onChange"]),T("span",Ja,"今日:"+A(x(fa).today),1),T("span",Xa,"总告警数:"+A(x(fa).total),1),P(T("div",Qa,[C(v,{type:"warning",closable:!1},{title:I(()=>[t[14]||(t[14]=T("span",null,"未启用PHP安全告警,请先",-1)),x(fa).safeTip.alarmTip?(k(),S(s,{key:0,type:"danger",onClick:x(qa),class:"!inline-block"},{default:I(()=>[...t[13]||(t[13]=[L("设置告警",-1)])]),_:1},8,["onClick"])):q("",!0),x(fa).safeTip.allTip?(k(),b("span",Ya,"和")):q("",!0),x(fa).safeTip.safeTip?(k(),S(s,{key:2,type:"danger",onClick:x(Aa)},{default:I(()=>[L("开启PHP-"+A(x(fa).version)+"防护",1)]),_:1},8,["onClick"])):q("",!0)]),_:1})],512),[[j,x(fa).safeTip.show]])]),T("div",Za,[C(i,{type:"default",class:"!mr-[12px]",onClick:x(Sa)},{default:I(()=>[...t[15]||(t[15]=[L("监视器",-1)])]),_:1},8,["onClick"]),C(i,{type:"default",onClick:x(La)},{default:I(()=>[...t[16]||(t[16]=[L("触发日志",-1)])]),_:1},8,["onClick"])]),C(p,{options:x(xa),class:"ml-[20px] mt-[20px]"},null,8,["options"]),x(fa).tips?(k(),S(f,{key:0},{content:I(()=>[C(y,{icon:"el-warning",size:"20",class:"mr-[8px]",color:"orange"}),T("div",ae,[0===x(fa).tipsIndex?(k(),b(V,{key:0},[L("当前PHP版本不兼容此功能,请切换其他PHP版本")],64)):q("",!0),1===x(fa).tipsIndex?(k(),b(V,{key:1},[t[18]||(t[18]=L(" 如需使用【PHP网站安全告警】功能,请先安装, ",-1)),C(s,{onClick:x(Ua)},{default:I(()=>[...t[17]||(t[17]=[L("点击安装",-1)])]),_:1},8,["onClick"])],64)):q("",!0),2===x(fa).tipsIndex?(k(),b(V,{key:2},[t[20]||(t[20]=L(" 如需使用【PHP网站安全告警】功能,请先购买, ",-1)),C(s,{onClick:x(Na)},{default:I(()=>[...t[19]||(t[19]=[L("点击购买",-1)])]),_:1},8,["onClick"])],64)):q("",!0)])]),_:1})):q("",!0)])])),[[_,x(ga)]])})}),[["__scopeId","data-v-ffd6aa29"]]),te=Object.freeze(Object.defineProperty({__proto__:null,default:ee},Symbol.toStringTag,{value:"Module"}));export{te as i,_a as m}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel