@whyour/qinglong 0.21.2 → 2.17.8-beta.1
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/docker/310.Dockerfile +1 -1
- package/docker/Dockerfile +1 -1
- package/package.json +2 -3
- package/sample/config.sample.sh +1 -1
- package/shell/api.sh +1 -1
- package/shell/check.sh +1 -1
- package/shell/otask.sh +80 -45
- package/shell/preload/sitecustomize.js +30 -0
- package/shell/preload/sitecustomize.py +44 -0
- package/shell/pub.sh +1 -1
- package/shell/share.sh +18 -4
- package/shell/start.sh +1 -1
- package/shell/task.sh +2 -6
- package/static/build/config/index.js +4 -3
- package/static/build/loaders/initFile.js +5 -0
- package/static/build/loaders/initTask.js +1 -1
- package/static/build/services/env.js +4 -5
- package/static/build/services/system.js +4 -0
- package/version.yaml +6 -7
package/docker/310.Dockerfile
CHANGED
|
@@ -54,7 +54,7 @@ RUN set -x && \
|
|
|
54
54
|
git config --global user.email "qinglong@@users.noreply.github.com" && \
|
|
55
55
|
git config --global user.name "qinglong" && \
|
|
56
56
|
git config --global http.postBuffer 524288000 && \
|
|
57
|
-
npm install -g pnpm@8.3.1 pm2
|
|
57
|
+
npm install -g pnpm@8.3.1 pm2 ts-node && \
|
|
58
58
|
rm -rf /root/.pnpm-store && \
|
|
59
59
|
rm -rf /root/.local/share/pnpm/store && \
|
|
60
60
|
rm -rf /root/.cache && \
|
package/docker/Dockerfile
CHANGED
|
@@ -55,7 +55,7 @@ RUN set -x && \
|
|
|
55
55
|
git config --global user.email "qinglong@@users.noreply.github.com" && \
|
|
56
56
|
git config --global user.name "qinglong" && \
|
|
57
57
|
git config --global http.postBuffer 524288000 && \
|
|
58
|
-
npm install -g pnpm@8.3.1 pm2
|
|
58
|
+
npm install -g pnpm@8.3.1 pm2 ts-node && \
|
|
59
59
|
rm -rf /root/.pnpm-store && \
|
|
60
60
|
rm -rf /root/.local/share/pnpm/store && \
|
|
61
61
|
rm -rf /root/.cache && \
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whyour/qinglong",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.17.8-beta.1",
|
|
4
4
|
"description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -179,10 +179,9 @@
|
|
|
179
179
|
"react-intl-universal": "^2.6.21",
|
|
180
180
|
"react-split-pane": "^0.1.92",
|
|
181
181
|
"sockjs-client": "^1.6.0",
|
|
182
|
-
"ts-node": "^10.
|
|
182
|
+
"ts-node": "^10.9.2",
|
|
183
183
|
"ts-proto": "^1.146.0",
|
|
184
184
|
"tslib": "^2.4.0",
|
|
185
|
-
"tsx": "^4.7.3",
|
|
186
185
|
"typescript": "5.2.2",
|
|
187
186
|
"vh-check": "^2.0.5",
|
|
188
187
|
"virtualizedtableforantd4": "1.3.0",
|
package/sample/config.sample.sh
CHANGED
package/shell/api.sh
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
3
|
create_token() {
|
|
4
|
-
local token_command="
|
|
4
|
+
local token_command="ts-node-transpile-only ${dir_root}/back/token.ts"
|
|
5
5
|
local token_file="${dir_root}/static/build/token.js"
|
|
6
6
|
if [[ -f $token_file ]]; then
|
|
7
7
|
token_command="node ${token_file}"
|
package/shell/check.sh
CHANGED
package/shell/otask.sh
CHANGED
|
@@ -71,8 +71,17 @@ run_nohup() {
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
env_str_to_array() {
|
|
74
|
+
. $file_env
|
|
74
75
|
local IFS="&"
|
|
75
76
|
read -ra array <<<"${!env_param}"
|
|
77
|
+
array_length=${#array[@]}
|
|
78
|
+
clear_env
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
clear_non_sh_env() {
|
|
82
|
+
if [[ $file_param != *.sh ]]; then
|
|
83
|
+
clear_env
|
|
84
|
+
fi
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
## 正常运行单个脚本,$1:传入参数
|
|
@@ -89,37 +98,34 @@ run_normal() {
|
|
|
89
98
|
file_param=${file_param/$relative_path\//}
|
|
90
99
|
fi
|
|
91
100
|
|
|
92
|
-
|
|
101
|
+
if [[ $isJsOrPythonFile == 'false' ]]; then
|
|
102
|
+
clear_non_sh_env
|
|
103
|
+
fi
|
|
104
|
+
configDir="${dir_config}" $timeoutCmd $which_program $file_param "${script_params[@]}"
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
handle_env_split() {
|
|
108
|
+
if [[ ! $num_param ]]; then
|
|
109
|
+
num_param="1-max"
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
env_str_to_array
|
|
113
|
+
local tempArr=$(echo $num_param | sed "s/-max/-${array_length}/g" | sed "s/max-/${array_length}-/g" | perl -pe "s|(\d+)(-\|~\|_)(\d+)|{\1..\3}|g")
|
|
114
|
+
local runArr=($(eval echo $tempArr))
|
|
115
|
+
array_run=($(awk -v RS=' ' '!a[$1]++' <<<${runArr[@]}))
|
|
93
116
|
}
|
|
94
117
|
|
|
95
118
|
## 并发执行时,设定的 RandomDelay 不会生效,即所有任务立即执行
|
|
96
119
|
run_concurrent() {
|
|
97
120
|
local file_param="$1"
|
|
98
121
|
local env_param="$2"
|
|
99
|
-
local num_param=$(echo "$3" | perl -pe "s|.*$2(.*)|\1|")
|
|
122
|
+
local num_param=$(echo "$3" | perl -pe "s|.*$2(.*)|\1|" | awk '{$1=$1};1')
|
|
100
123
|
if [[ ! $env_param ]]; then
|
|
101
124
|
echo -e "\n 缺少并发运行的环境变量参数"
|
|
102
125
|
exit 1
|
|
103
126
|
fi
|
|
104
127
|
|
|
105
|
-
|
|
106
|
-
local tempArr=$(echo $num_param | sed "s/-max/-${#array[@]}/g" | sed "s/max-/${#array[@]}-/g" | perl -pe "s|(\d+)(-\|~\|_)(\d+)|{\1..\3}|g")
|
|
107
|
-
local runArr=($(eval echo $tempArr))
|
|
108
|
-
runArr=($(awk -v RS=' ' '!a[$1]++' <<<${runArr[@]}))
|
|
109
|
-
|
|
110
|
-
local n=0
|
|
111
|
-
for i in ${runArr[@]}; do
|
|
112
|
-
array_run[n]=${array[$i - 1]}
|
|
113
|
-
let n++
|
|
114
|
-
done
|
|
115
|
-
|
|
116
|
-
local cookieStr=$(
|
|
117
|
-
IFS="&"
|
|
118
|
-
echo "${array_run[*]}"
|
|
119
|
-
)
|
|
120
|
-
[[ ! -z $cookieStr ]] && export "${env_param}=${cookieStr}"
|
|
121
|
-
|
|
122
|
-
env_str_to_array
|
|
128
|
+
handle_env_split
|
|
123
129
|
single_log_time=$(date "+%Y-%m-%d-%H-%M-%S.%3N")
|
|
124
130
|
|
|
125
131
|
cd $dir_scripts
|
|
@@ -128,15 +134,24 @@ run_concurrent() {
|
|
|
128
134
|
cd ${relative_path}
|
|
129
135
|
file_param=${file_param/$relative_path\//}
|
|
130
136
|
fi
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
|
|
138
|
+
local j=0
|
|
139
|
+
for i in ${array_run[@]}; do
|
|
140
|
+
single_log_path="$dir_log/$log_dir/${single_log_time}_$((j + 1)).log"
|
|
141
|
+
let j++
|
|
142
|
+
|
|
143
|
+
if [[ $isJsOrPythonFile == 'false' ]]; then
|
|
144
|
+
export "${env_param}=${array[$i - 1]}"
|
|
145
|
+
clear_non_sh_env
|
|
146
|
+
fi
|
|
147
|
+
eval configDir="${dir_config}" envParam="${env_param}" numParam="${i}" $timeoutCmd $which_program $file_param "${script_params[@]}" &>$single_log_path &
|
|
135
148
|
done
|
|
136
149
|
|
|
137
150
|
wait
|
|
138
|
-
|
|
139
|
-
|
|
151
|
+
local k=0
|
|
152
|
+
for i in ${array_run[@]}; do
|
|
153
|
+
single_log_path="$dir_log/$log_dir/${single_log_time}_$((k + 1)).log"
|
|
154
|
+
let k++
|
|
140
155
|
cat $single_log_path
|
|
141
156
|
[[ -f $single_log_path ]] && rm -f $single_log_path
|
|
142
157
|
done
|
|
@@ -145,28 +160,27 @@ run_concurrent() {
|
|
|
145
160
|
run_designated() {
|
|
146
161
|
local file_param="$1"
|
|
147
162
|
local env_param="$2"
|
|
148
|
-
local num_param=$(echo "$3" | perl -pe "s|.*$2(.*)|\1|")
|
|
149
|
-
if [[ ! $env_param ]]
|
|
150
|
-
echo -e "\n 缺少单独运行的参数 task xxx.js desi Test
|
|
163
|
+
local num_param=$(echo "$3" | perl -pe "s|.*$2(.*)|\1|" | awk '{$1=$1};1')
|
|
164
|
+
if [[ ! $env_param ]]; then
|
|
165
|
+
echo -e "\n 缺少单独运行的参数 task xxx.js desi Test"
|
|
151
166
|
exit 1
|
|
152
167
|
fi
|
|
153
168
|
|
|
154
|
-
|
|
155
|
-
local tempArr=$(echo $num_param | sed "s/-max/-${#array[@]}/g" | sed "s/max-/${#array[@]}-/g" | perl -pe "s|(\d+)(-\|~\|_)(\d+)|{\1..\3}|g")
|
|
156
|
-
local runArr=($(eval echo $tempArr))
|
|
157
|
-
runArr=($(awk -v RS=' ' '!a[$1]++' <<<${runArr[@]}))
|
|
158
|
-
|
|
159
|
-
local n=0
|
|
160
|
-
for i in ${runArr[@]}; do
|
|
161
|
-
array_run[n]=${array[$i - 1]}
|
|
162
|
-
let n++
|
|
163
|
-
done
|
|
169
|
+
handle_env_split
|
|
164
170
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
if [[ $isJsOrPythonFile == 'false' ]]; then
|
|
172
|
+
local n=0
|
|
173
|
+
for i in ${array_run[@]}; do
|
|
174
|
+
array_str[n]=${array[$i - 1]}
|
|
175
|
+
let n++
|
|
176
|
+
done
|
|
177
|
+
local envStr=$(
|
|
178
|
+
IFS="&"
|
|
179
|
+
echo "${array_str[*]}"
|
|
180
|
+
)
|
|
181
|
+
[[ ! -z $envStr ]] && export "${env_param}=${envStr}"
|
|
182
|
+
clear_non_sh_env
|
|
183
|
+
fi
|
|
170
184
|
|
|
171
185
|
cd $dir_scripts
|
|
172
186
|
local relative_path="${file_param%/*}"
|
|
@@ -174,7 +188,8 @@ run_designated() {
|
|
|
174
188
|
cd ${relative_path}
|
|
175
189
|
file_param=${file_param/$relative_path\//}
|
|
176
190
|
fi
|
|
177
|
-
|
|
191
|
+
|
|
192
|
+
configDir="${dir_config}" envParam="${env_param}" numParam="${num_param}" $timeoutCmd $which_program $file_param "${script_params[@]}"
|
|
178
193
|
}
|
|
179
194
|
|
|
180
195
|
## 运行其他命令
|
|
@@ -190,12 +205,31 @@ run_else() {
|
|
|
190
205
|
|
|
191
206
|
shift
|
|
192
207
|
|
|
208
|
+
clear_non_sh_env
|
|
193
209
|
$timeoutCmd $which_program $file_param "$@"
|
|
194
210
|
}
|
|
195
211
|
|
|
196
212
|
## 命令检测
|
|
197
213
|
main() {
|
|
214
|
+
isJsOrPythonFile="false"
|
|
215
|
+
if [[ $1 == *.js ]] || [[ $1 == *.py ]] || [[ $1 == *.pyc ]] || [[ $1 == *.ts ]]; then
|
|
216
|
+
isJsOrPythonFile="true"
|
|
217
|
+
fi
|
|
218
|
+
if [[ -f $file_env ]]; then
|
|
219
|
+
get_env_array
|
|
220
|
+
if [[ $isJsOrPythonFile == 'true' ]]; then
|
|
221
|
+
export NODE_OPTIONS="${NODE_OPTIONS} -r ${preload_js_file}"
|
|
222
|
+
export PYTHONPATH="${PYTHONPATH}:${dir_preload}"
|
|
223
|
+
else
|
|
224
|
+
. $file_env
|
|
225
|
+
fi
|
|
226
|
+
fi
|
|
227
|
+
|
|
198
228
|
if [[ $1 == *.js ]] || [[ $1 == *.py ]] || [[ $1 == *.pyc ]] || [[ $1 == *.sh ]] || [[ $1 == *.ts ]]; then
|
|
229
|
+
if [[ $1 == *.sh ]]; then
|
|
230
|
+
timeoutCmd=""
|
|
231
|
+
fi
|
|
232
|
+
|
|
199
233
|
case $# in
|
|
200
234
|
1)
|
|
201
235
|
run_normal "$1"
|
|
@@ -229,4 +263,5 @@ handle_task_start "${task_shell_params[@]}"
|
|
|
229
263
|
run_task_before "${task_shell_params[@]}"
|
|
230
264
|
main "${task_shell_params[@]}"
|
|
231
265
|
run_task_after "${task_shell_params[@]}"
|
|
266
|
+
clear_env
|
|
232
267
|
handle_task_end "${task_shell_params[@]}"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require(`./env.js`);
|
|
2
|
+
|
|
3
|
+
function expandRange(rangeStr, max) {
|
|
4
|
+
const tempRangeStr = rangeStr
|
|
5
|
+
.trim()
|
|
6
|
+
.replace(/-max/g, `-${max}`)
|
|
7
|
+
.replace(/max-/g, `${max}-`);
|
|
8
|
+
|
|
9
|
+
return tempRangeStr.split(' ').flatMap((part) => {
|
|
10
|
+
const rangeMatch = part.match(/^(\d+)([-~_])(\d+)$/);
|
|
11
|
+
if (rangeMatch) {
|
|
12
|
+
const [, start, , end] = rangeMatch.map(Number);
|
|
13
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
14
|
+
}
|
|
15
|
+
return Number(part);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function run() {
|
|
20
|
+
if (process.env.envParam && process.env.numParam) {
|
|
21
|
+
const { envParam, numParam } = process.env;
|
|
22
|
+
const array = (process.env[envParam] || '').split('&');
|
|
23
|
+
const runArr = expandRange(numParam, array.length);
|
|
24
|
+
const arrayRun = runArr.map((i) => array[i - 1]);
|
|
25
|
+
const envStr = arrayRun.join('&');
|
|
26
|
+
process.env[envParam] = envStr;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
run();
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
import env
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def try_parse_int(value):
|
|
7
|
+
try:
|
|
8
|
+
return int(value)
|
|
9
|
+
except ValueError:
|
|
10
|
+
return None
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def expand_range(range_str, max_value):
|
|
14
|
+
temp_range_str = (
|
|
15
|
+
range_str.strip()
|
|
16
|
+
.replace("-max", f"-{max_value}")
|
|
17
|
+
.replace("max-", f"{max_value}-")
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
result = []
|
|
21
|
+
for part in temp_range_str.split(" "):
|
|
22
|
+
range_match = re.match(r"^(\d+)([-~_])(\d+)$", part)
|
|
23
|
+
if range_match:
|
|
24
|
+
start, _, end = map(try_parse_int, range_match.groups())
|
|
25
|
+
result.extend(range(start, end + 1))
|
|
26
|
+
else:
|
|
27
|
+
result.append(int(part))
|
|
28
|
+
|
|
29
|
+
return result
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def run():
|
|
33
|
+
env_param = os.getenv("envParam")
|
|
34
|
+
num_param = os.getenv("numParam")
|
|
35
|
+
|
|
36
|
+
if env_param and num_param:
|
|
37
|
+
array = (os.getenv(env_param) or "").split("&")
|
|
38
|
+
run_arr = expand_range(num_param, len(array))
|
|
39
|
+
array_run = [array[i - 1] for i in run_arr if i - 1 < len(array) and i > 0]
|
|
40
|
+
env_str = "&".join(array_run)
|
|
41
|
+
os.environ[env_param] = env_str
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
run()
|
package/shell/pub.sh
CHANGED
package/shell/share.sh
CHANGED
|
@@ -10,6 +10,7 @@ if [[ $QL_DATA_DIR ]]; then
|
|
|
10
10
|
fi
|
|
11
11
|
|
|
12
12
|
dir_shell=$dir_root/shell
|
|
13
|
+
dir_preload=$dir_shell/preload
|
|
13
14
|
dir_sample=$dir_root/sample
|
|
14
15
|
dir_static=$dir_root/static
|
|
15
16
|
dir_config=$dir_data/config
|
|
@@ -25,7 +26,10 @@ ql_static_repo=$dir_repo/static
|
|
|
25
26
|
|
|
26
27
|
## 文件
|
|
27
28
|
file_config_sample=$dir_sample/config.sample.sh
|
|
28
|
-
file_env=$
|
|
29
|
+
file_env=$dir_preload/env.sh
|
|
30
|
+
js_file_env=$dir_preload/env.js
|
|
31
|
+
py_file_env=$dir_preload/env.py
|
|
32
|
+
preload_js_file=$dir_preload/sitecustomize.js
|
|
29
33
|
file_sharecode=$dir_config/sharecode.sh
|
|
30
34
|
file_config_user=$dir_config/config.sh
|
|
31
35
|
file_auth_sample=$dir_sample/auth.sample.json
|
|
@@ -74,9 +78,6 @@ init_env() {
|
|
|
74
78
|
|
|
75
79
|
import_config() {
|
|
76
80
|
[[ -f $file_config_user ]] && . $file_config_user
|
|
77
|
-
if [[ $LOAD_ENV != 'false' ]] && [[ -f $file_env ]]; then
|
|
78
|
-
. $file_env
|
|
79
|
-
fi
|
|
80
81
|
|
|
81
82
|
ql_base_url=${QlBaseUrl:-"/"}
|
|
82
83
|
ql_port=${QlPort:-"5700"}
|
|
@@ -439,6 +440,19 @@ init_nginx() {
|
|
|
439
440
|
sed -i "s,IPV4_CONFIG,${ipv4Str},g" /etc/nginx/conf.d/front.conf
|
|
440
441
|
}
|
|
441
442
|
|
|
443
|
+
get_env_array() {
|
|
444
|
+
exported_variables=()
|
|
445
|
+
while IFS= read -r line; do
|
|
446
|
+
exported_variables+=("$line")
|
|
447
|
+
done < <(grep '^export ' $file_env | awk '{print $2}' | cut -d= -f1)
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
clear_env() {
|
|
451
|
+
for var in "${exported_variables[@]}"; do
|
|
452
|
+
unset "$var"
|
|
453
|
+
done
|
|
454
|
+
}
|
|
455
|
+
|
|
442
456
|
handle_task_start() {
|
|
443
457
|
[[ $ID ]] && update_cron "\"$ID\"" "0" "$$" "$log_path" "$begin_timestamp"
|
|
444
458
|
echo -e "## 开始执行... $begin_time\n"
|
package/shell/start.sh
CHANGED
package/shell/task.sh
CHANGED
|
@@ -19,13 +19,9 @@ define_program() {
|
|
|
19
19
|
elif [[ $file_param == *.py ]] || [[ $file_param == *.pyc ]]; then
|
|
20
20
|
which_program="python3"
|
|
21
21
|
elif [[ $file_param == *.sh ]]; then
|
|
22
|
-
which_program="
|
|
22
|
+
which_program="."
|
|
23
23
|
elif [[ $file_param == *.ts ]]; then
|
|
24
|
-
|
|
25
|
-
which_program="ts-node-transpile-only"
|
|
26
|
-
else
|
|
27
|
-
which_program="tsx"
|
|
28
|
-
fi
|
|
24
|
+
which_program="ts-node-transpile-only"
|
|
29
25
|
else
|
|
30
26
|
which_program=""
|
|
31
27
|
fi
|
|
@@ -24,6 +24,7 @@ if (process.env.QL_DATA_DIR) {
|
|
|
24
24
|
dataPath = process.env.QL_DATA_DIR.replace(/\/$/g, '');
|
|
25
25
|
}
|
|
26
26
|
const shellPath = path_1.default.join(rootPath, 'shell/');
|
|
27
|
+
const preloadPath = path_1.default.join(shellPath, 'preload/');
|
|
27
28
|
const tmpPath = path_1.default.join(rootPath, '.tmp/');
|
|
28
29
|
const samplePath = path_1.default.join(rootPath, 'sample/');
|
|
29
30
|
const configPath = path_1.default.join(dataPath, 'config/');
|
|
@@ -34,9 +35,9 @@ const dbPath = path_1.default.join(dataPath, 'db/');
|
|
|
34
35
|
const uploadPath = path_1.default.join(dataPath, 'upload/');
|
|
35
36
|
const sshdPath = path_1.default.join(dataPath, 'ssh.d/');
|
|
36
37
|
const systemLogPath = path_1.default.join(dataPath, 'syslog/');
|
|
37
|
-
const envFile = path_1.default.join(
|
|
38
|
-
const jsEnvFile = path_1.default.join(
|
|
39
|
-
const pyEnvFile = path_1.default.join(
|
|
38
|
+
const envFile = path_1.default.join(preloadPath, 'env.sh');
|
|
39
|
+
const jsEnvFile = path_1.default.join(preloadPath, 'env.js');
|
|
40
|
+
const pyEnvFile = path_1.default.join(preloadPath, 'env.py');
|
|
40
41
|
const confFile = path_1.default.join(configPath, 'config.sh');
|
|
41
42
|
const crontabFile = path_1.default.join(configPath, 'crontab.list');
|
|
42
43
|
const authConfigFile = path_1.default.join(configPath, 'auth.json');
|
|
@@ -13,6 +13,7 @@ let dataPath = path_1.default.join(rootPath, 'data/');
|
|
|
13
13
|
if (process.env.QL_DATA_DIR) {
|
|
14
14
|
dataPath = process.env.QL_DATA_DIR.replace(/\/$/g, '');
|
|
15
15
|
}
|
|
16
|
+
const preloadPath = path_1.default.join(rootPath, 'shell/preload/');
|
|
16
17
|
const configPath = path_1.default.join(dataPath, 'config/');
|
|
17
18
|
const scriptPath = path_1.default.join(dataPath, 'scripts/');
|
|
18
19
|
const logPath = path_1.default.join(dataPath, 'log/');
|
|
@@ -39,6 +40,7 @@ exports.default = async () => {
|
|
|
39
40
|
const authFileExist = await (0, util_1.fileExist)(authConfigFile);
|
|
40
41
|
const confFileExist = await (0, util_1.fileExist)(confFile);
|
|
41
42
|
const scriptDirExist = await (0, util_1.fileExist)(scriptPath);
|
|
43
|
+
const preloadDirExist = await (0, util_1.fileExist)(preloadPath);
|
|
42
44
|
const logDirExist = await (0, util_1.fileExist)(logPath);
|
|
43
45
|
const configDirExist = await (0, util_1.fileExist)(configPath);
|
|
44
46
|
const uploadDirExist = await (0, util_1.fileExist)(uploadPath);
|
|
@@ -57,6 +59,9 @@ exports.default = async () => {
|
|
|
57
59
|
if (!scriptDirExist) {
|
|
58
60
|
await promises_1.default.mkdir(scriptPath);
|
|
59
61
|
}
|
|
62
|
+
if (!preloadDirExist) {
|
|
63
|
+
await promises_1.default.mkdir(preloadPath);
|
|
64
|
+
}
|
|
60
65
|
if (!logDirExist) {
|
|
61
66
|
await promises_1.default.mkdir(logPath);
|
|
62
67
|
}
|
|
@@ -15,7 +15,7 @@ exports.default = async () => {
|
|
|
15
15
|
const scheduleService = typedi_1.Container.get(schedule_1.default);
|
|
16
16
|
const subscriptionService = typedi_1.Container.get(subscription_1.default);
|
|
17
17
|
// 生成内置token
|
|
18
|
-
let tokenCommand = `
|
|
18
|
+
let tokenCommand = `ts-node-transpile-only ${(0, path_1.join)(config_1.default.rootPath, 'back/token.ts')}`;
|
|
19
19
|
const tokenFile = (0, path_1.join)(config_1.default.rootPath, 'static/build/token.js');
|
|
20
20
|
if (await (0, util_1.fileExist)(tokenFile)) {
|
|
21
21
|
tokenCommand = `node ${tokenFile}`;
|
|
@@ -206,13 +206,12 @@ let EnvService = class EnvService {
|
|
|
206
206
|
.replace(/'/g, "'\\''")
|
|
207
207
|
.trim();
|
|
208
208
|
env_string += `export ${key}='${value}'\n`;
|
|
209
|
-
const _env_value =
|
|
209
|
+
const _env_value = `${group
|
|
210
210
|
.map((x) => x.value)
|
|
211
211
|
.join('&')
|
|
212
|
-
.replace(/\\/g, '\\\\')
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
py_env_string += `os.environ['${key}']=${_env_value}\n`;
|
|
212
|
+
.replace(/\\/g, '\\\\')}`;
|
|
213
|
+
js_env_string += `process.env.${key}=\`${_env_value.replace(/\`/g, '\\`')}\`;\n`;
|
|
214
|
+
py_env_string += `os.environ['${key}']='''${_env_value.replace(/\'/g, "\\'")}'''\n`;
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
217
|
}
|
|
@@ -31,6 +31,7 @@ const pLimit_1 = __importDefault(require("../shared/pLimit"));
|
|
|
31
31
|
const notify_1 = __importDefault(require("./notify"));
|
|
32
32
|
const schedule_1 = __importDefault(require("./schedule"));
|
|
33
33
|
const sock_1 = __importDefault(require("./sock"));
|
|
34
|
+
const os_1 = __importDefault(require("os"));
|
|
34
35
|
const util_2 = require("../config/util");
|
|
35
36
|
let SystemService = class SystemService {
|
|
36
37
|
constructor(logger, scheduleService, sockService) {
|
|
@@ -156,6 +157,9 @@ let SystemService = class SystemService {
|
|
|
156
157
|
}
|
|
157
158
|
async updateLinuxMirror(info, res, onEnd) {
|
|
158
159
|
const oDoc = await this.getSystemConfig();
|
|
160
|
+
if (os_1.default.platform() !== 'linux') {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
159
163
|
const command = await (0, util_2.updateLinuxMirrorFile)(info.linuxMirror || '');
|
|
160
164
|
let hasError = false;
|
|
161
165
|
this.scheduleService.runTask(command, {
|
package/version.yaml
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
version: 2.17.
|
|
2
|
-
changeLogLink: https://t.me/jiao_long/
|
|
3
|
-
publishTime: 2024-
|
|
1
|
+
version: 2.17.8
|
|
2
|
+
changeLogLink: https://t.me/jiao_long/419
|
|
3
|
+
publishTime: 2024-07-13 08:00
|
|
4
4
|
changeLog: |
|
|
5
|
-
1.
|
|
6
|
-
2.
|
|
7
|
-
|
|
8
|
-
4. npm 包支持 alpine 和 debian、ubuntu,修复 linux 依赖安装命令
|
|
5
|
+
1. 修改环境变量加载逻辑
|
|
6
|
+
2. 修复执行任务报错 Argument list too long
|
|
7
|
+
|