parent
53daef9365
commit
27a7fc520f
@ -3,6 +3,7 @@ local appname = "passwall"
|
||||
local sys = api.sys
|
||||
|
||||
m = Map(appname)
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
s = m:section(TypedSection, "global", translate("ACLs"), "<font color='red'>" .. translate("ACLs is a tools which used to designate specific IP proxy mode.") .. "</font>")
|
||||
s.anonymous = true
|
||||
|
@ -2,6 +2,7 @@ local api = require "luci.passwall.api"
|
||||
local appname = "passwall"
|
||||
|
||||
m = Map(appname)
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
-- [[ App Settings ]]--
|
||||
s = m:section(TypedSection, "global_app", translate("App Update"),
|
||||
|
@ -10,6 +10,7 @@ local has_chnroute = fs.access("/usr/share/passwall/rules/chnroute")
|
||||
local chinadns_tls = os.execute("chinadns-ng -V | grep -i wolfssl >/dev/null")
|
||||
|
||||
m = Map(appname)
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
local nodes_table = {}
|
||||
for k, e in ipairs(api.get_valid_nodes()) do
|
||||
|
@ -15,6 +15,7 @@ for k, e in ipairs(api.get_valid_nodes()) do
|
||||
end
|
||||
|
||||
m = Map(appname)
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
-- [[ Haproxy Settings ]]--
|
||||
s = m:section(TypedSection, "global_haproxy", translate("Basic Settings"))
|
||||
|
@ -4,6 +4,7 @@ local sys = api.sys
|
||||
local datatypes = api.datatypes
|
||||
|
||||
m = Map(appname)
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
-- [[ Other Settings ]]--
|
||||
s = m:section(TypedSection, "global_other")
|
||||
|
@ -1,4 +1,5 @@
|
||||
local api = require "luci.passwall.api"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local appname = "passwall"
|
||||
local has_ss = api.is_finded("ss-redir")
|
||||
local has_ss_rust = api.is_finded("sslocal")
|
||||
@ -45,10 +46,6 @@ end
|
||||
|
||||
m = Map(appname)
|
||||
|
||||
-- [[ Subscribe Settings ]]--
|
||||
s = m:section(TypedSection, "global_subscribe", "")
|
||||
s.anonymous = true
|
||||
|
||||
function m.commit_handler(self)
|
||||
if self.no_commit then
|
||||
return
|
||||
@ -58,6 +55,21 @@ function m.commit_handler(self)
|
||||
end)
|
||||
end
|
||||
|
||||
if api.is_js_luci() then
|
||||
m.apply_on_parse = false
|
||||
m.on_after_apply = function(self)
|
||||
uci:foreach(appname, "subscribe_list", function(e)
|
||||
uci:delete(appname, e[".name"], "md5")
|
||||
end)
|
||||
uci:commit(appname)
|
||||
api.showMsg_Redirect()
|
||||
end
|
||||
end
|
||||
|
||||
-- [[ Subscribe Settings ]]--
|
||||
s = m:section(TypedSection, "global_subscribe", "")
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(ListValue, "filter_keyword_mode", translate("Filter keyword Mode"))
|
||||
o:value("0", translate("Close"))
|
||||
o:value("1", translate("Discard List"))
|
||||
|
@ -18,13 +18,7 @@ if api.is_js_luci() then
|
||||
m.on_after_apply = function(self)
|
||||
uci:delete(appname, arg[1], "md5")
|
||||
uci:commit(appname)
|
||||
luci.http.write([[
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {
|
||||
window.location.href = ']] .. self.redirect .. [[';
|
||||
}, 1000);
|
||||
</script>
|
||||
]])
|
||||
api.showMsg_Redirect(self.redirect, 3000)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -11,6 +11,7 @@ local port_validate = function(self, value, t)
|
||||
end
|
||||
|
||||
m = Map(appname)
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
-- [[ Delay Settings ]]--
|
||||
s = m:section(TypedSection, "global_delay", translate("Delay Settings"))
|
||||
|
@ -4,6 +4,8 @@ local has_xray = api.finded_com("xray")
|
||||
local has_singbox = api.finded_com("singbox")
|
||||
|
||||
m = Map(appname)
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
-- [[ Rule Settings ]]--
|
||||
s = m:section(TypedSection, "global_rules", translate("Rule status"))
|
||||
s.anonymous = true
|
||||
|
@ -9,6 +9,7 @@ local chnlist_path = "/usr/share/passwall/rules/chnlist"
|
||||
local chnroute_path = "/usr/share/passwall/rules/chnroute"
|
||||
|
||||
m = Map(appname)
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
-- [[ Rule List Settings ]]--
|
||||
s = m:section(TypedSection, "global_rules")
|
||||
|
@ -4,6 +4,7 @@ local datatypes = api.datatypes
|
||||
|
||||
m = Map(appname, "Sing-Box/Xray " .. translate("Shunt Rule"))
|
||||
m.redirect = api.url()
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
s = m:section(NamedSection, arg[1], "shunt_rules", "")
|
||||
s.addremove = false
|
||||
|
@ -1,6 +1,7 @@
|
||||
local api = require "luci.passwall.api"
|
||||
|
||||
m = Map("passwall_server", translate("Server-Side"))
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
t = m:section(NamedSection, "global", "global")
|
||||
t.anonymous = true
|
||||
|
@ -45,19 +45,44 @@ function set_apply_on_parse(map)
|
||||
if is_js_luci() then
|
||||
map.apply_on_parse = false
|
||||
map.on_after_apply = function(self)
|
||||
if self.redirect then
|
||||
luci.http.write([[
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {
|
||||
window.location.href = ']] .. self.redirect .. [[';
|
||||
}, 1000);
|
||||
</script>
|
||||
]])
|
||||
end
|
||||
showMsg_Redirect(self.redirect, 3000)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function showMsg_Redirect(redirectUrl, delay)
|
||||
local message = "PassWall " .. i18n.translate("Settings have been successfully saved and applied!")
|
||||
luci.http.write([[
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var messageDiv = document.createElement('div');
|
||||
messageDiv.style.position = 'fixed';
|
||||
messageDiv.style.top = '0';
|
||||
messageDiv.style.left = '0';
|
||||
messageDiv.style.width = '100%';
|
||||
messageDiv.style.background = '#4caf50';
|
||||
messageDiv.style.color = '#fff';
|
||||
messageDiv.style.textAlign = 'center';
|
||||
messageDiv.style.padding = '10px';
|
||||
messageDiv.style.zIndex = '10000';
|
||||
messageDiv.textContent = ']] .. message .. [[';
|
||||
document.body.appendChild(messageDiv);
|
||||
var redirectUrl = ']] .. (redirectUrl or "") .. [[';
|
||||
var delay = ]] .. (delay or 3000) .. [[;
|
||||
setTimeout(function() {
|
||||
if (redirectUrl) {
|
||||
window.location.href = redirectUrl;
|
||||
} else {
|
||||
if (messageDiv && messageDiv.parentNode) {
|
||||
messageDiv.parentNode.removeChild(messageDiv);
|
||||
}
|
||||
}
|
||||
}, delay);
|
||||
});
|
||||
</script>
|
||||
]])
|
||||
end
|
||||
|
||||
function uci_save(cursor, config, commit, apply)
|
||||
if is_old_uci() then
|
||||
cursor:save(config)
|
||||
|
@ -1800,3 +1800,6 @@ msgstr "是否要恢复客户端默认配置?"
|
||||
|
||||
msgid "Are you sure you want to restore the client to default settings?"
|
||||
msgstr "是否真的要恢复客户端默认配置?"
|
||||
|
||||
msgid "Settings have been successfully saved and applied!"
|
||||
msgstr "设置已成功保存并应用!"
|
||||
|
@ -20,10 +20,10 @@ index f0c9835..3555afe 100644
|
||||
|
||||
define Package/$(PKG_NAME)/postrm
|
||||
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
||||
index de67f1c..463bdff 100644
|
||||
index 3e98ec5..17184a5 100644
|
||||
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
||||
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
||||
@@ -492,6 +492,12 @@ o:value("9.9.9.9", "9.9.9.9 (Quad9)")
|
||||
@@ -493,6 +493,12 @@ o:value("9.9.9.9", "9.9.9.9 (Quad9)")
|
||||
o:value("149.112.112.112", "149.112.112.112 (Quad9)")
|
||||
o:value("208.67.220.220", "208.67.220.220 (OpenDNS)")
|
||||
o:value("208.67.222.222", "208.67.222.222 (OpenDNS)")
|
||||
@ -36,7 +36,7 @@ index de67f1c..463bdff 100644
|
||||
o:depends({dns_mode = "dns2socks"})
|
||||
o:depends({dns_mode = "tcp"})
|
||||
o:depends({dns_mode = "udp"})
|
||||
@@ -591,7 +597,7 @@ if api.is_finded("smartdns") then
|
||||
@@ -592,7 +598,7 @@ if api.is_finded("smartdns") then
|
||||
end
|
||||
|
||||
o = s:taboption("DNS", Flag, "dns_redirect", translate("DNS Redirect"), translate("Force special DNS server to need proxy devices."))
|
||||
|
Loading…
Reference in New Issue
Block a user