增加addon
This commit is contained in:
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
## Author: https://github.com/nevinee
|
## Author: https://github.com/nevinee
|
||||||
## Modified: 2021-03-18
|
## Modified: 2021-05-22
|
||||||
## Version: v1.0.3
|
## Version: v1.0.4
|
||||||
|
|
||||||
## 路径与清单
|
## 路径与清单
|
||||||
WorkDir=$(cd $(dirname $0); pwd)
|
WorkDir=$(cd $(dirname $0); pwd)
|
||||||
@ -13,7 +13,7 @@ FileQx=$WorkDir/QuantumultX/lxk0301_gallery.json
|
|||||||
FileQxRe=$WorkDir/QuantumultX/lxk0301_cookies.conf
|
FileQxRe=$WorkDir/QuantumultX/lxk0301_cookies.conf
|
||||||
FileSurge=$WorkDir/Surge/lxk0301_Task.sgmodule.sgmodule
|
FileSurge=$WorkDir/Surge/lxk0301_Task.sgmodule.sgmodule
|
||||||
|
|
||||||
## task清单顶部内容
|
## task清单头尾部内容
|
||||||
CommentsLoon="# IOS Loon Task&Cookies配置 By lxk0301\n# GitHub主页(https://gitee.com/lxk0301)\n# TG讨论组 (https://t.me/JD_fruit_pet)\n# TG通知频道 (https://t.me/jdfruit)\n# Loon的Task&Cookies脚本订阅链接: https://gitee.com/lxk0301/jd_scripts/raw/master/Loon/lxk0301_LoonTask.conf\n# 使用方法:打开APP,顶部的配置 -> 脚本 -> 订阅脚本- > 点击右上角+号 -> 添加url链接 (https://gitee.com/lxk0301/jd_scripts/raw/master/Loon/lxk0301_LoonTask.conf)\n\nhostname = me-api.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com"
|
CommentsLoon="# IOS Loon Task&Cookies配置 By lxk0301\n# GitHub主页(https://gitee.com/lxk0301)\n# TG讨论组 (https://t.me/JD_fruit_pet)\n# TG通知频道 (https://t.me/jdfruit)\n# Loon的Task&Cookies脚本订阅链接: https://gitee.com/lxk0301/jd_scripts/raw/master/Loon/lxk0301_LoonTask.conf\n# 使用方法:打开APP,顶部的配置 -> 脚本 -> 订阅脚本- > 点击右上角+号 -> 添加url链接 (https://gitee.com/lxk0301/jd_scripts/raw/master/Loon/lxk0301_LoonTask.conf)\n\nhostname = me-api.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com"
|
||||||
CommentsQx='{\n "name": "lxk0301 task gallery",\n "description": "https://gitee.com/lxk0301",\n "task": ['
|
CommentsQx='{\n "name": "lxk0301 task gallery",\n "description": "https://gitee.com/lxk0301",\n "task": ['
|
||||||
CommentsQxRe="hostname = draw.jdfcloud.com, jdjoy.jd.com, account.huami.com, me-api.jd.com"
|
CommentsQxRe="hostname = draw.jdfcloud.com, jdjoy.jd.com, account.huami.com, me-api.jd.com"
|
||||||
@ -32,7 +32,7 @@ do
|
|||||||
if [[ -n $TaskName ]]; then
|
if [[ -n $TaskName ]]; then
|
||||||
echo -e "\n# $TaskName" >> $FileLoon
|
echo -e "\n# $TaskName" >> $FileLoon
|
||||||
grep -E "cron.+script-path.+https://gitee\.com.+tag" $file >> $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",|' | perl -pe 's|^| \"|' >> $FileQx
|
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
|
grep -E "type.+cronexp.+script-path.+https://gitee\.com" $file >> $FileSurge
|
||||||
fi
|
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 "http-(request|response).+script-path.+https://gitee\.com.+tag" $file | perl -pe "s|(.+tag=)(.+)|\n# \2\n\1\2|" >> $FileLoon
|
||||||
@ -41,5 +41,5 @@ do
|
|||||||
done
|
done
|
||||||
echo -e " ]\n}" >> $FileQx
|
echo -e " ]\n}" >> $FileQx
|
||||||
echo -e $CommentsSurgeTail >> $FileSurge
|
echo -e $CommentsSurgeTail >> $FileSurge
|
||||||
perl -0777 -i -pe "s|,(\s{1,2} \])|\1|" $FileQx
|
perl -0777 -i -pe "s|,([\n\r]{1,2} \])|\1|" $FileQx
|
||||||
perl -0777 -i -pe "s|(# .+\n{2}){1,}(# .+)|\2|g" $FileLoon
|
perl -0777 -i -pe "s|(# .+\n{2}){1,}(# .+)|\2|g" $FileLoon
|
||||||
|
Reference in New Issue
Block a user