mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 14:56:07 +08:00
添加重置ql reset命令,支持批量操作ck
This commit is contained in:
parent
64aadb7eb8
commit
9e666f4348
16
shell/reset.sh
Normal file
16
shell/reset.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# 导入通用变量与函数
|
||||
dir_shell=/ql/shell
|
||||
. $dir_shell/share.sh
|
||||
|
||||
echo -e "1. 开始安装青龙依赖\n"
|
||||
npm_install_2 $dir_root
|
||||
echo -e "青龙依赖安装完成\n"
|
||||
|
||||
echo -e "2. 开始安装脚本依赖\n"
|
||||
cp -f $dir_sample/package.json $dir_scripts/package.json
|
||||
npm_install_2 $dir_scripts
|
||||
echo -e "脚本依赖安装完成\n"
|
||||
|
||||
exit 0
|
|
@ -56,7 +56,7 @@ import_config() {
|
|||
user_sum=0
|
||||
for line in $(cat $file_cookie); do
|
||||
let user_sum+=1
|
||||
eval Cookie${user_sum}="\"$line\""
|
||||
eval Cookie${user_sum}="\"${line}\""
|
||||
done
|
||||
|
||||
command_timeout_time=${CommandTimeoutTime:-"1h"}
|
||||
|
@ -247,8 +247,10 @@ diff_and_copy() {
|
|||
update_depend() {
|
||||
local dir_current=$(pwd)
|
||||
|
||||
cp -f $dir_sample/package.json $dir_scripts/package.json
|
||||
npm_install_2 $dir_scripts
|
||||
if [ ! -s $dir_scripts/package.json ] || [[ $(diff $dir_sample/package.json $dir_scripts/package.json) ]]; then
|
||||
cp -f $dir_sample/package.json $dir_scripts/package.json
|
||||
npm_install_2 $dir_scripts
|
||||
fi
|
||||
|
||||
if [ ! -s $dir_scripts/requirements.txt ] || [[ $(diff $dir_sample/requirements.txt $dir_scripts/requirements.txt) ]]; then
|
||||
cp -f $dir_sample/requirements.txt $dir_scripts/requirements.txt
|
||||
|
|
|
@ -242,11 +242,13 @@ usage() {
|
|||
echo -e "5. $cmd_update rmlog <days> # 删除旧日志"
|
||||
echo -e "6. $cmd_update code # 获取互助码"
|
||||
echo -e "6. $cmd_update bot # 启动tg-bot"
|
||||
echo -e "7. $cmd_update reset # 重置青龙基础环境"
|
||||
}
|
||||
|
||||
## 更新qinglong
|
||||
update_qinglong() {
|
||||
echo -e "--------------------------------------------------------------\n"
|
||||
[ -f $dir_root/package.json ] && ql_depend_old=$(cat $dir_root/package.json)
|
||||
reset_romote_url ${dir_root} "${github_proxy_url}https://github.com/whyour/qinglong.git"
|
||||
git_pull_scripts $dir_root
|
||||
|
||||
|
@ -256,7 +258,8 @@ update_qinglong() {
|
|||
detect_config_version
|
||||
update_depend
|
||||
|
||||
npm_install_2 $dir_root
|
||||
[ -f $dir_root/package.json ] && ql_depend_new=$(cat $dir_root/package.json)
|
||||
[[ "$ql_depend_old" != "$ql_depend_new" ]] && npm_install_2 $dir_root
|
||||
else
|
||||
echo -e "\n更新$dir_root失败,请检查原因...\n"
|
||||
fi
|
||||
|
@ -417,6 +420,9 @@ main() {
|
|||
bot)
|
||||
. $dir_shell/bot.sh
|
||||
;;
|
||||
reset)
|
||||
. $dir_shell/reset.sh
|
||||
;;
|
||||
*)
|
||||
echo -e "命令输入错误...\n"
|
||||
usage
|
||||
|
|
|
@ -6,7 +6,7 @@ import { Controlled as CodeMirror } from 'react-codemirror2';
|
|||
import { request } from '@/utils/http';
|
||||
|
||||
const Config = () => {
|
||||
const [width, setWdith] = useState('100%');
|
||||
const [width, setWidth] = useState('100%');
|
||||
const [marginLeft, setMarginLeft] = useState(0);
|
||||
const [marginTop, setMarginTop] = useState(-72);
|
||||
const [value, setValue] = useState('');
|
||||
|
@ -34,11 +34,11 @@ const Config = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (document.body.clientWidth < 768) {
|
||||
setWdith('auto');
|
||||
setWidth('auto');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(0);
|
||||
} else {
|
||||
setWdith('100%');
|
||||
setWidth('100%');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(-72);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,16 @@ enum StatusColor {
|
|||
'error',
|
||||
}
|
||||
|
||||
enum OperationName {
|
||||
'启用',
|
||||
'禁用',
|
||||
}
|
||||
|
||||
enum OperationPath {
|
||||
'enable',
|
||||
'disable',
|
||||
}
|
||||
|
||||
const type = 'DragableBodyRow';
|
||||
|
||||
const DragableBodyRow = ({
|
||||
|
@ -105,17 +115,6 @@ const Config = () => {
|
|||
return <span style={{ cursor: 'text' }}>{index + 1} </span>;
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '用户名',
|
||||
// dataIndex: 'pin',
|
||||
// key: 'pin',
|
||||
// align: 'center' as const,
|
||||
// render: (text: string, record: any) => {
|
||||
// const match = record.value.match(/pt_pin=([^; ]+)(?=;?)/);
|
||||
// const val = (match && match[1]) || '未匹配用户名';
|
||||
// return <span style={{ cursor: 'text' }}>{decodeUrl(val)}</span>;
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '昵称',
|
||||
dataIndex: 'nickname',
|
||||
|
@ -123,8 +122,10 @@ const Config = () => {
|
|||
align: 'center' as const,
|
||||
width: '15%',
|
||||
render: (text: string, record: any, index: number) => {
|
||||
const match = record.value.match(/pt_pin=([^; ]+)(?=;?)/);
|
||||
const val = (match && match[1]) || '未匹配用户名';
|
||||
return (
|
||||
<span style={{ cursor: 'text' }}>{record.nickname || '-'} </span>
|
||||
<span style={{ cursor: 'text' }}>{record.nickname || val} </span>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
@ -204,13 +205,14 @@ const Config = () => {
|
|||
),
|
||||
},
|
||||
];
|
||||
const [width, setWdith] = useState('100%');
|
||||
const [width, setWidth] = useState('100%');
|
||||
const [marginLeft, setMarginLeft] = useState(0);
|
||||
const [marginTop, setMarginTop] = useState(-72);
|
||||
const [value, setValue] = useState<any[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [isModalVisible, setIsModalVisible] = useState(false);
|
||||
const [editedCookie, setEditedCookie] = useState();
|
||||
const [selectedRowIds, setSelectedRowIds] = useState<string[]>([]);
|
||||
|
||||
const getCookies = () => {
|
||||
setLoading(true);
|
||||
|
@ -376,13 +378,68 @@ const Config = () => {
|
|||
[value],
|
||||
);
|
||||
|
||||
const onSelectChange = (selectedIds: any[]) => {
|
||||
setSelectedRowIds(selectedIds);
|
||||
};
|
||||
|
||||
const rowSelection = {
|
||||
selectedRowIds,
|
||||
onChange: onSelectChange,
|
||||
};
|
||||
|
||||
const delCookies = () => {
|
||||
Modal.confirm({
|
||||
title: '确认删除',
|
||||
content: <>确认删除选中的Cookie吗</>,
|
||||
onOk() {
|
||||
request
|
||||
.delete(`${config.apiPrefix}cookies`, { data: selectedRowIds })
|
||||
.then((data: any) => {
|
||||
if (data.code === 200) {
|
||||
message.success('批量删除成功');
|
||||
setSelectedRowIds([]);
|
||||
getCookies();
|
||||
} else {
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel');
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const operateCookies = (operationStatus: number) => {
|
||||
Modal.confirm({
|
||||
title: `确认${OperationName[operationStatus]}`,
|
||||
content: <>确认{OperationName[operationStatus]}选中的Cookie吗</>,
|
||||
onOk() {
|
||||
request
|
||||
.put(`${config.apiPrefix}cookies/${OperationPath[operationStatus]}`, {
|
||||
data: selectedRowIds,
|
||||
})
|
||||
.then((data: any) => {
|
||||
if (data.code === 200) {
|
||||
getCookies();
|
||||
} else {
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel');
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (document.body.clientWidth < 768) {
|
||||
setWdith('auto');
|
||||
setWidth('auto');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(0);
|
||||
} else {
|
||||
setWdith('100%');
|
||||
setWidth('100%');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(-72);
|
||||
}
|
||||
|
@ -411,12 +468,42 @@ const Config = () => {
|
|||
},
|
||||
}}
|
||||
>
|
||||
{selectedRowIds.length > 0 && (
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginBottom: 5 }}
|
||||
onClick={delCookies}
|
||||
>
|
||||
批量删除
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCookies(0)}
|
||||
style={{ marginLeft: 8, marginBottom: 5 }}
|
||||
>
|
||||
批量启用
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCookies(1)}
|
||||
style={{ marginLeft: 8, marginRight: 8 }}
|
||||
>
|
||||
批量禁用
|
||||
</Button>
|
||||
<span style={{ marginLeft: 8 }}>
|
||||
已选择
|
||||
<a>{selectedRowIds?.length}</a>项
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
<DndProvider backend={HTML5Backend}>
|
||||
<Table
|
||||
columns={columns}
|
||||
rowSelection={rowSelection}
|
||||
pagination={false}
|
||||
dataSource={value}
|
||||
rowKey="value"
|
||||
rowKey="_id"
|
||||
size="middle"
|
||||
scroll={{ x: 768 }}
|
||||
components={components}
|
||||
|
|
|
@ -176,7 +176,7 @@ const Crontab = () => {
|
|||
},
|
||||
];
|
||||
|
||||
const [width, setWdith] = useState('100%');
|
||||
const [width, setWidth] = useState('100%');
|
||||
const [marginLeft, setMarginLeft] = useState(0);
|
||||
const [marginTop, setMarginTop] = useState(-72);
|
||||
const [value, setValue] = useState<any[]>([]);
|
||||
|
@ -524,11 +524,11 @@ const Crontab = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (document.body.clientWidth < 768) {
|
||||
setWdith('auto');
|
||||
setWidth('auto');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(0);
|
||||
} else {
|
||||
setWdith('100%');
|
||||
setWidth('100%');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(-72);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ const CronLogModal = ({
|
|||
const [value, setValue] = useState<string>('启动中...');
|
||||
const [loading, setLoading] = useState<any>(true);
|
||||
const [excuting, setExcuting] = useState<any>(true);
|
||||
const [isPhone, setIsPhone] = useState(false);
|
||||
|
||||
const getCronLog = (isFirst?: boolean) => {
|
||||
if (isFirst) {
|
||||
|
@ -86,6 +87,10 @@ const CronLogModal = ({
|
|||
}
|
||||
}, [cron]);
|
||||
|
||||
useEffect(() => {
|
||||
setIsPhone(document.body.clientWidth < 768);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={titleElement()}
|
||||
|
@ -100,7 +105,18 @@ const CronLogModal = ({
|
|||
onCancel={() => cancel()}
|
||||
>
|
||||
{!loading && value && (
|
||||
<pre style={{ whiteSpace: 'break-spaces', lineHeight: '17px' }}>
|
||||
<pre
|
||||
style={
|
||||
!isPhone
|
||||
? { whiteSpace: 'break-spaces', lineHeight: '17px' }
|
||||
: {
|
||||
whiteSpace: 'break-spaces',
|
||||
lineHeight: '17px',
|
||||
width: 375,
|
||||
zoom: 0.88,
|
||||
}
|
||||
}
|
||||
>
|
||||
{value}
|
||||
</pre>
|
||||
)}
|
||||
|
|
|
@ -7,7 +7,7 @@ import ReactDiffViewer from 'react-diff-viewer';
|
|||
import './index.less';
|
||||
|
||||
const Crontab = () => {
|
||||
const [width, setWdith] = useState('100%');
|
||||
const [width, setWidth] = useState('100%');
|
||||
const [marginLeft, setMarginLeft] = useState(0);
|
||||
const [marginTop, setMarginTop] = useState(-72);
|
||||
const [value, setValue] = useState('');
|
||||
|
@ -32,11 +32,11 @@ const Crontab = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (document.body.clientWidth < 768) {
|
||||
setWdith('auto');
|
||||
setWidth('auto');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(0);
|
||||
} else {
|
||||
setWdith('100%');
|
||||
setWidth('100%');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(-72);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import { Controlled as CodeMirror } from 'react-codemirror2';
|
|||
import { request } from '@/utils/http';
|
||||
|
||||
const Crontab = () => {
|
||||
const [width, setWdith] = useState('100%');
|
||||
const [width, setWidth] = useState('100%');
|
||||
const [marginLeft, setMarginLeft] = useState(0);
|
||||
const [marginTop, setMarginTop] = useState(-72);
|
||||
const [value, setValue] = useState('');
|
||||
|
@ -34,11 +34,11 @@ const Crontab = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (document.body.clientWidth < 768) {
|
||||
setWdith('auto');
|
||||
setWidth('auto');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(0);
|
||||
} else {
|
||||
setWdith('100%');
|
||||
setWidth('100%');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(-72);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ function getFilterData(keyword: string, data: any) {
|
|||
}
|
||||
|
||||
const Log = () => {
|
||||
const [width, setWdith] = useState('100%');
|
||||
const [width, setWidth] = useState('100%');
|
||||
const [marginLeft, setMarginLeft] = useState(0);
|
||||
const [marginTop, setMarginTop] = useState(-72);
|
||||
const [title, setTitle] = useState('请选择日志文件');
|
||||
|
@ -103,12 +103,12 @@ const Log = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (document.body.clientWidth < 768) {
|
||||
setWdith('auto');
|
||||
setWidth('auto');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(0);
|
||||
setIsPhone(true);
|
||||
} else {
|
||||
setWdith('100%');
|
||||
setWidth('100%');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(-72);
|
||||
setIsPhone(false);
|
||||
|
|
|
@ -18,7 +18,7 @@ const optionsWithDisabled = [
|
|||
];
|
||||
|
||||
const Password = () => {
|
||||
const [width, setWdith] = useState('100%');
|
||||
const [width, setWidth] = useState('100%');
|
||||
const [marginLeft, setMarginLeft] = useState(0);
|
||||
const [marginTop, setMarginTop] = useState(-72);
|
||||
const [value, setValue] = useState('');
|
||||
|
@ -56,11 +56,11 @@ const Password = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (document.body.clientWidth < 768) {
|
||||
setWdith('auto');
|
||||
setWidth('auto');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(0);
|
||||
} else {
|
||||
setWdith('100%');
|
||||
setWidth('100%');
|
||||
setMarginLeft(0);
|
||||
setMarginTop(-72);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user