This commit is contained in:
Faker 2024-08-20 20:46:32 +08:00
parent c196c5f4fe
commit 4047d2c602
2 changed files with 12 additions and 181 deletions

View File

@ -28,7 +28,6 @@ else
code=${code:-'abcd'}
read -p "task_before.sh 操作(替换或下载选项为 y不替换为 n回车为替换请输入" Rbefore
Rbefore=${Rbefore:-'y'}
read -p "已删除BOT设置"
#read -p "bot 操作(跳过为 0添加 task:ql bot 选项为 1添加后设置并运行为 2回车等同 0请输入:" bot
#bot=${bot:-'0'}
read -p "config.sample.sh 操作(跳过为 0添加 task:自动更新模板 选项为 1添加后运行一次为 2回车等同 2请输入" sample
@ -111,12 +110,9 @@ dl_extra_shell() {
# extra.sh 设置区设置
set_default_extra() {
echo -e "一、集成仓库 Shufflewzc-Faker2"
read -p "直接回车拉取Faker2仓库输入2回车拉取Faker3纯净仓库" CollectedRepo
echo -e "二、其他仓库Other Repositories\n1-passerby-b\n2-curtinlv\n3-smiek2221\n4-cdle\n5-ZCY01\n6-whyour/hundun\n7-moposmall\n8-Ariszy (Zhiyi-N)\n9-photonmang\n10-jiulan\n12-star261\n13-Wenmoux\n14-Tsukasa007"
read -p "输入您想拉取其他仓库编号(回车默认不拉取),拉取多个请用空格隔开:" OtherRepo
CollectedRepo=${CollectedRepo:-"4"}
read -p "直接回车拉取Faker2仓库输入3回车拉取Faker3纯净仓库,输入4回车拉取Faker4简洁仓库" CollectedRepo
CollectedRepo=${CollectedRepo:-"2"}
sed -i "s/CollectedRepo=(4)/CollectedRepo=(${CollectedRepo})/g" $extra_shell_path
sed -i "s/OtherRepo=()/OtherRepo=(${OtherRepo})/g" $extra_shell_path
}
# 将 ql extra 添加到定时任务
add_ql_extra() {
@ -183,7 +179,7 @@ dl_git_shell() {
chmod 755 $git_shell_path
}
read -p "回车继续执行github拉库修复操作" Rgit
read -p "回车继续执行github连接修复" Rgit
Rgit=${Rgit:-'y'}
if [ "${Rgit}" = 'y' -o "${all}" = 1 ]; then
@ -305,52 +301,6 @@ else
fi
# 添加定时任务 ql bot
add_ql_bot() {
if [ "$(grep -c "ql\ bot" /ql/data/config/crontab.list)" != 0 ]; then
echo "您的任务列表中已存在 task:ql bot"
else
echo "开始添加 task:ql bot"
# 获取token
token=$(cat /ql/data/config/auth.json | jq --raw-output .token)
curl -s -H 'Accept: application/json' -H "Authorization: Bearer $token" -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept-Language: zh-CN,zh;q=0.9' --data-binary '{"name":"拉取机器人","command":"ql bot","schedule":"13 14 * * *"}' --compressed 'http://127.0.0.1:5600/api/crons?t=1697961933000'
fi
}
# 运行一次并简单设置 bot.json
set_bot_json() {
ql bot
echo -e "------ 机器累了,休息 10s ------"
sleep 10
echo -e "\"//user_id\": \"↓↓↓ 你的USERID去除双引号 ↓↓↓\",\n\"user_id\": 123456789,\n\"//bot_token\": \"↓↓↓ 你的机器人TOKEN ↓↓↓\",\n\"bot_token\": \"123456789:ABCDEFGSHSFDASDFAD\",\n\"//api_id\": \"↓↓↓ https://my.telegram.org 在该网站申请到的id ↓↓↓\",\n\"api_id\": \"456423156\",\n\"//api_hash\": \"↓↓↓ https://my.telegram.org 在该网站申请到的hash ↓↓↓\",\n\"api_hash\": \"ASDFAWEFADSFAWEFDSFASFD\","
echo -e "----- 以上为示例,以下为你的配置(不要引号) -----"
read -p "\"user_id\": " user_id
read -p "\"bot_token\": " bot_token
read -p "\"api_id\": " api_id
read -p "\"api_hash\": " api_hash
sed -i "s/123456789,/${user_id},/" $bot_json
sed -ri "s/123456789\:ABCDEFGSHSFDASDFAD/${bot_token}/" $bot_json
sed -i "s/456423156/${api_id}/" $bot_json
sed -i "s/ASDFAWEFADSFAWEFDSFASFD/${api_hash}/" $bot_json
}
# 再运行一次 ql bot
run_ql_bot() {
ql bot
echo -e "------ 机器累了,休息 10s ------"
sleep 10
}
if [ "${all}" = 1 ]; then
add_ql_bot && set_bot_json && run_ql_bot
else
case ${bot} in
0) echo "已为您跳过 bot 操作"
;;
1) add_ql_bot
;;
2) add_ql_bot && set_bot_json && run_ql_bot
esac
fi
# 添加定时任务 自动更新模板
add_curl_sample() {
if [ "$(grep -c "config.sample.sh" /ql/data/config/crontab.list)" != 0 ]; then

View File

@ -10,160 +10,41 @@
### 1定时任务→添加定时→命令【ql extra】→定时规则【15 0-23/4 * * *】→运行
### 2若运行过 1custom 一键脚本,点击运行即可
### 3推荐配置如下。自行在设置区填写编号
## 2. 安装依赖
### 1默认不安装因为 Build 20210728-002 及以上版本的 code.sh 自动检查修复依赖
### 2若需要在此处使用请在设置区设置
## 3. Ninja
### 1默认启动并自动更新
### 2⚠未修改容器映射的请勿运行否则会出现青龙打不开或者设备死机等不良后果映射参考 https://github.com/MoonBegonia/ninja#%E5%AE%B9%E5%99%A8%E5%86%85
#------ 设置区 ------#
## 1. 拉取仓库编号设置,默认 Faker2 仓库
CollectedRepo=(4) ##示例CollectedRepo=(2 4 6)
OtherRepo=() ##示例OtherRepo=(1 3)
CollectedRepo=(2) ##示例CollectedRepo=(2 4 6)
## 2. 是否安装依赖和安装依赖包的名称设置
dependencies="no" ##yes为安装no为不安装
package_name="canvas png-js date-fns axios crypto-js ts-md5 tslib @types/node dotenv typescript fs require tslib"
## 3. Ninja 是否需要启动和更新设置
Ninja="down" ##up为更新on为启动down为不运行
#------ 编号区 ------#
:<<\EOF
一、集成仓库Collected Repositories)
2-JDHelloWorld
3-he1pu
4-Faker2
5-Faker3
6-yuannian1112
二、其他仓库Other Repositories
1-passerby-b
2-curtinlv
3-smiek2221
4-cdle
5-ZCY01
6-whyour/hundun
7-moposmall
8-Ariszy (Zhiyi-N)
9-photonmang
10-jiulan
12-star261
13-Wenmoux
14-Tsukasa007
EOF
2-Faker2
3-Faker3
4-Faker4
#------ 代码区 ------#
# 🌱拉取仓库
CR2(){
ql repo https://github.com/shufflewzc/faker3.git "jd_|jx_|gua_|jddj_|jdCookie" "activity|backUp" "^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate|ql|JDSignValidator|magic|depend|h5sts" "main"
}
CR3(){
ql repo https://github.com/he1pu/JDHelp.git "jd_|jx_|getJDCookie" "Coupon|update" "^jd[^_]|USER|^sign|^ZooFaker|utils"
}
CR4(){
ql repo https://github.com/shufflewzc/faker2.git "jd_|jx_|gua_|jddj_|jdCookie" "activity|backUp" "^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate|ql|JDSignValidator|magic|depend|h5sts" "main"
}
CR5(){
CR3(){
ql repo https://github.com/shufflewzc/faker3.git "jd_|jx_|gua_|jddj_|jdCookie" "activity|backUp" "^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate|ql|JDSignValidator|magic|depend|h5sts" "main"
}
CR6(){
ql repo https://github.com/yuannian1112/jd_scripts.git "jd_|jx_|getJDCookie" "activity|backUp" "^jd[^_]|USER|utils"
CR4(){
ql repo https://github.com/shufflewzc/faker4.git "jd_|jx_|gua_|jddj_|jdCookie" "activity|backUp" "^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate|ql|JDSignValidator|magic|depend|h5sts" "main"
}
for i in ${CollectedRepo[@]}; do
CR$i
sleep 10
done
OR1(){
ql repo https://github.com/passerby-b/JDDJ.git "jddj_" "scf_test_event|jddj_fruit_code.js|jddj_getck.js|jd_|jddj_cookie"
}
OR2(){
ql repo https://github.com/curtinlv/JD-Script.git "jd_"
}
OR3(){
ql repo https://github.com/smiek2221/scripts.git "jd_|gua_" "" "^MovementFaker|^JDJRValidator|^ZooFaker|^sign"
}
OR4(){
ql repo https://github.com/cdle/xdd.git "jd_" "disposable|expired|jdc"
}
OR5(){
ql repo https://github.com/ZCY01/daily_scripts.git "jd_"
}
OR6(){
ql repo https://github.com/whyour/hundun.git "quanx" "tokens|caiyun|didi|donate|fold|Env"
}
OR7(){
ql repo https://github.com/moposmall/Script.git "Me"
}
OR8(){
ql repo https://github.com/Ariszy/Private-Script.git "JD"
}
OR9(){
ql repo https://github.com/photonmang/quantumultX.git "JDscripts"
}
OR10(){
ql repo https://github.com/jiulan/platypus.git "jd_|jx_" "" "overdue" "main"
}
OR11(){
ql repo https://github.com/panghu999/panghu.git "jd_"
}
OR12(){
ql repo https://github.com/star261/jd.git "jd_|star" "" "code" "main"
}
OR13(){
ql repo https://github.com/Wenmoux/scripts.git "other|jd" "" "" "wen"
}
OR14(){
ql repo https://github.com/Tsukasa007/my_script.git "jd_|jx_" "jdCookie|USER_AGENTS|sendNotify|backup" "" "master"
}
for i in ${OtherRepo[@]}; do
OR$i
sleep 5
done
# 🍪Ninja
update_Ninja_normal(){
cd /ql/ninja/backend && git checkout . && git pull
pnpm install && pm2 start
cp sendNotify.js /ql/scripts/sendNotify.js
}
check_Ninja_normal(){
NOWTIME=$(date +%Y-%m-%d-%H-%M-%S)
i=0
while ((i<=0)); do
echo "扫描 Ninja 是否在线"
ps -fe|grep ninja|grep -v grep
if [ $? -ne 0 ]; then
i=0
echo $NOWTIME" 扫描结束Ninja 掉线了不用担心马上重启!"
cd /ql
ps -ef|grep ninja|grep -v grep|awk '{print $1}'|xargs kill -9
cd /ql/ninja/backend
pnpm install
pm2 start
ps -fe|grep Daemon |grep -v grep
if [ $? -ne 1 ]; then
i=1
echo $NOWTIME" Ninja 重启完成!"
curl "https://api.telegram.org/bot$TG_BOT_TOKEN/sendMessage?chat_id=$TG_USER_ID&text=Ninja 已重启完成"
fi
else
i=1
echo $NOWTIME" 扫描结束Ninja 还在!"
fi
done
}
if [ "$Ninja" = "up" ]; then
update_Ninja_normal &
elif [ "$Ninja" = "on" ]; then
check_Ninja_normal
fi
# 📦依赖
install_dependencies_normal(){