mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-07 09:14:32 +08:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 468d05cb10 | |||
| 88c2e5d160 | |||
| 8cf491b802 | |||
| 5886e78299 | |||
| 591ef9781c | |||
| 52fef96c1c | |||
| d5fd9c57ec | |||
| 8a7d6a1c13 | |||
| 1745c72981 | |||
| b98b7646cb | |||
| 1446e925ec | |||
| 799cda1e3e | |||
| d2e0231341 | |||
| 9e0aa655a0 | |||
| e303c73d44 | |||
| e5e8e66d6b | |||
| 0bb3381122 | |||
| 2c5bf2bd6b | |||
| 83763b00ae | |||
| 47fc795c97 | |||
| 6a59bf7af3 | |||
| 6f185570d6 | |||
| 8b8336d9d0 | |||
| a1e1d6ed3f | |||
| df3e209534 | |||
| 851408860e | |||
| d92ea23b0e | |||
| d83641db92 | |||
| 48f262e1f3 | |||
| bc49a7db50 | |||
| 49975b461c | |||
| 3ccb635956 | |||
| 074a90e0ac | |||
| 526f927436 |
@@ -17,16 +17,47 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
to_gitlab:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: pixta-dev/repository-mirroring-action@v1
|
||||
with:
|
||||
target_repo_url:
|
||||
git@gitlab.com:whyour/qinglong.git
|
||||
ssh_private_key:
|
||||
${{ secrets.GITLAB_SSH_PK }}
|
||||
|
||||
to_gitee:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: pixta-dev/repository-mirroring-action@v1
|
||||
with:
|
||||
target_repo_url:
|
||||
git@gitee.com:whyour/qinglong.git
|
||||
ssh_private_key:
|
||||
${{ secrets.GITLAB_SSH_PK }}
|
||||
|
||||
build-static:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: build front and back
|
||||
run: |
|
||||
npm i -g pnpm
|
||||
pnpm install
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm build:front
|
||||
pnpm build:back
|
||||
|
||||
@@ -34,6 +65,9 @@ jobs:
|
||||
env:
|
||||
GITHUB_REPO: github.com/${{ github.repository_owner }}/qinglong-static
|
||||
GITHUB_BRANCH: ${{ github.ref_name }}
|
||||
REPO_GITEE: git@gitee.com:whyour/qinglong-static.git
|
||||
REPO_GITLAB: git@gitlab.com:whyour/qinglong-static.git
|
||||
PRIVATE_KEY: ${{ secrets.GITLAB_SSH_PK }}
|
||||
run: |
|
||||
mkdir -p tmp
|
||||
cd ./tmp
|
||||
@@ -44,6 +78,16 @@ jobs:
|
||||
git commit --allow-empty -m "copy static at $(date +'%Y-%m-%d %H:%M:%S')"
|
||||
git push --force --quiet "https://${{ secrets.API_TOKEN }}@${GITHUB_REPO}.git" ${GITHUB_BRANCH}:${GITHUB_BRANCH}
|
||||
|
||||
mkdir -p ~/.ssh
|
||||
echo "${PRIVATE_KEY}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -l git"
|
||||
git remote add gitee "${REPO_GITEE}"
|
||||
git remote add gitlab "${REPO_GITLAB}"
|
||||
git push --force --quiet gitee ${GITHUB_BRANCH}:${GITHUB_BRANCH}
|
||||
git push --force --quiet gitlab ${GITHUB_BRANCH}:${GITHUB_BRANCH}
|
||||
|
||||
build:
|
||||
needs: build-static
|
||||
|
||||
@@ -55,7 +99,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: latest
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Setup timezone
|
||||
uses: zcong1993/setup-timezone@master
|
||||
@@ -98,7 +147,7 @@ jobs:
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v3
|
||||
@@ -112,3 +161,6 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
/npm-debug.log*
|
||||
/yarn-error.log
|
||||
/yarn.lock
|
||||
/pnpm-lock.yaml
|
||||
/package-lock.json
|
||||
|
||||
# production
|
||||
|
||||
+8
-3
@@ -22,7 +22,7 @@ Timed task management panel with python3, javaScript, shell, typescript support
|
||||
[docker-image-size-url]: https://hub.docker.com/r/whyour/qinglong
|
||||
</div>
|
||||
|
||||
[](https://whyour.cn)
|
||||
[](https://whyour.cn)
|
||||
|
||||
[简体中文](./README.md) | English
|
||||
|
||||
@@ -41,7 +41,7 @@ Timed task management panel with python3, javaScript, shell, typescript support
|
||||
### Local Deployment
|
||||
|
||||
```bash
|
||||
# To be completed
|
||||
# To be refined, see the development steps first (not supported on windows yet)
|
||||
```
|
||||
|
||||
### Podman Deployment
|
||||
@@ -160,7 +160,11 @@ task <file_path> now
|
||||
# the foreground does not generate the day, directly recorded in the log file, and can be specified account execution
|
||||
task <file_path> conc <env_name> <account_number>(Optional)
|
||||
# Specify the account to execute and run immediately regardless of whether a random delay is set
|
||||
task <file_path> desi <env_name> <account_number>
|
||||
task <file_path> desi <env_name> <account_number>
|
||||
# Set task timeout
|
||||
task -m <max_time> <file_path>
|
||||
# Print task log in real time, no need to carry this parameter when creating timed tasks
|
||||
task -l <file_path>
|
||||
```
|
||||
|
||||
2. parameter description
|
||||
@@ -175,6 +179,7 @@ task <file_path> desi <env_name> <account_number>
|
||||
* file_path: File path for task execution
|
||||
* env_name: The name of the environment variable that needs to be concurrent or specified at the time of task execution
|
||||
* account_number: Specify the account number of an environment variable to be executed when the task is executed
|
||||
* max_time: Timeout, suffix "s" for seconds (default), "m" for minutes, "h" for hours, "d" for days
|
||||
|
||||
## Links
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
[docker-image-size-url]: https://hub.docker.com/r/whyour/qinglong
|
||||
</div>
|
||||
|
||||
[](https://whyour.cn)
|
||||
[](https://whyour.cn)
|
||||
|
||||
简体中文 | [English](./README-en.md)
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
### 本机部署
|
||||
|
||||
```bash
|
||||
# 待完善
|
||||
# 待完善,可先参考开发步骤 (windows暂时不支持)
|
||||
```
|
||||
|
||||
### podman 部署
|
||||
@@ -159,7 +159,11 @@ task <file_path> now
|
||||
# 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日,直接记录在日志文件中,且可指定账号执行
|
||||
task <file_path> conc <env_name> <account_number>(可选的)
|
||||
# 指定账号执行,无论是否设置了随机延迟,均立即运行
|
||||
task <file_path> desi <env_name> <account_number>
|
||||
task <file_path> desi <env_name> <account_number>
|
||||
# 设置任务超时时间
|
||||
task -m <max_time> <file_path>
|
||||
# 实时打印任务日志,创建定时任务时,不用携带此参数
|
||||
task -l <file_path>
|
||||
```
|
||||
|
||||
2. 参数说明
|
||||
@@ -175,6 +179,7 @@ task <file_path> desi <env_name> <account_number>
|
||||
* file_path: 任务执行时的文件路径
|
||||
* env_name: 任务执行时需要并发或者指定时的环境变量名称
|
||||
* account_number: 任务执行时指定某个环境变量需要执行的账号序号
|
||||
* max_time: 超时时间,后缀"s"代表秒(默认值), "m"代表分, "h"代表小时, "d"代表天
|
||||
|
||||
## 链接
|
||||
|
||||
|
||||
+6
-2
@@ -58,8 +58,12 @@ export default (app: Router) => {
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
const cronViewService = Container.get(CronViewService);
|
||||
const data = await cronViewService.update(req.body);
|
||||
return res.send({ code: 200, data });
|
||||
if (req.body.type === 1) {
|
||||
return res.send({ code: 400, message: '参数错误' });
|
||||
} else {
|
||||
const data = await cronViewService.update(req.body);
|
||||
return res.send({ code: 200, data });
|
||||
}
|
||||
} catch (e) {
|
||||
return next(e);
|
||||
}
|
||||
|
||||
+5
-2
@@ -8,6 +8,7 @@ import { celebrate, Joi } from 'celebrate';
|
||||
import UserService from '../services/user';
|
||||
import { EnvModel } from '../data/env';
|
||||
import { promiseExec } from '../config/util';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const route = Router();
|
||||
|
||||
@@ -25,7 +26,9 @@ export default (app: Router) => {
|
||||
const currentVersionFile = fs.readFileSync(config.versionFile, 'utf8');
|
||||
const version = currentVersionFile.match(versionRegx)![1];
|
||||
const lastCommitTime = (
|
||||
await promiseExec(`cd ${config.rootPath} && git show -s --format=%ai | head -1`)
|
||||
await promiseExec(
|
||||
`cd ${config.rootPath} && git show -s --format=%ai | head -1`,
|
||||
)
|
||||
).replace('\n', '');
|
||||
const lastCommitId = (
|
||||
await promiseExec(`cd ${config.rootPath} && git rev-parse --short HEAD`)
|
||||
@@ -50,7 +53,7 @@ export default (app: Router) => {
|
||||
data: {
|
||||
isInitialized,
|
||||
version,
|
||||
lastCommitTime,
|
||||
lastCommitTime: dayjs(lastCommitTime).unix(),
|
||||
lastCommitId,
|
||||
branch,
|
||||
},
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const LOG_END_SYMBOL = '\n ';
|
||||
export const LOG_END_SYMBOL = '\n ';
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { sequelize } from '.';
|
||||
import { DataTypes, Model } from 'sequelize';
|
||||
|
||||
export enum CronViewType {
|
||||
'系统' = 1,
|
||||
'个人',
|
||||
}
|
||||
|
||||
interface SortType {
|
||||
type: 'ASC' | 'DESC';
|
||||
value: string;
|
||||
@@ -20,6 +25,7 @@ export class CrontabView {
|
||||
filters?: FilterType[];
|
||||
sorts?: SortType[];
|
||||
filterRelation?: 'and' | 'or';
|
||||
type?: CronViewType;
|
||||
|
||||
constructor(options: CrontabView) {
|
||||
this.name = options.name;
|
||||
@@ -29,6 +35,7 @@ export class CrontabView {
|
||||
this.filters = options.filters;
|
||||
this.sorts = options.sorts;
|
||||
this.filterRelation = options.filterRelation;
|
||||
this.type = options.type || CronViewType.个人;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,5 +57,6 @@ export const CrontabViewModel = sequelize.define<CronViewInstance>(
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
},
|
||||
type: DataTypes.NUMBER,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -41,6 +41,7 @@ export class ServerChanNotification extends NotificationBaseInfo {
|
||||
|
||||
export class PushDeerNotification extends NotificationBaseInfo {
|
||||
public pushDeerKey = '';
|
||||
public pushDeerUrl = '';
|
||||
}
|
||||
|
||||
export class ChatNotification extends NotificationBaseInfo {
|
||||
|
||||
+10
-3
@@ -10,7 +10,7 @@ import { fileExist } from '../config/util';
|
||||
import { SubscriptionModel } from '../data/subscription';
|
||||
import { CrontabViewModel } from '../data/cronView';
|
||||
import config from '../config';
|
||||
import { sequelize } from '../data'
|
||||
import { sequelize } from '../data';
|
||||
|
||||
export default async () => {
|
||||
try {
|
||||
@@ -24,10 +24,17 @@ export default async () => {
|
||||
|
||||
// 初始化新增字段
|
||||
try {
|
||||
await sequelize.query('alter table CrontabViews add column filterRelation VARCHAR(255)')
|
||||
await sequelize.query(
|
||||
'alter table CrontabViews add column filterRelation VARCHAR(255)',
|
||||
);
|
||||
} catch (error) {}
|
||||
try {
|
||||
await sequelize.query('alter table Subscriptions add column proxy VARCHAR(255)')
|
||||
await sequelize.query(
|
||||
'alter table Subscriptions add column proxy VARCHAR(255)',
|
||||
);
|
||||
} catch (error) {}
|
||||
try {
|
||||
await sequelize.query('alter table CrontabViews add column type NUMBER');
|
||||
} catch (error) {}
|
||||
|
||||
// 2.10-2.11 升级
|
||||
|
||||
@@ -8,13 +8,28 @@ import groupBy from 'lodash/groupBy';
|
||||
import { DependenceModel } from '../data/dependence';
|
||||
import { Op } from 'sequelize';
|
||||
import config from '../config';
|
||||
import { CrontabViewModel } from '../data/cronView';
|
||||
import { CrontabViewModel, CronViewType } from '../data/cronView';
|
||||
import { initPosition } from '../data/env';
|
||||
|
||||
export default async () => {
|
||||
const cronService = Container.get(CronService);
|
||||
const envService = Container.get(EnvService);
|
||||
const dependenceService = Container.get(DependenceService);
|
||||
|
||||
// 初始化新增默认全部任务视图
|
||||
CrontabViewModel.findAll({
|
||||
where: { type: CronViewType.系统, name: '全部任务' },
|
||||
raw: true,
|
||||
}).then((docs) => {
|
||||
if (docs.length === 0) {
|
||||
CrontabViewModel.create({
|
||||
name: '全部任务',
|
||||
type: CronViewType.系统,
|
||||
position: initPosition / 2,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化更新所有任务状态为空闲
|
||||
await CrontabModel.update(
|
||||
{ status: CrontabStatus.idle },
|
||||
|
||||
@@ -326,10 +326,10 @@ export default class CronService {
|
||||
|
||||
const endTime = dayjs();
|
||||
const diffTimeStr = doc.last_execution_time
|
||||
? `,耗时 ${endTime.diff(
|
||||
? ` 耗时 ${endTime.diff(
|
||||
dayjs(doc.last_execution_time * 1000),
|
||||
'second',
|
||||
)}`
|
||||
)} 秒`
|
||||
: '';
|
||||
if (logFileExist) {
|
||||
const str = err ? `\n${err}` : '';
|
||||
|
||||
@@ -123,8 +123,8 @@ export default class NotificationService {
|
||||
}
|
||||
|
||||
private async pushDeer() {
|
||||
const { pushDeerKey } = this.params;
|
||||
const url = `https://api2.pushdeer.com/message/push`;
|
||||
const { pushDeerKey, pushDeerUrl } = this.params;
|
||||
const url = pushDeerUrl || `https://api2.pushdeer.com/message/push`;
|
||||
const res: any = await got
|
||||
.post(url, {
|
||||
...this.gotOption,
|
||||
|
||||
+1
-2
@@ -75,7 +75,6 @@
|
||||
"nedb": "^1.8.0",
|
||||
"node-schedule": "^2.1.0",
|
||||
"nodemailer": "^6.7.2",
|
||||
"p-queue": "7.2.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"sequelize": "^6.25.5",
|
||||
"serve-handler": "^6.1.3",
|
||||
@@ -136,7 +135,7 @@
|
||||
"sockjs-client": "^1.6.0",
|
||||
"ts-node": "^10.6.0",
|
||||
"tslib": "^2.4.0",
|
||||
"typescript": "^4.6.2",
|
||||
"typescript": "4.8.4",
|
||||
"umi-request": "^1.4.0",
|
||||
"vh-check": "^2.0.5",
|
||||
"webpack": "^5.70.0",
|
||||
|
||||
Generated
+13702
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -38,6 +38,7 @@ let SCKEY = '';
|
||||
//此处填你申请的PushDeer KEY.
|
||||
//(环境变量名 DEER_KEY)
|
||||
let PUSHDEER_KEY = '';
|
||||
let PUSHDEER_URL = '';
|
||||
|
||||
// =======================================Synology Chat通知设置区域===========================================
|
||||
//此处填你申请的CHAT_URL与CHAT_TOKEN
|
||||
@@ -151,6 +152,7 @@ if (process.env.PUSH_KEY) {
|
||||
|
||||
if (process.env.DEER_KEY) {
|
||||
PUSHDEER_KEY = process.env.DEER_KEY;
|
||||
PUSHDEER_URL = process.env.DEER_URL;
|
||||
}
|
||||
|
||||
if (process.env.CHAT_URL) {
|
||||
@@ -413,7 +415,7 @@ function PushDeerNotify(text, desp) {
|
||||
// PushDeer 建议对消息内容进行 urlencode
|
||||
desp = encodeURI(desp);
|
||||
const options = {
|
||||
url: `https://api2.pushdeer.com/message/push`,
|
||||
url: PUSHDEER_URL || `https://api2.pushdeer.com/message/push`,
|
||||
body: `pushkey=${PUSHDEER_KEY}&text=${text}&desp=${desp}&type=markdown`,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
|
||||
@@ -61,6 +61,7 @@ push_config = {
|
||||
'PUSH_KEY': '', # server 酱的 PUSH_KEY,兼容旧版与 Turbo 版
|
||||
|
||||
'DEER_KEY': '', # PushDeer 的 PUSHDEER_KEY
|
||||
'DEER_URL': '', # PushDeer 的 PUSHDEER_URL
|
||||
|
||||
'CHAT_URL': '', # synology chat url
|
||||
'CHAT_TOKEN': '', # synology chat token
|
||||
@@ -280,6 +281,9 @@ def pushdeer(title: str, content: str) -> None:
|
||||
print("PushDeer 服务启动")
|
||||
data = {"text": title, "desp": content, "type": "markdown", "pushkey": push_config.get("DEER_KEY")}
|
||||
url = 'https://api2.pushdeer.com/message/push'
|
||||
if push_config.get("DEER_URL"):
|
||||
url = push_config.get("DEER_URL")
|
||||
|
||||
response = requests.post(url, data=data).json()
|
||||
|
||||
if len(response.get("content").get("result")) > 0:
|
||||
|
||||
+8
-3
@@ -87,13 +87,18 @@ check_pm2() {
|
||||
fi
|
||||
}
|
||||
|
||||
start_public() {
|
||||
echo -e "=====> 启动公开服务\n"
|
||||
pm2 delete public --source-map-support --time &>/dev/null
|
||||
pm2 start $dir_static/build/public.js -n public --source-map-support --time &>/dev/null
|
||||
}
|
||||
|
||||
main() {
|
||||
echo -e "=====> 开始检测"
|
||||
npm i -g pnpm
|
||||
pnpm setup &>/dev/null
|
||||
source ~/.bashrc
|
||||
pnpm install -g &>/dev/null
|
||||
pnpm add -g pm2
|
||||
patch_version
|
||||
start_public
|
||||
copy_dep
|
||||
check_ql
|
||||
check_nginx
|
||||
|
||||
+3
-2
@@ -75,7 +75,8 @@ run_nohup() {
|
||||
}
|
||||
|
||||
check_server() {
|
||||
cpu_use=$(top -b -n 1 | grep CPU | grep -v -E 'grep|PID' | awk '{print $2}' | cut -f 1 -d "%" | head -n 1)
|
||||
local top_result=$(top -b -n 1)
|
||||
cpu_use=$(echo "$top_result" | grep CPU | grep -v -E 'grep|PID' | awk '{print $2}' | cut -f 1 -d "%" | head -n 1)
|
||||
|
||||
mem_free=$(free -m | grep "Mem" | awk '{print $3}' | head -n 1)
|
||||
mem_total=$(free -m | grep "Mem" | awk '{print $2}' | head -n 1)
|
||||
@@ -84,7 +85,7 @@ check_server() {
|
||||
disk_use=$(df -P | grep /dev | grep -v -E '(tmp|boot|shm)' | awk '{print $5}' | cut -f 1 -d "%" | head -n 1)
|
||||
|
||||
if [[ $cpu_use -gt $cpu_warn ]] || [[ $mem_free -lt $mem_warn ]] || [[ $disk_use -gt $disk_warn ]]; then
|
||||
local resource=$(top -b -n 1 | grep -v -E 'grep|Mem|idle|Load|tr' | awk '{$2="";$3="";$4="";$5="";$7="";print $0}' | head -n 10 | tr '\n' '|' | sed s/\|/\\\\n/g)
|
||||
local resource=$(echo "$top_result" | grep -v -E 'grep|Mem|idle|Load|tr' | awk '{$2="";$3="";$4="";$5="";$7="";print $0}' | head -n 10 | tr '\n' '|' | sed s/\|/\\\\n/g)
|
||||
notify_api "服务器资源异常警告" "当前CPU占用 $cpu_use% 内存占用 $mem_use% 磁盘占用 $disk_use% \n资源占用详情 \n\n $resource"
|
||||
fi
|
||||
}
|
||||
|
||||
+7
-10
@@ -333,7 +333,6 @@ git_pull_scripts() {
|
||||
exit_status=$?
|
||||
git pull &>/dev/null
|
||||
unset_proxy
|
||||
reset_branch "$branch"
|
||||
|
||||
cd $dir_current
|
||||
}
|
||||
@@ -344,19 +343,21 @@ reset_romote_url() {
|
||||
local url=$2
|
||||
local branch="$3"
|
||||
|
||||
cd $dir_work
|
||||
if [[ -d "$dir_work/.git" ]]; then
|
||||
cd $dir_work
|
||||
[[ -f ".git/index.lock" ]] && rm -f .git/index.lock >/dev/null
|
||||
git remote set-url origin $url &>/dev/null
|
||||
|
||||
local part_cmd=""
|
||||
reset_branch "$branch"
|
||||
cd $dir_current
|
||||
else
|
||||
git init
|
||||
git remote add origin $url &>/dev/null
|
||||
fi
|
||||
reset_branch "$branch"
|
||||
cd $dir_current
|
||||
}
|
||||
|
||||
reset_branch() {
|
||||
local branch="$1"
|
||||
local part_cmd=""
|
||||
if [[ $branch ]]; then
|
||||
part_cmd="origin/${branch}"
|
||||
git checkout -B "$branch" &>/dev/null
|
||||
@@ -381,10 +382,6 @@ reload_pm2() {
|
||||
echo -e "启动定时任务服务\n"
|
||||
pm2 delete schedule --source-map-support --time &>/dev/null
|
||||
pm2 start $dir_static/build/schedule.js -n schedule --source-map-support --time &>/dev/null
|
||||
|
||||
echo -e "启动公开服务\n"
|
||||
pm2 delete public --source-map-support --time &>/dev/null
|
||||
pm2 start $dir_static/build/public.js -n public --source-map-support --time &>/dev/null
|
||||
}
|
||||
|
||||
diff_time() {
|
||||
|
||||
+9
-3
@@ -61,15 +61,21 @@ format_params() {
|
||||
params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g')
|
||||
}
|
||||
|
||||
show_log="false"
|
||||
while getopts ":l" opt; do
|
||||
while getopts ":lm:" opt; do
|
||||
case $opt in
|
||||
l)
|
||||
show_log="true"
|
||||
;;
|
||||
m)
|
||||
max_time="$OPTARG"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
[[ "$show_log" == "true" ]] && shift $(($OPTIND - 1))
|
||||
[[ $show_log ]] && shift $(($OPTIND - 1))
|
||||
if [[ $max_time ]]; then
|
||||
shift $(($OPTIND - 1))
|
||||
command_timeout_time="$max_time"
|
||||
fi
|
||||
|
||||
format_params "$@"
|
||||
define_program "$@"
|
||||
|
||||
+11
-5
@@ -159,6 +159,7 @@ update_repo() {
|
||||
reset_romote_url ${repo_path} "${formatUrl}" "${branch}"
|
||||
git_pull_scripts ${repo_path} "${branch}" "${proxy}"
|
||||
else
|
||||
rm -rf ${repo_path} &>/dev/null
|
||||
git_clone_scripts "${formatUrl}" ${repo_path} "${branch}" "${proxy}"
|
||||
fi
|
||||
if [[ $exit_status -eq 0 ]]; then
|
||||
@@ -245,17 +246,21 @@ usage() {
|
||||
|
||||
## 更新qinglong
|
||||
update_qinglong() {
|
||||
patch_version &>/dev/null
|
||||
|
||||
local mirror="github"
|
||||
local githubStatus=$(curl -s -m 2 -IL "https://github.com" | grep 200)
|
||||
if [ "$githubStatus" == "" ]; then
|
||||
mirror="gitee"
|
||||
fi
|
||||
echo -e "\n使用 ${mirror} 源更新...\n"
|
||||
export isFirstStartServer=false
|
||||
|
||||
local all_branch=$(git branch -a)
|
||||
local all_branch=$(cd ${dir_root} && git branch -a)
|
||||
local primary_branch="master"
|
||||
if [[ "${all_branch}" =~ "${current_branch}" ]]; then
|
||||
primary_branch="${current_branch}"
|
||||
fi
|
||||
[[ -f $dir_root/package.json ]] && ql_depend_old=$(cat $dir_root/package.json)
|
||||
reset_romote_url ${dir_root} "https://github.com/whyour/qinglong.git" ${primary_branch}
|
||||
reset_romote_url ${dir_root} "https://${mirror}.com/whyour/qinglong.git" ${primary_branch}
|
||||
git_pull_scripts $dir_root ${primary_branch}
|
||||
|
||||
if [[ $exit_status -eq 0 ]]; then
|
||||
@@ -276,11 +281,12 @@ update_qinglong() {
|
||||
update_qinglong_static() {
|
||||
local no_restart="$1"
|
||||
local primary_branch="$2"
|
||||
local url="https://github.com/whyour/qinglong-static.git"
|
||||
local url="https://${mirror}.com/whyour/qinglong-static.git"
|
||||
if [[ -d ${ql_static_repo}/.git ]]; then
|
||||
reset_romote_url ${ql_static_repo} ${url} ${primary_branch}
|
||||
git_pull_scripts ${ql_static_repo} ${primary_branch}
|
||||
else
|
||||
rm -rf ${ql_static_repo} &>/dev/null
|
||||
git_clone_scripts ${url} ${ql_static_repo} ${primary_branch}
|
||||
fi
|
||||
if [[ $exit_status -eq 0 ]]; then
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
}
|
||||
|
||||
.ant-modal-body {
|
||||
max-height: calc(85vh - 110px);
|
||||
max-height: calc(85vh - var(--vh-offset, 110px));
|
||||
max-height: calc(80vh - 110px);
|
||||
max-height: calc(80vh - var(--vh-offset, 110px));
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ interface TSystemInfo {
|
||||
branch: 'develop' | 'master';
|
||||
isInitialized: boolean;
|
||||
lastCommitId: string;
|
||||
lastCommitTime: string;
|
||||
lastCommitTime: number;
|
||||
version: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,10 @@
|
||||
|
||||
.crontab-detail {
|
||||
.card-wrapper {
|
||||
height: 80vh;
|
||||
height: calc(80vh - var(--vh-offset, 0px));
|
||||
|
||||
.ant-card:last-child {
|
||||
.ant-card-body {
|
||||
height: calc(80vh - 238px);
|
||||
height: calc(80vh - var(--vh-offset, 0px) - 238px);
|
||||
height: calc(80vh - 367px);
|
||||
height: calc(80vh - var(--vh-offset, 0px) - 367px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ const Crontab = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (viewConf && enabledCronViews && enabledCronViews.length > 0) {
|
||||
const view = enabledCronViews.slice(2).find((x) => x.id === viewConf.id);
|
||||
const view = enabledCronViews.slice(4).find((x) => x.id === viewConf.id);
|
||||
setMoreMenuActive(!!view);
|
||||
}
|
||||
}, [viewConf, enabledCronViews]);
|
||||
@@ -894,7 +894,7 @@ const Crontab = () => {
|
||||
viewAction(key);
|
||||
}}
|
||||
items={[
|
||||
...[...enabledCronViews].slice(2).map((x) => ({
|
||||
...[...enabledCronViews].slice(4).map((x) => ({
|
||||
label: (
|
||||
<Space style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span>{x.name}</span>
|
||||
@@ -990,11 +990,7 @@ const Crontab = () => {
|
||||
}
|
||||
onTabClick={tabClick}
|
||||
items={[
|
||||
{
|
||||
key: 'all',
|
||||
label: '全部任务',
|
||||
},
|
||||
...[...enabledCronViews].slice(0, 2).map((x) => ({
|
||||
...[...enabledCronViews].slice(0, 4).map((x) => ({
|
||||
key: x.id,
|
||||
label: x.name,
|
||||
})),
|
||||
|
||||
@@ -81,6 +81,16 @@ const ViewManageModal = ({
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
align: 'center' as const,
|
||||
render: (text) => (
|
||||
<div style={{ textAlign: 'left', paddingLeft: 30 }}>{text}</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
align: 'center' as const,
|
||||
render: (v) => (v === 1 ? '系统' : '个人'),
|
||||
},
|
||||
{
|
||||
title: '显示',
|
||||
@@ -100,10 +110,10 @@ const ViewManageModal = ({
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 140,
|
||||
width: 100,
|
||||
align: 'center' as const,
|
||||
render: (text: string, record: any, index: number) => {
|
||||
return (
|
||||
return record.type !== 1 ? (
|
||||
<Space size="middle">
|
||||
<a onClick={() => editView(record, index)}>
|
||||
<EditOutlined />
|
||||
@@ -112,6 +122,8 @@ const ViewManageModal = ({
|
||||
<DeleteOutlined />
|
||||
</a>
|
||||
</Space>
|
||||
) : (
|
||||
'-'
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -31,7 +31,9 @@ const About = ({ systemInfo }: { systemInfo: SharedContext['systemInfo'] }) => {
|
||||
{TVersion[systemInfo.branch]} v{systemInfo.version}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="更新时间" span={3}>
|
||||
{dayjs(systemInfo.lastCommitTime).format('YYYY-MM-DD HH:mm:ss')}
|
||||
{dayjs(systemInfo.lastCommitTime * 1000).format(
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
)}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="更新ID" span={3}>
|
||||
{systemInfo.lastCommitId}
|
||||
|
||||
@@ -31,7 +31,7 @@ import CheckUpdate from './checkUpdate';
|
||||
import About from './about';
|
||||
import { useOutletContext } from '@umijs/max';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import './index.less'
|
||||
import './index.less';
|
||||
|
||||
const { Text } = Typography;
|
||||
const optionsWithDisabled = [
|
||||
@@ -80,10 +80,15 @@ const Setting = () => {
|
||||
dataIndex: 'scopes',
|
||||
key: 'scopes',
|
||||
align: 'center' as const,
|
||||
width: '40%',
|
||||
render: (text: string, record: any) => {
|
||||
return record.scopes.map((scope: any) => {
|
||||
return <Tag key={scope}>{(config.scopesMap as any)[scope]}</Tag>;
|
||||
});
|
||||
return (
|
||||
<div style={{ textAlign: 'left' }}>
|
||||
{record.scopes.map((scope: any) => {
|
||||
return <Tag key={scope}>{(config.scopesMap as any)[scope]}</Tag>;
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -137,6 +137,10 @@ export default {
|
||||
tip: 'PushDeer的Key,https://github.com/easychen/pushdeer',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: 'pushDeerUrl',
|
||||
tip: 'PushDeer的自架API endpoint,默认是 https://api2.pushdeer.com/message/push',
|
||||
},
|
||||
],
|
||||
bark: [
|
||||
{
|
||||
|
||||
+7
-10
@@ -1,11 +1,8 @@
|
||||
export const version = '2.15.0';
|
||||
export const changeLogLink = 'https://t.me/jiao_long/340';
|
||||
export const changeLog = `2.15.0 版本说明
|
||||
1. 任务视图筛选条件支持 且/或
|
||||
2. 订阅支持设置代理
|
||||
3. 修改日志管理列表默认排序
|
||||
4. 修复openapi token生成逻辑
|
||||
5. 修复日志管理搜索失效
|
||||
6. 修复系统最后commit时间获取
|
||||
7. 其他优化
|
||||
export const version = '2.15.2';
|
||||
export const changeLogLink = 'https://t.me/jiao_long/353';
|
||||
export const changeLog = `2.15.2 版本说明
|
||||
1. 任务视图增加系统视图排序
|
||||
2. task 命令增加 -m 参数,支持设置任务超时时间,格式参考 CommandTimeoutTime。例如 task -m 1h xxx.js
|
||||
3. 修复资源占用检查逻辑
|
||||
4. 其他优化
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user