@whyour/qinglong 0.21.2 → 2.17.8-rc
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 +73 -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-rc",
|
|
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
|
@@ -75,6 +75,12 @@ env_str_to_array() {
|
|
|
75
75
|
read -ra array <<<"${!env_param}"
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
clear_non_sh_env() {
|
|
79
|
+
if [[ $file_param != *.sh ]]; then
|
|
80
|
+
clear_env
|
|
81
|
+
fi
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
## 正常运行单个脚本,$1:传入参数
|
|
79
85
|
run_normal() {
|
|
80
86
|
local file_param=$1
|
|
@@ -89,37 +95,34 @@ run_normal() {
|
|
|
89
95
|
file_param=${file_param/$relative_path\//}
|
|
90
96
|
fi
|
|
91
97
|
|
|
92
|
-
|
|
98
|
+
if [[ $isJsOrPythonFile == 'false' ]]; then
|
|
99
|
+
clear_non_sh_env
|
|
100
|
+
fi
|
|
101
|
+
configDir="${dir_config}" $timeoutCmd $which_program $file_param "${script_params[@]}"
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
handle_env_split() {
|
|
105
|
+
if [[ ! $num_param ]]; then
|
|
106
|
+
num_param="1-max"
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
env_str_to_array
|
|
110
|
+
local tempArr=$(echo $num_param | sed "s/-max/-${#array[@]}/g" | sed "s/max-/${#array[@]}-/g" | perl -pe "s|(\d+)(-\|~\|_)(\d+)|{\1..\3}|g")
|
|
111
|
+
local runArr=($(eval echo $tempArr))
|
|
112
|
+
array_run=($(awk -v RS=' ' '!a[$1]++' <<<${runArr[@]}))
|
|
93
113
|
}
|
|
94
114
|
|
|
95
115
|
## 并发执行时,设定的 RandomDelay 不会生效,即所有任务立即执行
|
|
96
116
|
run_concurrent() {
|
|
97
117
|
local file_param="$1"
|
|
98
118
|
local env_param="$2"
|
|
99
|
-
local num_param=$(echo "$3" | perl -pe "s|.*$2(.*)|\1|")
|
|
119
|
+
local num_param=$(echo "$3" | perl -pe "s|.*$2(.*)|\1|" | awk '{$1=$1};1')
|
|
100
120
|
if [[ ! $env_param ]]; then
|
|
101
121
|
echo -e "\n 缺少并发运行的环境变量参数"
|
|
102
122
|
exit 1
|
|
103
123
|
fi
|
|
104
124
|
|
|
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
|
|
125
|
+
handle_env_split
|
|
123
126
|
single_log_time=$(date "+%Y-%m-%d-%H-%M-%S.%3N")
|
|
124
127
|
|
|
125
128
|
cd $dir_scripts
|
|
@@ -128,15 +131,24 @@ run_concurrent() {
|
|
|
128
131
|
cd ${relative_path}
|
|
129
132
|
file_param=${file_param/$relative_path\//}
|
|
130
133
|
fi
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
|
|
135
|
+
local j=0
|
|
136
|
+
for i in ${array_run[@]}; do
|
|
137
|
+
single_log_path="$dir_log/$log_dir/${single_log_time}_$((j + 1)).log"
|
|
138
|
+
let j++
|
|
139
|
+
|
|
140
|
+
if [[ $isJsOrPythonFile == 'false' ]]; then
|
|
141
|
+
export "${env_param}=${array[$i - 1]}"
|
|
142
|
+
clear_non_sh_env
|
|
143
|
+
fi
|
|
144
|
+
eval configDir="${dir_config}" envParam="${env_param}" numParam="${i}" $timeoutCmd $which_program $file_param "${script_params[@]}" &>$single_log_path &
|
|
135
145
|
done
|
|
136
146
|
|
|
137
147
|
wait
|
|
138
|
-
|
|
139
|
-
|
|
148
|
+
local k=0
|
|
149
|
+
for i in ${array_run[@]}; do
|
|
150
|
+
single_log_path="$dir_log/$log_dir/${single_log_time}_$((k + 1)).log"
|
|
151
|
+
let k++
|
|
140
152
|
cat $single_log_path
|
|
141
153
|
[[ -f $single_log_path ]] && rm -f $single_log_path
|
|
142
154
|
done
|
|
@@ -145,28 +157,27 @@ run_concurrent() {
|
|
|
145
157
|
run_designated() {
|
|
146
158
|
local file_param="$1"
|
|
147
159
|
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
|
|
160
|
+
local num_param=$(echo "$3" | perl -pe "s|.*$2(.*)|\1|" | awk '{$1=$1};1')
|
|
161
|
+
if [[ ! $env_param ]]; then
|
|
162
|
+
echo -e "\n 缺少单独运行的参数 task xxx.js desi Test"
|
|
151
163
|
exit 1
|
|
152
164
|
fi
|
|
153
165
|
|
|
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[@]}))
|
|
166
|
+
handle_env_split
|
|
158
167
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
if [[ $isJsOrPythonFile == 'false' ]]; then
|
|
169
|
+
local n=0
|
|
170
|
+
for i in ${array_run[@]}; do
|
|
171
|
+
array_str[n]=${array[$i - 1]}
|
|
172
|
+
let n++
|
|
173
|
+
done
|
|
174
|
+
local envStr=$(
|
|
175
|
+
IFS="&"
|
|
176
|
+
echo "${array_str[*]}"
|
|
177
|
+
)
|
|
178
|
+
[[ ! -z $envStr ]] && export "${env_param}=${envStr}"
|
|
179
|
+
clear_non_sh_env
|
|
180
|
+
fi
|
|
170
181
|
|
|
171
182
|
cd $dir_scripts
|
|
172
183
|
local relative_path="${file_param%/*}"
|
|
@@ -174,7 +185,8 @@ run_designated() {
|
|
|
174
185
|
cd ${relative_path}
|
|
175
186
|
file_param=${file_param/$relative_path\//}
|
|
176
187
|
fi
|
|
177
|
-
|
|
188
|
+
|
|
189
|
+
configDir="${dir_config}" envParam="${env_param}" numParam="${num_param}" $timeoutCmd $which_program $file_param "${script_params[@]}"
|
|
178
190
|
}
|
|
179
191
|
|
|
180
192
|
## 运行其他命令
|
|
@@ -190,11 +202,26 @@ run_else() {
|
|
|
190
202
|
|
|
191
203
|
shift
|
|
192
204
|
|
|
205
|
+
clear_non_sh_env
|
|
193
206
|
$timeoutCmd $which_program $file_param "$@"
|
|
194
207
|
}
|
|
195
208
|
|
|
196
209
|
## 命令检测
|
|
197
210
|
main() {
|
|
211
|
+
isJsOrPythonFile="false"
|
|
212
|
+
if [[ $1 == *.js ]] || [[ $1 == *.py ]] || [[ $1 == *.pyc ]] || [[ $1 == *.ts ]]; then
|
|
213
|
+
isJsOrPythonFile="true"
|
|
214
|
+
fi
|
|
215
|
+
if [[ -f $file_env ]]; then
|
|
216
|
+
if [[ $isJsOrPythonFile == 'true' ]]; then
|
|
217
|
+
export NODE_OPTIONS="${NODE_OPTIONS} -r ${preload_js_file}"
|
|
218
|
+
export PYTHONPATH="${PYTHONPATH}:${dir_preload}"
|
|
219
|
+
else
|
|
220
|
+
get_env_array
|
|
221
|
+
. $file_env
|
|
222
|
+
fi
|
|
223
|
+
fi
|
|
224
|
+
|
|
198
225
|
if [[ $1 == *.js ]] || [[ $1 == *.py ]] || [[ $1 == *.pyc ]] || [[ $1 == *.sh ]] || [[ $1 == *.ts ]]; then
|
|
199
226
|
case $# in
|
|
200
227
|
1)
|
|
@@ -229,4 +256,5 @@ handle_task_start "${task_shell_params[@]}"
|
|
|
229
256
|
run_task_before "${task_shell_params[@]}"
|
|
230
257
|
main "${task_shell_params[@]}"
|
|
231
258
|
run_task_after "${task_shell_params[@]}"
|
|
259
|
+
clear_env
|
|
232
260
|
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}'''\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
|
+
|