luci-app-passwall: sync upstream

last commit: 0c8f946caa
This commit is contained in:
gitea-action 2025-03-31 16:30:21 +08:00
parent f0c707dabe
commit b426201b16
2 changed files with 29 additions and 24 deletions

View File

@ -2,6 +2,7 @@ local api = require "luci.passwall.api"
local appname = "passwall" local appname = "passwall"
local fs = api.fs local fs = api.fs
local sys = api.sys local sys = api.sys
local uci = api.uci
local datatypes = api.datatypes local datatypes = api.datatypes
local path = string.format("/usr/share/%s/rules/", appname) local path = string.format("/usr/share/%s/rules/", appname)
local gfwlist_path = "/usr/share/passwall/rules/gfwlist" local gfwlist_path = "/usr/share/passwall/rules/gfwlist"
@ -313,7 +314,10 @@ end
m:append(Template(appname .. "/rule_list/js")) 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")) s:tab("geoview", translate("Geo View"))
o = s:taboption("geoview", DummyValue, "_geoview_fieldset") o = s:taboption("geoview", DummyValue, "_geoview_fieldset")
o.rawhtml = true o.rawhtml = true

View File

@ -3,16 +3,16 @@ local api = require "luci.passwall.api"
-%> -%>
<style> <style>
.faq-title { .faq-title {
color: var(--primary); color: var(--primary);
font-weight: bolder; font-weight: bolder;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
display: inline-block; display: inline-block;
} }
.faq-item { .faq-item {
margin-bottom: 0.8rem; margin-bottom: 0.8rem;
line-height:1.2rem; line-height:1.2rem;
} }
</style> </style>
<div class="cbi-value"> <div class="cbi-value">
@ -25,25 +25,25 @@ local api = require "luci.passwall.api"
</div> </div>
<div class="cbi-value" id="cbi-passwall-geoview-lookup"><label class="cbi-value-title" for="geoview.lookup"><%:Domain/IP Query%></label> <div class="cbi-value" id="cbi-passwall-geoview-lookup"><label class="cbi-value-title" for="geoview.lookup"><%:Domain/IP Query%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" class="cbi-textfield" id="geoview.lookup" name="geoview.lookup"> <input type="text" class="cbi-textfield" id="geoview.lookup" name="geoview.lookup" />
<input class="btn cbi-button cbi-button-apply" type="button" id="lookup-view_btn" <input class="btn cbi-button cbi-button-apply" type="button" id="lookup-view_btn"
onclick='do_geoview(this, "lookup", document.getElementById("geoview.lookup").value)' onclick='do_geoview(this, "lookup", document.getElementById("geoview.lookup").value)'
value="<%:Query%>" /> value="<%:Query%>" />
<br /> <br />
<div class="cbi-value-description"> <div class="cbi-value-description">
<%: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.%>
</div> </div>
</div> </div>
</div> </div>
<div class="cbi-value" id="cbi-passwall-geoview-extract"><label class="cbi-value-title" for="geoview.extract"><%:GeoIP/Geosite Query%></label> <div class="cbi-value" id="cbi-passwall-geoview-extract"><label class="cbi-value-title" for="geoview.extract"><%:GeoIP/Geosite Query%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" class="cbi-textfield" id="geoview.extract" name="geoview.extract"> <input type="text" class="cbi-textfield" id="geoview.extract" name="geoview.extract" />
<input class="btn cbi-button cbi-button-apply" type="button" id="extract-view_btn" <input class="btn cbi-button cbi-button-apply" type="button" id="extract-view_btn"
onclick='do_geoview(this, "extract", document.getElementById("geoview.extract").value)' onclick='do_geoview(this, "extract", document.getElementById("geoview.extract").value)'
value="<%:Query%>" /> value="<%:Query%>" />
<br /> <br />
<div class="cbi-value-description"> <div class="cbi-value-description">
<%: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%>
</div> </div>
</div> </div>
</div> </div>
@ -59,9 +59,10 @@ local api = require "luci.passwall.api"
var QueryingText = '<%:Querying%>'; var QueryingText = '<%:Querying%>';
function do_geoview(btn,action,value) { function do_geoview(btn,action,value) {
value = value.trim();
if (!value) { if (!value) {
alert("<%:Please enter query content!%>"); alert("<%:Please enter query content!%>");
return; return;
} }
lookup_btn.disabled = true; lookup_btn.disabled = true;
extract_btn.disabled = true; extract_btn.disabled = true;
@ -78,4 +79,4 @@ local api = require "luci.passwall.api"
}) })
} }
//]]> //]]>
</script> </script>