diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua index 178651d13..74964cf64 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua @@ -45,11 +45,9 @@ o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), o.default = "0" o = s:option(Value, option_name("up_mbps"), translate("Max upload Mbps")) -o.default = "100" o.rewrite_option = o.option o = s:option(Value, option_name("down_mbps"), translate("Max download Mbps")) -o.default = "100" o.rewrite_option = o.option o = s:option(Value, option_name("hop_interval"), translate("Hop Interval")) diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/hysteria2.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/hysteria2.lua index ea4556a71..61c1c857f 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/hysteria2.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/hysteria2.lua @@ -33,11 +33,9 @@ o.default = "1" o.rewrite_option = o.option o = s:option(Value, option_name("up_mbps"), translate("Max upload Mbps")) -o.default = "100" o.rewrite_option = o.option o = s:option(Value, option_name("down_mbps"), translate("Max download Mbps")) -o.default = "100" o.rewrite_option = o.option o = s:option(Flag, option_name("ignoreClientBandwidth"), translate("ignoreClientBandwidth")) diff --git a/luci-app-passwall2/luasrc/passwall2/util_hysteria2.lua b/luci-app-passwall2/luasrc/passwall2/util_hysteria2.lua index 90aa0a5f3..fcb74e423 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_hysteria2.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_hysteria2.lua @@ -20,10 +20,10 @@ function gen_config_server(node) type = "password", password = node.hysteria2_auth_password }, - bandwidth = { - up = node.hysteria2_up_mbps and node.hysteria2_up_mbps .. " mbps" or "1 gbps", - down = node.hysteria2_down_mbps and node.hysteria2_down_mbps .. " mbps" or "1 gbps", - }, + bandwidth = (node.hysteria2_up_mbps or node.hysteria2_down_mbps) and { + up = node.hysteria2_up_mbps and node.hysteria2_up_mbps .. " mbps" or nil, + down = node.hysteria2_down_mbps and node.hysteria2_down_mbps .. " mbps" or nil + } or nil, ignoreClientBandwidth = (node.hysteria2_ignoreClientBandwidth == "1") and true or false, disableUDP = (node.hysteria2_udp == "0") and true or false, } @@ -82,10 +82,10 @@ function gen_config(var) maxIdleTimeout = (node.hysteria2_idle_timeout) and tonumber(node.hysteria2_idle_timeout) or nil, disablePathMTUDiscovery = (node.hysteria2_disable_mtu_discovery) and true or false, }, - bandwidth = { - up = node.hysteria2_up_mbps and node.hysteria2_up_mbps .. " mbps" or "100 mbps", - down = node.hysteria2_down_mbps and node.hysteria2_down_mbps .. " mbps" or "100 mbps" - }, + bandwidth = (node.hysteria2_up_mbps or node.hysteria2_down_mbps) and { + up = node.hysteria2_up_mbps and node.hysteria2_up_mbps .. " mbps" or nil, + down = node.hysteria2_down_mbps and node.hysteria2_down_mbps .. " mbps" or nil + } or nil, fast_open = (node.fast_open == "1") and true or false, lazy = (node.hysteria2_lazy_start == "1") and true or false, socks5 = (local_socks_address and local_socks_port) and {