import{o as r,c as f,w as a,b as l,a as e,u as o,g as c,f as s,h as d,d as m,e as u,D as k,t as R,F as L}from"./app-DnroACXc.js";import{P as b}from"./app-CyTk3GnO.js";import{i as v,c as w}from"./app-DckefXYL.js";import{_ as U}from"./app-COct4tsy.js";import{_}from"./app-BbRQPmFH.js";import{_ as p}from"./app-DPkDcD7h.js";import{_ as x,a as h}from"./app-DntYVxd7.js";import{_ as g}from"./app-BdF_-Hag.js";import{_ as $}from"./app-BDxBQhL3.js";import{C as y}from"./app-Do8DhyKT.js";import{_ as D}from"./app-MnSDCF4P.js";import{D as V}from"./app-Cx7ENVlu.js";import"./app-CUqfl6on.js";import"./app-LqsmzyUT.js";import"./app-B4bUdtyo.js";import"./app-CYYQ_Zep.js";import"./app-CF0qXH5Q.js";import"./app-BJhJ7lM8.js";import"./app-Dd07dUxy.js";import"./app-Dpl5YSiv.js";import"./app-CF8nmC-F.js";import"./app-NVAx7Sc3.js";import"./app-xECxwo4T.js";import"./app-MtOp7vk3.js";import"./app-B8VsrFxM.js";import"./app-B09rlSqG.js";function S(){v(this),this.success=this.$NotifyPopup,this.rewriteRule={mode:"proxy",redirectStatus:307},this.statusOptions=[{code:301,text:"Moved Permanently"},{code:308,text:"Permanent Redirect"},{code:302,text:"Found"},{code:303,text:"See Other"},{code:307,text:"Temporary Redirect"}]}const C=e("header",null,"创建重写规则",-1),N=["value"],P=e("td",{class:"title"},"匹配规则 *",-1),B={key:0,class:"comment"},O=["href"],F={key:1,class:"comment"},T=["href"],I=e("td",null,"目标URL *",-1),E={class:"comment"},H=["href"],M=["href"],Q=e("td",null,"转发方式",-1),j=e("p",{class:"comment"},"隐式表示不在客户端显示重写后的URL；显式表示在客户端跳转URL，将会显示重写后的URL。",-1),q=e("td",null,"匹配条件",-1),z={colspan:"2"},A=e("td",null,"跳转状态码",-1),G=e("p",{class:"comment"},"通常使用默认的307即可。",-1),J=e("td",null,"代理主机名",-1),K={class:"comment"},W=["href"],X=["href"],Y=e("td",null,"保留URL参数",-1),Z=e("p",{class:"comment"},"选中此选项，将会把用户输入的URL中的参数部分转发到目标URL上。",-1),ee=e("td",null,"终止往下匹配",-1),te=e("p",{class:"comment"},"如果选中了此选项，一旦匹配成功，不会继续匹配其他的重写规则或路由规则。",-1),oe=e("td",null,"启用当前重写规则",-1),Ce={__name:"createPopup",setup(le){const t=w(new S);return(se,i)=>(r(),f(b,null,{default:a(()=>[C,l(D,{action:"$",onSuccess:o(t).success},{default:a(()=>[e("input",{type:"hidden",name:"webId",value:o(t).webId},null,8,N),l(V,null,{default:a(()=>[e("tbody",null,[e("tr",null,[P,e("td",null,[l(p,{type:"text",name:"pattern",maxlength:"500",placeholder:"比如 /post/(.+)",autofocus:"",class:"w-full"}),o(t).teaRole=="admin"?(r(),c("p",B,[s("需要符合正则表达式规范，"),e("a",{href:o(t).teaDocURL+"/docs/appendix/regexp/index",target:"_blank"},"正则表达式语法 »",8,O)])):d("",!0),o(t).teaRole=="user"?(r(),c("p",F,[s("需要符合正则表达式规范，"),e("a",{href:o(t).teaDocURL+"/docs/cdn/regexp.html",target:"_blank"},"正则表达式语法 »",8,T)])):d("",!0)])]),e("tr",null,[I,e("td",null,[l(p,{type:"text",name:"replace",placeholder:"比如 /post/${1}.html",maxlength:"500",class:"w-full"}),e("p",E,[s("URL中可以包含一些"),o(t).teaRole=="admin"?(r(),c("a",{key:0,href:o(t).teaDocURL+"/docs/server/variables",target:"_blank"},"内置的变量",8,H)):d("",!0),o(t).teaRole=="user"?(r(),c("a",{key:1,href:o(t).teaDocURL+"/docs/cdn/variables.html",target:"_blank"},"内置的变量",8,M)):d("",!0),s("，并且可以用 "),l(y,null,{default:a(()=>[s("${1}")]),_:1}),s(" 、 "),l(y,null,{default:a(()=>[s("${2}")]),_:1}),s(" 等变量形式表示在匹配规则中匹配的第N个括号里的内容，也可以是一个完整的URL，比如：http://example.com/hello。 ")])])]),e("tr",null,[Q,e("td",null,[l(x,{name:"mode",modelValue:o(t).rewriteRule.mode,"onUpdate:modelValue":i[0]||(i[0]=n=>o(t).rewriteRule.mode=n)},{default:a(()=>[l(h,{value:"proxy"},{default:a(()=>[s("隐式")]),_:1}),l(h,{value:"redirect"},{default:a(()=>[s("显式")]),_:1})]),_:1},8,["modelValue"]),j])]),e("tr",null,[q,e("td",null,[l($)])]),e("tr",null,[e("td",z,[l(g)])])]),m(e("tbody",null,[m(e("tr",null,[A,e("td",null,[l(x,{name:"redirectStatus",modelValue:o(t).rewriteRule.redirectStatus,"onUpdate:modelValue":i[1]||(i[1]=n=>o(t).rewriteRule.redirectStatus=n)},{default:a(()=>[(r(!0),c(L,null,k(o(t).statusOptions,n=>(r(),f(h,{value:n.code},{default:a(()=>[s(R(n.code)+" "+R(n.text),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"]),G])],512),[[u,o(t).rewriteRule.mode=="redirect"]]),m(e("tr",null,[J,e("td",null,[l(p,{type:"text",name:"proxyHost",placeholder:"比如 example.com",maxlength:"100",class:"w-full"}),e("p",K,[s("如果转发的方式为隐式而且目标URL为不同的域名时需要用到此选项，用于修改被代理服务接收到的域名，默认和客户端请求的主机名一致，通常不必填写，支持"),o(t).teaRole=="admin"?(r(),c("a",{key:0,href:o(t).teaDocURL+"/docs/server/variables",target:"_blank"},"请求变量",8,W)):d("",!0),o(t).teaRole=="user"?(r(),c("a",{key:1,href:o(t).teaDocURL+"/docs/cdn/variables.html",target:"_blank"},"请求变量",8,X)):d("",!0),s("。 ")])])],512),[[u,o(t).rewriteRule.mode=="proxy"]]),e("tr",null,[Y,e("td",null,[l(_,{name:"withQuery",value:"1",checked:"checked"}),Z])]),e("tr",null,[ee,e("td",null,[l(_,{name:"isBreak",value:"1"}),te])]),e("tr",null,[oe,e("td",null,[l(_,{name:"isOn",value:"1",checked:"checked"})])])],512),[[u,o(t).moreOptionsVisible]])]),_:1}),l(U)]),_:1},8,["onSuccess"])]),_:1}))}};export{Ce as default};
