luci-app-jd-dailybonus: sync with upstream source

This commit is contained in:
CN_SZTL 2020-11-07 20:09:09 +08:00
parent 71f8f2a91d
commit 3bd45fdc84
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
7 changed files with 427 additions and 340 deletions

View File

@ -1,67 +1,20 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
# Copyright (C) 2006-2017 OpenWrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-jd-dailybonus
LUCI_TITLE:=Luci for JD dailybonus Script
LUCI_DEPENDS:=+node +node-request +coreutils +coreutils-nohup +wget
LUCI_PKGARCH:=all
PKG_VERSION:=0.8.6
PKG_RELEASE:=20201021
include $(INCLUDE_DIR)/package.mk
PKG_NAME:=luci-app-jd-dailybonus
PKG_VERSION:=0.8.7
PKG_RELEASE:=20201031
define Package/luci-app-jd-dailybonus
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=Luci for JD dailybonus Script
PKGARCH:=all
DEPENDS:=+node +node-request +coreutils +coreutils-nohup +wget
endef
define Build/Prepare
endef
define Build/Compile
endef
define Package/luci-app-define Package/jd-dailybonus/conffiles
endef
define Package/luci-app-jd-dailybonus/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
$(INSTALL_DIR) $(1)/
cp -pR ./root/* $(1)/
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
po2lmo ./po/zh_Hans/jd-dailybonus.po $(1)/usr/lib/lua/luci/i18n/jd-dailybonus.zh-cn.lmo
endef
define Package/luci-app-jd-dailybonus/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
( . /etc/uci-defaults/luci-jd-dailybonus ) && rm -f /etc/uci-defaults/luci-jd-dailybonus
rm -rf /tmp/luci-indexcache
rm -rf /tmp/luci-modulecache/*
chmod +x /etc/init.d/jd-dailybonus >/dev/null 2>&1
chmod +x /usr/share/jd-dailybonus/newapp.sh >/dev/null 2>&1
/etc/init.d/jd-dailybonus enable >/dev/null 2>&1
fi
exit 0
endef
define Package/luci-app-jd-dailybonus/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/jd-dailybonus disable
/etc/init.d/jd-dailybonus stop
fi
exit 0
endef
$(eval $(call BuildPackage,luci-app-jd-dailybonus))
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,5 +1,5 @@
config global
option version '1.47'
option version '1.79'
option auto_run_time '1'
option auto_run '1'
option auto_update_time '1'

View File

@ -86,7 +86,7 @@ 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)' * * * /bin/bash -c "sleep $[RANDOM % 180]s"; /usr/share/jd-dailybonus/newapp.sh -w' >>$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
[ $(uci_get_by_type global auto_update 0) -eq 1 ] && echo '1 '$(uci_get_by_type global auto_update_time)' * * * /usr/share/jd-dailybonus/newapp.sh -u' >>$CRON_FILE
crontab $CRON_FILE
}
@ -118,12 +118,14 @@ serverchan() {
run() {
fill_cookie
echo -e $(date '+%Y-%m-%d %H:%M:%S %A') >$LOG_HTM 2>/dev/null
nohup node $JD_SCRIPT >>$LOG_HTM 2>/dev/null &
[ ! -f "/usr/bin/node" ] && echo "未安装node,请安装后再试!">>$LOG_HTM && exit 1
node $JD_SCRIPT >>$LOG_HTM 2>&1 &
}
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
serverchan
}