File: /www/server/panel/BTPanel/static/js/index63.js
import{c as R,da as ae,dF as ne,cT as le,gp as re,db as ie,c_ as ue,cZ as j,k as E,e as V,_ as k,w as J,M as ce,W as pe,cR as de}from"./utils-lib.js?v=1777008528";import{c as I,j as C,C as q,v as g,e as r,x as y,p as e,z as P,aI as $,I as me,k as L,q as n,y as A,J as ge,M as B,bm as _e,ap as fe,aW as ye,U as ve,bw as be,r as T,o as we,Q as M,s as H,N as Ce}from"./base-lib.js?v=1777008528";import{L as N,k as xe}from"./useStore9.js?v=1777008528";import{u as Se,A as he}from"./index207.js?v=1777008528";import{_ as Le}from"./index118.js?v=1777008528";import{L as z,B as F,C as Ve,d as ke}from"./useController27.js?v=1777008528";import{_ as Ee}from"./index131.js?v=1777008528";import{_ as Ae}from"./index206.js?v=1777008528";import{k as Te,aI as De}from"./index3.js?v=1777008528";import{bA as We,bB as Oe}from"./firewall.js?v=1777008528";const Re=I({__name:"index",setup(t,{expose:a}){R();const l=z(),{getOperateLog:i,outLogs:d}=l,{isRefreshList:c}=F(),{BtTable:x,BtPage:S,BtSearch:w,BtRefresh:s,refresh:h}=ae({request:f=>{const{search:_,...p}=f;return i({keywords:_,...p,stype:"网站管理"})},columns:[{label:"用户",prop:"username",width:180},{label:"操作类型",prop:"type",width:100},{label:"详情",render:function(f){const p=new DOMParser().parseFromString(f.log,"text/html");return r("span",{innerHTML:ne(p.body.innerHTML)},null)}},{label:"操作时间",width:150,prop:"addtime",align:"right"}],extension:[le(c)]});return a({init:h}),(f,_)=>{const p=P,o=Le;return C(),q(o,null,{"header-left":g(()=>[r(p,{onClick:e(d)},{default:g(()=>[..._[0]||(_[0]=[y("导出日志",-1)])]),_:1},8,["onClick"])]),"header-right":g(()=>[r(e(w),{class:"mr-1rem !w-[24rem]",placeholder:"请输入搜索关键字"}),r(e(s))]),content:g(()=>[r(e(x))]),"footer-right":g(()=>[r(e(S))]),_:1})}}}),Ie={class:"flex flex-col"},Pe={class:"flex items-center justify-end mb-[12px]"},$e={class:"flex justify-between w-full flex-wrap"},Ne={class:"flex items-center text-small"},ze={class:"pl-[1rem] mr-[8px]"},Ue={class:"flex items-center mt-4px"},Be={class:"ml-1rem"},Me=I({__name:"index",setup(t,{expose:a}){const{mainHeight:l,adHideInfo:i}=R(),d=z(),{logParams:c,logMsg:x,preLoading:S}=$(d),w=[{label:"运行日志",value:"access"},{label:"异常日志",value:"error"}],{containerRef:s,tipStyle:h,selectedText:f,handleAiAnalyze:_}=re({getPrompt:p=>{const o=c.value.typeValue==="access"?"运行":"异常";return"这是我宝塔面板的网站".concat(b.value,"的").concat(o,"日志,帮我分析是否有安全风险:\n")}});return a({init:()=>O("WebLogs")}),(p,o)=>{const U=P,Y=fe,Q=ye,Z=ve,X=ie,ee=be,te=ue,se=Ee,oe=me("bt-loading");return C(),L("div",Ie,[n("div",Pe,[n("div",$e,[n("div",Ne,[r(U,{type:"default",onClick:e(it)},{default:g(()=>[...o[7]||(o[7]=[y(" 清理日志 ",-1)])]),_:1},8,["onClick"]),r(U,{type:"default",class:"!mr-[8px]",onClick:e(ut)},{default:g(()=>[...o[8]||(o[8]=[y(" 导出日志 ",-1)])]),_:1},8,["onClick"]),r(Y,{modelValue:e(c).keywordSwitch,"onUpdate:modelValue":o[0]||(o[0]=m=>e(c).keywordSwitch=m),width:36,onChange:e(pt)},null,8,["modelValue","onChange"]),n("span",ze,[r(Q,{content:"点击开启日志关键词告警",placement:"top"},{default:g(()=>[...o[9]||(o[9]=[n("span",null,[n("span",{class:"lt-xl:hidden"},"关键词"),y("告警 ")],-1)])]),_:1}),n("span",{class:"cursor-pointer text-primary",onClick:o[1]||(o[1]=(...m)=>e(W)&&e(W)(...m))}," [配置] ")]),e(c).typeValue==="access"&&!e(i).logIp?(C(),q(Z,{key:0,modelValue:e(c).ipArea,"onUpdate:modelValue":o[2]||(o[2]=m=>e(c).ipArea=m),class:"pr-[2rem]",onChange:e(dt)},{default:g(()=>[...o[10]||(o[10]=[n("div",{class:"flex items-center"},[n("span",{class:"text-small"},"显示IP归属地"),n("i",{class:"svgtofont-icon-ltd text-ltd !text-extraLarge"})],-1)])]),_:1},8,["modelValue","onChange"])):A("",!0)]),n("div",Ue,[r(X,{type:"button",size:"default",class:"mr-1rem",modelValue:e(c).typeValue,"onUpdate:modelValue":o[3]||(o[3]=m=>e(c).typeValue=m),onChange:e(v),options:w},null,8,["modelValue","onChange"]),r(ee,{modelValue:e(c).timeValue,"onUpdate:modelValue":o[4]||(o[4]=m=>e(c).timeValue=m),format:"YYYY/MM/DD","value-format":"x",onChange:e(v),type:"daterange","range-separator":"-","disabled-date":e(rt),"start-placeholder":"开始",class:"!lt-xl:w-[12rem] !at-lg:w-[12rem] !at-xl:w-[12rem] !w-[20rem]","end-placeholder":"结束"},null,8,["modelValue","onChange","disabled-date"]),n("div",Be,[r(te,{class:"!lt-xl:w-[16rem] !w-[24rem]",modelValue:e(c).searchValue,"onUpdate:modelValue":o[5]||(o[5]=m=>e(c).searchValue=m),placeholder:"请输入搜索关键字",onSearch:e(v)},null,8,["modelValue","onSearch"])]),r(se,{class:"ml-1rem",onRefresh:e(v)},null,8,["onRefresh"])])])]),n("div",{class:"relative",ref_key:"logContainerRef",ref:s},[ge(r(Ae,{content:e(x),isHtml:!0,autoScroll:!0,fullScreen:{title:"全屏查看-日志",onRefresh:()=>e(O)("WebLogs")},"ai-tips":{name:e(b),logType:e(c).typeValue==="access"?"运行":"异常"},style:B("height:"+(e(l)-292)+"px;min-height:400px;width: 99.5%")},null,8,["content","fullScreen","ai-tips","style"]),[[oe,e(S)]]),r(_e,{name:"tip-fade"},{default:g(()=>[e(f)?(C(),L("div",{key:0,class:"log-ai-tip",style:B(e(h)),onClick:o[6]||(o[6]=(...m)=>e(_)&&e(_)(...m))},[...o[11]||(o[11]=[n("img",{src:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='14' fill='none'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='3.001' x2='12.142' y1='0' y2='1.302' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%23C2C63E'/%3E%3Cstop offset='1' stop-color='%2329A73A'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' x1='11.464' x2='15.12' y1='9.333' y2='9.853' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%23C2C63E'/%3E%3Cstop offset='1' stop-color='%2329A73A'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cg fill-rule='evenodd'%3E%3Cpath fill='url(%23a)' d='m7.52 4.258 4.322 1.576L7.52 7.41 5.921 11.67l-1.6-4.259L0 5.834l4.322-1.576L5.922 0z'/%3E%3Cpath fill='url(%23b)' d='m13.271 11.036 1.73.63-1.73.63-.64 1.704-.64-1.703-1.728-.63 1.729-.631.64-1.703z'/%3E%3C/g%3E%3C/svg%3E",class:"ai-icon"},null,-1),n("span",{class:"tip-text"},"AI分析",-1)])],4)):A("",!0)]),_:1})],512)])}}}),He=j(Me,[["__scopeId","data-v-567a2092"]]),{selectedWebSite:b,webTabActive:At,outDataForm:Ge,configData:je}=$(N()),{clearWebLogEvent:Je,outWebLogEvent:Tt,setKeyWordConfigEvent:qe,onConfirmKeyConfig:Fe,getKeywordAlarmData:K,delLogSourceEvent:Ke,sendSourceConfirm:Ye,getLogSystemSite:Qe,getSiteLogsData:Ze,logSystemConfirm:Xe}=z(),{logParams:u,isRefreshLogSystem:et,isRefreshList:tt,logSystemList:G}=F(),{payment:st}=R(),{isRefreshList:ot,routeData:at}=Se(),nt=[{label:"网站日志",name:"WebLogs",lazy:!0,render:()=>r(He,null,null)},{label:"操作日志",name:"OperateLog",lazy:!0,render:()=>r(Re,null,null)},{label:"web日志分析",name:"WebLogAnalysis",lazy:!0,render:()=>r(he,null,null)}],D=T([]),lt=async()=>{const{msg:t}=await E({loading:"正在获取网站列表,请稍后...",request:xe(),data:{msg:Array}});return Array.isArray(t)?(b.value=Array.isArray(t)&&t[0]||"",D.value=t.map(a=>({label:a,value:a})),t):(D.value=[],[])},rt=t=>t.getTime()>Date.now(),it=()=>{V({title:"清理【"+b.value+"】网站日志",area:44,component:()=>k(()=>import("./index333.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{tips:"清理相关日志可能会导致故障排查困难,请谨慎操作",type:"website",clearEvent:async(a,l)=>{const i=Ve(a),d=await Je(i,l);return v(),d.status}},showFooter:!0})},ut=()=>{Ge.value.type=N().getType("website"),je.value={type:"website"},V({title:"导出日志",area:44,component:()=>k(()=>import("./index160.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),showFooter:!0,compData:{type:"website"}})},ct=()=>{let t={ip_area:u.value.ipArea?1:0,siteName:b.value,search:u.value.searchValue};return u.value.timeValue&&(u.value.timeValue[0]=new Date(u.value.timeValue[0]).setHours(0,0,0,0),u.value.timeValue[1]=new Date(u.value.timeValue[1]).setHours(23,59,59,0),t.time_search=JSON.stringify([u.value.timeValue[0]/1e3,u.value.timeValue[1]/1e3])),u.value.searchValue||delete t.search,t},v=()=>{const t=ct();Ze(t),u.value.typeValue!=="error"&&K()},W=()=>{V({title:"关键字告警配置",area:62,component:()=>k(()=>import("./keyword-config.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),showFooter:!0})},pt=async t=>{const{keywordConfig:a}=u.value;if((!a.keys.length||!a.channel||!a.cycle)&&t){u.value.keywordSwitch=!t,W();return}const l={sitename:b.value};t&&(l.cycle=u.value.keywordConfig.cycle,l.keys=JSON.stringify(u.value.keywordConfig.keys),l.channel=u.value.keywordConfig.channel);const{status:i}=await qe(l);i&&(u.value.keywordSwitch=t)},dt=t=>{if(st.value.authType!=="ltd")return u.value.ipArea=!t,Te({sourceId:107});v()},Dt=async(t,a,l)=>{try{await a();const i={cycle:t.value.cycle,channel:t.value.give.join(","),keys:JSON.stringify(t.value.keyword.split(","))},d=await Fe(i);return K(),d.status}catch(i){}},Wt=async t=>{await J({title:"删除【"+t.site_name+"】日志源",icon:"warning-filled",content:"是否删除【"+t.site_name+"】?"});const a={server_id:t.server.id,source_type:t.source_type,source_list:JSON.stringify([t.site_name])};await Ke(a)},Ot=async t=>{var a;try{let l=G.value.length>0,i={server_data:JSON.stringify({ip:t.ip,port:t.port})};l?i.server_id=(a=G.value[0])==null?void 0:a.id:i.server_type="bt_log_server";const d=await Xe(i);return d.status&&Qe(),d.status}catch(l){}},Rt=async t=>{try{const a={server_id:t.server_id,source_type:"site",source_list:JSON.stringify(t.site)},l=await Ye(a);return et.value=!0,l.status}catch(a){}},O=t=>{t==="WebLogs"?v():t==="WebLogAnalysis"?(ot.value=!0,at.value.name=b.value):tt.value=!0},mt={class:"flex items-center mb-[20px]"},gt={key:0},_t={class:"flex items-center"},ft={class:"mx-[0.4rem]"},yt=I({__name:"index",setup(t){const{selectedWebSite:a,webTabActive:l}=$(N()),i=T(""),d=T(""),c=()=>{V({title:"日志服务系统",area:60,component:()=>k(()=>import("./index460.js?v=1777008528"),__vite__mapDeps([]),import.meta.url)})},x=async()=>{await E({request:We(),data:{size:[String,i],log_path:[String,d]}})},S=async w=>{await J({icon:"question-filled",type:"calc",title:"清空Web日志",content:"清空Web日志后,网站访问数据将彻底删除,此操作不可逆,是否继续操作?"}),await E({loading:"正在清空Web日志,请稍后...",request:Oe(),data:[String,i]}),ce.success("清空Web日志成功")};return we(async()=>{await lt(),x(),l.value==="WebLogs"&&v()}),(w,s)=>{const h=pe,f=P,_=de;return C(),L("div",null,[n("div",mt,[s[10]||(s[10]=y(" 网站: ",-1)),r(h,{modelValue:e(a),"onUpdate:modelValue":s[0]||(s[0]=p=>M(a)?a.value=p:null),options:e(D),onChange:s[1]||(s[1]=p=>e(O)(e(l))),placeholder:"请选择网站",class:"!w-[22rem]",filterable:""},null,8,["modelValue","options"]),e(l)==="WebLogs"?(C(),L("div",gt,[r(f,{class:"!ml-12px",onClick:c},{default:g(()=>[...s[6]||(s[6]=[y(" 日志服务系统 ",-1)])]),_:1})])):A("",!0),s[11]||(s[11]=n("div",{class:"bg-dark w-[1px] h-2rem mx-8"},null,-1)),n("div",_t,[s[7]||(s[7]=n("span",null,"Web日志:",-1)),n("span",{onClick:s[2]||(s[2]=p=>e(De)({path:e(d)})),class:"bt-link"},[y(H(e(d)||"--")+" ",1),Ce(w.$slots,"default",{},void 0,!0)]),n("span",ft,H(e(i)),1)]),r(f,{onClick:s[3]||(s[3]=p=>S())},{default:g(()=>[...s[8]||(s[8]=[y("清空",-1)])]),_:1}),n("div",{class:"flex items-center ml-[16px]",onClick:s[4]||(s[4]=p=>e(ke)())},[...s[9]||(s[9]=[n("i",{class:"svgtofont-desired text-medium"},null,-1),n("span",{class:"bt-link"},"需求反馈",-1)])])]),r(_,{type:"card",modelValue:e(l),"onUpdate:modelValue":s[5]||(s[5]=p=>M(l)?l.value=p:null),options:e(nt)},null,8,["modelValue","options"])])}}}),vt=j(yt,[["__scopeId","data-v-ce1405e8"]]),It=Object.freeze(Object.defineProperty({__proto__:null,default:vt},Symbol.toStringTag,{value:"Module"}));export{Ot as a,D as b,Rt as c,Wt as d,It as i,Dt as s};
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}