HEX
Server: nginx/1.28.3
System: Linux ip-172-31-12-242 6.17.0-1007-aws #7~24.04.1-Ubuntu SMP Thu Jan 22 21:04:49 UTC 2026 x86_64
User: root (0)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/server/panel/BTPanel/static/js/index517.js
import{r as $,c as oe,H as ne,o as re,I as ie,J as ue,p as s,j as D,k as A,e as f,v as d,q as k,F as S,B as Z,C as R,x as j,y as B,L as K,s as W,Q as ce,a1 as fe,T as de,am as pe,an as me,ad as _e,ak as he,aj as ve,b8 as be,U as ge,aW as ye,ab as xe}from"./base-lib.js?v=1777008528";import{a2 as De,c7 as ke,W as Ce,b as Ve,a as we,cO as Le,cP as Te,f as $e,cZ as Ee}from"./utils-lib.js?v=1777008528";import{u as F}from"./index157.js?v=1777008528";import{d as Ie,e as Ue,f as Re,c as je}from"./domain.js?v=1777008528";import{g as Ne}from"./useController26.js?v=1777008528";import{w as Pe}from"./index3.js?v=1777008528";import{addProxyProject as Oe}from"./site.js?v=1777008528";import"./__commonjsHelpers__.js?v=1777008528";import"./useStore6.js?v=1777008528";import"./index119.js?v=1777008528";import"./index116.js?v=1777008528";const{domainId:Ae,domainName:z,createSiteType:x}=F(),H=$([]),Be=[{value:"url",label:"URL地址"},{value:"unix",label:"unix地址"}],X=(n,e)=>{const l=e.domains[n];l.name&&l.suffix?(l.fullDomain="".concat(l.name).concat(l.suffix),n===0&&(e.remark=l.fullDomain)):l.fullDomain=""},He=(n,e)=>{let l="";if(n.domains&&n.domains.length>0){const o=n.domains.find(c=>c.suffix&&c.suffix!=="");o&&(l=o.suffix)}!l&&Array.isArray(e)&&e.length>0&&(l=e[0].value),n.domains.push({name:"",suffix:l,fullDomain:"",status:"",hint:""})},Me=(n,e)=>{if(e.domains.length>1&&(e.domains.splice(n,1),n===0&&e.domains.length>0)){const l=e.domains[0];l.name&&l.suffix&&(l.fullDomain="".concat(l.name).concat(l.suffix),e.remark=l.fullDomain)}},qe=(n,e)=>{Pe({type:"file",path:n.proxysite,change:l=>{const o=De(l,"string","");n.proxysite=o,e&&e.value&&e.value.validateField("proxysite")}})},Je=async(n,e,l)=>{var o;try{const c={p:1,limit:200},h=x.value==="domain"?await l(c):await Ue(c),p=x.value==="domain"?h.data:h.data.data;if(p&&p.length>0){const t=p.map(u=>({label:".".concat(x.value==="domain"?u.full_domain:u.domain),value:".".concat(x.value==="domain"?u.full_domain:u.domain),id:(x.value==="domain",u.id),fullDomain:x.value==="domain"?u.full_domain:u.domain})).sort((u,g)=>u.label.localeCompare(g.label));n.value=t;let v=((o=t[0])==null?void 0:o.value)||"";if(z.value){const u=t.find(g=>g.value===".".concat(z.value)||g.value===z.value);u&&(v=u.value)}e.domains.forEach(u=>{(!u.suffix||u.suffix==="")&&(u.suffix=v)})}}catch(c){}},Qe=async n=>{try{const e=n.domains.filter(o=>o.name&&o.suffix).map(o=>o.fullDomain);if(e.length===0)return;n.domains.forEach(o=>{o.name&&o.suffix&&(o.status="checking",o.hint="检测中...")});const l=await Re({domains:e});if(l.data&&l.data.data){const o=l.data.data;n.domains.forEach(c=>{if(c.name&&c.suffix){const h=o[c.fullDomain];h===!0?(c.status="available",c.hint="域名可用"):h===!1?(c.status="registered",c.hint="域名已被注册"):(c.status="error",c.hint="检测失败")}})}}catch(e){n.domains.forEach(l=>{l.name&&l.suffix&&(l.status="error",l.hint="检测失败")})}},We=(n,e)=>{if(typeof n=="object")return;if(e.targetType==="unix"){e.todomain="$http_host";return}let l=n.replace(/^http[s]?:\/\//,"");l=l.replace(/(:|\?|\/|\\)(.*)$/,""),e.todomain=l},ze=async(n,e,l,o,c,h)=>{var t;c.value=!0;let p=null;try{const v=e.domains[0];if(v&&v.name==="*")return v.hint="第一个域名不能是通配符",v.status="error",o.error("第一个域名不能是通配符"),!1;(x==null?void 0:x.value)!=="local"?await Qe(e):e.domains.forEach(i=>{i.name&&i.suffix&&(i.status="available",i.hint="")});let u=0,g=0,N=0,P=0;const C=[];for(const i of e.domains)if(i.name&&i.suffix)switch(i.status){case"checking":u++;break;case"registered":g++;break;case"error":N++;break;case"available":P++,C.push(i);break}if(u>0)return o.error("域名检测中,请稍候..."),!1;if(g>0)return o.error("存在不可用的域名,请检查后重试"),!1;if(N>0)return o.error("域名检测失败,请重试"),!1;if(P>0&&(p=o.load("所有域名都可用,正在创建反向代理...")),C.length===0)return o.error("没有可用的域名"),!1;const O=C.map(i=>i.fullDomain),y=C[0],a={remark:y?"".concat(e.remark).concat(y.suffix):e.remark,proxy_type:e.targetType==="url"?"http":"unix",proxy_pass:e.proxysite,domains:O.join("\n"),proxy_host:y?"".concat(e.todomain).concat(y.suffix):e.todomain};if((await Oe(a)).status){try{const i=C.map(L=>{const I=h.value.find(J=>J.value===L.suffix),q=(I==null?void 0:I.id)||Ae.value||0;return{name:L.fullDomain,[x.value==="domain"?"domain_id":"local_domain_id"]:q,record:L.name}}),V=JSON.stringify(i);let m="",_=!1;e.ssl_type==="certificate"&&e.ssl_cert&&(m=e.ssl_cert,_=e.force_https);const w={domain_list:V,ssl_hash:m,site_name:((t=C[0])==null?void 0:t.fullDomain)||"",https:_},E=await Ie(w)}catch(i){}return n&&n(),o.success("反向代理创建成功"),!0}else return o.error("反向代理创建失败"),!1}catch(v){return!1}finally{p==null||p.close(),c.value=!1}};let M="",G="";const Y=(n,e)=>{M=n,G=e},Ge=n=>e=>{const l=e.label.split(" - ")[0],o=n.toLowerCase();return l.toLowerCase().includes(o)||e.label.toLowerCase().includes(o)},Se=(n,e)=>{if(n===M){const l=[...H.value].sort((o,c)=>{const h=o.label===M&&o.value===G,p=c.label===M&&c.value===G;return h&&!p?-1:!h&&p?1:0});e(l)}else if(n){const l=H.value.filter(Ge(n));e(l)}else e(H.value)},Ze={class:"reverse-proxy-form"},Ke={class:"domain-input-container"},Xe={class:"domain-input-group"},Ye={class:"domain-actions"},Fe={class:"cert-option-content"},et={class:"cert-name text-base font-500 mb-3"},tt={class:"cert-sublabel text-small"},st={class:"flex items-center"},lt=oe({__name:"index",props:{compData:{default:()=>({domainId:0})}},setup(n,{expose:e}){const{domainId:l,getDomainHintClass:o}=F(),c=$(!1),h=$(!1),p=$(),t=ne({domains:[{name:"",suffix:"",fullDomain:"",status:"",hint:""}],targetType:"url",proxysite:"http://",todomain:"$http_host",remark:"",ssl_type:"false",ssl_cert:"",force_https:!1}),v=$([]),u=$(""),g=$(""),N=()=>{t.proxysite=t.targetType==="url"?"http://":""},P=async y=>{const a=String(y);if(u.value="",g.value="",t.ssl_cert="",Y("",""),a==="certificate")try{const b=await je({p:1,limit:100,reverse:1,search_limit:1});b.status&&b.data&&(H.value=b.data.map(i=>{var w,E;const V=i.dns&&i.dns.length>0?i.dns.join(", "):i.subject||"未知域名";let m="";if(i.endtime!==void 0)if(i.endtime<0)m="已过期".concat(Math.abs(i.endtime),"天");else{const L=((w=i.info)==null?void 0:w.notAfter)||"未知";m="过期时间:".concat(L,"(剩").concat(i.endtime,"天)")}const _=(E=i.info)!=null&&E.issuer_O?" - ".concat(i.info.issuer_O):"";return{label:V+" - "+m+_,subLabel:m+_,value:i.hash}}))}catch(b){}else t.ssl_cert="",t.force_https=!1},C={proxysite:[{required:!0,message:"请输入目标地址",trigger:"blur"},{validator:(y,a,b)=>{if(!a){b(new Error(t.targetType==="url"?"目标地址不能为空":"请选择sock文件"));return}if(t.targetType==="unix"){b();return}const i=a.trim();if(/^https?:\/\/$/.test(i)){b(new Error("请输入目标URL域名"));return}if(!/^https?:\/\/.+/.test(i)){b(new Error("目标URL格式不正确,应以http://或https://开头"));return}const V=/^(\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])$/;let m=a.replace(/^http[s]?:\/\//,"");m=m.replace(/(:|\?|\/|\\)(.*)$/,""),V.test(m)?t.todomain="$http_host":t.todomain=m,b()}}],todomain:[{required:!0,message:"请输入发送域名",trigger:["blur","change"]}]},O=async()=>{c.value=!0;try{await Je(v,t,Ne)}catch(y){}finally{c.value=!1}};return re(O),e({init:O,onConfirm:y=>{const a=$e();return ze(y,t,p,a,h,v)}}),(y,a)=>{const b=de,i=pe,V=me,m=ke,_=_e,w=he,E=ve,L=be,I=ge,q=Ce,J=Ve,ee=we,Q=Le,te=ye,se=Te,le=xe,ae=ie("bt-loading");return ue((D(),A("div",Ze,[f(le,{model:s(t),rules:C,disabled:s(h),ref_key:"addSiteFormRef",ref:p},{default:d(()=>[f(_,{label:"域名","label-width":"100px",class:"!mb-0"},{default:d(()=>[k("div",Ke,[(D(!0),A(S,null,Z(s(t).domains,(r,U)=>(D(),A("div",{key:U,class:"domain-item"},[k("div",Xe,[f(b,{modelValue:r.name,"onUpdate:modelValue":T=>r.name=T,placeholder:"请输入子域名 (不支持通配符)",class:"domain-name-input",onInput:()=>s(X)(U,s(t))},null,8,["modelValue","onUpdate:modelValue","onInput"]),f(V,{modelValue:r.suffix,"onUpdate:modelValue":T=>r.suffix=T,placeholder:"选择后缀",class:"domain-suffix-select",onChange:()=>s(X)(U,s(t))},{default:d(()=>[(D(!0),A(S,null,Z(s(v),T=>(D(),R(i,{key:T.value,label:T.label,value:T.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","onChange"]),k("div",Ye,[U===s(t).domains.length-1&&s(t).domains.length<10?(D(),R(m,{key:0,onClick:a[0]||(a[0]=()=>s(He)(s(t),s(v))),class:"text-primary"},{default:d(()=>[...a[11]||(a[11]=[j(" 添加 ",-1)])]),_:1})):B("",!0),s(t).domains.length>1?(D(),R(m,{key:1,onClick:()=>s(Me)(U,s(t)),class:"text-danger"},{default:d(()=>[...a[12]||(a[12]=[j(" 移除 ",-1)])]),_:1},8,["onClick"])):B("",!0)])]),k("div",{class:K(["domain-hint",s(o)(r.status)])},W(r.hint),3)]))),128))])]),_:1}),f(_,{"label-width":"100px",label:"SSL证书配置"},{default:d(()=>[f(E,{modelValue:s(t).ssl_type,"onUpdate:modelValue":a[1]||(a[1]=r=>s(t).ssl_type=r),onChange:P},{default:d(()=>[f(w,{value:"false"},{default:d(()=>[...a[13]||(a[13]=[j("不使用SSL",-1)])]),_:1}),f(w,{value:"certificate"},{default:d(()=>[...a[14]||(a[14]=[j("证书夹",-1)])]),_:1})]),_:1},8,["modelValue"])]),_:1}),s(t).ssl_type==="certificate"?(D(),R(_,{key:0,"label-width":"100px",label:"选择证书"},{default:d(()=>[f(L,{"popper-class":"my-autocomplete",modelValue:s(u),"onUpdate:modelValue":a[2]||(a[2]=r=>ce(u)?u.value=r:null),class:"!w-[52rem]","popper-append-to-body":!1,"fetch-suggestions":s(Se),"trigger-on-focus":!0,clearable:"","value-key":"label",onSelect:a[3]||(a[3]=r=>{u.value=r.label,g.value=r.value,s(t).ssl_cert=r.value,s(Y)(r.label,r.value)}),placeholder:"请输入或选择证书"},{default:d(({item:r})=>[k("div",{class:K(["cert-option !h-[5.4rem] !leading-auto !line-height-normal flex flex-col justify-center",r.label===s(u)&&r.value===s(g)?"is-selected":""])},[k("div",Fe,[k("div",et,W(r.label.split(" - ")[0]),1),k("div",tt,W(r.subLabel),1)])],2)]),_:1},8,["modelValue","fetch-suggestions"])]),_:1})):B("",!0),s(t).ssl_type==="certificate"?(D(),R(_,{key:1,"label-width":"100px",label:"强制HTTPS访问"},{default:d(()=>[f(I,{modelValue:s(t).force_https,"onUpdate:modelValue":a[4]||(a[4]=r=>s(t).force_https=r)},{default:d(()=>[...a[15]||(a[15]=[j("启用强制HTTPS访问",-1)])]),_:1},8,["modelValue"])]),_:1})):B("",!0),f(_,{"label-width":"100px",label:"目标",prop:"proxysite"},{default:d(()=>[k("div",st,[f(_,{"label-width":"50px"},{default:d(()=>[f(q,{modelValue:s(t).targetType,"onUpdate:modelValue":a[5]||(a[5]=r=>s(t).targetType=r),placeholder:"请选择",options:s(Be),style:{width:"16rem","margin-right":"1rem"},onChange:N},null,8,["modelValue","options"])]),_:1}),f(Q,{modelValue:s(t).proxysite,"onUpdate:modelValue":a[7]||(a[7]=r=>s(t).proxysite=r),placeholder:s(t).targetType==="url"?"请输入目标地址":"请选择sock文件",width:"35rem",iconType:s(t).targetType==="url"?!1:"folder",onInput:a[8]||(a[8]=r=>s(We)(r,s(t)))},fe({_:2},[s(t).targetType!=="url"?{name:"append",fn:d(()=>[f(ee,{onClick:a[6]||(a[6]=()=>s(qe)(s(t),s(p)))},{default:d(()=>[f(J,{icon:"el-folder-opened",class:"cursor-pointer"})]),_:1})]),key:"0"}:void 0]),1032,["modelValue","placeholder","iconType"])])]),_:1}),f(_,{"label-width":"100px",label:"发送域名(host)",prop:"todomain"},{default:d(()=>[f(te,{content:"请求转发到后端服务器时的主机名,一般为$http_host,如果目标URL是域名,则需要改为域名",placement:"top","show-after":300},{default:d(()=>[f(Q,{modelValue:s(t).todomain,"onUpdate:modelValue":a[9]||(a[9]=r=>s(t).todomain=r),placeholder:"请输入发送域名",width:"52rem"},null,8,["modelValue"])]),_:1})]),_:1}),f(_,{"label-width":"100px",label:"备注"},{default:d(()=>[f(Q,{modelValue:s(t).remark,"onUpdate:modelValue":a[10]||(a[10]=r=>s(t).remark=r),placeholder:"请输入备注,可为空",width:"52rem"},null,8,["modelValue"])]),_:1}),f(_,{label:" "},{default:d(()=>[f(se,{options:[{content:"堡塔后台开启密保验证功能,无法添加解析记录"}]})]),_:1})]),_:1},8,["model","disabled"])])),[[ae,s(c)]])}}}),_t=Ee(lt,[["__scopeId","data-v-deae7b5b"]]);export{_t as default};