diy支持任意仓库地址,修复添加ck报错,移除monk仓库内置

This commit is contained in:
whyour 2021-04-16 17:30:22 +08:00
parent 5de67b9679
commit 0563555a6a
7 changed files with 54 additions and 66 deletions

View File

@ -16,23 +16,17 @@ const initData = [
status: CrontabStatus.idle, status: CrontabStatus.idle,
}, },
{ {
name: '自定义仓库', name: 'build面板',
command: `sleep ${randomSchedule( command: 'rebuild >> ${QL_DIR}/log/rebuild.log 2>&1',
60, schedule: '30 7 */7 * *',
1, status: CrontabStatus.disabled,
)} && diy whyour hundun "quanx/jx|quanx/jd" tokens >> $QL_DIR/log/diy_pull.log 2>&1`,
schedule: `${randomSchedule(60, 1)} ${randomSchedule(
24,
6,
).toString()} * * *`,
status: CrontabStatus.idle,
}, },
{ {
name: '自定义仓库', name: '自定义仓库',
command: `sleep ${randomSchedule( command: `sleep ${randomSchedule(
60, 60,
1, 1,
)} && diy monk-coder dust "i-chenzhe|normal" >> $QL_DIR/log/diy_pull.log 2>&1`, )} && diy whyour hundun "quanx/jx|quanx/jd" tokens >> $QL_DIR/log/diy_pull.log 2>&1`,
schedule: `${randomSchedule(60, 1)} ${randomSchedule( schedule: `${randomSchedule(60, 1)} ${randomSchedule(
24, 24,
6, 6,
@ -45,12 +39,6 @@ const initData = [
schedule: '48 5 * * *', schedule: '48 5 * * *',
status: CrontabStatus.idle, status: CrontabStatus.idle,
}, },
{
name: 'build面板',
command: 'rebuild >> ${QL_DIR}/log/rebuild.log 2>&1',
schedule: '30 7 */7 * *',
status: CrontabStatus.disabled,
},
{ {
name: '删除日志', name: '删除日志',
command: 'rm_log >/dev/null 2>&1', command: 'rm_log >/dev/null 2>&1',
@ -63,6 +51,12 @@ const initData = [
schedule: '33 6 */7 * *', schedule: '33 6 */7 * *',
status: CrontabStatus.disabled, status: CrontabStatus.disabled,
}, },
{
name: '启动挂机程序',
command: 'js hangup',
schedule: '33 6 */7 * *',
status: CrontabStatus.disabled,
},
{ {
name: '运行所有脚本(慎用)', name: '运行所有脚本(慎用)',
command: 'js runall', command: 'js runall',

View File

@ -2,7 +2,6 @@ FROM node:lts-alpine
LABEL maintainer="whyour" LABEL maintainer="whyour"
ARG QL_BASE_URL=https://github.com.cnpmjs.org/whyour/qinglong ARG QL_BASE_URL=https://github.com.cnpmjs.org/whyour/qinglong
ARG QL_BASE_BRANCH=master ARG QL_BASE_BRANCH=master
ARG SSH_PRIVATE_KEY
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
LANG=zh_CN.UTF-8 \ LANG=zh_CN.UTF-8 \
SHELL=/bin/bash \ SHELL=/bin/bash \
@ -23,15 +22,9 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
nginx \ nginx \
python3 \ python3 \
jq \ jq \
openssh \
&& rm -rf /var/cache/apk/* \ && rm -rf /var/cache/apk/* \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \ && echo "Asia/Shanghai" > /etc/timezone \
&& mkdir -p /root/.ssh \
&& chmod 700 /root/.ssh \
&& echo -e $SSH_PRIVATE_KEY > /root/.ssh/id_rsa \
&& chmod 600 /root/.ssh/id_rsa \
&& ssh-keyscan github.com > /root/.ssh/known_hosts \
&& touch ~/.bashrc \ && touch ~/.bashrc \
&& mkdir /run/nginx \ && mkdir /run/nginx \
&& git clone -b ${QL_BASE_BRANCH} ${QL_BASE_URL} ${QL_DIR} \ && git clone -b ${QL_BASE_BRANCH} ${QL_BASE_URL} ${QL_DIR} \

View File

@ -49,23 +49,10 @@ echo -e "======================3. 启动控制面板========================\n"
pm2 start ${QL_DIR}/build/app.js -n panel pm2 start ${QL_DIR}/build/app.js -n panel
echo -e "控制面板启动成功...\n" echo -e "控制面板启动成功...\n"
echo -e "======================4. 启动挂机程序========================\n"
CookieConf=${QL_DIR}/config/cookie.sh
. ${QL_DIR}/config/config.sh
. ${CookieConf}
if [[ ${ENABLE_HANGUP} == true ]]; then
if [ -s ${CookieConf} ]; then
js hangup 2>/dev/null
echo -e "挂机程序启动成功...\n"
else
echo -e "尚未在Cookie管理中添加一条Cookie可能是首次部署容器因此不启动挂机程序...\n"
fi
else
echo -e "默认不自动启动挂机程序,跳过...\n"
fi
echo -e "\n容器启动成功...\n" echo -e "\n容器启动成功...\n"
echo -e "\n请先访问5700端口登录面板成功之后手动执行一次git_pull命令...\n" echo -e "\n请先访问5700端口登录面板成功之后先手动执行一次git_pull命令...\n"
echo -e "\n如果需要启动挂机程序手动执行docker exec -it qinglong js hangup...\n"
echo -e "\n或者去cron管理搜索hangup手动执行挂机任务...\n"
if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
set -- node "$@" set -- node "$@"

View File

@ -11,8 +11,7 @@ ListCronCurrent=$ConfigDir/crontab.list
AuthConf=$ConfigDir/auth.json AuthConf=$ConfigDir/auth.json
declare -A BlackListDict declare -A BlackListDict
author=$1 url=$1
repo=$2
path=$3 path=$3
blackword=$4 blackword=$4
@ -31,11 +30,11 @@ diyscriptsdir=/ql/diyscripts
mkdir -p ${diyscriptsdir} mkdir -p ${diyscriptsdir}
if [ ! -d "$diyscriptsdir/${author}_${repo}" ]; then if [ ! -d "$diyscriptsdir/${author}_${repo}" ]; then
echo -e "${author}本地仓库不存在,从gayhub拉取ing..." echo -e "${author}本地仓库不存在,从远程拉取ing..."
url="https://ghproxy.com/https://github.com/${author}/${repo}" repoTmp=${url##*/}
if [ $author == "monk-coder" ] && [ $repo == "dust" ]; then repo=${repoTmpName%.*}
url="git@github.com:monk-coder/dust.git" tmp=${url%/*}
fi author=${tmp##*/}
cd ${diyscriptsdir} && git clone $url ${author}_${repo} cd ${diyscriptsdir} && git clone $url ${author}_${repo}
gitpullstatus=$? gitpullstatus=$?
[ $gitpullstatus -eq 0 ] && echo -e "${author}本地仓库拉取完毕" [ $gitpullstatus -eq 0 ] && echo -e "${author}本地仓库拉取完毕"

View File

@ -12,6 +12,7 @@ echo -e "重新build...\n"
yarn install --network-timeout 1000000000 || yarn install --registry=https://registry.npm.taobao.org --network-timeout 1000000000 yarn install --network-timeout 1000000000 || yarn install --registry=https://registry.npm.taobao.org --network-timeout 1000000000
yarn build yarn build
yarn build-back yarn build-back
yarn cache clean
echo -e "重新build完成...\n" echo -e "重新build完成...\n"
echo -e "重启服务...\n" echo -e "重启服务...\n"

View File

@ -23,6 +23,12 @@ body {
} }
} }
.cookie-wrapper {
th {
white-space: nowrap;
}
}
@media (max-width: 768px) { @media (max-width: 768px) {
.ant-pro-grid-content.wide { .ant-pro-grid-content.wide {
.ant-pro-page-container-children-content { .ant-pro-page-container-children-content {

View File

@ -220,14 +220,19 @@ const Config = () => {
.get(`${config.apiPrefix}cookies`) .get(`${config.apiPrefix}cookies`)
.then((data: any) => { .then((data: any) => {
setValue(data.data); setValue(data.data);
asyncUpdateStatus(data.data);
}) })
.finally(() => setLoading(false)); .finally(() => setLoading(false));
}; };
const asyncUpdateStatus = async (data: any[]) => { useEffect(() => {
for (let i = 0; i < data.length; i++) { if (value && loading) {
const cookie = data[i]; asyncUpdateStatus();
}
}, [value]);
const asyncUpdateStatus = async () => {
for (let i = 0; i < value.length; i++) {
const cookie = value[i];
await sleep(1000); await sleep(1000);
refreshStatus(cookie, i); refreshStatus(cookie, i);
} }
@ -347,25 +352,28 @@ const Config = () => {
}); });
}; };
const handleCancel = (cookie: any) => { const handleCancel = (cookies: any[]) => {
setIsModalVisible(false); setIsModalVisible(false);
if (cookie) { if (cookies && cookies.length > 0) {
handleCookies(cookie); handleCookies(cookies);
} }
}; };
const handleCookies = (cookie: any) => { const handleCookies = (cookies: any[]) => {
const index = value.findIndex((x) => x._id === cookie._id); for (let i = 0; i < cookies.length; i++) {
const result = [...value]; const cookie = cookies[i];
if (index === -1) { const index = value.findIndex((x) => x._id === cookie._id);
result.push(...cookie); const result = [...value];
} else { if (index === -1) {
result.splice(index, 1, { result.push(cookie);
...cookie, } else {
}); result.splice(index, 1, {
...cookie,
});
}
setValue(result);
refreshStatus(cookie, index);
} }
refreshStatus(cookie, index);
setValue(result);
}; };
const components = { const components = {
@ -414,7 +422,7 @@ const Config = () => {
return ( return (
<PageContainer <PageContainer
className="code-mirror-wrapper" className="cookie-wrapper"
title="Cookie管理" title="Cookie管理"
loading={loading} loading={loading}
extra={[ extra={[