import{i as z,u as E,c as J}from"./app-Ba7ZqSpq.js";import{_ as F}from"./app-Cft_lrsr.js";import{_ as q}from"./app-rIYFLdeU.js";import{_ as A}from"./app-DFulsyXy.js";import{_ as j}from"./app-DWUwCFNm.js";import{r as w,aa as Y,J as K,o as n,g as d,a as e,u as s,b as l,w as a,i as b,t as _,f as r,h as p,c as v,F as R,D as x,d as T,e as S,bb as I}from"./app-SC54XQDl.js";import{_ as Q,a as U}from"./app-PrSv7rSt.js";import{_ as $}from"./app-CVQkwzlf.js";import{_ as O}from"./app-FlPLZh9D.js";import{_ as W}from"./app-DkOT0Z3c.js";import{_ as L}from"./app-C33Py4oT.js";import{_ as X}from"./app-T1ysvErZ.js";import{T as H}from"./app-DoVkxbmA.js";import{D as N}from"./app-ZeVDYyDS.js";import{L as Z}from"./app-Crd12MWL.js";import{_ as y}from"./app-CWnUJ4gg.js";import{_ as tt}from"./app-BUqHq_rP.js";import"./app-qhR41k1m.js";import"./app-CS3AUTAk.js";import"./app-CCkWSX4Q.js";import"./app-Dhl-Bw0H.js";import"./app-BjSCO7rC.js";import"./app-B9xxzP2y.js";import"./app-C28obFWS.js";import"./app-CkINxBL9.js";import"./app-PPG0ZS4d.js";import"./app--Lj8zATS.js";import"./app-Ch8j4za4.js";import"./app-C2mBgI5Z.js";import"./app-CNHjdV6U.js";import"./app-BZGObKCm.js";import"./app-BPIIxVwk.js";import"./app-DgoEZtNT.js";import"./app-Dw0jKdCD.js";import"./app-DnXuoh8P.js";import"./app-DZaelcLs.js";import"./app-DHsI_tns.js";import"./app-C8HFiBxn.js";import"./app-g-bJrEAS.js";import"./app-D_RBJHM6.js";import"./app-CmrRgGIA.js";import"./app-DyP4Nide.js";function et(){z(this),this.success=this.$NotifyReloadSuccess("保存成功")}const st=["value"],ot=["value"],lt=e("h5",{class:"mb-4"},"自定义页面",-1),nt=e("p",{class:"comment !mb-4",style:{"padding-top":"0","margin-top":"0"}},"根据响应状态码返回一些自定义页面，比如404，500等错误页面。",-1),at={key:0},it=["onClick"],dt={key:0},ut={key:1},rt=e("i",{class:"icon expand small"},null,-1),mt={key:0},ct={class:"mt-1"},pt={key:1},_t={class:"label-group mt-1"},ht={key:2},ft={class:"mt-1"},yt={key:0},vt={key:1,class:"disabled"},bt={key:0,class:"label-group"},gt={key:1,class:"disabled"},wt={key:0,class:"label-group"},Lt={key:1,class:"disabled"},kt=["onClick"],Pt={class:"mt-4"},Tt=e("h5",{class:"group-header"},"临时关闭页面",-1),St=e("p",{class:"comment !mb-4",style:{"margin-top":"0","padding-top":"0"}},"开启临时关闭页面时，所有请求都会直接显示此页面。可用于临时升级网站或者禁止用户访问某个网页。",-1),Ut=e("td",{class:"title"},"启用临时关闭网站",-1),$t=e("p",{class:"comment"},"选中后，表示临时关闭当前网站，并显示自定义内容。",-1),Ct=e("td",null,"显示内容类型 *",-1),Vt={key:0},Rt=e("td",{class:"title"},"显示页面URL *",-1),xt=e("p",{class:"comment"},"将从此URL中读取内容。",-1),It={key:1},Ot=e("td",{class:"title"},"跳转到URL *",-1),Ht=e("p",{class:"comment"},"将会跳转到此URL。",-1),Nt=e("td",null,"显示页面HTML *",-1),Gt={class:"comment"},Dt=e("td",null,"状态码",-1),Mt=e("h5",{class:"group-header"},"其他设置",-1),Bt=e("td",{class:"title"},"启用系统自定义页面",-1),zt=e("p",{class:"comment"},"选中后，表示如果当前网站没有自定义页面，则尝试使用系统对应的自定义页面。",-1),Et=e("div",{class:"ui margin"},null,-1),Jt={__name:"HTTPPagesAndShutdownBox",props:["v-enable-global-pages","v-pages","v-shutdown-config","v-is-location","webId"],setup(C){const m=E(),c=C,{pages:h,shutdownConfig:i,shutdownStatus:g,enableGlobalPages:k}=function(){let u=[];c.vPages!=null&&(u=c.vPages);let o={isPrior:!1,isOn:!1,bodyType:"html",url:"",body:"",status:0};c.vShutdownConfig!=null&&(c.vShutdownConfig.body==null&&(c.vShutdownConfig.body=""),c.vShutdownConfig.bodyType==null&&(c.vShutdownConfig.bodyType="html"),o=c.vShutdownConfig);let t="";return o.status>0&&(t=o.status.toString()),{pages:w(u),shutdownConfig:w(o),shutdownStatus:w(t),enableGlobalPages:w(c.vEnableGlobalPages)}}(),G=function(){m.popup("/servers/server/settings/pages/createPopup?webId="+c.webId,{callback:function(u){h.value.push(u.data.page),P()},height:m.POPUP_HEIGHT_LG})},V=function(u,o){m.popup("/servers/server/settings/pages/updatePopup?pageId="+o,{callback:function(t){h.value[u]=t.data.page,P()},height:m.POPUP_HEIGHT_LG})},D=function(u){m.confirm("确定要删除此自定义页面吗？",function(){h.value.$remove(u),P()})},M=function(){i.value.body=`<!DOCTYPE html>
<html lang="en">
<head>
	<title>升级中</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<style>
		address { line-height: 1.8; }
	</style>
</head>
<body>

<h1>网站升级中</h1>
<p>为了给您提供更好的服务，我们正在升级网站，请稍后重新访问。</p>

<address>Connection: \${remoteAddr} (Client) -&gt; \${serverAddr} (Server)</address>
<address>Request ID: \${requestId}</address>

</body>
</html>`},B=Y("$postForm"),P=function(){setTimeout(function(){B.exposed.submit()},100)};return K(g,function(u){let o=parseInt(u);!isNaN(o)&&o>0&&o<1e3?i.value.status=o:i.value.status=0}),(u,o)=>(n(),d("div",null,[e("input",{type:"hidden",name:"pagesJSON",value:JSON.stringify(s(h))},null,8,st),e("input",{type:"hidden",name:"shutdownJSON",value:JSON.stringify(s(i))},null,8,ot),lt,nt,s(h).length>0?(n(),d("div",at,[l(Z,{items:s(h)},{default:a(()=>[l(y,{header:"响应状态码",class:"normal-value-column",frozen:""},{body:a(({data:t})=>[e("a",{href:"",onClick:b(f=>V(u.index,t.id),["prevent"])},[t.status!=null&&t.status.length==1?(n(),d("span",dt,_(t.status[0]),1)):(n(),d("span",ut,_(t.status),1)),r("  "),rt],8,it)]),_:1}),l(y,{header:"页面类型",class:"normal-value-column",style:{"word-wrap":"break-word"}},{body:a(({data:t})=>[t.bodyType=="url"?(n(),d("div",mt,[r(_(t.url)+" ",1),e("div",ct,[l(L,null,{default:a(()=>[r("读取URL")]),_:1})])])):p("",!0),t.bodyType=="redirectURL"?(n(),d("div",pt,[r(_(t.url)+" ",1),e("div",_t,[l(L,null,{default:a(()=>[r("跳转URL")]),_:1}),t.newStatus>0?(n(),v(L,{key:0},{default:a(()=>[r(_(t.newStatus),1)]),_:2},1024)):p("",!0)])])):p("",!0),t.bodyType=="html"?(n(),d("div",ht,[r(" [HTML内容] "),e("div",ft,[t.newStatus>0?(n(),v(L,{key:0},{default:a(()=>[r(_(t.newStatus),1)]),_:2},1024)):p("",!0)])])):p("",!0)]),_:1}),l(y,{header:"新状态码",class:"normal-value-column"},{body:a(({data:t})=>[t.newStatus>0?(n(),d("span",yt,_(t.newStatus),1)):(n(),d("span",vt,"保持"))]),_:1}),l(y,{header:"例外URL",class:"name-column"},{body:a(({data:t})=>[t.exceptURLPatterns!=null&&t.exceptURLPatterns?(n(),d("div",bt,[(n(!0),d(R,null,x(t.exceptURLPatterns,f=>(n(),v(H,{outlined:""},{default:a(()=>[r(_(f.pattern),1)]),_:2},1024))),256))])):(n(),d("span",gt,"-"))]),_:1}),l(y,{header:"限制URL",class:"name-column"},{body:a(({data:t})=>[t.onlyURLPatterns!=null&&t.onlyURLPatterns?(n(),d("div",wt,[(n(!0),d(R,null,x(t.onlyURLPatterns,f=>(n(),v(H,{outlined:""},{default:a(()=>[r(_(f.pattern),1)]),_:2},1024))),256))])):(n(),d("span",Lt,"-"))]),_:1}),l(y,{header:"操作",class:"two op",frozen:"","align-frozen":"right"},{body:a(({data:t})=>[e("a",{href:"",title:"修改",onClick:b(f=>V(u.index,t.id),["prevent"])},"修改",8,kt),r("   "),e("a",{href:"",title:"删除",onClick:o[0]||(o[0]=b(f=>D(u.index),["prevent"]))},"删除")]),_:1})]),_:1},8,["items"])])):p("",!0),e("div",Pt,[l(tt,{"action-create":"",size:"small",type:"button",onClick:o[1]||(o[1]=b(t=>G(),["prevent"]))},{default:a(()=>[r("添加自定义页面")]),_:1})]),Tt,St,e("div",null,[l(N,null,{default:a(()=>[u.vIsLocation?(n(),v(W,{key:0,"v-config":s(i)},null,8,["v-config"])):p("",!0),T(e("tbody",null,[e("tr",null,[Ut,e("td",null,[l(O,{value:"1",modelValue:s(i).isOn,"onUpdate:modelValue":o[2]||(o[2]=t=>s(i).isOn=t)},null,8,["modelValue"]),$t])])],512),[[S,!u.vIsLocation||s(i).isPrior]]),T(e("tbody",null,[e("tr",null,[Ct,e("td",null,[l(Q,{modelValue:s(i).bodyType,"onUpdate:modelValue":o[3]||(o[3]=t=>s(i).bodyType=t)},{default:a(()=>[l(U,{value:"html"},{default:a(()=>[r("HTML")]),_:1}),l(U,{value:"url"},{default:a(()=>[r("读取URL")]),_:1}),l(U,{value:"redirectURL"},{default:a(()=>[r("跳转URL")]),_:1})]),_:1},8,["modelValue"])])]),s(i).bodyType=="url"?(n(),d("tr",Vt,[Rt,e("td",null,[l($,{type:"text",modelValue:s(i).url,"onUpdate:modelValue":o[4]||(o[4]=t=>s(i).url=t),placeholder:"类似于 https://example.com/page.html",class:"w-full"},null,8,["modelValue"]),xt])])):p("",!0),s(i).bodyType=="redirectURL"?(n(),d("tr",It,[Ot,e("td",null,[l($,{type:"text",modelValue:s(i).url,"onUpdate:modelValue":o[5]||(o[5]=t=>s(i).url=t),placeholder:"类似于 https://example.com/page.html",class:"w-full"},null,8,["modelValue"]),Ht])])):p("",!0),T(e("tr",null,[Nt,e("td",null,[l(X,{name:"body",ref:"shutdownHTMLBody",modelValue:s(i).body,"onUpdate:modelValue":o[6]||(o[6]=t=>s(i).body=t),rows:"8",class:"w-full"},null,8,["modelValue"]),e("p",Gt,[e("a",{href:"",onClick:b(M,["prevent"])},"[使用模板]"),r("。填写页面的HTML内容，支持请求变量。 ")])])],512),[[S,s(i).bodyType=="html"]]),e("tr",null,[Dt,e("td",null,[l($,{type:"text",size:"3",maxlength:"3",name:"shutdownStatus",style:{width:"5.2em"},placeholder:"状态码",modelValue:s(g),"onUpdate:modelValue":o[7]||(o[7]=t=>I(g)?g.value=t:null)},null,8,["modelValue"])])])],512),[[S,(!u.vIsLocation||s(i).isPrior)&&s(i).isOn]])]),_:1})]),Mt,l(N,null,{default:a(()=>[e("tbody",null,[e("tr",null,[Bt,e("td",null,[l(O,{name:"enableGlobalPages",modelValue:s(k),"onUpdate:modelValue":o[8]||(o[8]=t=>I(k)?k.value=t:null)},null,8,["modelValue"]),zt])])])]),_:1}),Et]))}},Ft={key:0},qt=["value"],At={key:1},He={__name:"index",setup(C){const m=J(new et);return(c,h)=>(n(),v(F,{ctx:s(m)},{default:a(()=>[s(m).featureIsOn?(n(),d("div",Ft,[l(A,{action:"$",onSuccess:s(m).success},{default:a(()=>[e("input",{type:"hidden",name:"webId",value:s(m).webId},null,8,qt),l(Jt,{"v-pages":s(m).pages,"v-shutdown-config":s(m).shutdownConfig,"v-enable-global-pages":s(m).enableGlobalPages,"web-id":s(m).webId},null,8,["v-pages","v-shutdown-config","v-enable-global-pages","web-id"]),l(j,{class:"mt-4"})]),_:1},8,["onSuccess"])])):p("",!0),s(m).featureIsOn?p("",!0):(n(),d("div",At,[l(q)]))]),_:1},8,["ctx"]))}};export{He as default};
