mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
删除无用代码
This commit is contained in:
parent
d630f34505
commit
3052b48f51
|
@ -34,7 +34,6 @@ export default (app: Router) => {
|
||||||
async (req: Request, res: Response, next: NextFunction) => {
|
async (req: Request, res: Response, next: NextFunction) => {
|
||||||
const logger: Logger = Container.get('logger');
|
const logger: Logger = Container.get('logger');
|
||||||
try {
|
try {
|
||||||
console.log(req.params.file);
|
|
||||||
const content = getFileContentByName(
|
const content = getFileContentByName(
|
||||||
`${config.scriptPath}${req.params.file}`,
|
`${config.scriptPath}${req.params.file}`,
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,13 +18,7 @@ const initData = [
|
||||||
name: '删除日志',
|
name: '删除日志',
|
||||||
command: 'ql rmlog 7',
|
command: 'ql rmlog 7',
|
||||||
schedule: '30 7 */7 * *',
|
schedule: '30 7 */7 * *',
|
||||||
status: CrontabStatus.idle,
|
status: CrontabStatus.disabled,
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '互助码',
|
|
||||||
command: 'ql code',
|
|
||||||
schedule: '30 7 * * *',
|
|
||||||
status: CrontabStatus.idle,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,6 @@ export default class EnvService {
|
||||||
{ status: { $ne: EnvStatus.disabled }, name: { $exists: true } },
|
{ status: { $ne: EnvStatus.disabled }, name: { $exists: true } },
|
||||||
);
|
);
|
||||||
const groups = _.groupBy(envs, 'name');
|
const groups = _.groupBy(envs, 'name');
|
||||||
console.log(groups);
|
|
||||||
let env_string = '';
|
let env_string = '';
|
||||||
for (const key in groups) {
|
for (const key in groups) {
|
||||||
if (Object.prototype.hasOwnProperty.call(groups, key)) {
|
if (Object.prototype.hasOwnProperty.call(groups, key)) {
|
||||||
|
|
1
sample/task.sample.sh
Normal file
1
sample/task.sample.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#!/usr/bin/env bash
|
|
@ -4,16 +4,20 @@
|
||||||
dir_shell=/ql/shell
|
dir_shell=/ql/shell
|
||||||
. $dir_shell/share.sh
|
. $dir_shell/share.sh
|
||||||
|
|
||||||
echo -e "1. 开始安装青龙依赖\n"
|
echo -e "1. 开始检测配置文件\n"
|
||||||
|
fix_config
|
||||||
|
echo -e "配置文件检测完成\n"
|
||||||
|
|
||||||
|
echo -e "2. 开始安装青龙依赖\n"
|
||||||
npm_install_2 $dir_root
|
npm_install_2 $dir_root
|
||||||
echo -e "青龙依赖安装完成\n"
|
echo -e "青龙依赖安装完成\n"
|
||||||
|
|
||||||
echo -e "2. 开始安装脚本依赖\n"
|
echo -e "3. 开始安装脚本依赖\n"
|
||||||
cp -f $dir_sample/package.json $dir_scripts/package.json
|
cp -f $dir_sample/package.json $dir_scripts/package.json
|
||||||
npm_install_2 $dir_scripts
|
npm_install_2 $dir_scripts
|
||||||
echo -e "脚本依赖安装完成\n"
|
echo -e "脚本依赖安装完成\n"
|
||||||
|
|
||||||
echo -e "3. 复制通知文件\n"
|
echo -e "4. 复制通知文件\n"
|
||||||
echo -e "复制一份 $file_notify_py_sample 为 $file_notify_py\n"
|
echo -e "复制一份 $file_notify_py_sample 为 $file_notify_py\n"
|
||||||
cp -fv $file_notify_py_sample $file_notify_py
|
cp -fv $file_notify_py_sample $file_notify_py
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -24,6 +24,9 @@ file_config_user=$dir_config/config.sh
|
||||||
file_auth_sample=$dir_sample/auth.sample.json
|
file_auth_sample=$dir_sample/auth.sample.json
|
||||||
file_auth_user=$dir_config/auth.json
|
file_auth_user=$dir_config/auth.json
|
||||||
file_extra_shell=$dir_config/extra.sh
|
file_extra_shell=$dir_config/extra.sh
|
||||||
|
file_task_before=$dir_config/task_before.sh
|
||||||
|
file_task_after=$dir_config/task_after.sh
|
||||||
|
file_task_sample=$dir_sample/task.sample.sh
|
||||||
file_extra_sample=$dir_sample/extra.sample.sh
|
file_extra_sample=$dir_sample/extra.sample.sh
|
||||||
file_notify_js_sample=$dir_sample/notify.js
|
file_notify_js_sample=$dir_sample/notify.js
|
||||||
file_notify_py_sample=$dir_sample/notify.py
|
file_notify_py_sample=$dir_sample/notify.py
|
||||||
|
@ -162,6 +165,18 @@ fix_config() {
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $file_task_before ]; then
|
||||||
|
echo -e "复制一份 $file_task_sample 为 $file_task_before\n"
|
||||||
|
cp -fv $file_task_sample $file_task_before
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $file_task_after ]; then
|
||||||
|
echo -e "复制一份 $file_task_sample 为 $file_task_after\n"
|
||||||
|
cp -fv $file_task_sample $file_task_after
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f $file_extra_shell ]; then
|
if [ ! -f $file_extra_shell ]; then
|
||||||
echo -e "复制一份 $file_extra_sample 为 $file_extra_shell\n"
|
echo -e "复制一份 $file_extra_sample 为 $file_extra_shell\n"
|
||||||
cp -fv $file_extra_sample $file_extra_shell
|
cp -fv $file_extra_sample $file_extra_shell
|
||||||
|
|
|
@ -50,9 +50,9 @@ usage() {
|
||||||
define_cmd
|
define_cmd
|
||||||
gen_array_scripts
|
gen_array_scripts
|
||||||
echo -e "task命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或去掉 “$dir_scripts/” 目录后的相对路径(定时任务中请写作相对路径),用法为:"
|
echo -e "task命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或去掉 “$dir_scripts/” 目录后的相对路径(定时任务中请写作相对路径),用法为:"
|
||||||
echo -e "1.$cmd_task <file_name> # 依次执行,如果设置了随机延迟,将随机延迟一定秒数"
|
echo -e "1.$cmd_task <file_name> # 依次执行,如果设置了随机延迟,将随机延迟一定秒数"
|
||||||
echo -e "2.$cmd_task <file_name> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
|
echo -e "2.$cmd_task <file_name> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
|
||||||
echo -e "3.$cmd_task <file_name> conc # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
|
echo -e "3.$cmd_task <file_name> conc <环境变量名> # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
|
||||||
if [[ ${#array_scripts[*]} -gt 0 ]]; then
|
if [[ ${#array_scripts[*]} -gt 0 ]]; then
|
||||||
echo -e "\n当前有以下脚本可以运行:"
|
echo -e "\n当前有以下脚本可以运行:"
|
||||||
for ((i = 0; i < ${#array_scripts[*]}; i++)); do
|
for ((i = 0; i < ${#array_scripts[*]}; i++)); do
|
||||||
|
@ -74,11 +74,8 @@ run_normal() {
|
||||||
local p1=$1
|
local p1=$1
|
||||||
cd $dir_scripts
|
cd $dir_scripts
|
||||||
define_program "$p1"
|
define_program "$p1"
|
||||||
|
. $file_task_before
|
||||||
if [[ $p1 == *.js ]]; then
|
if [[ $p1 == *.js ]]; then
|
||||||
if [[ $AutoHelpOther == true ]] && [[ $(ls $dir_code) ]]; then
|
|
||||||
local latest_log=$(ls -r $dir_code | head -1)
|
|
||||||
. $dir_code/$latest_log
|
|
||||||
fi
|
|
||||||
if [[ $# -eq 1 ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
random_delay
|
random_delay
|
||||||
fi
|
fi
|
||||||
|
@ -92,6 +89,7 @@ run_normal() {
|
||||||
local id=$(cat $list_crontab_user | grep -E "$cmd_task $p1$" | perl -pe "s|.*ID=(.*) $cmd_task $p1$|\1|" | xargs | sed 's/ /","/g')
|
local id=$(cat $list_crontab_user | grep -E "$cmd_task $p1$" | perl -pe "s|.*ID=(.*) $cmd_task $p1$|\1|" | xargs | sed 's/ /","/g')
|
||||||
update_cron_status "\"$id\"" "0"
|
update_cron_status "\"$id\"" "0"
|
||||||
timeout $command_timeout_time $which_program $p1 2>&1 | tee $log_path
|
timeout $command_timeout_time $which_program $p1 2>&1 | tee $log_path
|
||||||
|
. $file_task_after
|
||||||
update_cron_status "\"$id\"" "1"
|
update_cron_status "\"$id\"" "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,6 @@ usage() {
|
||||||
echo -e "3. $cmd_update raw <fileurl> # 更新单个脚本文件"
|
echo -e "3. $cmd_update raw <fileurl> # 更新单个脚本文件"
|
||||||
echo -e "4. $cmd_update repo <repourl> <path> <blacklist> <dependence> <branch> # 更新单个仓库的脚本"
|
echo -e "4. $cmd_update repo <repourl> <path> <blacklist> <dependence> <branch> # 更新单个仓库的脚本"
|
||||||
echo -e "5. $cmd_update rmlog <days> # 删除旧日志"
|
echo -e "5. $cmd_update rmlog <days> # 删除旧日志"
|
||||||
echo -e "6. $cmd_update code # 获取互助码"
|
|
||||||
echo -e "6. $cmd_update bot # 启动tg-bot"
|
echo -e "6. $cmd_update bot # 启动tg-bot"
|
||||||
echo -e "7. $cmd_update reset # 重置青龙基础环境"
|
echo -e "7. $cmd_update reset # 重置青龙基础环境"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ export function render(oldRender: any) {
|
||||||
oldRender();
|
oldRender();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log(e);
|
|
||||||
if (e.response && e.response.status === 401) {
|
if (e.response && e.response.status === 401) {
|
||||||
localStorage.removeItem(config.authKey);
|
localStorage.removeItem(config.authKey);
|
||||||
history.push('/login');
|
history.push('/login');
|
||||||
|
|
2
src/pages/env/editNameModal.tsx
vendored
2
src/pages/env/editNameModal.tsx
vendored
|
@ -16,8 +16,6 @@ const EditNameModal = ({
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const handleOk = async (values: any) => {
|
const handleOk = async (values: any) => {
|
||||||
console.log(values);
|
|
||||||
console.log(ids);
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { code, data } = await request.put(`${config.apiPrefix}envs/name`, {
|
const { code, data } = await request.put(`${config.apiPrefix}envs/name`, {
|
||||||
data: {
|
data: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user