修改shell根目录获取,移除notify.sh

This commit is contained in:
whyour
2022-03-07 23:16:36 +08:00
parent 1db13653bf
commit 747f4552e0
11 changed files with 86 additions and 59 deletions
+26
View File
@@ -176,4 +176,30 @@ update_cron() {
fi
}
notify_api() {
local title=$1
local content=$1
local currentTimeStamp=$(date +%s)
local api=$(
curl -s --noproxy "*" "http://0.0.0.0:5600/api/system/notify?t=$currentTimeStamp" \
-X 'PUT' \
-H "Accept: application/json" \
-H "Authorization: Bearer $token" \
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" \
-H "Content-Type: application/json;charset=UTF-8" \
-H "Origin: http://0.0.0.0:5700" \
-H "Referer: http://0.0.0.0:5700/crontab" \
-H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \
--data-raw "{\"title\":\"$title\",\"content\":\"$content\"}" \
--compressed
)
code=$(echo $api | jq -r .code)
message=$(echo $api | jq -r .message)
if [[ $code == 200 ]]; then
echo -e "成功"
else
echo -e "失败(${message})"
fi
}
get_token
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## 导入通用变量与函数
dir_shell=/ql/shell
dir_shell=$QL_DIR/shell
. $dir_shell/share.sh
if [[ -z ${BotRepoUrl} ]]; then
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
dir_shell=/ql/shell
dir_shell=$QL_DIR/shell
. $dir_shell/share.sh
. $dir_shell/api.sh
-5
View File
@@ -1,5 +0,0 @@
const notify = require('/ql/data/scripts/sendNotify.js');
const title = process.argv[2];
const content = process.argv[3];
notify.sendNotify(`${title}`, `${content}`);
-8
View File
@@ -1,8 +0,0 @@
#!/bin/bash
#author:spark thanks to: https://github.com/sparkssssssss/scripts
. /ql/data/config/config.sh
title=$(echo $1|sed 's/-/_/g')
msg=$(echo -e $2)
node /ql/shell/notify.js "$title" "$msg"
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## 导入通用变量与函数
dir_shell=/ql/shell
dir_shell=$QL_DIR/shell
. $dir_shell/share.sh
days=$1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## 目录
dir_root=/ql
dir_root=$QL_DIR
dir_data=$dir_root/data
dir_shell=$dir_root/shell
dir_sample=$dir_root/sample
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## 导入通用变量与函数
dir_shell=/ql/shell
dir_shell=$QL_DIR/shell
. $dir_shell/share.sh
. $dir_shell/api.sh
+18 -18
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
dir_shell=/ql/shell
dir_shell=$QL_DIR/shell
. $dir_shell/share.sh
. $dir_shell/api.sh
@@ -43,7 +43,7 @@ detect_config_version() {
local notify_title="配置文件更新通知"
local notify_content="更新日期: $update_date\n用户版本: $ver_config_user\n新的版本: $ver_config_sample\n更新内容: $update_content\n更新说明: 如需使用新功能请对照config.sample.sh,将相关新参数手动增加到你自己的config.sh中,否则请无视本消息。本消息只在该新版本配置文件更新当天发送一次。\n"
echo -e $notify_content
notify "$notify_title" "$notify_content"
notify_api "$notify_title" "$notify_content"
[[ $? -eq 0 ]] && echo $ver_config_sample >$send_mark
fi
else
@@ -91,7 +91,7 @@ del_cron() {
done
if [[ $ids ]]; then
result=$(del_cron_api "$ids")
notify "$path 删除任务${result}" "$detail"
notify_api "$path 删除任务${result}" "$detail"
fi
}
@@ -131,7 +131,7 @@ add_cron() {
fi
fi
done
notify "$path 新增任务" "$detail"
notify_api "$path 新增任务" "$detail"
}
## 更新仓库
@@ -203,7 +203,7 @@ update_raw() {
if [[ -z $cron_id ]]; then
result=$(add_cron_api "$cron_line:$cmd_task $filename:$cron_name")
echo -e "$result\n"
notify "新增任务通知" "\n$result"
notify_api "新增任务通知" "\n$result"
# update_cron_api "$cron_line:$cmd_task $filename:$cron_name:$cron_id"
fi
else
@@ -274,7 +274,7 @@ update_qinglong() {
fi
if [[ $exit_status -eq 0 ]]; then
echo -e "\n更新$ql_static_repo成功...\n"
local static_version=$(cat /ql/src/version.ts | perl -pe "s|.*\'(.*)\';\.*|\1|" | head -1)
local static_version=$(cat $dir_root/src/version.ts | perl -pe "s|.*\'(.*)\';\.*|\1|" | head -1)
echo -e "\n当前版本 $static_version...\n"
rm -rf $dir_static/*
@@ -292,10 +292,10 @@ update_qinglong() {
}
patch_version() {
if [[ -f "/ql/db/cookie.db" ]]; then
if [[ -f "$dir_root/db/cookie.db" ]]; then
echo -e "检测到旧的db文件,拷贝为新db...\n"
mv /ql/db/cookie.db /ql/db/env.db
rm -rf /ql/db/cookie.db
mv $dir_root/db/cookie.db $dir_root/db/env.db
rm -rf $dir_root/db/cookie.db
echo
fi
@@ -305,29 +305,29 @@ patch_version() {
git config --global pull.rebase false
cp -f /ql/.env.example /ql/.env
cp -f $dir_root/.env.example $dir_root/.env
if [[ -d "/ql/db" ]]; then
if [[ -d "$dir_root/db" ]]; then
echo -e "检测到旧的db目录,拷贝到data目录...\n"
cp -rf /ql/config /ql/data
cp -rf $dir_root/config $dir_root/data
echo
fi
if [[ -d "/ql/scripts" ]]; then
if [[ -d "$dir_root/scripts" ]]; then
echo -e "检测到旧的scripts目录,拷贝到data目录...\n"
cp -rf /ql/scripts /ql/data
cp -rf $dir_root/scripts $dir_root/data
echo
fi
if [[ -d "/ql/log" ]]; then
if [[ -d "$dir_root/log" ]]; then
echo -e "检测到旧的log目录,拷贝到data目录...\n"
cp -rf /ql/log /ql/data
cp -rf $dir_root/log $dir_root/data
echo
fi
if [[ -d "/ql/config" ]]; then
if [[ -d "$dir_root/config" ]]; then
echo -e "检测到旧的config目录,拷贝到data目录...\n"
cp -rf /ql/config /ql/data
cp -rf $dir_root/config $dir_root/data
echo
fi