parent
f0c707dabe
commit
b426201b16
@ -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
|
||||||
|
@ -25,7 +25,7 @@ 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%>" />
|
||||||
@ -37,7 +37,7 @@ local api = require "luci.passwall.api"
|
|||||||
</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%>" />
|
||||||
@ -59,6 +59,7 @@ 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;
|
||||||
|
Loading…
Reference in New Issue
Block a user