luci-app-passwall: sync upstream

last commit: ab736505aa
This commit is contained in:
gitea-action 2024-12-22 12:00:17 +08:00
parent d240aaf8d3
commit 7ba36b76e2
5 changed files with 21 additions and 13 deletions

View File

@ -79,9 +79,7 @@ function index()
entry({"admin", "services", appname, "update_rules"}, call("update_rules")).leaf = true
--[[rule_list]]
entry({"admin", "services", appname, "read_gfwlist"}, call("read_rulelist", "gfw")).leaf = true
entry({"admin", "services", appname, "read_chnlist"}, call("read_rulelist", "chn")).leaf = true
entry({"admin", "services", appname, "read_chnroute"}, call("read_rulelist", "chnroute")).leaf = true
entry({"admin", "services", appname, "read_rulelist"}, call("read_rulelist")).leaf = true
--[[Components update]]
entry({"admin", "services", appname, "check_passwall"}, call("app_check")).leaf = true
@ -495,14 +493,18 @@ function com_update(comname)
http_write_json(json)
end
function read_rulelist(list)
function read_rulelist()
local rule_type = http.formvalue("type")
local rule_path
if list == "gfw" then
if rule_type == "gfw" then
rule_path = "/usr/share/passwall/rules/gfwlist"
elseif list == "chn" then
elseif rule_type == "chn" then
rule_path = "/usr/share/passwall/rules/chnlist"
else
elseif rule_type == "chnroute" then
rule_path = "/usr/share/passwall/rules/chnroute"
else
http.status(400, "Invalid rule type")
return
end
if fs.access(rule_path) then
http.prepare_content("text/plain")

View File

@ -12,7 +12,10 @@ f:append(Template(appname .. "/log/log"))
fb = SimpleForm('backup-restore')
fb.reset = false
fb.submit = false
s = fb:section(SimpleSection, translate("Backup and Restore"), translate("Backup or Restore Client and Server Configurations."))
s = fb:section(SimpleSection, translate("Backup and Restore"), translate("Backup or Restore Client and Server Configurations.") ..
"<br><font color='red'>" ..
translate("Note: Restoring configurations across different versions may cause compatibility issues.") ..
"</font>")
o = s:option(DummyValue, '', nil)
o.template = appname .. "/log/backup_restore"

View File

@ -6,7 +6,7 @@ local total_lines_text = translate("Total Lines")
<script type="text/javascript">
//<![CDATA[
function read_gfw() {
fetch('<%= api.url("read_gfwlist") %>')
fetch('<%= api.url("read_rulelist") %>?type=gfw')
.then(response => response.text())
.then(data => {
var total_lines = data.split("\n").length;
@ -19,7 +19,7 @@ local total_lines_text = translate("Total Lines")
}
function read_chn() {
fetch('<%= api.url("read_chnlist") %>')
fetch('<%= api.url("read_rulelist") %>?type=chn')
.then(response => response.text())
.then(data => {
var total_lines = data.split("\n").length;
@ -32,7 +32,7 @@ local total_lines_text = translate("Total Lines")
}
function read_chnroute() {
fetch('<%= api.url("read_chnroute") %>')
fetch('<%= api.url("read_rulelist") %>?type=chnroute')
.then(response => response.text())
.then(data => {
var total_lines = data.split("\n").length;

View File

@ -1759,6 +1759,9 @@ msgstr "备份还原"
msgid "Backup or Restore Client and Server Configurations."
msgstr "备份或还原客户端及服务端配置。"
msgid "Note: Restoring configurations across different versions may cause compatibility issues."
msgstr "注意:不同版本间的配置恢复可能会导致兼容性问题。"
msgid "Create Backup File"
msgstr "创建备份文件"

View File

@ -20,10 +20,10 @@ index 2b72468..15c6437 100644
define Package/$(PKG_NAME)/postrm
diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua
index ae0617a..29e3604 100644
index e7fcbee..4143d44 100644
--- a/luci-app-passwall/luasrc/controller/passwall.lua
+++ b/luci-app-passwall/luasrc/controller/passwall.lua
@@ -283,7 +283,7 @@ function connect_status()
@@ -281,7 +281,7 @@ function connect_status()
url = "-x socks5h://" .. socks_server .. " " .. url
end
end