import{c as e,o as a,r as s,v as l,x as t,e as r,B as d,y as o,z as i,ab as m,a9 as u}from"./base-lib.js?v=1761009159";import{p,P as n,M as c,aK as g,k as b}from"./utils-lib.js?v=1761009159";import{modifyDirAuthPass as _,setDirAuth as f}from"./site.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const w={class:"p-[20px]"},D=e({__name:"add-pass-limit",props:{compData:{default:()=>({})}},emits:["close"],setup(e,{expose:D,emit:V}){const h=e,y=V,v=a({site_dir:h.compData.site_dir||"",name:h.compData.name||"",username:h.compData.username||"",password:h.compData.password||""}),x=s(!1),q=s(),j=a({site_dir:[{required:!0,message:"请输入需要加密访问的目录",trigger:"blur"}],name:[{required:!0,message:"请输入名称",trigger:"blur"},{min:3,message:"名称必须大于三位",trigger:"blur"}],username:[{required:!0,message:"请输入用户名",trigger:"blur"},{min:3,message:"用户名必须大于三位",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{min:3,message:"密码必须大于三位",trigger:"blur"}]});return D({onConfirm:async()=>{await q.value.validate();try{x.value=!0;const e=h.compData.name?_:f,a=await e({id:h.compData.id,...v});if(void 0!==a.data.tip&&!h.compData.name){await p({title:"添加须知",content:a.data.tip,icon:"warning-filled"});return void((await n({loading:"正在添加，请稍后...",request:f({id:h.compData.id,...v,force:!0}),message:!0})).status&&(y("close"),h.compData.refresh()))}c.request(a),a.status&&(h.compData.refresh(),y("close"))}catch(e){g(e)}finally{x.value=!1}}}),(e,a)=>{const s=b,p=m,n=u;return l(),t("div",w,[r(n,{ref_key:"passwordSiteForm",ref:q,rules:o(j),model:o(v),disabled:o(x)},{default:d(()=>[r(p,{label:"加密访问",prop:"site_dir"},{default:d(()=>[r(s,{disabled:!!e.compData.name,modelValue:o(v).site_dir,"onUpdate:modelValue":a[0]||(a[0]=e=>o(v).site_dir=e),placeholder:"输入需要加密访问的目录，如：/text/",width:"26rem"},null,8,["disabled","modelValue"])]),_:1}),r(p,{label:"名称",prop:"name"},{default:d(()=>[r(s,{modelValue:o(v).name,"onUpdate:modelValue":a[1]||(a[1]=e=>o(v).name=e),disabled:!!e.compData.name,width:"26rem"},null,8,["modelValue","disabled"])]),_:1}),r(p,{label:"用户名",prop:"username"},{default:d(()=>[r(s,{modelValue:o(v).username,"onUpdate:modelValue":a[2]||(a[2]=e=>o(v).username=e),placeholder:"请输入大于三位的用户名",width:"26rem"},null,8,["modelValue"])]),_:1}),r(p,{label:"密码",prop:"password"},{default:d(()=>[r(s,{modelValue:o(v).password,"onUpdate:modelValue":a[3]||(a[3]=e=>o(v).password=e),type:"password",placeholder:"请输入大于三位的密码",width:"26rem"},null,8,["modelValue"])]),_:1}),a[4]||(a[4]=i("ul",{class:"ml-6 mt-8 list-disc leading-10"},[i("li",{class:"text-secondary"},"目录设置加密访问后，会导致目录及子目录下的“反向代理”失效"),i("li",{class:"text-secondary"},"目录设置加密访问后，访问时需要输入账号密码才能访问"),i("li",{class:"text-secondary"},"例如我设置了加密访问 /test/ ,那我访问 http://aaa.com/test/ 时就要输入账号密码才能访问")],-1))]),_:1,__:[4]},8,["rules","model","disabled"])])}}});export{D as default};
