From b426201b16a0aa0066706649622ef9b7bc1928d8 Mon Sep 17 00:00:00 2001 From: gitea-action Date: Mon, 31 Mar 2025 16:30:21 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/0c8f946caa9dcfd89674248c9964db1397440cc1 --- .../model/cbi/passwall/client/rule_list.lua | 6 ++- .../view/passwall/rule_list/geoview.htm | 47 ++++++++++--------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua index 15f04bd8a..48ce08bd0 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua @@ -2,6 +2,7 @@ local api = require "luci.passwall.api" local appname = "passwall" local fs = api.fs local sys = api.sys +local uci = api.uci local datatypes = api.datatypes local path = string.format("/usr/share/%s/rules/", appname) local gfwlist_path = "/usr/share/passwall/rules/gfwlist" @@ -313,7 +314,10 @@ end m:append(Template(appname .. "/rule_list/js")) -if api.is_finded("geoview") then +local geo_dir = (uci:get(appname, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/") +local geosite_path = geo_dir .. "/geosite.dat" +local geoip_path = geo_dir .. "/geoip.dat" +if api.is_finded("geoview") and fs.access(geosite_path) and fs.access(geoip_path) then s:tab("geoview", translate("Geo View")) o = s:taboption("geoview", DummyValue, "_geoview_fieldset") o.rawhtml = true diff --git a/luci-app-passwall/luasrc/view/passwall/rule_list/geoview.htm b/luci-app-passwall/luasrc/view/passwall/rule_list/geoview.htm index f5fc86901..7b95b42c1 100644 --- a/luci-app-passwall/luasrc/view/passwall/rule_list/geoview.htm +++ b/luci-app-passwall/luasrc/view/passwall/rule_list/geoview.htm @@ -3,16 +3,16 @@ local api = require "luci.passwall.api" -%>
@@ -25,25 +25,25 @@ local api = require "luci.passwall.api"
- - + +
- <%:Enter a domain or IP to query the Geo rule list they belong to.%> + <%:Enter a domain or IP to query the Geo rule list they belong to.%>
- - + +
- <%:Enter a GeoIP or Geosite to extract the domains/IPs they contain. Format: geoip:cn or geosite:gfw%> + <%:Enter a GeoIP or Geosite to extract the domains/IPs they contain. Format: geoip:cn or geosite:gfw%>
@@ -59,9 +59,10 @@ local api = require "luci.passwall.api" var QueryingText = '<%:Querying%>'; function do_geoview(btn,action,value) { + value = value.trim(); if (!value) { - alert("<%:Please enter query content!%>"); - return; + alert("<%:Please enter query content!%>"); + return; } lookup_btn.disabled = true; extract_btn.disabled = true; @@ -78,4 +79,4 @@ local api = require "luci.passwall.api" }) } //]]> - \ No newline at end of file +