diff --git a/internal/web/actions/default/servers/create.go b/internal/web/actions/default/servers/create.go index 19ed4e5f..4ff12af9 100644 --- a/internal/web/actions/default/servers/create.go +++ b/internal/web/actions/default/servers/create.go @@ -347,7 +347,7 @@ func (this *CreateAction) RunPost(params struct { var rootJSON []byte var err error if len(params.WebRoot) > 0 { - var rootConfig = &serverconfigs.HTTPRootConfig{} + var rootConfig = serverconfigs.NewHTTPRootConfig() rootConfig.IsOn = true rootConfig.Dir = params.WebRoot rootConfig.Indexes = []string{"index.html", "index.htm"} diff --git a/web/public/js/components/server/http-web-root-box.js b/web/public/js/components/server/http-web-root-box.js index a99d3f94..5a7c3f47 100644 --- a/web/public/js/components/server/http-web-root-box.js +++ b/web/public/js/components/server/http-web-root-box.js @@ -1,23 +1,34 @@ Vue.component("http-web-root-box", { props: ["v-root-config", "v-is-location", "v-is-group"], data: function () { - let rootConfig = this.vRootConfig - if (rootConfig == null) { - rootConfig = { + let config = this.vRootConfig + if (config == null) { + config = { isPrior: false, isOn: false, dir: "", indexes: [], stripPrefix: "", decodePath: false, - isBreak: false + isBreak: false, + exceptHiddenFiles: true, + onlyURLPatterns: [], + exceptURLPatterns: [] } } - if (rootConfig.indexes == null) { - rootConfig.indexes = [] + if (config.indexes == null) { + config.indexes = [] } + + if (config.onlyURLPatterns == null) { + config.onlyURLPatterns = [] + } + if (config.exceptURLPatterns == null) { + config.exceptURLPatterns = [] + } + return { - rootConfig: rootConfig, + config: config, advancedVisible: false } }, @@ -30,27 +41,27 @@ Vue.component("http-web-root-box", { teaweb.popup("/servers/server/settings/web/createIndex", { height: "10em", callback: function (resp) { - that.rootConfig.indexes.push(resp.data.index) + that.config.indexes.push(resp.data.index) } }) }, removeIndex: function (i) { - this.rootConfig.indexes.$remove(i) + this.config.indexes.$remove(i) }, isOn: function () { - return ((!this.vIsLocation && !this.vIsGroup) || this.rootConfig.isPrior) && this.rootConfig.isOn + return ((!this.vIsLocation && !this.vIsGroup) || this.config.isPrior) && this.config.isOn } }, template: `
- + - - + + @@ -60,7 +71,7 @@ Vue.component("http-web-root-box", { @@ -72,8 +83,8 @@ Vue.component("http-web-root-box", { + + + + + + + + + + + + @@ -93,17 +125,17 @@ Vue.component("http-web-root-box", { - +
启用静态资源分发
- +
静态资源根目录 - +

可以访问此根目录下的静态资源。

首页文件 -
-
+
+
{{index}}
@@ -82,10 +93,31 @@ Vue.component("http-web-root-box", {

在URL中只有目录没有文件名时默认查找的首页文件。

例外URL + +

如果填写了例外URL,表示不支持通过这些URL访问。

+
限制URL + +

如果填写了限制URL,表示仅支持通过这些URL访问。

+
排除隐藏文件 + +

排除以点(.)符号开头的隐藏目录或文件,比如/.git/logs/HEAD

+
去除URL前缀 - +

可以把请求的路径部分前缀去除后再查找文件,比如把 /web/app/index.html 去除前缀 /web 后就变成 /app/index.html

路径解码
- +

是否对请求路径进行URL解码,比如把 /Web+App+Browser.html 解码成 /Web App Browser.html 再查找文件。

是否终止请求终止请求
- +

在找不到要访问的文件的情况下是否终止请求并返回404,如果选择终止请求,则不再尝试反向代理等设置。