1 Star 0 Fork 54

晚风拂柳颜/jd_scripts_1

forked from 舞动的风/jd_scripts 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
update_task.sh 2.51 KB
一键复制 编辑 原始数据 按行查看 历史
wudongdefeng 提交于 2022-03-09 13:11 . diy仓库更新于:2022-03-09 13:08
#!/usr/bin/env bash
## Author: https://github.com/nevinee
## Modified: 2021-05-22
## Version: v1.0.4
## 路径与清单
WorkDir=$(cd $(dirname $0); pwd)
JsList=$(cd $WorkDir; ls *.js | grep -Ei "j[drx]_" | perl -ne "{print unless /\.bak/}")
JsList="$JsList backUp/xmSports.js"
FileLoon=$WorkDir/Loon/lxk0301_LoonTask.conf
FileQx=$WorkDir/QuantumultX/lxk0301_gallery.json
FileQxRe=$WorkDir/QuantumultX/lxk0301_cookies.conf
FileSurge=$WorkDir/Surge/lxk0301_Task.sgmodule.sgmodule
## task清单头尾部内容
CommentsLoon="# IOS Loon Task&Cookies配置 \n# TG通知频道 (https://t.me/jdfruit)\n# 使用方法:打开APP,顶部的配置 -> 脚本 -> 订阅脚本- > 点击右上角+号 -> 添加url链接\n\nhostname = me-api.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com"
CommentsQx='{\n "name": "lxk0301 task gallery",\n "description": "see you latter",\n "task": ['
CommentsQxRe="hostname = draw.jdfcloud.com, jdjoy.jd.com, account.huami.com, me-api.jd.com"
CommentsSurgeHead="#!name=lxk0301 iOS Tasks&Cookies Module\n#!desc=iOS Tasks&Cookies 模块配置\n\n# Task&Cookies模块配置 \n# TG讨论组 (https://t.me/JD_fruit_pet)\n\n[Script]"
CommentsSurgeTail="\n[MITM]\nhostname = %APPEND% me-api.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com"
## 执行写入
cd $WorkDir
echo -e $CommentsLoon > $FileLoon
echo -e $CommentsQx > $FileQx
echo -e $CommentsQxRe > $FileQxRe
echo -e $CommentsSurgeHead > $FileSurge
for file in $JsList
do
TaskName=$(grep "new Env" $file | awk -F "'|\"" '{print $2}' | head -1)
if [[ -n $TaskName ]]; then
echo -e "\n# $TaskName" >> $FileLoon
grep -E "cron.+script-path.+https://gitee\.com.+tag" $file >> $FileLoon
grep -E "https://gitee\.com.+tag.+enabled" $file | perl -pe "{s|(.+\w)|\1\", \"addons\":\"https://gitee.com/lxk0301/jd_scripts/raw/master/QuantumultX/lxk0301_cookies.conf\"\},|; s|^| \{\"config\":\"|}" >> $FileQx
grep -E "type.+cronexp.+script-path.+https://gitee\.com" $file >> $FileSurge
fi
grep -E "http-(request|response).+script-path.+https://gitee\.com.+tag" $file | perl -pe "s|(.+tag=)(.+)|\n# \2\n\1\2|" >> $FileLoon
grep -E "script-(request|response)-.+https://gitee\.com" $file | perl -pe "s|(.+)|\n# $TaskName\n\1|" >> $FileQxRe
grep -E "type=http-(request|response).+pattern.+script-path.+https://gitee\.com" $file >> $FileSurge
done
echo -e " ]\n}" >> $FileQx
echo -e $CommentsSurgeTail >> $FileSurge
perl -0777 -i -pe "s|,([\n\r]{1,2} \])|\1|" $FileQx
perl -0777 -i -pe "s|(# .+\n{2}){1,}(# .+)|\2|g" $FileLoon
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hjdhnx/jd_scripts_1.git
[email protected]:hjdhnx/jd_scripts_1.git
hjdhnx
jd_scripts_1
jd_scripts_1
master

搜索帮助