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

Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
Promix953 2021-02-04 00:12:04 +08:00 committed by CN_SZTL
parent 5f5e1c64d9
commit 2b5a8ad9c7
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 10 additions and 12 deletions

View File

@ -22,7 +22,7 @@ end
function run()
local running = luci.sys.call("busybox ps -w | grep JD_DailyBonus.js | grep -v grep >/dev/null") == 0
if not running then
luci.sys.call('/usr/share/jd-dailybonus/newapp.sh -r')
luci.sys.call('sh /usr/share/jd-dailybonus/newapp.sh -r')
end
luci.http.write('')
end
@ -31,7 +31,7 @@ end
function check_update()
local jd = 'jd-dailybonus'
local e = {}
local new_version = luci.sys.exec('/usr/share/jd-dailybonus/newapp.sh -n')
local new_version = luci.sys.exec('sh /usr/share/jd-dailybonus/newapp.sh -n')
e.new_version = new_version
e.error = 0
luci.http.prepare_content('application/json')
@ -45,7 +45,7 @@ function update()
local uci = luci.model.uci.cursor()
local version = luci.http.formvalue('version')
--下载脚本
local code = luci.sys.exec('/usr/share/jd-dailybonus/newapp.sh -u')
local code = luci.sys.exec('sh /usr/share/jd-dailybonus/newapp.sh -u')
e.error = code
luci.http.prepare_content('application/json')
luci.http.write_json(e)

View File

@ -70,9 +70,9 @@
<div class="cbi-value-field">
<input type="button" data-rel="1" class="cbi-button cbi-input-reload cookie-button" value="<%= translate('获取第一Cookie') %>" />
<input type="button" data-rel="2" class="cbi-button cbi-input-reload cookie-button" value="<%= translate('获取第二Cookie') %>" />
<br>
<br />
<div class="cbi-value-description">
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助"></span>
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助" /></span>
<%= translate("点击上面按钮使用京东手机app扫码获取Cookie")%>
</div>
</div>

View File

@ -1,14 +1,12 @@
<%+cbi/valueheader%>
<label class="cbi-value-title"><%= translate("执行") %></label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-reload" id="update_service" type="button" size="0" onclick="run()"
value="<%= translate("手动执行签到") %>">
<input class="cbi-button cbi-button-reload" id="update_service" type="button" size="0" onclick="run()" value="<%= translate('手动执行签到') %>" />
</div>
<label class="cbi-value-title"><%= translate("更新脚本") %></label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-reload" id="update_script" type="button" size="0" onclick="check_version()" data-version="<%= self.version %>"
value="<%= translate("手动检查脚本更新当前版本v")..self.version %>">
<input class="cbi-button cbi-button-reload" id="update_script" type="button" size="0" onclick="check_version()" data-version="<%= self.version %>" value="<%= translate('手动检查脚本更新当前版本v')..self.version %>" />
</div>
<script type="text/javascript">

View File

@ -19,7 +19,7 @@ del_cron() {
}
start_service(){
/usr/share/jd-dailybonus/newapp.sh -s
sh /usr/share/jd-dailybonus/newapp.sh -s
}
stop_service() {

View File

@ -51,8 +51,8 @@ cancel() {
add_cron() {
sed -i '/jd-dailybonus/d' $CRON_FILE
[ $(uci_get_by_type global auto_run 0) -eq 1 ] && echo $(uci_get_by_type global auto_run_time_m)' '$(uci_get_by_type global auto_run_time_h)' * * * /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
[ $(uci_get_by_type global auto_run 0) -eq 1 ] && echo $(uci_get_by_type global auto_run_time_m)' '$(uci_get_by_type global auto_run_time_h)' * * * sh /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)' * * * sh /usr/share/jd-dailybonus/newapp.sh -u' >>$CRON_FILE
crontab $CRON_FILE
/etc/init.d/cron restart
}