From 07ba8d1de3337062273c24c9db7ef7c4b86ab703 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sat, 26 Mar 2022 22:04:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=B7=AF=E7=94=B1=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E8=AF=B7=E6=B1=82=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../locations/locationutils/location_helper.go | 13 +++++++++++++ .../server/http-request-scripts-config-box.js | 6 +++--- .../js/components/server/script-group-config-box.js | 9 +++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/internal/web/actions/default/servers/server/settings/locations/locationutils/location_helper.go b/internal/web/actions/default/servers/server/settings/locations/locationutils/location_helper.go index d43c3c99..decf6048 100644 --- a/internal/web/actions/default/servers/server/settings/locations/locationutils/location_helper.go +++ b/internal/web/actions/default/servers/server/settings/locations/locationutils/location_helper.go @@ -1,6 +1,7 @@ package locationutils import ( + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" @@ -161,6 +162,18 @@ func (this *LocationHelper) createMenus(serverIdString string, locationIdString "isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.FastcgiRef != nil && locationConfig.Web.FastcgiRef.IsPrior, }) + if teaconst.IsPlus { + if locationConfig.Web != nil && locationConfig.Web.RequestScripts != nil { + _ = locationConfig.Web.RequestScripts.Init() + } + menuItems = append(menuItems, maps.Map{ + "name": "边缘脚本", + "url": "/servers/server/settings/locations/requestScripts?serverId=" + serverIdString + "&locationId=" + locationIdString, + "isActive": secondMenuItem == "requestScripts", + "isOn": locationConfig.Web != nil && locationConfig.Web.RequestScripts != nil && !locationConfig.Web.RequestScripts.IsEmpty(), + }) + } + menuItems = append(menuItems, maps.Map{ "name": "-", "url": "", diff --git a/web/public/js/components/server/http-request-scripts-config-box.js b/web/public/js/components/server/http-request-scripts-config-box.js index e604216c..168c3dbe 100644 --- a/web/public/js/components/server/http-request-scripts-config-box.js +++ b/web/public/js/components/server/http-request-scripts-config-box.js @@ -1,5 +1,5 @@ Vue.component("http-request-scripts-config-box", { - props: ["vRequestScriptsConfig"], + props: ["vRequestScriptsConfig", "v-is-location"], data: function () { let config = this.vRequestScriptsConfig if (config == null) { @@ -25,12 +25,12 @@ Vue.component("http-request-scripts-config-box", {

请求初始化

在请求刚初始化时调用,此时自定义Header等尚未生效。

- +

准备发送请求

在准备执行请求或者转发请求之前调用,此时自定义Header、源站等已准备好。

- +
` diff --git a/web/public/js/components/server/script-group-config-box.js b/web/public/js/components/server/script-group-config-box.js index 82759bd0..22889946 100644 --- a/web/public/js/components/server/script-group-config-box.js +++ b/web/public/js/components/server/script-group-config-box.js @@ -1,5 +1,5 @@ Vue.component("script-group-config-box", { - props: ["v-group"], + props: ["v-group", "v-is-location"], data: function () { let group = this.vGroup if (group == null) { @@ -33,6 +33,11 @@ Vue.component("script-group-config-box", { } }, template: `
- + + +
+
+ +
` }) \ No newline at end of file