diff --git a/web/public/js/components/common/time-duration-box.js b/web/public/js/components/common/time-duration-box.js index 0ee9f530..4d8943fc 100644 --- a/web/public/js/components/common/time-duration-box.js +++ b/web/public/js/components/common/time-duration-box.js @@ -50,6 +50,7 @@ Vue.component("time-duration-box", { + ` diff --git a/web/public/js/components/server/http-cache-ref-box.js b/web/public/js/components/server/http-cache-ref-box.js index 12cb76b7..8efd1950 100644 --- a/web/public/js/components/server/http-cache-ref-box.js +++ b/web/public/js/components/server/http-cache-ref-box.js @@ -21,7 +21,14 @@ Vue.component("http-cache-ref-box", { conds: null, allowChunkedEncoding: true, isReverse: this.vIsReverse, - methods: [] + methods: [], + expiresTime: { + isPrior: false, + isOn: false, + overwrite: true, + autoCalculate: true, + duration: {count: -1, "unit": "hour"} + } } } if (ref.key == null) { @@ -79,6 +86,9 @@ Vue.component("http-cache-ref-box", { }, changeKey: function (key) { this.$refs.variablesDescriber.update(key) + }, + changeExpiresTime: function (expiresTime) { + this.ref.expiresTime = expiresTime } }, template: ` @@ -107,12 +117,18 @@ Vue.component("http-cache-ref-box", { - 请求方法 + 请求方法限制

允许请求的缓存方法,默认支持所有的请求方法。

+ + 客户端过期时间(Expires) + + + + 可缓存的最大内容尺寸 diff --git a/web/public/js/components/server/http-cache-refs-box.js b/web/public/js/components/server/http-cache-refs-box.js index af0276b4..150b1cae 100644 --- a/web/public/js/components/server/http-cache-refs-box.js +++ b/web/public/js/components/server/http-cache-refs-box.js @@ -50,6 +50,7 @@ Vue.component("http-cache-refs-box", { 0 - {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit}} {{cacheRef.methods.join(", ")}} + Expires 状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}} diff --git a/web/public/js/components/server/http-cache-refs-config-box.js b/web/public/js/components/server/http-cache-refs-config-box.js index 25cd5d56..479ca276 100644 --- a/web/public/js/components/server/http-cache-refs-config-box.js +++ b/web/public/js/components/server/http-cache-refs-config-box.js @@ -173,6 +173,7 @@ Vue.component("http-cache-refs-config-box", { 0 - {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit}} {{cacheRef.methods.join(", ")}} + Expires 状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}} diff --git a/web/public/js/components/server/http-expires-time-config-box.js b/web/public/js/components/server/http-expires-time-config-box.js new file mode 100644 index 00000000..183ba3e7 --- /dev/null +++ b/web/public/js/components/server/http-expires-time-config-box.js @@ -0,0 +1,69 @@ +Vue.component("http-expires-time-config-box", { + props: ["v-expires-time"], + data: function () { + let expiresTime = this.vExpiresTime + if (expiresTime == null) { + expiresTime = { + isPrior: false, + isOn: false, + overwrite: true, + autoCalculate: true, + duration: {count: -1, "unit": "hour"} + } + } + return { + expiresTime: expiresTime + } + }, + watch: { + "expiresTime.isPrior": function () { + this.notifyChange() + }, + "expiresTime.isOn": function () { + this.notifyChange() + }, + "expiresTime.overwrite": function () { + this.notifyChange() + }, + "expiresTime.autoCalculate": function () { + this.notifyChange() + } + }, + methods: { + notifyChange: function () { + this.$emit("change", this.expiresTime) + } + }, + template: `
+ + + + + + + + + + + + + + + + + + + + +
是否启用 +

启用后,将会在响应的Header中添加Expires字段,浏览器据此会将内容缓存在客户端;同时,在管理后台执行清理缓存时,也将无法清理客户端已有的缓存。

+
覆盖源站设置 + +

选中后,会覆盖源站Header中已有的Expires字段。

+
自动计算时间 +

根据当前页面中设置的缓存有效期进行计算。

+
强制缓存时间 + +
+
` +}) \ No newline at end of file