From a8d1d71e8414f109124e9a011d07060fc23eef0c Mon Sep 17 00:00:00 2001 From: hanhh Date: Thu, 3 Jun 2021 23:10:22 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ghproxy=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E9=95=9C=E5=83=8F=E6=B7=BB=E5=8A=A0wget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Dockerfile | 3 ++- sample/config.sample.sh | 5 ++++- shell/share.sh | 1 + shell/update.sh | 21 ++++++++++++--------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6bc8a2e4..599379c2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ FROM node:lts-alpine LABEL maintainer="whyour" -ARG QL_URL=https://ghproxy.com/https://github.com/whyour/qinglong.git +ARG QL_URL=https://github.com/whyour/qinglong.git ARG QL_BRANCH=master ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ LANG=zh_CN.UTF-8 \ @@ -16,6 +16,7 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories moreutils \ git \ curl \ + wget \ tzdata \ perl \ openssl \ diff --git a/sample/config.sample.sh b/sample/config.sample.sh index 354b14fb..9c040605 100644 --- a/sample/config.sample.sh +++ b/sample/config.sample.sh @@ -1,6 +1,6 @@ ## Version: v2.0.0-05302045 ## Date: 2021-05-30 -## Update Content: 增加ql bot命令所需文件提示 +## Update Content: 增加GithubProxyUrl参数,访问github链接不需要代理时,可移除此参数 ## 上面版本号中,如果第2位数字有变化,那么代表增加了新的参数,如果只有第3位数字有变化,仅代表更新了注释,没有增加新的参数,可更新可不更新 @@ -10,6 +10,9 @@ AutoDelCron="true" ## 在运行 ql repo 命令时,是否自动增加新的本地定时任务 AutoAddCron="true" +## 由于github仓库拉取较慢,所以会默认添加代理前缀,如不需要请移除 +GithubProxyUrl="https://ghproxy.com/" + ## 设置定时任务执行的超时时间,默认1h,后缀"s"代表秒(默认值), "m"代表分, "h"代表小时, "d"代表天 CommandTimeoutTime="1h" diff --git a/shell/share.sh b/shell/share.sh index aaeaec99..9df6d354 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -60,6 +60,7 @@ import_config() { done command_timeout_time=${CommandTimeoutTime:-"1h"} + github_proxy_url=${GithubProxyUrl:-""} } ## 创建目录,$1:目录的绝对路径 diff --git a/shell/update.sh b/shell/update.sh index 830a5cce..d3362409 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -125,12 +125,13 @@ add_cron() { if [ -f $file ]; then cron_line=$( perl -ne "{ - print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*$file_name/ - }" $file | + print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*/ + }" $file | perl -pe "{ - s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*/?$file_name.*|\1|g; - s| | |g - }" | sort -u | head -1 + s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*|\1|g; + s|\*([\d\*])(.*)|\1\2|g; + s| | |g; + }" | sort -u | head -1 ) cron_name=$(grep "new Env" $file | awk -F "'|\"" '{print $2}' | head -1) [[ -z $cron_name ]] && cron_name="$file_name" @@ -193,11 +194,12 @@ update_raw() { cp -f $raw_file_name $dir_scripts/${filename} cron_line=$( perl -ne "{ - print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*$raw_file_name/ + print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*/ }" $raw_file_name | perl -pe "{ - s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*/?$raw_file_name.*|\1|g; - s| | |g + s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*|\1|g; + s|\*([\d\*])(.*)|\1\2|g; + s| | |g; }" | sort -u | head -1 ) cron_name=$(grep "new Env" $raw_file_name | awk -F "'|\"" '{print $2}' | head -1) @@ -244,6 +246,7 @@ usage() { 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 if [[ $exit_status -eq 0 ]]; then @@ -258,7 +261,7 @@ update_qinglong() { echo -e "\n更新$dir_root失败,请检查原因...\n" fi - local url="https://ghproxy.com/https://github.com/whyour/qinglong-static.git" + local url="${github_proxy_url}https://github.com/whyour/qinglong-static.git" if [ -d ${ql_static_repo}/.git ]; then reset_romote_url ${ql_static_repo} ${url} cd ${ql_static_repo} From 55c63ff9c51be0c77b761f270c935f062ea70a9b Mon Sep 17 00:00:00 2001 From: hanhh Date: Thu, 3 Jun 2021 23:28:36 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8Denv=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/update.sh b/shell/update.sh index d3362409..bdf636c2 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -96,7 +96,7 @@ del_cron() { fi cron_file="$dir_scripts/${cron}" if [[ -f $cron_file ]]; then - cron_name=$(grep "new Env" $cron_file | awk -F "'|\"" '{print $2}' | head -1) + cron_name=$(grep "new Env" $raw_file_name | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1) rm -f $cron_file fi [[ -z $cron_name ]] && cron_name="$cron" @@ -133,7 +133,7 @@ add_cron() { s| | |g; }" | sort -u | head -1 ) - cron_name=$(grep "new Env" $file | awk -F "'|\"" '{print $2}' | head -1) + cron_name=$(grep "new Env" $raw_file_name | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1) [[ -z $cron_name ]] && cron_name="$file_name" [[ -z $cron_line ]] && cron_line="0 6 * * *" result=$(add_cron_api "$cron_line:$cmd_task $file:$cron_name") @@ -202,7 +202,7 @@ update_raw() { s| | |g; }" | sort -u | head -1 ) - cron_name=$(grep "new Env" $raw_file_name | awk -F "'|\"" '{print $2}' | head -1) + cron_name=$(grep "new Env" $raw_file_name | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1) [[ -z $cron_name ]] && cron_name="$raw_file_name" [[ -z $cron_line ]] && cron_line="0 6 * * *" if [[ -z $cron_id ]]; then From c8769dcf9efff260dc94fa1696d7de89070e809f Mon Sep 17 00:00:00 2001 From: hanhh Date: Thu, 3 Jun 2021 23:41:40 +0800 Subject: [PATCH 3/8] =?UTF-8?q?github=E4=BB=93=E5=BA=93=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/test.sh | 3 +++ shell/update.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 shell/test.sh diff --git a/shell/test.sh b/shell/test.sh new file mode 100644 index 00000000..817ae298 --- /dev/null +++ b/shell/test.sh @@ -0,0 +1,3 @@ +url="https://ghproxy.com/https://github.com/zooPanda/zoo.git" +github_proxy_url="https://ghproxy.com/" +echo "${github_proxy_url}${url/https:\/\/ghproxy.com\//}" \ No newline at end of file diff --git a/shell/update.sh b/shell/update.sh index bdf636c2..e6fc219c 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -165,7 +165,7 @@ update_repo() { local repo_path="${dir_repo}/${author}_${repo}" if [ -d ${repo_path}/.git ]; then - reset_romote_url ${repo_path} ${url} + reset_romote_url ${repo_path} "${github_proxy_url}${url/https:\/\/ghproxy.com\//}" git_pull_scripts ${repo_path} else git_clone_scripts ${url} ${repo_path} From b40d3814315dc410cf591b1cde5e3601b29d3be6 Mon Sep 17 00:00:00 2001 From: hanhh Date: Fri, 4 Jun 2021 00:02:12 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcron=20name=E5=8C=B9?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/update.sh b/shell/update.sh index e6fc219c..ccc51c9b 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -96,7 +96,7 @@ del_cron() { fi cron_file="$dir_scripts/${cron}" if [[ -f $cron_file ]]; then - cron_name=$(grep "new Env" $raw_file_name | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1) + cron_name=$(grep "new Env" $cron_file | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1) rm -f $cron_file fi [[ -z $cron_name ]] && cron_name="$cron" @@ -133,7 +133,7 @@ add_cron() { s| | |g; }" | sort -u | head -1 ) - cron_name=$(grep "new Env" $raw_file_name | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1) + cron_name=$(grep "new Env" $file | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1) [[ -z $cron_name ]] && cron_name="$file_name" [[ -z $cron_line ]] && cron_line="0 6 * * *" result=$(add_cron_api "$cron_line:$cmd_task $file:$cron_name") From 5874d52f5393ac5630a1ff7c3553ea68befc7936 Mon Sep 17 00:00:00 2001 From: hanhh Date: Fri, 4 Jun 2021 19:14:56 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcron=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shell/update.sh b/shell/update.sh index ccc51c9b..344c5688 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -125,13 +125,13 @@ add_cron() { if [ -f $file ]; then cron_line=$( perl -ne "{ - print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*/ - }" $file | + print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*$file_name/ + }" $file | perl -pe "{ - s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*|\1|g; - s|\*([\d\*])(.*)|\1\2|g; - s| | |g; - }" | sort -u | head -1 + s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*/?$file_name.*|\1|g; + s|\*([\d\*])(.*)|\1\2|g; + s| | |g; + }" | sort -u | head -1 ) cron_name=$(grep "new Env" $file | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1) [[ -z $cron_name ]] && cron_name="$file_name" @@ -194,10 +194,10 @@ update_raw() { cp -f $raw_file_name $dir_scripts/${filename} cron_line=$( perl -ne "{ - print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*/ + print if /.*([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*]( |,|\").*$raw_file_name/ }" $raw_file_name | perl -pe "{ - s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*|\1|g; + s|[^\d\*]*(([\d\*]*[\*-\/,\d]*[\d\*] ){4,5}[\d\*]*[\*-\/,\d]*[\d\*])( \|,\|\").*/?$raw_file_name.*|\1|g; s|\*([\d\*])(.*)|\1\2|g; s| | |g; }" | sort -u | head -1 From ece1ca84e2dbbedd1e2d37f1cf03c9b9e6e78570 Mon Sep 17 00:00:00 2001 From: hanhh Date: Fri, 4 Jun 2021 20:49:10 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcron=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/update.sh b/shell/update.sh index 344c5688..5eba4e96 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -135,6 +135,7 @@ add_cron() { ) cron_name=$(grep "new Env" $file | awk -F "\(" '{print $2}' | awk -F "\)" '{print $1}' | sed 's:^.\(.*\).$:\1:' | head -1) [[ -z $cron_name ]] && cron_name="$file_name" + [[ -z $cron_line ]] && cron_line=$(grep "cron:" $file | awk -F ":" '{print $2}' | xargs) [[ -z $cron_line ]] && cron_line="0 6 * * *" result=$(add_cron_api "$cron_line:$cmd_task $file:$cron_name") echo -e "$result" From 2bd9b82cc75e84cb9efa271b8474ff632b1f4053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E8=85=BE?= Date: Fri, 4 Jun 2021 20:57:35 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/log/index.module.less | 4 ---- src/pages/log/index.tsx | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/pages/log/index.module.less b/src/pages/log/index.module.less index fb59c15c..07e40d39 100644 --- a/src/pages/log/index.module.less +++ b/src/pages/log/index.module.less @@ -18,10 +18,6 @@ } &-search { margin-bottom: 16px; - // position: absolute; - // top: 0; - // left: 0; - // padding-bottom: 16px; } } diff --git a/src/pages/log/index.tsx b/src/pages/log/index.tsx index 532594c4..a18840d8 100644 --- a/src/pages/log/index.tsx +++ b/src/pages/log/index.tsx @@ -10,10 +10,10 @@ function getFilterData(keyword: string, data: any) { const expandedKeys: string[] = []; if (keyword) { const tree: any = []; - data.forEach((item) => { + data.forEach((item: any) => { if (item.title.includes(keyword)) { tree.push(item); - expandedKeys.push(...item.children.map((x) => x.key)); + expandedKeys.push(...item.children.map((x: any) => x.key)); } else { const children: any[] = []; (item.children || []).forEach((subItem: any) => { @@ -95,7 +95,7 @@ const Log = () => { const onSearch = useCallback( (e) => { const keyword = e.target.value; - const { tree, expandedKeys } = getFilterData(keyword, data); + const { tree } = getFilterData(keyword, data); setFilterData(tree); }, [data, setFilterData], From da1c5267b4c08e30684d332b46001b497247c4b5 Mon Sep 17 00:00:00 2001 From: zt8989 <251027705@qq.com> Date: Sun, 6 Jun 2021 08:07:56 +0800 Subject: [PATCH 8/8] Update index.module.less --- src/pages/log/index.module.less | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/log/index.module.less b/src/pages/log/index.module.less index 07e40d39..6eed1ad4 100644 --- a/src/pages/log/index.module.less +++ b/src/pages/log/index.module.less @@ -4,7 +4,6 @@ &-container { overflow: hidden; position: relative; - // padding: 16px 0; background-color: #fff; height: calc(100vh - 128px); height: calc(100vh - var(--vh-offset, 0px) - 128px);