Files
MIXBOX-ARCHIVE/apps/qiandao/config/mixbox.conf
2020-03-05 00:08:40 +08:00

55 lines
2.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#------------------【QianDao】--------------------
qiandao() {
eval `mbdb export qiandao`
source /etc/mixbox/bin/base
echo "********* $service ***********"
echo "[${appinfo}]"
readsh "启动${appname}服务[1/0] " "enable" "1"
if [ "$enable" == '1' ]; then
# Scripts Here
echo "支持签到的网站:"
i=1
echo "$qiandao_support" | tr " " "\n" | while read line
do
tmp=""
[ -n "$(mbdb get ${appname}.main.qiandao_"${line}"_setting)" ] && tmp="[已设置]"
[ "$(mbdb get ${appname}.main.qiandao_"${line}")" == '1' ] && tmp="[已启用]"
echo "$i) ${line} $tmp"
let i=$i+1
done
while(true)
do
read -p "请选择要签到网站(回车结束)" res
[ -z "$res" ] && break
name="$(echo $qiandao_support | tr " " "\n" | sed -n "$res"p)"
[ -z "$(echo $qiandao_support | grep $name)" ] && echo "输入有误!" && continue
read -p "请输入$name的cookie(已设置时0.关闭 1.启用)" res
checkread $res && [ -z "$(mbdb get ${appname}.main.qiandao_"$name"_setting)" ] && echo "$name未设置cookie" && continue
if [ "$res" == '0' ]; then
mbdb set $appname.main.qiandao_"$name"=0
elif [ "$res" == '1' ]; then
mbdb set $appname.main.qiandao_"$name"=1
elif [ -n "$res" ]; then
mbdb set $appname.main.qiandao_"$name"=1
mbdb set $appname.main.qiandao_"$name"_setting=`base_encode $res`
else
mbdb set $appname.main.qiandao_"$name"=0
mbdb set $appname.main.qiandao_"$name"_setting=`base_encode $res`
fi
done
[ -z "$qiandao_time" ] && qiandao_time="8"
read -p "每天执行签到的时间(每天$qiandao_time点)[0-23]" res
[ -n "$res" ] && mbdb set $appname.main.qiandao_time="$res"
read -p "立即执行签到(否则仅保存设置)[1/0] " res
[ "$res" == '1' ] && mbdb set $appname.main.qiandao_action=2 || mbdb set $appname.main.qiandao_action=1
${mbroot}/apps/${appname}/scripts/${appname}.sh restart
else
${mbroot}/apps/${appname}/scripts/${appname}.sh stop
fi
}
#------------------【QianDao】--------------------