diff --git a/internal/web/actions/default/servers/serverutils/server_helper.go b/internal/web/actions/default/servers/serverutils/server_helper.go index 8bee336d..6eee620f 100644 --- a/internal/web/actions/default/servers/serverutils/server_helper.go +++ b/internal/web/actions/default/servers/serverutils/server_helper.go @@ -348,6 +348,15 @@ func (this *ServerHelper) createSettingsMenu(secondMenuItem string, serverIdStri "isActive": secondMenuItem == "remoteAddr", "isOn": serverConfig.Web != nil && serverConfig.Web.RemoteAddr != nil && serverConfig.Web.RemoteAddr.IsOn, }) + + if teaconst.IsPlus { + menuItems = append(menuItems, maps.Map{ + "name": "带宽限制", + "url": "/servers/server/settings/bandwidth?serverId=" + serverIdString, + "isActive": secondMenuItem == "bandwidth", + "isOn": serverConfig.BandwidthLimit != nil && serverConfig.BandwidthLimit.IsOn, + }) + } } else if serverConfig.IsTCPFamily() { menuItems = append(menuItems, maps.Map{ "name": "TCP", diff --git a/web/public/js/components/common/size-capacity-box.js b/web/public/js/components/common/size-capacity-box.js index 0f6751e5..af571081 100644 --- a/web/public/js/components/common/size-capacity-box.js +++ b/web/public/js/components/common/size-capacity-box.js @@ -60,6 +60,8 @@ Vue.component("size-capacity-box", { + + ` diff --git a/web/public/js/components/server/bandwidth-limit-config-box.js b/web/public/js/components/server/bandwidth-limit-config-box.js new file mode 100644 index 00000000..3d5bec3a --- /dev/null +++ b/web/public/js/components/server/bandwidth-limit-config-box.js @@ -0,0 +1,84 @@ +Vue.component("bandwidth-limit-config-box", { + props: ["v-bandwidth-limit"], + data: function () { + let config = this.vBandwidthLimit + if (config == null) { + config = { + isOn: false, + dailySize: { + count: -1, + unit: "gb" + }, + monthlySize: { + count: -1, + unit: "gb" + }, + totalSize: { + count: -1, + unit: "gb" + }, + noticePageBody: "" + } + } + return { + config: config + } + }, + methods: { + showBodyTemplate: function () { + this.config.noticePageBody = ` + +
+| 是否启用 | +
+ 注意:由于带宽统计是每5分钟统计一次,所以超出带宽限制后,对用户的提醒也会有所延迟。 + |
+
| 日带宽限制 | +
+ |
+
| 月带宽限制 | +
+ |
+
| 网页提示内容 | +
+
+ [使用模板]。当达到带宽限制时网页显示的HTML内容,不填写则显示默认的提示内容。 + |
+