mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-05 08:14:32 +08:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 81e2bbb14c | |||
| 970dff144c | |||
| 819b15b15e | |||
| 3fa57c69ac | |||
| 18689c8119 | |||
| 61e7049baa | |||
| 39c40a328d | |||
| 955d815d14 | |||
| 3a3b945de8 | |||
| 73c53dbc8d | |||
| f76828d4ec | |||
| 7b2956eb0a | |||
| b2167ae5e4 |
@@ -11,7 +11,7 @@ export default async () => {
|
||||
const subscriptionService = Container.get(SubscriptionService);
|
||||
|
||||
// 生成内置token
|
||||
let tokenCommand = `ts-node-transpile-only ${config.rootPath}/back/token.ts`;
|
||||
let tokenCommand = `tsx ${config.rootPath}/back/token.ts`;
|
||||
const tokenFile = `${config.rootPath}static/build/token.js`;
|
||||
if (await fileExist(tokenFile)) {
|
||||
tokenCommand = `node ${tokenFile}`;
|
||||
@@ -41,6 +41,7 @@ export default async () => {
|
||||
}
|
||||
|
||||
// 运行所有订阅
|
||||
await subscriptionService.setSshConfig();
|
||||
const subs = await subscriptionService.list();
|
||||
for (const sub of subs) {
|
||||
subscriptionService.handleTask(sub, !sub.is_disabled, !sub.is_disabled);
|
||||
|
||||
@@ -18,7 +18,7 @@ import { TASK_PREFIX, QL_PREFIX } from '../config/const';
|
||||
|
||||
@Service()
|
||||
export default class CronService {
|
||||
constructor(@Inject('logger') private logger: winston.Logger) {}
|
||||
constructor(@Inject('logger') private logger: winston.Logger) { }
|
||||
|
||||
private isSixCron(cron: Crontab) {
|
||||
const { schedule } = cron;
|
||||
@@ -264,9 +264,9 @@ export default class CronService {
|
||||
}
|
||||
}
|
||||
|
||||
public async find(params: { log_path: string }): Promise<Crontab | null> {
|
||||
public async find({ log_path }: { log_path: string }): Promise<Crontab | null> {
|
||||
try {
|
||||
const result = await CrontabModel.findOne({ where: { ...params } });
|
||||
const result = await CrontabModel.findOne({ where: { log_path } });
|
||||
return result;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
|
||||
@@ -161,7 +161,7 @@ export default class NotificationService {
|
||||
this.title,
|
||||
)}/${encodeURIComponent(
|
||||
this.content,
|
||||
)}?icon=${barkIcon}?sound=${barkSound}&group=${barkGroup}`;
|
||||
)}?icon=${barkIcon}&sound=${barkSound}&group=${barkGroup}`;
|
||||
const res: any = await got
|
||||
.get(url, {
|
||||
...this.gotOption,
|
||||
@@ -484,11 +484,11 @@ export default class NotificationService {
|
||||
|
||||
return {
|
||||
formatUrl: url
|
||||
.replaceAll('$title', encodeURIComponent(this.title))
|
||||
.replaceAll('$content', encodeURIComponent(this.content)),
|
||||
?.replaceAll('$title', encodeURIComponent(this.title))
|
||||
?.replaceAll('$content', encodeURIComponent(this.content)),
|
||||
formatBody: body
|
||||
.replaceAll('$title', this.title)
|
||||
.replaceAll('$content', this.content),
|
||||
?.replaceAll('$title', this.title)
|
||||
?.replaceAll('$content', this.content),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export default class SubscriptionService {
|
||||
}
|
||||
}
|
||||
|
||||
private async setSshConfig() {
|
||||
public async setSshConfig() {
|
||||
const docs = await SubscriptionModel.findAll();
|
||||
this.sshKeyService.setSshConfig(docs);
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ RUN set -x \
|
||||
&& git config --global user.name "qinglong" \
|
||||
&& git config --global http.postBuffer 524288000 \
|
||||
&& npm install -g pnpm \
|
||||
&& pnpm add -g pm2 ts-node typescript tslib \
|
||||
&& pnpm add -g pm2 tsx \
|
||||
&& rm -rf /root/.pnpm-store \
|
||||
&& rm -rf /root/.local/share/pnpm/store \
|
||||
&& rm -rf /root/.cache \
|
||||
|
||||
@@ -9,9 +9,8 @@ export isFirstStartServer=true
|
||||
echo -e "======================1. 检测配置文件========================\n"
|
||||
make_dir /etc/nginx/conf.d
|
||||
make_dir /run/nginx
|
||||
cp -fv $nginx_conf /etc/nginx/nginx.conf
|
||||
cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf
|
||||
sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf
|
||||
init_nginx
|
||||
|
||||
pm2 l &>/dev/null
|
||||
|
||||
patch_version &>/dev/null
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ map $http_upgrade $connection_upgrade {
|
||||
|
||||
server {
|
||||
listen 5700;
|
||||
listen [::]:5700 ipv6only=on;
|
||||
IPV6_CONFIG
|
||||
root /ql/static/dist;
|
||||
ssl_session_timeout 5m;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"start:front": "max dev",
|
||||
"start:back": "nodemon",
|
||||
"start:public": "ts-node --transpile-only ./back/public.ts",
|
||||
"start:schedule": "ts-node --transpile-only ./back/schedule.ts",
|
||||
"build:front": "max build",
|
||||
"build:back": "tsc -p tsconfig.back.json",
|
||||
"panel": "npm run build:back && node static/build/app.js",
|
||||
@@ -142,6 +143,7 @@
|
||||
"sockjs-client": "^1.6.0",
|
||||
"ts-node": "^10.6.0",
|
||||
"tslib": "^2.4.0",
|
||||
"tsx": "^3.12.3",
|
||||
"typescript": "4.8.4",
|
||||
"umi-request": "^1.4.0",
|
||||
"vh-check": "^2.0.5",
|
||||
|
||||
Generated
+2
@@ -84,6 +84,7 @@ specifiers:
|
||||
toad-scheduler: ^1.6.0
|
||||
ts-node: ^10.6.0
|
||||
tslib: ^2.4.0
|
||||
tsx: ^3.12.3
|
||||
typedi: ^0.10.0
|
||||
typescript: 4.8.4
|
||||
umi-request: ^1.4.0
|
||||
@@ -184,6 +185,7 @@ devDependencies:
|
||||
sockjs-client: 1.6.1
|
||||
ts-node: 10.9.1_ksn4eycaeggbrckn3ykh37hwf4
|
||||
tslib: 2.4.1
|
||||
tsx: 3.12.3
|
||||
typescript: 4.8.4
|
||||
umi-request: 1.4.0
|
||||
vh-check: 2.0.5
|
||||
|
||||
+2
-2
@@ -296,7 +296,7 @@ async function sendNotify(
|
||||
) {
|
||||
//提供6种通知
|
||||
desp += author; //增加作者信息,防止被贩卖等
|
||||
|
||||
|
||||
// 根据标题跳过一些消息推送,环境变量:SKIP_PUSH_TITLE 用回车分隔
|
||||
let skipTitle = process.env.SKIP_PUSH_TITLE
|
||||
if(skipTitle) {
|
||||
@@ -533,7 +533,7 @@ function BarkNotify(text, desp, params = {}) {
|
||||
const options = {
|
||||
url: `${BARK_PUSH}/${encodeURIComponent(text)}/${encodeURIComponent(
|
||||
desp,
|
||||
)}?icon=${BARK_ICON}?sound=${BARK_SOUND}&group=${BARK_GROUP}&${querystring.stringify(
|
||||
)}?icon=${BARK_ICON}&sound=${BARK_SOUND}&group=${BARK_GROUP}&${querystring.stringify(
|
||||
params,
|
||||
)}`,
|
||||
headers: {
|
||||
|
||||
+15
-6
@@ -1,15 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
create_token() {
|
||||
local token_command="tsx ${dir_root}/back/token.ts"
|
||||
local token_file="${dir_root}static/build/token.js"
|
||||
if [[ -f $token_file ]]; then
|
||||
token_command="node ${token_file}"
|
||||
fi
|
||||
token=$(eval "$token_command")
|
||||
}
|
||||
|
||||
get_token() {
|
||||
if [[ -f $file_auth_token ]]; then
|
||||
token=$(cat $file_auth_token | jq -r .value)
|
||||
else
|
||||
local token_command="ts-node-transpile-only ${dir_root}/back/token.ts"
|
||||
local token_file="${dir_root}static/build/token.js"
|
||||
if [[ -f $token_file ]]; then
|
||||
token_command="node ${token_file}"
|
||||
local expiration=$(cat $file_auth_token | jq -r .expiration)
|
||||
local currentTimeStamp=$(date +%s)
|
||||
if [[ $currentTimeStamp -ge $expiration ]]; then
|
||||
create_token
|
||||
fi
|
||||
token=$(eval "$token_command")
|
||||
else
|
||||
create_token
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
-4
@@ -1,9 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## 导入通用变量与函数
|
||||
dir_shell=$QL_DIR/shell
|
||||
. $dir_shell/share.sh
|
||||
|
||||
if [[ -z ${BotRepoUrl} ]]; then
|
||||
url="https://github.com/SuMaiKaDe/bot.git"
|
||||
repo_path="${dir_repo}/dockerbot"
|
||||
|
||||
Regular → Executable
+2
-9
@@ -1,9 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
dir_shell=$QL_DIR/shell
|
||||
. $dir_shell/share.sh
|
||||
. $dir_shell/api.sh
|
||||
|
||||
reset_env() {
|
||||
echo -e "---> 1. 开始检测配置文件\n"
|
||||
fix_config
|
||||
@@ -29,9 +25,7 @@ copy_dep() {
|
||||
echo -e "---> 通知文件复制完成\n"
|
||||
|
||||
echo -e "---> 2. 复制nginx配置文件\n"
|
||||
cp -fv $nginx_conf /etc/nginx/nginx.conf
|
||||
cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf
|
||||
sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf
|
||||
init_nginx
|
||||
echo -e "---> 配置文件复制完成\n"
|
||||
}
|
||||
|
||||
@@ -70,9 +64,8 @@ check_pm2() {
|
||||
pm2_log
|
||||
local currentTimeStamp=$(date +%s)
|
||||
local api=$(
|
||||
curl -s --noproxy "*" "http://0.0.0.0:5600/api/user?t=$currentTimeStamp" \
|
||||
curl -s --noproxy "*" "http://0.0.0.0:5600/api/system?t=$currentTimeStamp" \
|
||||
-H 'Accept: */*' \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' \
|
||||
-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' \
|
||||
|
||||
Regular → Executable
-5
@@ -1,10 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## 导入通用变量与函数
|
||||
dir_shell=$QL_DIR/shell
|
||||
. $dir_shell/share.sh
|
||||
. $dir_shell/api.sh
|
||||
|
||||
trap "single_hanle" 2 20 15 14
|
||||
single_hanle() {
|
||||
handle_task_after "$@"
|
||||
|
||||
Regular → Executable
+1
-1
@@ -11,7 +11,7 @@ echo -e "提交master代码"
|
||||
git push
|
||||
|
||||
echo -e "更新cdn文件"
|
||||
ts-node sample/tool.ts
|
||||
tsx sample/tool.ts
|
||||
|
||||
string=$(cat version.yaml | grep "version" | egrep "[^ ]*" -o | egrep "\d\.*")
|
||||
version="v$string"
|
||||
|
||||
+6
-6
@@ -1,9 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## 导入通用变量与函数
|
||||
dir_shell=$QL_DIR/shell
|
||||
. $dir_shell/share.sh
|
||||
|
||||
days=$1
|
||||
|
||||
## 删除运行脚本的旧日志
|
||||
@@ -19,10 +15,14 @@ remove_js_log() {
|
||||
diff_time=$(($(date +%s) - $(date +%s -d "$log_date")))
|
||||
fi
|
||||
if [[ $diff_time -gt $((${days} * 86400)) ]]; then
|
||||
local log_path=$(echo "$log" | sed "s,${dir_log},,g")
|
||||
local log_path=$(echo "$log" | sed "s,${dir_log}/,,g")
|
||||
local result=$(find_cron_api "log_path=$log_path")
|
||||
if [[ $result ]]; then
|
||||
echo -e "查询文件 $log_path"
|
||||
if [[ -z $result ]]; then
|
||||
echo -e "删除中~"
|
||||
rm -vf $log
|
||||
else
|
||||
echo -e "正在被 $result 使用,跳过~"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
+19
-5
@@ -431,16 +431,17 @@ format_timestamp() {
|
||||
}
|
||||
|
||||
patch_version() {
|
||||
# 兼容pnpm@7
|
||||
pnpm setup &>/dev/null
|
||||
source ~/.bashrc
|
||||
|
||||
if [[ $PipMirror ]]; then
|
||||
pip3 config set global.index-url $PipMirror
|
||||
fi
|
||||
if [[ $NpmMirror ]]; then
|
||||
npm config set registry $NpmMirror
|
||||
pnpm config set registry $NpmMirror
|
||||
fi
|
||||
|
||||
# 兼容pnpm@7
|
||||
pnpm setup &>/dev/null
|
||||
source ~/.bashrc
|
||||
pnpm install -g &>/dev/null
|
||||
|
||||
if [[ -f "$dir_root/db/cookie.db" ]]; then
|
||||
@@ -450,7 +451,7 @@ patch_version() {
|
||||
echo
|
||||
fi
|
||||
|
||||
pnpm add -g pm2 ts-node typescript tslib
|
||||
pnpm add -g pm2 tsx
|
||||
|
||||
git config --global pull.rebase false
|
||||
|
||||
@@ -481,6 +482,19 @@ patch_version() {
|
||||
fi
|
||||
}
|
||||
|
||||
init_nginx() {
|
||||
cp -fv $nginx_conf /etc/nginx/nginx.conf
|
||||
cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf
|
||||
sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf
|
||||
|
||||
ipv6=$(ip a | grep inet6)
|
||||
ipv6Str=""
|
||||
if [[ $ipv6 ]]; then
|
||||
ipv6Str="listen [::]:5700 ipv6only=on;"
|
||||
fi
|
||||
sed -i "s,IPV6_CONFIG,${ipv6Str},g" /etc/nginx/conf.d/front.conf
|
||||
}
|
||||
|
||||
init_env
|
||||
detect_termux
|
||||
detect_macos
|
||||
|
||||
+5
-1
@@ -15,7 +15,11 @@ define_program() {
|
||||
elif [[ $file_param == *.sh ]]; then
|
||||
which_program="bash"
|
||||
elif [[ $file_param == *.ts ]]; then
|
||||
which_program="ts-node-transpile-only"
|
||||
if ! type tsx &>/dev/null; then
|
||||
which_program="ts-node-transpile-only"
|
||||
else
|
||||
which_program="tsx"
|
||||
fi
|
||||
else
|
||||
which_program=""
|
||||
fi
|
||||
|
||||
+15
-6
@@ -152,19 +152,28 @@ update_raw() {
|
||||
local autoAddCron="$3"
|
||||
local autoDelCron="$4"
|
||||
|
||||
if [[ ! $autoAddCron ]];then
|
||||
if [[ ! $autoAddCron ]]; then
|
||||
autoAddCron=${AutoAddCron}
|
||||
fi
|
||||
if [[ ! $autoDelCron ]];then
|
||||
if [[ ! $autoDelCron ]]; then
|
||||
autoDelCron=${AutoDelCron}
|
||||
fi
|
||||
|
||||
local proxyStr=""
|
||||
if [[ $proxy ]]; then
|
||||
if [[ $url == http:* ]]; then
|
||||
proxyStr="-e \"http_proxy=${proxy}\""
|
||||
elif [[ $url == https:* ]]; then
|
||||
proxyStr="-e \"http_proxy=${proxy};https_proxy=${proxy}\""
|
||||
fi
|
||||
fi
|
||||
|
||||
local raw_url="$url"
|
||||
local suffix="${raw_url##*.}"
|
||||
local raw_file_name="${uniq_path}.${suffix}"
|
||||
echo -e "开始下载:${raw_url} \n\n保存路径:$dir_raw/${raw_file_name}\n"
|
||||
|
||||
wget -q --no-check-certificate -e "http_proxy=${proxy};https_proxy=${proxy}" -O "$dir_raw/${raw_file_name}.new" ${raw_url}
|
||||
wget -q --no-check-certificate $proxyStr -O "$dir_raw/${raw_file_name}.new" ${raw_url}
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
mv "$dir_raw/${raw_file_name}.new" "$dir_raw/${raw_file_name}"
|
||||
@@ -297,11 +306,11 @@ diff_scripts() {
|
||||
local extensions="$6"
|
||||
local autoAddCron="$7"
|
||||
local autoDelCron="$8"
|
||||
|
||||
if [[ ! $autoAddCron ]];then
|
||||
|
||||
if [[ ! $autoAddCron ]]; then
|
||||
autoAddCron=${AutoAddCron}
|
||||
fi
|
||||
if [[ ! $autoDelCron ]];then
|
||||
if [[ ! $autoDelCron ]]; then
|
||||
autoDelCron=${AutoDelCron}
|
||||
fi
|
||||
|
||||
|
||||
@@ -47,9 +47,8 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => {
|
||||
</div>
|
||||
</>
|
||||
),
|
||||
okText: '确认',
|
||||
cancelText: '强制更新',
|
||||
onCancel() {
|
||||
okText: '强制更新',
|
||||
onOk() {
|
||||
showUpdatingModal();
|
||||
request
|
||||
.put(`${config.apiPrefix}system/update`)
|
||||
@@ -103,6 +102,7 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => {
|
||||
width: 600,
|
||||
maskClosable: false,
|
||||
closable: false,
|
||||
keyboard: false,
|
||||
okButtonProps: { disabled: true },
|
||||
title: '更新中...',
|
||||
centered: true,
|
||||
|
||||
+10
-11
@@ -1,12 +1,11 @@
|
||||
version: 2.15.9
|
||||
changeLogLink: https://t.me/jiao_long/364
|
||||
version: 2.15.10
|
||||
changeLogLink: https://t.me/jiao_long/365
|
||||
changeLog: |
|
||||
1. 通知脚本增加环境变量 SKIP_PUSH_TITLE,设置需要跳过推送的标题,多个换行符分割分隔,感谢 https://github.com/pharaoh2012
|
||||
2. nginx 增加 ipv6 配置
|
||||
3. 对比工具增加通知文件对比
|
||||
4. 修复文件类型订阅重复添加任务
|
||||
5. 修改自动删除日志逻辑
|
||||
6. 修复定时任务状态筛选,排序
|
||||
7. 修改表格样式
|
||||
8. 修复切换导航,编辑器页面可能崩溃
|
||||
9. 其他 bug 修复
|
||||
1. 增加 ipv6 自动检测
|
||||
2. 修复订阅管理下载 http 协议文件
|
||||
3. 修复日志删除逻辑
|
||||
4. 修复自定义通知
|
||||
5. 修复检查更新弹框逻辑
|
||||
6. 修复 bark 推送声音,感谢 https://github.com/adams549659584
|
||||
7. 修复 task 命令获取 token
|
||||
8. 其他 bug 修复
|
||||
|
||||
Reference in New Issue
Block a user