update 2023-02-09 20:16:37

This commit is contained in:
github-actions[bot] 2023-02-09 20:16:37 +08:00
parent cc3dc24e53
commit 41d843ac39
25 changed files with 5202 additions and 16836 deletions

View File

@ -3,7 +3,7 @@ config mosdns 'mosdns'
option not_first_start '0'
option enabled '0'
option geo_auto_update '0'
option geo_update_week_time 'all'
option geo_update_week_time '*'
option geo_update_day_time '2'
option redirect '1'
option autoconf '1'

View File

@ -16,6 +16,24 @@ DISTRIB_TARGET = nil
LOG_FILE = "/tmp/log/" .. appname .. ".log"
CACHE_PATH = "/tmp/etc/" .. appname .. "_tmp"
function exec_call(cmd)
local process = io.popen(cmd .. '; echo -e "\n$?"')
local lines = {}
local result = ""
local return_code
for line in process:lines() do
lines[#lines + 1] = line
end
process:close()
if #lines > 0 then
return_code = lines[#lines]
for i = 1, #lines - 1 do
result = result .. lines[i] .. ((i == #lines - 1) and "" or "\n")
end
end
return tonumber(return_code), trim(result)
end
function base64Decode(text)
local raw = text
if not text then return '' end
@ -39,11 +57,7 @@ function curl_base(url, file, args)
args[#args + 1] = "-o " .. file
end
local cmd = string.format('curl %s "%s"', table_join(args), url)
if file then
return luci.sys.call(cmd .. " > /dev/null")
else
return trim(luci.sys.exec(cmd))
end
return exec_call(cmd)
end
function curl_proxy(url, file, args)
@ -55,15 +69,15 @@ function curl_proxy(url, file, args)
tmp_args[#tmp_args + 1] = "-x socks5h://" .. socks_server
return curl_base(url, file, tmp_args)
end
return nil
return nil, nil
end
function curl_logic(url, file, args)
local result = curl_proxy(url, file, args)
if not result then
result = curl_base(url, file, args)
local return_code, result = curl_proxy(url, file, args)
if not return_code or return_code ~= 0 then
return_code, result = curl_base(url, file, args)
end
return result
return return_code, result
end
function url(...)
@ -628,9 +642,9 @@ end
function get_api_json(url)
local jsonc = require "luci.jsonc"
local json_content = curl_logic(url, nil, curl_args)
if json_content == "" then return {} end
return jsonc.parse(json_content) or {}
local return_code, content = curl_logic(url, nil, curl_args)
if return_code ~= 0 or content == "" then return {} end
return jsonc.parse(content) or {}
end
function common_to_check(api_url, local_version, match_file_name)

View File

@ -63,7 +63,8 @@ function to_download(url, size)
end
end
result = api.curl_logic(url, tmp_file, api.curl_args) == 0
local return_code, result = api.curl_logic(url, tmp_file, api.curl_args)
result = return_code == 0
if not result then
api.exec("/bin/rm", {"-f", tmp_file})

View File

@ -63,7 +63,8 @@ function to_download(url, size)
end
end
result = api.curl_logic(url, tmp_file, api.curl_args) == 0
local return_code, result = api.curl_logic(url, tmp_file, api.curl_args)
result = return_code == 0
if not result then
api.exec("/bin/rm", {"-f", tmp_file})

View File

@ -71,7 +71,8 @@ function to_download(url, size)
end
end
result = api.curl_logic(url, tmp_file, api.curl_args) == 0
local return_code, result = api.curl_logic(url, tmp_file, api.curl_args)
result = return_code == 0
if not result then
api.exec("/bin/rm", {"-f", tmp_file})

View File

@ -69,7 +69,8 @@ function to_download(url, size)
end
end
result = api.curl_logic(url, tmp_file, api.curl_args) == 0
local return_code, result = api.curl_logic(url, tmp_file, api.curl_args)
result = return_code == 0
if not result then
api.exec("/bin/rm", {"-f", tmp_file})

View File

@ -69,7 +69,8 @@ function to_download(url, size)
end
end
result = api.curl_logic(url, tmp_file, api.curl_args) == 0
local return_code, result = api.curl_logic(url, tmp_file, api.curl_args)
result = return_code == 0
if not result then
api.exec("/bin/rm", {"-f", tmp_file})

View File

@ -197,9 +197,6 @@ end
if api.is_finded("dns2socks") then
dns_mode:value("dns2socks", "dns2socks")
end
if has_v2ray then
dns_mode:value("v2ray", "V2ray")
end
if has_xray then
dns_mode:value("xray", "Xray")
end
@ -209,7 +206,6 @@ o = s:taboption("DNS", ListValue, "v2ray_dns_mode", " ")
o:value("tcp", "TCP")
o:value("doh", "DoH")
o:value("fakedns", "FakeDNS")
o:depends("dns_mode", "v2ray")
o:depends("dns_mode", "xray")
o.validate = function(self, value, t)
if value == "fakedns" then
@ -274,8 +270,6 @@ o:depends("v2ray_dns_mode", "doh")
o = s:taboption("DNS", Flag, "dns_cache", translate("Cache Resolved"))
o.default = "1"
o:depends({dns_mode = "dns2socks"})
o:depends({dns_mode = "v2ray", v2ray_dns_mode = "tcp"})
o:depends({dns_mode = "v2ray", v2ray_dns_mode = "doh"})
o:depends({dns_mode = "xray", v2ray_dns_mode = "tcp"})
o:depends({dns_mode = "xray", v2ray_dns_mode = "doh"})
o.rmempty = false
@ -285,8 +279,6 @@ if has_chnlist and api.is_finded("chinadns-ng") then
o.default = "0"
o:depends({dns_mode = "dns2socks"})
o:depends({dns_mode = "dns2tcp"})
o:depends({dns_mode = "v2ray", v2ray_dns_mode = "tcp"})
o:depends({dns_mode = "v2ray", v2ray_dns_mode = "doh"})
o:depends({dns_mode = "xray", v2ray_dns_mode = "tcp"})
o:depends({dns_mode = "xray", v2ray_dns_mode = "doh"})
o:depends({dns_mode = "udp"})

View File

@ -0,0 +1,6 @@
#!/bin/sh
[[ "$ACTION" == "ifup" && $(uci get "passwall.@global[0].enabled") == "1" ]] && {
/etc/init.d/passwall restart
echo "passwall: restart when $INTERFACE ifup" > /dev/kmsg
}

View File

@ -924,7 +924,7 @@ start_redir() {
start_socks() {
tcp_node_socks=1
tcp_node_socks_port=$(config_t_get global tcp_node_socks_port 1070)
tcp_node_socks_port=$(get_new_port $(config_t_get global tcp_node_socks_port 1070))
tcp_node_http_port=$(config_t_get global tcp_node_http_port 0)
[ "$tcp_node_http_port" != "0" ] && tcp_node_http=1
[ "$SOCKS_ENABLED" = "1" ] && {
@ -1079,7 +1079,7 @@ start_dns() {
local config_file=$TMP_PATH/DNS.json
local log_file=$TMP_PATH/DNS.log
local log_file=/dev/null
local _v2ray_args="config_file=$config_file log_file=$log_file"
local _v2ray_args="type=$DNS_MODE config_file=$config_file log_file=$log_file"
[ "${DNS_CACHE}" == "0" ] && _v2ray_args="${_v2ray_args} dns_cache=0"
_v2ray_args="${_v2ray_args} dns_query_strategy=${DNS_QUERY_STRATEGY}"
local _dns_client_ip=$(config_t_get global dns_client_ip)

View File

@ -66,13 +66,8 @@ local function curl(url, file, valifile)
if valifile then
args[#args + 1] = "--dump-header " .. valifile
end
local result = api.curl_logic(url, nil, args)
if file then
return tonumber(trim(result))
else
return trim(result)
end
local return_code, result = api.curl_logic(url, nil, args)
return tonumber(result)
end
--check excluded domain
@ -246,7 +241,7 @@ end
local function fetch_geoip()
--请求geoip
xpcall(function()
local json_str = curl(geoip_api)
local json_str = api.curl_logic(geoip_api)
local json = jsonc.parse(json_str)
if json.tag_name and json.assets then
for _, v in ipairs(json.assets) do
@ -297,7 +292,7 @@ end
local function fetch_geosite()
--请求geosite
xpcall(function()
local json_str = curl(geosite_api)
local json_str = api.curl_logic(geosite_api)
local json = jsonc.parse(json_str)
if json.tag_name and json.assets then
for _, v in ipairs(json.assets) do
@ -345,24 +340,26 @@ local function fetch_geosite()
end
if arg[2] then
if arg[2]:find("gfwlist") then
gfwlist_update = 1
end
if arg[2]:find("chnroute") then
chnroute_update = 1
end
if arg[2]:find("chnroute6") then
chnroute6_update = 1
end
if arg[2]:find("chnlist") then
chnlist_update = 1
end
if arg[2]:find("geoip") then
geoip_update = 1
end
if arg[2]:find("geosite") then
geosite_update = 1
end
string.gsub(arg[2], '[^' .. "," .. ']+', function(w)
if w == "gfwlist" then
gfwlist_update = 1
end
if w == "chnroute" then
chnroute_update = 1
end
if w == "chnroute6" then
chnroute6_update = 1
end
if w == "chnlist" then
chnlist_update = 1
end
if w == "geoip" then
geoip_update = 1
end
if w == "geosite" then
geosite_update = 1
end
end)
else
gfwlist_update = ucic:get_first(name, 'global_rules', "gfwlist_update", 1)
chnroute_update = ucic:get_first(name, 'global_rules', "chnroute_update", 1)

View File

@ -1134,6 +1134,7 @@
135309.com
135320.com
135650.com
13567.com
1356789.com
1356net.com
135958.com
@ -1276,6 +1277,7 @@
163663.com
163686.com
1637.com
163888.net
163cdn.com
163cn.tv
163cp.com
@ -1925,6 +1927,7 @@
210997.com
210z.com
2113.net
2114.com
2115.com
211600.com
211ic.com
@ -2555,7 +2558,6 @@
3259.com
326pay.com
32800.com
328888.xyz
328f.com
328vip.com
3290.com
@ -3857,7 +3859,6 @@
51job.com
51jobcdn.com
51jobdns.com
51joyfish.com
51js.com
51jt.com
51jucaimi.com
@ -4473,6 +4474,7 @@
5433.com
545c.com
5460.net
54674479.com
5490146.cc
5490196.cc
5499.com
@ -4491,6 +4493,7 @@
54md.com
54op.com
54pictu.com
54qs.com
54tf.com
54traveler.com
54tusi.com
@ -4756,6 +4759,7 @@
593yx.com
5947.net
59490.com
5951835ccc.com
595818.com
595led.com
595tuchuang.com
@ -5109,6 +5113,7 @@
6543210.com
654321wan.com
654h.com
65522v.com
655a.com
655u.com
655yx.com
@ -5407,6 +5412,7 @@
711pr.com
7120.com
712100.com
71268924.com
71360.com
7139.com
715083.com
@ -5979,6 +5985,7 @@
861817.com
86215.com
8624x.com
86255845.com
86262.com
8633.com
863347.com
@ -6167,6 +6174,7 @@
89dj.com
89ds.com
89hl.com
89qw.com
89uu.com
8a.hk
8ao8ao.com
@ -7037,7 +7045,6 @@
9txs.org
9u.net
9upk.com
9v.com
9vf.com
9w9.com
9wee.com
@ -7906,6 +7913,7 @@ aituan.com
aitupian.com
aituwo.com
aityp.com
aiufida.com
aiurl.com
aiuw.com
aiuxdesign.com
@ -8733,7 +8741,6 @@ apgblogs.com
apgoview.com
aphidic.com
api.anythinktech.com
api.bz
apiadmin.org
apiairasia.com
apicase.io
@ -11150,6 +11157,7 @@ bjythd.com
bjyunyu.com
bjywt.com
bjzaxy.com
bjzbb.com
bjzbkj.com
bjzcha.com
bjzcth.com
@ -11986,6 +11994,7 @@ bytesmanager.com
bytestacks.com
bytetcc.com
bytetos.com
bytewars.cc
bytexns.com
bytexservice.com
byts.com
@ -12651,7 +12660,6 @@ ccpitqd.org
ccpitsd.com
ccpittex.com
ccpittj.org
ccpitwh.org
ccpitxiamen.org
ccpitxian.org
ccpitxj.org
@ -12872,9 +12880,11 @@ cdnhwc3.com
cdnhwc5.com
cdnhwc6.com
cdnhwc8.com
cdnhwcbzj102.com
cdnhwcedt124.com
cdnhwchcg02.com
cdnhwcibv122.com
cdnhwctnm107.com
cdnidc.net
cdnjtzy.com
cdnle.com
@ -13105,6 +13115,7 @@ cf-ns.net
cf.com
cf69.com
cf865.com
cf9q4i.xyz
cfachina.org
cfbond.com
cfc365.com
@ -15412,7 +15423,6 @@ cnhacker.com
cnhaio.com
cnhalo.net
cnhan.com
cnhandan.com
cnhanxing.com
cnhaoshengyi.com
cnhaskell.com
@ -17398,7 +17408,6 @@ dashoucloud.com
dashuihua.com
dashuju123.com
dashuye.com
dasougu.com
dasoujia.com
dassm.com
dasung.com
@ -17680,7 +17689,6 @@ ddwhm.com
ddwzh.com
ddxinwen.com
ddxq.mobi
ddxs.cc
ddxstxt8.com
ddyqh.com
ddyun.com
@ -19095,7 +19103,6 @@ drip.im
dripcar.com
driverdevelop.com
drivergenius.com
driversdown.com
driverzeng.com
drivethelife.com
drli.group
@ -19741,7 +19748,6 @@ eastcompeace.com
eastcoms.com
eastday.com
eastdesign.net
eastdigit.com
eastdrama.com
eastdushi.com
easteat.com
@ -21608,6 +21614,7 @@ fenglinjiu.com
fengmanginfo.com
fengmaniu.com
fengmeng.net
fengmi-baike.com
fengmk2.com
fengniao.com
fengniaohuanjing.com
@ -22233,7 +22240,6 @@ fqnovelpic.com
fqnovelstatic.com
fqnovelvod.com
fqpai.com
fqsszx.com
fqxs.org
fr-odc.samsungapps.com
fr-trading.com
@ -25776,7 +25782,6 @@ hbsia.org
hbskw.com
hbslndx.com
hbsmservice.com
hbsmw.com
hbsocar.com
hbsoft.net
hbsogdjt.com
@ -26181,7 +26186,6 @@ hengxiangtaji.com
hengxinjinshu.com
hengxueedu.com
hengyan.com
hengyer.com
hengyidai.com
hengyigl.com
hengyoux.com
@ -26661,7 +26665,6 @@ hkwb.net
hkxbjt.com
hkxen.com
hkyykq.com
hkzcdn.com
hkzlcm.com
hl-brushes.com
hl95.com
@ -27060,6 +27063,7 @@ hookbase.com
hookdll.com
hoolai.com
hoolaigames.com
hoolee8.com
hoolinks.com
hoolo.tv
hoop-archi.com
@ -27492,7 +27496,6 @@ huaguoshan.com
huahanart.com
huahua777.com
huahuacaocao.com
huahuakon.com
huahuo.com
huaibaobei.com
huaibei.com
@ -28257,6 +28260,7 @@ hxsd.tv
hxsec.com
hxshx.com
hxsme.org
hxstrive.com
hxtk.com
hxwglm.com
hxxkw.org
@ -28796,6 +28800,7 @@ icloudgslb.com
icloudnative.io
icloudnews.net
iclouds.work
icloudv6.com
icloudwaf.com
icmade.com
icme14.org
@ -29097,6 +29102,7 @@ ifjing.com
iflyhealth.com
iflying.com
iflyink.com
iflynote.com
iflyos.vip
iflyread.com
iflyrec.com
@ -29517,7 +29523,6 @@ imgii.com
imgkr.com
imglefeng.com
imglink.win
imgloc.com
imgo.tv
imgscdn.com
imgse.com
@ -30223,6 +30228,7 @@ itaoyun.com
itavcn.com
itbegin.com
itbeihe.com
itbiancheng.com
itbiaoju.com
itbilu.com
itbkz.com
@ -30412,6 +30418,7 @@ iuctrip.com
iudodo.com
iufida.com
iuinns.com
iun2s8.xyz
iuni.com
iuoooo.com
iuplus.com
@ -32155,7 +32162,6 @@ jocat.com
joe92.com
joenchen.com
johhan.com
johnwatsondev.com
johogames.com
joiest.com
joinchitchat.com
@ -33664,7 +33670,6 @@ kintiger.com
kinval.com
kinzoncap.com
kirgen.com
kirikira.com
kirimasharo.com
kirin-tech.com
kirincloud.net
@ -34410,7 +34415,6 @@ kx516.com
kx7p.com
kxapp.com
kxapps.com
kxbaidu.com
kxbox.com
kxcblog.com
kxceping.com
@ -34440,6 +34444,7 @@ kxxsc.com
kxxxl.com
kxzmw.com
ky-express.com
ky0001.vip
ky0048.cc
ky010.vip
ky107.co
@ -34661,6 +34666,7 @@ langren8.com
langrencard.com
langrenclub.com
langrensha.net
langtao.cc
langtaojin.com
langtze.com
languangdy.com
@ -36153,6 +36159,7 @@ lm284.com
lm335.com
lm553.com
lm685.com
lm7979.com
lm9999.com
lmacc.com
lmanmo.com
@ -37698,6 +37705,7 @@ mdvoo.com
mdy-edu.com
mdybk.com
mdydt.net
mdzgjx.com
me-city.com
me361.com
me4399.com
@ -39669,6 +39677,7 @@ n127.com
n12m.cc
n18081.com
n21.cc
n28082.com
n3293.com
n3762.com
n3875.com
@ -39885,7 +39894,6 @@ ncacg.org
ncartfoundation.org
ncdxbbs.com
ncfcsa.org
ncfcw.net
ncfgroup.com
ncfwx.com
ncfxwhjjh.com
@ -41016,7 +41024,6 @@ okii.com
okinfo.org
okjike.com
okjk.co
okjoys.com
okjx.cc
okki.com
okkkk.com
@ -43434,7 +43441,6 @@ qiansw.com
qiantucdn.com
qianvisa.com
qianwa.com
qianwee.com
qianxiangbank.com
qianxibj.net
qianxin.com
@ -44802,6 +44808,7 @@ rdbuy.com
rdcy.org
rddoc.com
rdgz.org
rdhyw.com
rdidc.com
rdnsdb.com
rdplat.com
@ -49409,6 +49416,7 @@ suobuy.com
suofeiya.com
suofeiyashop.com
suoge.net
suokao.com
suosihulian.com
suoxin5.com
suoyiren.com
@ -49911,6 +49919,7 @@ szider.com
szisland.com
szjcyyy.com
szjhxjt.com
szjinhuanyu.com
szjlwul.com
szjunfei.com
szjuquan.com
@ -50507,6 +50516,7 @@ tciplay.com
tcl.com
tclbusiness.com
tclclouds.com
tcljd.com
tclking.com
tclkqn.com
tcloudbase.com
@ -51200,6 +51210,7 @@ tingke8.com
tingliku.com
tingmall.com
tingmimi.net
tingniukeji.com
tingroom.com
tingshuge.com
tingsonglaw.com
@ -51453,6 +51464,7 @@ toec.com
toecsec.com
toecsoft.com
toecxy.com
tofengmi.com
togj.com
togocareer.com
togogo.net
@ -52586,6 +52598,7 @@ u6u.com
u77.com
u78.com
u7u9.com
u8376.com
u8sy.com
u8yx.com
u9game.net
@ -52594,7 +52607,6 @@ u9time.com
u9u8.com
u9u9.com
u9wan.com
ua168.com
uahh.site
uami-global.org
uao-online.com
@ -55666,7 +55678,6 @@ wj001.com
wj166.com
wjajw.com
wjasset.com
wjbb.com
wjbk.site
wjceo.com
wjdaily.com
@ -55829,6 +55840,7 @@ wnzhuishu.com
wnzy.net
wo-smart.com
wo-xa.com
wo.cc
wo113.net
wo116114.com
wo123.com
@ -60726,7 +60738,6 @@ yoolin.cc
yoooooooooo.com
yoopu.me
yootou.com
yoouxi.com
yooxun.com
yooxuu.com
yooyoo360.com
@ -61232,7 +61243,6 @@ ytcos.com
ytcutv.com
ytdaily.com
ytdcloud.com
ytdfcw.com
yte1.com
yteng.net
ytesting.com
@ -62165,7 +62175,6 @@ zampdmp.com
zampdsp.com
zamplink.net
zamplus.com
zan-shang.com
zanba.com
zanbai.com
zangaifamily.com
@ -63593,6 +63602,7 @@ zichenit.com
zidan.chat
zidanduanxin.com
zidanduanxin.net
zidg.com
zidian8.com
zidianwang.com
zidoo.tv

View File

@ -170,7 +170,6 @@
2400:3fc0::/32
2400:4440::/32
2400:44c0::/32
2400:44e0::/32
2400:4540::/32
2400:4600::/32
2400:4640::/32

File diff suppressed because it is too large Load Diff

View File

@ -837,8 +837,8 @@ local function curl(url, file, ua)
local args = {
"-skL", "--retry 3", "--connect-timeout 3", '--user-agent "' .. ua .. '"'
}
local result = api.curl_logic(url, file, args)
return result
local return_code, result = api.curl_logic(url, file, args)
return return_code
end
local function truncate_nodes(add_from)

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall2
PKG_VERSION:=1.8
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_Transparent_Proxy \

View File

@ -13,6 +13,24 @@ command_timeout = 300
LEDE_BOARD = nil
DISTRIB_TARGET = nil
function exec_call(cmd)
local process = io.popen(cmd .. '; echo -e "\n$?"')
local lines = {}
local result = ""
local return_code
for line in process:lines() do
lines[#lines + 1] = line
end
process:close()
if #lines > 0 then
return_code = lines[#lines]
for i = 1, #lines - 1 do
result = result .. lines[i] .. ((i == #lines - 1) and "" or "\n")
end
end
return tonumber(return_code), trim(result)
end
function base64Decode(text)
local raw = text
if not text then return '' end
@ -36,11 +54,7 @@ function curl_base(url, file, args)
args[#args + 1] = "-o " .. file
end
local cmd = string.format('curl %s "%s"', table_join(args), url)
if file then
return luci.sys.call(cmd .. " > /dev/null")
else
return trim(luci.sys.exec(cmd))
end
return exec_call(cmd)
end
function curl_proxy(url, file, args)
@ -52,15 +66,15 @@ function curl_proxy(url, file, args)
tmp_args[#tmp_args + 1] = "-x socks5h://" .. socks_server
return curl_base(url, file, tmp_args)
end
return nil
return nil, nil
end
function curl_logic(url, file, args)
local result = curl_proxy(url, file, args)
if not result then
result = curl_base(url, file, args)
local return_code, result = curl_proxy(url, file, args)
if not return_code or return_code ~= 0 then
return_code, result = curl_base(url, file, args)
end
return result
return return_code, result
end
function url(...)
@ -600,9 +614,9 @@ end
function get_api_json(url)
local jsonc = require "luci.jsonc"
local json_content = curl_logic(url, nil, curl_args)
if json_content == "" then return {} end
return jsonc.parse(json_content) or {}
local return_code, content = curl_logic(url, nil, curl_args)
if return_code ~= 0 or content == "" then return {} end
return jsonc.parse(content) or {}
end
function common_to_check(api_url, local_version, match_file_name)

View File

@ -63,7 +63,8 @@ function to_download(url, size)
end
end
result = api.curl_logic(url, tmp_file, api.curl_args) == 0
local return_code, result = api.curl_logic(url, tmp_file, api.curl_args)
result = return_code == 0
if not result then
api.exec("/bin/rm", {"-f", tmp_file})

View File

@ -63,7 +63,8 @@ function to_download(url, size)
end
end
result = api.curl_logic(url, tmp_file, api.curl_args) == 0
local return_code, result = api.curl_logic(url, tmp_file, api.curl_args)
result = return_code == 0
if not result then
api.exec("/bin/rm", {"-f", tmp_file})

View File

@ -69,7 +69,8 @@ function to_download(url, size)
end
end
result = api.curl_logic(url, tmp_file, api.curl_args) == 0
local return_code, result = api.curl_logic(url, tmp_file, api.curl_args)
result = return_code == 0
if not result then
api.exec("/bin/rm", {"-f", tmp_file})

View File

@ -69,7 +69,8 @@ function to_download(url, size)
end
end
result = api.curl_logic(url, tmp_file, api.curl_args) == 0
local return_code, result = api.curl_logic(url, tmp_file, api.curl_args)
result = return_code == 0
if not result then
api.exec("/bin/rm", {"-f", tmp_file})

View File

@ -34,12 +34,6 @@ local log = function(...)
end
end
-- trim
local function trim(text)
if not text or text == "" then return "" end
return (string.gsub(text, "^%s*(.-)%s*$", "%1"))
end
-- curl
local function curl(url, file)
local args = {
@ -48,20 +42,15 @@ local function curl(url, file)
if file then
args[#args + 1] = "-o " .. file
end
local result = api.curl_logic(url, nil, args)
if file then
return tonumber(trim(result))
else
return trim(result)
end
local return_code, result = api.curl_logic(url, nil, args)
return tonumber(result)
end
--获取geoip
local function fetch_geoip()
--请求geoip
xpcall(function()
local json_str = curl(geoip_api)
local json_str = api.curl_logic(geoip_api)
local json = jsonc.parse(json_str)
if json.tag_name and json.assets then
for _, v in ipairs(json.assets) do
@ -112,7 +101,7 @@ end
local function fetch_geosite()
--请求geosite
xpcall(function()
local json_str = curl(geosite_api)
local json_str = api.curl_logic(geosite_api)
local json = jsonc.parse(json_str)
if json.tag_name and json.assets then
for _, v in ipairs(json.assets) do
@ -160,12 +149,14 @@ local function fetch_geosite()
end
if arg[2] then
if arg[2]:find("geoip") then
geoip_update = 1
end
if arg[2]:find("geosite") then
geosite_update = 1
end
string.gsub(arg[2], '[^' .. "," .. ']+', function(w)
if w == "geoip" then
geoip_update = 1
end
if w == "geosite" then
geosite_update = 1
end
end)
else
geoip_update = ucic:get_first(name, 'global_rules', "geoip_update", 1)
geosite_update = ucic:get_first(name, 'global_rules', "geosite_update", 1)

View File

@ -706,8 +706,8 @@ local function curl(url, file, ua)
local args = {
"-skL", "--retry 3", "--connect-timeout 3", '--user-agent "' .. ua .. '"'
}
local result = api.curl_logic(url, file, args)
return result
local return_code, result = api.curl_logic(url, file, args)
return return_code
end
local function truncate_nodes(add_from)

View File

@ -11,7 +11,7 @@ LUCI_DEPENDS:=+curl +opkg +luci-base +tar +coreutils +coreutils-stat +libuci-lua
LUCI_EXTRA_DEPENDS:=luci-lib-taskd (>=1.0.17)
LUCI_PKGARCH:=all
PKG_VERSION:=0.1.12-9
PKG_VERSION:=0.1.12-10
# PKG_RELEASE MUST be empty for luci.mk
PKG_RELEASE:=

View File

@ -230,12 +230,15 @@ function store_action(param)
local pkg
for pkg in itr do
if pkg:match("^.*%.json$") then
local meta = json_parse(fs.readfile(metadir .. "/" .. pkg))
local metapkg = metapkgpre .. meta.name
local status = ipkg.status(metapkg)
if next(status) ~= nil then
meta.time = tonumber(status[metapkg]["Installed-Time"])
data[#data+1] = meta
local metadata = fs.readfile(metadir .. "/" .. pkg)
if metadata ~= nil then
local meta = json_parse(metadata)
local metapkg = metapkgpre .. meta.name
local status = ipkg.status(metapkg)
if next(status) ~= nil then
meta.time = tonumber(status[metapkg]["Installed-Time"])
data[#data+1] = meta
end
end
end
end