luci-app-shadowsocks-libev: add a ss_rules section if none exists
When there is no ss_rules section, the "Redir Rules" tab will have empty form in the generated page. This is especialy the case when the shadowsocks-libev config is from an earlier version before 3.0.6-2 Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
parent
2697ef81a1
commit
be77667225
1 changed files with 6 additions and 1 deletions
|
@ -16,8 +16,13 @@ m = Map("shadowsocks-libev",
|
||||||
If the prior check results in action <em>checkdst</em>, packets will continue \
|
If the prior check results in action <em>checkdst</em>, packets will continue \
|
||||||
to have their destination addresses checked."))
|
to have their destination addresses checked."))
|
||||||
|
|
||||||
|
local sdata = m:get('ss_rules')
|
||||||
|
if not sdata then
|
||||||
|
m:set('ss_rules', nil, 'ss_rules')
|
||||||
|
m:set('ss_rules', 'ss_rules', 'disabled', true)
|
||||||
|
end
|
||||||
|
|
||||||
s = m:section(NamedSection, "ss_rules", "ss-rules")
|
s = m:section(NamedSection, "ss_rules", "ss_rules")
|
||||||
s:tab("general", translate("General Settings"))
|
s:tab("general", translate("General Settings"))
|
||||||
s:tab("srcip", translate("Source Settings"))
|
s:tab("srcip", translate("Source Settings"))
|
||||||
s:tab("dstip", translate("Destination Settings"))
|
s:tab("dstip", translate("Destination Settings"))
|
||||||
|
|
Loading…
Reference in a new issue