@whyour/qinglong 2.18.3-3 → 2.19.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +7 -9
- package/docker/310.Dockerfile +18 -9
- package/docker/Dockerfile +18 -9
- package/docker/docker-entrypoint.sh +14 -15
- package/docker/front.conf +0 -32
- package/ecosystem.config.js +5 -25
- package/package.json +9 -11
- package/sample/notify.js +5 -3
- package/shell/check.sh +0 -2
- package/shell/preload/sitecustomize.js +38 -15
- package/shell/preload/sitecustomize.py +42 -18
- package/shell/share.sh +23 -75
- package/shell/update.sh +21 -20
- package/static/build/api/health.js +32 -0
- package/static/build/api/index.js +4 -0
- package/static/build/api/log.js +1 -1
- package/static/build/api/script.js +2 -3
- package/static/build/api/system.js +1 -0
- package/static/build/api/update.js +47 -0
- package/static/build/api/user.js +2 -2
- package/static/build/app.js +70 -21
- package/static/build/config/const.js +2 -1
- package/static/build/config/index.js +32 -25
- package/static/build/config/util.js +72 -20
- package/static/build/data/dependence.js +1 -13
- package/static/build/data/notify.js +1 -0
- package/static/build/loaders/app.js +7 -9
- package/static/build/loaders/db.js +1 -3
- package/static/build/loaders/express.js +1 -9
- package/static/build/loaders/initData.js +7 -8
- package/static/build/loaders/initFile.js +0 -1
- package/static/build/loaders/logger.js +34 -15
- package/static/build/middlewares/monitoring.js +56 -0
- package/static/build/schedule/api.js +47 -8
- package/static/build/schedule/client.js +1 -1
- package/static/build/services/cron.js +12 -6
- package/static/build/services/dependence.js +10 -9
- package/static/build/services/grpc.js +97 -0
- package/static/build/services/health.js +74 -0
- package/static/build/services/http.js +67 -0
- package/static/build/services/metrics.js +82 -0
- package/static/build/services/notify.js +2 -2
- package/static/build/services/system.js +8 -1
- package/static/build/services/user.js +11 -4
- package/static/build/shared/pLimit.js +13 -1
- package/static/dist/{2208.03c2cf4a.async.js → 2208.98ccac5f.async.js} +1 -1
- package/static/dist/8826.faecf076.async.js +1 -0
- package/static/dist/8851.cf7e0ebc.async.js +1 -0
- package/static/dist/index.html +2 -2
- package/static/dist/layouts__index.6e23431c.async.js +1 -0
- package/static/dist/{preload_helper.1b1a7a9f.js → preload_helper.67e88ed6.js} +1 -1
- package/static/dist/{src__pages__crontab__index.5eb33581.async.js → src__pages__crontab__index.d6d37f6a.async.js} +1 -1
- package/static/dist/{src__pages__crontab__modal.b20074c2.async.js → src__pages__crontab__modal.dcd053b5.async.js} +1 -1
- package/static/dist/src__pages__dependence__modal.7f588c0b.async.js +1 -0
- package/static/dist/src__pages__env__editNameModal.411043e2.async.js +1 -0
- package/static/dist/{src__pages__env__modal.d923acdb.async.js → src__pages__env__modal.7d952f26.async.js} +1 -1
- package/static/dist/src__pages__error__index.837f4753.async.js +1 -0
- package/static/dist/{src__pages__initialization__index.684197ee.async.js → src__pages__initialization__index.5bd471c5.async.js} +1 -1
- package/static/dist/src__pages__script__editNameModal.32bb2f80.async.js +1 -0
- package/static/dist/src__pages__script__index.53f99bee.async.js +1 -0
- package/static/dist/{src__pages__script__renameModal.09dfb133.async.js → src__pages__script__renameModal.8232c924.async.js} +1 -1
- package/static/dist/{src__pages__script__saveModal.21b81bcc.async.js → src__pages__script__saveModal.8e358e84.async.js} +1 -1
- package/static/dist/{src__pages__script__setting.c6503aaf.async.js → src__pages__script__setting.dcdd7253.async.js} +1 -1
- package/static/dist/{src__pages__setting__appModal.b115baf8.async.js → src__pages__setting__appModal.25adf30e.async.js} +1 -1
- package/static/dist/src__pages__setting__dependence.95dd01e7.async.js +1 -0
- package/static/dist/src__pages__setting__index.3b426f9f.async.js +1 -0
- package/static/dist/src__pages__setting__notification.989e57d6.async.js +1 -0
- package/static/dist/src__pages__setting__security.7623a492.async.js +1 -0
- package/static/dist/src__pages__setting__systemLog.2e8cc7a0.async.js +1 -0
- package/static/dist/src__pages__subscription__modal.46a69195.async.js +1 -0
- package/static/dist/{umi.32588872.js → umi.b7656bb3.js} +1 -1
- package/version.yaml +12 -6
- package/back.d.ts +0 -9
- package/other.config.js +0 -13
- package/static/build/loaders/update.js +0 -79
- package/static/build/public.js +0 -34
- package/static/build/schedule/index.js +0 -52
- package/static/build/update.js +0 -29
- package/static/dist/8826.b3f9fa78.async.js +0 -1
- package/static/dist/8851.a57942be.async.js +0 -1
- package/static/dist/layouts__index.623b87d2.async.js +0 -1
- package/static/dist/src__pages__dependence__modal.1bb8572d.async.js +0 -1
- package/static/dist/src__pages__env__editNameModal.115bb8ea.async.js +0 -1
- package/static/dist/src__pages__error__index.a17578c5.async.js +0 -1
- package/static/dist/src__pages__script__editNameModal.7d1cc6b4.async.js +0 -1
- package/static/dist/src__pages__script__index.0cd08dcd.async.js +0 -1
- package/static/dist/src__pages__setting__dependence.f3afc194.async.js +0 -1
- package/static/dist/src__pages__setting__index.34ed674c.async.js +0 -1
- package/static/dist/src__pages__setting__notification.b7722a0b.async.js +0 -1
- package/static/dist/src__pages__setting__security.534a5e67.async.js +0 -1
- package/static/dist/src__pages__setting__systemLog.cb8a2174.async.js +0 -1
- package/static/dist/src__pages__subscription__modal.10cd630d.async.js +0 -1
package/.env.example
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
PUBLIC_PORT=5400
|
|
3
|
-
CRON_PORT=5500
|
|
1
|
+
GRPC_PORT=5500
|
|
4
2
|
BACK_PORT=5600
|
|
5
3
|
PORT=5700
|
|
6
4
|
|
|
7
|
-
LOG_LEVEL='
|
|
5
|
+
LOG_LEVEL='info'
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
JWT_SECRET=
|
|
8
|
+
JWT_EXPIRES_IN=
|
|
10
9
|
|
|
11
|
-
QINIU_AK=
|
|
12
|
-
QINIU_SK=
|
|
13
|
-
QINIU_SCOPE=
|
|
14
|
-
TEMP=''
|
|
10
|
+
QINIU_AK=
|
|
11
|
+
QINIU_SK=
|
|
12
|
+
QINIU_SCOPE=
|
package/docker/310.Dockerfile
CHANGED
|
@@ -19,14 +19,13 @@ LABEL maintainer="${QL_MAINTAINER}"
|
|
|
19
19
|
ARG QL_URL=https://github.com/${QL_MAINTAINER}/qinglong.git
|
|
20
20
|
ARG QL_BRANCH=develop
|
|
21
21
|
|
|
22
|
-
ENV
|
|
23
|
-
|
|
24
|
-
NODE_PATH=/usr/local/bin:/usr/local/pnpm-global/5/node_modules:/usr/local/lib/node_modules:/root/.local/share/pnpm/global/5/node_modules \
|
|
22
|
+
ENV QL_DIR=/ql \
|
|
23
|
+
QL_BRANCH=${QL_BRANCH} \
|
|
25
24
|
LANG=C.UTF-8 \
|
|
26
25
|
SHELL=/bin/bash \
|
|
27
26
|
PS1="\u@\h:\w \$ " \
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
PYTHONPATH= \
|
|
28
|
+
PYTHON_SHORT_VERSION=
|
|
30
29
|
|
|
31
30
|
COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/
|
|
32
31
|
COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
|
|
@@ -55,12 +54,11 @@ RUN set -x && \
|
|
|
55
54
|
git config --global user.name "qinglong" && \
|
|
56
55
|
git config --global http.postBuffer 524288000 && \
|
|
57
56
|
npm install -g pnpm@8.3.1 pm2 ts-node && \
|
|
58
|
-
rm -rf /root/.pnpm-store && \
|
|
59
|
-
rm -rf /root/.local/share/pnpm/store && \
|
|
60
57
|
rm -rf /root/.cache && \
|
|
61
58
|
rm -rf /root/.npm && \
|
|
59
|
+
rm -rf /etc/apt/apt.conf.d/docker-clean && \
|
|
62
60
|
ulimit -c 0 && \
|
|
63
|
-
|
|
61
|
+
PYTHON_SHORT_VERSION=$(echo ${PYTHON_VERSION} | cut -d. -f1,2)
|
|
64
62
|
|
|
65
63
|
ARG SOURCE_COMMIT
|
|
66
64
|
RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
|
|
@@ -73,12 +71,23 @@ RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
|
|
|
73
71
|
cp -rf /static/* ${QL_DIR}/static && \
|
|
74
72
|
rm -rf /static
|
|
75
73
|
|
|
74
|
+
ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
|
|
75
|
+
PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
|
|
76
|
+
PYTHONUSERBASE=${QL_DIR}/data/dep_cache/python3
|
|
77
|
+
|
|
78
|
+
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PNPM_HOME} \
|
|
79
|
+
NODE_PATH=/usr/local/bin:/usr/local/lib/node_modules:${PNPM_HOME}/global/5/node_modules \
|
|
80
|
+
PIP_CACHE_DIR=${PYTHON_HOME}/pip \
|
|
81
|
+
PYTHONPATH=${PYTHON_HOME}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}/site-packages:${PYTHONPATH}
|
|
82
|
+
|
|
83
|
+
RUN pip3 install --prefix ${PYTHON_HOME} requests
|
|
84
|
+
|
|
76
85
|
COPY --from=builder /tmp/build/node_modules/. /ql/node_modules/
|
|
77
86
|
|
|
78
87
|
WORKDIR ${QL_DIR}
|
|
79
88
|
|
|
80
89
|
HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
|
|
81
|
-
CMD curl -sf --noproxy '*' http://127.0.0.1:
|
|
90
|
+
CMD curl -sf --noproxy '*' http://127.0.0.1:5600/api/health || exit 1
|
|
82
91
|
|
|
83
92
|
ENTRYPOINT ["./docker/docker-entrypoint.sh"]
|
|
84
93
|
|
package/docker/Dockerfile
CHANGED
|
@@ -19,14 +19,13 @@ LABEL maintainer="${QL_MAINTAINER}"
|
|
|
19
19
|
ARG QL_URL=https://github.com/${QL_MAINTAINER}/qinglong.git
|
|
20
20
|
ARG QL_BRANCH=develop
|
|
21
21
|
|
|
22
|
-
ENV
|
|
23
|
-
|
|
24
|
-
NODE_PATH=/usr/local/bin:/usr/local/pnpm-global/5/node_modules:/usr/local/lib/node_modules:/root/.local/share/pnpm/global/5/node_modules \
|
|
22
|
+
ENV QL_DIR=/ql \
|
|
23
|
+
QL_BRANCH=${QL_BRANCH} \
|
|
25
24
|
LANG=C.UTF-8 \
|
|
26
25
|
SHELL=/bin/bash \
|
|
27
26
|
PS1="\u@\h:\w \$ " \
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
PYTHONPATH= \
|
|
28
|
+
PYTHON_SHORT_VERSION=
|
|
30
29
|
|
|
31
30
|
COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/
|
|
32
31
|
COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
|
|
@@ -56,12 +55,11 @@ RUN set -x && \
|
|
|
56
55
|
git config --global user.name "qinglong" && \
|
|
57
56
|
git config --global http.postBuffer 524288000 && \
|
|
58
57
|
npm install -g pnpm@8.3.1 pm2 ts-node && \
|
|
59
|
-
rm -rf /root/.pnpm-store && \
|
|
60
|
-
rm -rf /root/.local/share/pnpm/store && \
|
|
61
58
|
rm -rf /root/.cache && \
|
|
62
59
|
rm -rf /root/.npm && \
|
|
60
|
+
rm -rf /etc/apt/apt.conf.d/docker-clean && \
|
|
63
61
|
ulimit -c 0 && \
|
|
64
|
-
|
|
62
|
+
PYTHON_SHORT_VERSION=$(echo ${PYTHON_VERSION} | cut -d. -f1,2)
|
|
65
63
|
|
|
66
64
|
ARG SOURCE_COMMIT
|
|
67
65
|
RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
|
|
@@ -74,12 +72,23 @@ RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
|
|
|
74
72
|
cp -rf /static/* ${QL_DIR}/static && \
|
|
75
73
|
rm -rf /static
|
|
76
74
|
|
|
75
|
+
ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
|
|
76
|
+
PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
|
|
77
|
+
PYTHONUSERBASE=${QL_DIR}/data/dep_cache/python3
|
|
78
|
+
|
|
79
|
+
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PNPM_HOME} \
|
|
80
|
+
NODE_PATH=/usr/local/bin:/usr/local/lib/node_modules:${PNPM_HOME}/global/5/node_modules \
|
|
81
|
+
PIP_CACHE_DIR=${PYTHON_HOME}/pip \
|
|
82
|
+
PYTHONPATH=${PYTHON_HOME}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}/site-packages:${PYTHONPATH}
|
|
83
|
+
|
|
84
|
+
RUN pip3 install --prefix ${PYTHON_HOME} requests
|
|
85
|
+
|
|
77
86
|
COPY --from=builder /tmp/build/node_modules/. /ql/node_modules/
|
|
78
87
|
|
|
79
88
|
WORKDIR ${QL_DIR}
|
|
80
89
|
|
|
81
90
|
HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
|
|
82
|
-
CMD curl -sf --noproxy '*' http://127.0.0.1:
|
|
91
|
+
CMD curl -sf --noproxy '*' http://127.0.0.1:5600/api/health || exit 1
|
|
83
92
|
|
|
84
93
|
ENTRYPOINT ["./docker/docker-entrypoint.sh"]
|
|
85
94
|
|
|
@@ -4,7 +4,15 @@ dir_shell=/ql/shell
|
|
|
4
4
|
. $dir_shell/share.sh
|
|
5
5
|
. $dir_shell/env.sh
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
log_with_style() {
|
|
8
|
+
local level="$1"
|
|
9
|
+
local message="$2"
|
|
10
|
+
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
|
11
|
+
|
|
12
|
+
printf "\n[%s] [%7s] %s\n" "${timestamp}" "${level}" "${message}"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
log_with_style "INFO" "🚀 1. 检测配置文件..."
|
|
8
16
|
import_config "$@"
|
|
9
17
|
make_dir /etc/nginx/conf.d
|
|
10
18
|
make_dir /run/nginx
|
|
@@ -13,32 +21,23 @@ fix_config
|
|
|
13
21
|
|
|
14
22
|
pm2 l &>/dev/null
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
patch_version
|
|
18
|
-
|
|
19
|
-
echo -e "======================3. 启动nginx========================\n"
|
|
24
|
+
log_with_style "INFO" "🔄 2. 启动 nginx..."
|
|
20
25
|
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
|
21
|
-
echo -e "nginx启动成功...\n"
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
reload_update
|
|
27
|
+
log_with_style "INFO" "⚙️ 3. 启动 pm2 服务...\n"
|
|
25
28
|
reload_pm2
|
|
26
29
|
|
|
27
30
|
if [[ $AutoStartBot == true ]]; then
|
|
28
|
-
|
|
31
|
+
log_with_style "INFO" "🤖 4. 启动 bot..."
|
|
29
32
|
nohup ql bot >$dir_log/bot.log 2>&1 &
|
|
30
|
-
echo -e "bot后台启动中...\n"
|
|
31
33
|
fi
|
|
32
34
|
|
|
33
35
|
if [[ $EnableExtraShell == true ]]; then
|
|
34
|
-
|
|
36
|
+
log_with_style "INFO" "🛠️ 5. 执行自定义脚本..."
|
|
35
37
|
nohup ql extra >$dir_log/extra.log 2>&1 &
|
|
36
|
-
echo -e "自定义脚本后台执行中...\n"
|
|
37
38
|
fi
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
echo -e "容器启动成功..."
|
|
41
|
-
echo -e "############################################################\n"
|
|
40
|
+
log_with_style "SUCCESS" "🎉 容器启动成功!"
|
|
42
41
|
|
|
43
42
|
tail -f /dev/null
|
|
44
43
|
|
package/docker/front.conf
CHANGED
|
@@ -2,14 +2,6 @@ upstream baseApi {
|
|
|
2
2
|
server 0.0.0.0:5600;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
upstream publicApi {
|
|
6
|
-
server 0.0.0.0:5400;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
upstream updateApi {
|
|
10
|
-
server 0.0.0.0:5300;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
5
|
map $http_upgrade $connection_upgrade {
|
|
14
6
|
default keep-alive;
|
|
15
7
|
'websocket' upgrade;
|
|
@@ -20,30 +12,6 @@ server {
|
|
|
20
12
|
IPV6_CONFIG
|
|
21
13
|
ssl_session_timeout 5m;
|
|
22
14
|
|
|
23
|
-
location QL_BASE_URLapi/update/ {
|
|
24
|
-
proxy_set_header Host $http_host;
|
|
25
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
26
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
27
|
-
proxy_pass http://updateApi/api/;
|
|
28
|
-
proxy_buffering off;
|
|
29
|
-
proxy_redirect default;
|
|
30
|
-
proxy_connect_timeout 1800;
|
|
31
|
-
proxy_send_timeout 1800;
|
|
32
|
-
proxy_read_timeout 1800;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
location QL_BASE_URLapi/public/ {
|
|
36
|
-
proxy_set_header Host $http_host;
|
|
37
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
38
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
39
|
-
proxy_pass http://publicApi/api/;
|
|
40
|
-
proxy_buffering off;
|
|
41
|
-
proxy_redirect default;
|
|
42
|
-
proxy_connect_timeout 1800;
|
|
43
|
-
proxy_send_timeout 1800;
|
|
44
|
-
proxy_read_timeout 1800;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
15
|
location QL_BASE_URLapi/ {
|
|
48
16
|
proxy_set_header Host $http_host;
|
|
49
17
|
proxy_set_header X-Real-IP $remote_addr;
|
package/ecosystem.config.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
apps: [
|
|
3
3
|
{
|
|
4
|
-
name: '
|
|
5
|
-
max_restarts:
|
|
6
|
-
kill_timeout:
|
|
4
|
+
name: 'qinglong',
|
|
5
|
+
max_restarts: 5,
|
|
6
|
+
kill_timeout: 1000,
|
|
7
7
|
wait_ready: true,
|
|
8
|
-
listen_timeout:
|
|
8
|
+
listen_timeout: 5000,
|
|
9
9
|
source_map_support: true,
|
|
10
10
|
time: true,
|
|
11
|
-
script: 'static/build/
|
|
11
|
+
script: 'static/build/app.js',
|
|
12
12
|
env: {
|
|
13
13
|
http_proxy: '',
|
|
14
14
|
https_proxy: '',
|
|
@@ -18,25 +18,5 @@ module.exports = {
|
|
|
18
18
|
ALL_PROXY: '',
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
|
-
{
|
|
22
|
-
name: 'public',
|
|
23
|
-
max_restarts: 10,
|
|
24
|
-
kill_timeout: 15000,
|
|
25
|
-
wait_ready: true,
|
|
26
|
-
listen_timeout: 10000,
|
|
27
|
-
source_map_support: true,
|
|
28
|
-
time: true,
|
|
29
|
-
script: 'static/build/public.js',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: 'panel',
|
|
33
|
-
max_restarts: 10,
|
|
34
|
-
kill_timeout: 15000,
|
|
35
|
-
wait_ready: true,
|
|
36
|
-
listen_timeout: 10000,
|
|
37
|
-
source_map_support: true,
|
|
38
|
-
time: true,
|
|
39
|
-
script: 'static/build/app.js',
|
|
40
|
-
},
|
|
41
21
|
],
|
|
42
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whyour/qinglong",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0-0",
|
|
4
4
|
"description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,17 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"start": "concurrently -n w: npm:start:*",
|
|
16
|
-
"start:update": "ts-node -P tsconfig.back.json ./back/update.ts",
|
|
17
|
-
"start:public": "ts-node -P tsconfig.back.json ./back/public.ts",
|
|
18
|
-
"start:rpc": "ts-node -P tsconfig.back.json ./back/schedule/index.ts",
|
|
19
16
|
"start:back": "nodemon",
|
|
20
17
|
"start:front": "max dev",
|
|
21
18
|
"build:front": "max build",
|
|
22
|
-
"build:back": "tsc -p tsconfig.
|
|
19
|
+
"build:back": "tsc -p back/tsconfig.json",
|
|
23
20
|
"panel": "npm run build:back && node static/build/app.js",
|
|
24
|
-
"schedule": "npm run build:back && node static/build/schedule/index.js",
|
|
25
|
-
"public": "npm run build:back && node static/build/public.js",
|
|
26
|
-
"update": "npm run build:back && node static/build/update.js",
|
|
27
21
|
"gen:proto": "protoc --experimental_allow_proto3_optional --plugin=./node_modules/.bin/protoc-gen-ts_proto ./back/protos/*.proto --ts_proto_out=./ --ts_proto_opt=outputServices=grpc-js,env=node,esModuleInterop=true,snakeToCamel=false",
|
|
28
22
|
"gen:api": "python3 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./back/protos/api.proto",
|
|
29
23
|
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
|
|
@@ -105,7 +99,7 @@
|
|
|
105
99
|
"nodemailer": "^6.9.16",
|
|
106
100
|
"p-queue-cjs": "7.3.4",
|
|
107
101
|
"@bufbuild/protobuf": "^2.2.3",
|
|
108
|
-
"
|
|
102
|
+
"ps-tree": "^1.2.0",
|
|
109
103
|
"reflect-metadata": "^0.2.2",
|
|
110
104
|
"sequelize": "^6.37.5",
|
|
111
105
|
"serve-handler": "^6.1.6",
|
|
@@ -120,7 +114,9 @@
|
|
|
120
114
|
"ip2region": "2.3.0",
|
|
121
115
|
"keyv": "^5.2.3",
|
|
122
116
|
"@keyv/sqlite": "^4.0.1",
|
|
123
|
-
"proper-lockfile": "^4.1.2"
|
|
117
|
+
"proper-lockfile": "^4.1.2",
|
|
118
|
+
"compression": "^1.7.4",
|
|
119
|
+
"helmet": "^6.0.1"
|
|
124
120
|
},
|
|
125
121
|
"devDependencies": {
|
|
126
122
|
"moment": "2.30.1",
|
|
@@ -154,6 +150,7 @@
|
|
|
154
150
|
"@types/uuid": "^8.3.4",
|
|
155
151
|
"@types/request-ip": "0.0.41",
|
|
156
152
|
"@types/proper-lockfile": "^4.1.4",
|
|
153
|
+
"@types/ps-tree": "^1.1.6",
|
|
157
154
|
"@uiw/codemirror-extensions-langs": "^4.21.9",
|
|
158
155
|
"@uiw/react-codemirror": "^4.21.9",
|
|
159
156
|
"@umijs/max": "^4.4.4",
|
|
@@ -192,6 +189,7 @@
|
|
|
192
189
|
"typescript": "5.2.2",
|
|
193
190
|
"vh-check": "^2.0.5",
|
|
194
191
|
"virtualizedtableforantd4": "1.3.0",
|
|
195
|
-
"
|
|
192
|
+
"@types/compression": "^1.7.2",
|
|
193
|
+
"@types/helmet": "^4.0.0"
|
|
196
194
|
}
|
|
197
195
|
}
|
package/sample/notify.js
CHANGED
|
@@ -84,7 +84,8 @@ const push_config = {
|
|
|
84
84
|
AIBOTK_NAME: '', // 智能微秘书 发送群名 或者好友昵称和type要对应好
|
|
85
85
|
|
|
86
86
|
SMTP_SERVICE: '', // 邮箱服务名称,比如 126、163、Gmail、QQ 等,支持列表 https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json
|
|
87
|
-
SMTP_EMAIL: '', // SMTP
|
|
87
|
+
SMTP_EMAIL: '', // SMTP 发件邮箱
|
|
88
|
+
SMTP_TO: '', // SMTP 收件邮箱,默认通知将会发给发件邮箱
|
|
88
89
|
SMTP_PASSWORD: '', // SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定
|
|
89
90
|
SMTP_NAME: '', // SMTP 收发件人姓名,可随意填写
|
|
90
91
|
|
|
@@ -993,7 +994,8 @@ function fsBotNotify(text, desp) {
|
|
|
993
994
|
}
|
|
994
995
|
|
|
995
996
|
async function smtpNotify(text, desp) {
|
|
996
|
-
const { SMTP_EMAIL, SMTP_PASSWORD, SMTP_SERVICE, SMTP_NAME } =
|
|
997
|
+
const { SMTP_EMAIL, SMTP_TO, SMTP_PASSWORD, SMTP_SERVICE, SMTP_NAME } =
|
|
998
|
+
push_config;
|
|
997
999
|
if (![SMTP_EMAIL, SMTP_PASSWORD].every(Boolean) || !SMTP_SERVICE) {
|
|
998
1000
|
return;
|
|
999
1001
|
}
|
|
@@ -1011,7 +1013,7 @@ async function smtpNotify(text, desp) {
|
|
|
1011
1013
|
const addr = SMTP_NAME ? `"${SMTP_NAME}" <${SMTP_EMAIL}>` : SMTP_EMAIL;
|
|
1012
1014
|
const info = await transporter.sendMail({
|
|
1013
1015
|
from: addr,
|
|
1014
|
-
to: addr,
|
|
1016
|
+
to: SMTP_TO ? SMTP_TO.split(';') : addr,
|
|
1015
1017
|
subject: text,
|
|
1016
1018
|
html: `${desp.replace(/\n/g, '<br/>')}`,
|
|
1017
1019
|
});
|
package/shell/check.sh
CHANGED
|
@@ -38,25 +38,48 @@ function run() {
|
|
|
38
38
|
|
|
39
39
|
const splitStr = '__sitecustomize__';
|
|
40
40
|
const fileName = process.argv[1].replace(`${dir_scripts}/`, '');
|
|
41
|
-
|
|
41
|
+
const tempFile = `/tmp/env_${process.pid}.json`;
|
|
42
|
+
|
|
43
|
+
const commands = [
|
|
44
|
+
`source ${file_task_before} ${fileName}`,
|
|
45
|
+
task_before ? `eval '${task_before.replace(/'/g, "'\\''")}'` : null,
|
|
46
|
+
`echo -e '${splitStr}'`,
|
|
47
|
+
`node -e "require('fs').writeFileSync('${tempFile}', JSON.stringify(process.env))"`,
|
|
48
|
+
].filter(Boolean);
|
|
49
|
+
|
|
42
50
|
if (task_before) {
|
|
43
|
-
const escapeTaskBefore = task_before
|
|
44
|
-
.replace(/"/g, '\\"')
|
|
45
|
-
.replace(/\$/g, '\\$');
|
|
46
|
-
command = `${command} && eval '${escapeTaskBefore}'`;
|
|
47
51
|
console.log('执行前置命令\n');
|
|
48
52
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
|
|
54
|
+
const res = execSync(commands.join(' && '), {
|
|
55
|
+
encoding: 'utf-8',
|
|
56
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
57
|
+
shell: '/bin/bash',
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const [output] = res.split(splitStr);
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const envStr = require('fs').readFileSync(tempFile, 'utf-8');
|
|
64
|
+
const newEnvObject = JSON.parse(envStr);
|
|
65
|
+
if (typeof newEnvObject === 'object' && newEnvObject !== null) {
|
|
66
|
+
for (const key in newEnvObject) {
|
|
67
|
+
if (Object.prototype.hasOwnProperty.call(newEnvObject, key)) {
|
|
68
|
+
process.env[key] = newEnvObject[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
require('fs').unlinkSync(tempFile);
|
|
73
|
+
} catch (jsonError) {
|
|
74
|
+
console.log(
|
|
75
|
+
'\ue926 Failed to parse environment variables:',
|
|
76
|
+
jsonError.message,
|
|
77
|
+
);
|
|
78
|
+
try {
|
|
79
|
+
require('fs').unlinkSync(tempFile);
|
|
80
|
+
} catch (e) {}
|
|
59
81
|
}
|
|
82
|
+
|
|
60
83
|
if (output) {
|
|
61
84
|
console.log(output);
|
|
62
85
|
}
|
|
@@ -43,35 +43,57 @@ def run():
|
|
|
43
43
|
|
|
44
44
|
split_str = "__sitecustomize__"
|
|
45
45
|
file_name = sys.argv[0].replace(f"{os.getenv('dir_scripts')}/", "")
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
# 创建临时文件路径
|
|
48
|
+
temp_file = f"/tmp/env_{os.getpid()}.json"
|
|
49
|
+
|
|
50
|
+
# 构建命令数组
|
|
51
|
+
commands = [
|
|
52
|
+
f'source {os.getenv("file_task_before")} {file_name}'
|
|
53
|
+
]
|
|
54
|
+
|
|
47
55
|
task_before = os.getenv("task_before")
|
|
48
|
-
|
|
49
56
|
if task_before:
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
escaped_task_before = task_before.replace("'", "'\\''")
|
|
58
|
+
commands.append(f"eval '{escaped_task_before}'")
|
|
52
59
|
print("执行前置命令\n")
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
)
|
|
58
|
-
|
|
60
|
+
|
|
61
|
+
commands.append(f"echo -e '{split_str}'")
|
|
62
|
+
|
|
63
|
+
# 修改 Python 命令,使用单行并正确处理引号
|
|
64
|
+
python_cmd = f"python3 -c 'import os,json; f=open(\\\"{temp_file}\\\",\\\"w\\\"); json.dump(dict(os.environ),f); f.close()'"
|
|
65
|
+
commands.append(python_cmd)
|
|
66
|
+
|
|
67
|
+
command = " && ".join(cmd for cmd in commands if cmd)
|
|
68
|
+
command = f'bash -c "{command}"'
|
|
59
69
|
|
|
60
70
|
res = subprocess.check_output(command, shell=True, encoding="utf-8")
|
|
61
|
-
output
|
|
71
|
+
output = res.split(split_str)[0]
|
|
62
72
|
|
|
63
|
-
|
|
73
|
+
try:
|
|
74
|
+
with open(temp_file, 'r') as f:
|
|
75
|
+
env_json = json.loads(f.read())
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
for key, value in env_json.items():
|
|
78
|
+
os.environ[key] = value
|
|
79
|
+
|
|
80
|
+
os.unlink(temp_file)
|
|
81
|
+
except Exception as json_error:
|
|
82
|
+
print(f"\ue926 Failed to parse environment variables: {json_error}")
|
|
83
|
+
try:
|
|
84
|
+
os.unlink(temp_file)
|
|
85
|
+
except:
|
|
86
|
+
pass
|
|
67
87
|
|
|
68
88
|
if len(output) > 0:
|
|
69
89
|
print(output)
|
|
70
90
|
if task_before:
|
|
71
|
-
print("
|
|
91
|
+
print("执行前置命令结束\n")
|
|
72
92
|
|
|
73
93
|
except subprocess.CalledProcessError as error:
|
|
74
|
-
print(f"run task before error: {error}")
|
|
94
|
+
print(f"\ue926 run task before error: {error}")
|
|
95
|
+
if task_before:
|
|
96
|
+
print("执行前置命令结束\n")
|
|
75
97
|
except OSError as error:
|
|
76
98
|
error_message = str(error)
|
|
77
99
|
if "Argument list too long" not in error_message:
|
|
@@ -81,9 +103,11 @@ def run():
|
|
|
81
103
|
"\ue926 The environment variable is too large. It is recommended to use task_before.py instead of task_before.sh\n"
|
|
82
104
|
)
|
|
83
105
|
if task_before:
|
|
84
|
-
print("
|
|
106
|
+
print("执行前置命令结束\n")
|
|
85
107
|
except Exception as error:
|
|
86
|
-
print(f"run task before error: {error}")
|
|
108
|
+
print(f"\ue926 run task before error: {error}")
|
|
109
|
+
if task_before:
|
|
110
|
+
print("执行前置命令结束\n")
|
|
87
111
|
|
|
88
112
|
import task_before
|
|
89
113
|
|