luci-app-jd-dailybonus: bump to v0.8.8

This commit is contained in:
CN_SZTL 2020-12-05 17:32:58 +08:00
parent f1af959af6
commit 454e57e51b
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
6 changed files with 379 additions and 386 deletions

View File

@ -12,8 +12,8 @@ LUCI_DEPENDS:=+node +node-request +coreutils +coreutils-nohup +wget
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-jd-dailybonus
PKG_VERSION:=0.8.7
PKG_RELEASE:=20201031
PKG_VERSION:=0.8.8
PKG_RELEASE:=20201204
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -5,7 +5,7 @@ function index()
if not nixio.fs.access("/etc/config/jd-dailybonus") then
return
end
entry({"admin", "services", "jd-dailybonus"}, alias("admin", "services", "jd-dailybonus", "client"), _("JD-DailyBonus"), 10).dependent = true -- 首页
entry({"admin", "services", "jd-dailybonus", "client"}, cbi("jd-dailybonus/client"),_("Client"), 10).leaf = true -- 基本设置
entry({"admin", "services", "jd-dailybonus", "log"},form("jd-dailybonus/log"),_("Log"), 30).leaf = true -- 日志页面
@ -32,7 +32,7 @@ function run()
local failed = luci.http.formvalue("failed")
local name = ""
uci:foreach("vssr", "global", function(s) name = s[".name"] end)
if cookie ~= " " then
uci:set("jd-dailybonus", '@global[0]', 'auto_update', auto_update)
uci:set("jd-dailybonus", '@global[0]', 'auto_update_time', auto_update_time)
@ -43,8 +43,8 @@ function run()
uci:set("jd-dailybonus", '@global[0]', 'cookie2', cookie2)
uci:set("jd-dailybonus", '@global[0]', 'serverchan', serverchan)
uci:set("jd-dailybonus", '@global[0]', 'failed', failed)
uci:save("jd-dailybonus")
uci:commit("jd-dailybonus")
uci:save("jd-dailybonus")
uci:commit("jd-dailybonus")
luci.sys.call("/usr/share/jd-dailybonus/newapp.sh -r")
luci.sys.call("/usr/share/jd-dailybonus/newapp.sh -a")
e.error = 0

View File

@ -1,9 +1,9 @@
config global
option version '1.79'
option version '1.87'
option auto_run_time '1'
option auto_run '1'
option auto_update_time '1'
option auto_update '1'
option stop '0'
option failed '0'
option remote_url 'https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js'
option remote_url 'https://cdn.jsdelivr.net/gh/NobyDa/Script/JD-DailyBonus/JD_DailyBonus.js'

View File

@ -49,8 +49,6 @@ cancel() {
exit 1
}
REMOTE_SCRIPT=$(uci_get_by_type global remote_url)
fill_cookie() {
cookie1=$(uci_get_by_type global cookie)
if [ ! "$cookie1" = "" ]; then
@ -77,13 +75,6 @@ fill_cookie() {
fi
}
if [ -e $TEMP_SCRIPT ]; then
remote_ver=$(cat $TEMP_SCRIPT | sed -n '/更新时间/p' | awk '{for (i=1;i<=NF;i++){if ($i ~/v/) {print $i}}}' | sed 's/v//')
else
remote_ver=$(cat $JD_SCRIPT | sed -n '/更新时间/p' | awk '{for (i=1;i<=NF;i++){if ($i ~/v/) {print $i}}}' | sed 's/v//')
fi
local_ver=$(uci_get_by_type global version)
add_cron() {
sed -i '/jd-dailybonus/d' $CRON_FILE
[ $(uci_get_by_type global auto_run 0) -eq 1 ] && echo '5 '$(uci_get_by_type global auto_run_time)' * * * sleep '$(expr $(head -n 128 /dev/urandom | tr -dc "0123456789" | head -c4) % 180)'s; /usr/share/jd-dailybonus/newapp.sh -w' >>$CRON_FILE
@ -96,7 +87,7 @@ add_cron() {
serverchan() {
sckey=$(uci_get_by_type global serverchan)
failed=$(uci_get_by_type global failed)
desc=$(cat /www/JD_DailyBonus.htm | grep -E '签到号|签到概览|签到总计|账号总计|其他总计' | sed 's/$/&\n/g')
desc=$(cat /www/JD_DailyBonus.htm | grep -E '签到号|签到概览|签到奖励|其他奖励|账号总计|其他总计' | sed 's/$/&\n/g')
serverurlflag=$(uci_get_by_type global serverurl)
serverurl=https://sc.ftqq.com/
if [ "$serverurlflag" = "sct" ]; then
@ -118,15 +109,13 @@ serverchan() {
run() {
fill_cookie
echo -e $(date '+%Y-%m-%d %H:%M:%S %A') >$LOG_HTM 2>/dev/null
[ ! -f "/usr/bin/node" ] && echo "未安装node,请安装后再试!">>$LOG_HTM && exit 1
node $JD_SCRIPT >>$LOG_HTM 2>&1 &
[ ! -f "/usr/bin/node" ] && echo -e "未安装node.js,请安装后再试!\nNode.js is not installed, please try again after installation!">>$LOG_HTM && exit 1
node $JD_SCRIPT >>$LOG_HTM 2>/dev/null
}
back_run() {
fill_cookie
echo -e $(date '+%Y-%m-%d %H:%M:%S %A') >$LOG_HTM 2>/dev/null
[ ! -f "/usr/bin/node" ] && echo "未安装node,请安装后再试!">>$LOG_HTM && exit 1
node $JD_SCRIPT >>$LOG_HTM 2>/dev/null
run
sleep 1s
serverchan
}
@ -136,22 +125,37 @@ save() {
}
# Update Script From Server
download() {
REMOTE_SCRIPT=$(uci_get_by_type global remote_url)
wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT
return $?
}
get_ver() {
echo $(cat $1 | sed -n '/更新时间/p' | awk '{for (i=1;i<=NF;i++){if ($i ~/v/) {print $i}}}' | sed 's/v//')
}
check_ver() {
wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT
download
if [ $? -ne 0 ]; then
cancel "501"
else
echo $remote_ver
echo $(get_ver $TEMP_SCRIPT)
fi
}
update() {
wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT
download
if [ $? -ne 0 ]; then
cancel "501"
fi
if [ $(expr $local_ver \< $remote_ver) -eq 1 ]; then
if [ -e $JD_SCRIPT ]; then
local_ver=$(get_ver $JD_SCRIPT)
else
local_ver=0
fi
remote_ver=$(get_ver $TEMP_SCRIPT)
if [ $(expr "$local_ver" \< "$remote_ver") -eq 1 ]; then
cp -r $TEMP_SCRIPT $JD_SCRIPT
fill_cookie
uci set jd-dailybonus.@global[0].version=$remote_ver