重构Cookie管理逻辑和交互

This commit is contained in:
whyour
2021-03-22 17:59:21 +08:00
parent ad513d1eae
commit ad30e6bbeb
12 changed files with 255 additions and 64 deletions
+4 -3
View File
@@ -19,13 +19,14 @@ Name3=(Fruit Pet Bean DreamFactory JdFactory Joy Jdzz Jxnc BookShop Cash Sgmh Cf
function Import_Conf {
if [ -f ${FileConf} ]
then
. ${CookieConf}
. ${FileConf}
if [ -z "${Cookie1}" ]; then
echo -e "请先在 config.sh 中配置好 Cookie\n"
if [ ! -s ${CookieConf} ]; then
echo -e "请先在Cookie管理中添加一条Cookie...\n"
exit 1
fi
else
echo -e "配置文件 ${FileConf} 不存在,请先按教程配置好该文件\n"
echo -e "配置文件 ${FileConf} 不存在,请先按教程配置好该文件...\n"
exit 1
fi
}
+2 -11
View File
@@ -8,6 +8,7 @@ LogDir=${ShellDir}/log
ScriptsDir=${ShellDir}/scripts
ConfigDir=${ShellDir}/config
FileConf=${ConfigDir}/config.sh
CookieConf=${ConfigDir}/cookie.sh
FileDiy=${ConfigDir}/diy.sh
FileConfSample=${ShellDir}/sample/config.sh.sample
ListCron=${ConfigDir}/crontab.list
@@ -27,6 +28,7 @@ ScriptsURL=https://github.com.cnpmjs.org/RikudouPatrickstar/jd_scripts
## 导入配置文件
function Import_Conf {
if [ -f ${FileConf} ]; then
. ${CookieConf}
. ${FileConf}
fi
}
@@ -108,17 +110,6 @@ function Update_Entrypoint {
fi
}
## 用户数量UserSum
function Count_UserSum {
i=1
while [ $i -le 1000 ]; do
Tmp=Cookie$i
CookieTmp=${!Tmp}
[[ ${CookieTmp} ]] && UserSum=$i || break
let i++
done
}
## 检测文件:LXK9301/jd_scripts 仓库中的 docker/crontab_list.sh
## 检测定时任务是否有变化,此函数会在Log文件夹下生成四个文件,分别为:
## task.list crontab.list中的所有任务清单,仅保留脚本名
+4 -2
View File
@@ -7,6 +7,7 @@ ShellDir=${JD_DIR:-$(cd $(dirname $0); pwd)}
ScriptsDir=${ShellDir}/scripts
ConfigDir=${ShellDir}/config
FileConf=${ConfigDir}/config.sh
CookieConf=${ConfigDir}/cookie.sh
FileConfSample=${ShellDir}/sample/config.sh.sample
LogDir=${ShellDir}/log
ListScripts=($(cd ${ScriptsDir}; ls *.js | grep -E "j[drx]_"))
@@ -18,9 +19,10 @@ ListJs=${LogDir}/js.list
function Import_Conf {
if [ -f ${FileConf} ]
then
. ${CookieConf}
. ${FileConf}
if [ -z "${Cookie1}" ]; then
echo -e "请先在config.sh中配置好Cookie...\n"
if [ ! -s ${CookieConf} ]; then
echo -e "请先在Cookie管理中添加一条Cookie...\n"
exit 1
fi
else
+1
View File
@@ -1,6 +1,7 @@
#!/bin/bash
#author:spark thanks to: https://github.com/sparkssssssss/scripts
. /jd/config/cookie.sh
. /jd/config/config.sh
title=$(echo $1|sed 's/-/_/g')
msg=$(echo -e $2)
+1
View File
@@ -5,6 +5,7 @@ ShellDir=${JD_DIR:-$(cd $(dirname $0); pwd)}
LogDir=${ShellDir}/log
## 导入配置文件
. ${ShellDir}/config/cookie.sh
. ${ShellDir}/config/config.sh
## 删除运行js脚本的旧日志