aaden-cli 1.6.115 → 1.6.117
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.
|
@@ -4,10 +4,23 @@ sudoS() { echo "Innerken322." | sudo -S -p '' "$@"; }
|
|
|
4
4
|
|
|
5
5
|
sudoS npm config set prefix /usr/local
|
|
6
6
|
cd || exit
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
sudoS
|
|
7
|
+
# 用 curl 下载并按 S3 ETag(单段上传 = MD5)校验,对了再装。以前用 axel:家目录里有旧的 ngrok.N 残留时
|
|
8
|
+
# 它把文件存成 ngrok.21 之类,后面 cp ngrok 找不到文件,坏掉的 /etc/aaden/ngrok 一直没换掉
|
|
9
|
+
# (10-08 的 1233:ngrok 启动即 SEGV,systemd 重启了 64 万次)。
|
|
10
|
+
sudoS rm -rf ngrok ngrok.st
|
|
11
|
+
rm -f ngrok.[0-9]* 2>/dev/null
|
|
12
|
+
NGROK_URL="https://aaden-storage.s3.eu-central-1.amazonaws.com/ngrok"
|
|
13
|
+
NGROK_TMP=$(mktemp)
|
|
14
|
+
curl -fsSL "$NGROK_URL" -o "$NGROK_TMP" --max-time 300
|
|
15
|
+
NGROK_WANT=$(curl -sfI "$NGROK_URL" --max-time 30 | awk 'tolower($1)=="etag:"{print $2}' | tr -d '"\r')
|
|
16
|
+
NGROK_GOT=$(md5sum "$NGROK_TMP" | cut -d' ' -f1)
|
|
17
|
+
if [ -s "$NGROK_TMP" ] && { [ -z "$NGROK_WANT" ] || [ "$NGROK_GOT" = "$NGROK_WANT" ]; }; then
|
|
18
|
+
sudoS install -m 755 "$NGROK_TMP" /etc/aaden/ngrok
|
|
19
|
+
echo "ngrok 已重新安装(md5 $NGROK_GOT)"
|
|
20
|
+
else
|
|
21
|
+
echo "ngrok 下载校验失败(下载 $NGROK_GOT / 期望 $NGROK_WANT),保留原文件"
|
|
22
|
+
fi
|
|
23
|
+
rm -f "$NGROK_TMP"
|
|
11
24
|
|
|
12
25
|
DeviceId=$(cat /var/www/html/Resource/config/config.ini | grep -e DeviceId | cut -d = -f 2 | grep '[1-9]*' | sed 's/"//g')
|
|
13
26
|
aaden-cli update-ngrok-config $DeviceId
|
|
@@ -33,6 +33,8 @@ report() {
|
|
|
33
33
|
echo "--- 服务日志"
|
|
34
34
|
sudoS journalctl -u "$SVC" -n 15 --no-pager -q 2>/dev/null
|
|
35
35
|
fi
|
|
36
|
+
echo "--- ngrok 文件"
|
|
37
|
+
echo "本机 md5 $(md5sum "$NGROK" 2>/dev/null | cut -d' ' -f1) / S3 $(curl -sfI https://aaden-storage.s3.eu-central-1.amazonaws.com/ngrok --max-time 15 | awk 'tolower($1)=="etag:"{print $2}' | tr -d '"\r')"
|
|
36
38
|
echo "--- 进程"
|
|
37
39
|
pgrep -a -f "$NGROK "
|
|
38
40
|
}
|
package/dist/index.js
CHANGED
|
@@ -121,6 +121,8 @@ const COMMANDS = {
|
|
|
121
121
|
/** 每条命令最多跑多久;latest.zip 全量在慢网络上要 20 分钟 */
|
|
122
122
|
const COMMAND_TIMEOUT_MS = 45 * 60 * 1000
|
|
123
123
|
const REPORT_INTERVAL_MS = 10 * 1000
|
|
124
|
+
/** 没有新输出也隔这么久回报一次:云端 30 分钟没回报就判失败,而下载 latest.zip 之类一声不吭能跑 20 分钟 */
|
|
125
|
+
const HEARTBEAT_MS = 60 * 1000
|
|
124
126
|
const MAX_OUTPUT = 60 * 1024
|
|
125
127
|
|
|
126
128
|
/** 每次 auto-upgrade 开始时写;cron(root)和补跑(aaden)都要能写,所以 chmod 666 */
|
|
@@ -277,9 +279,11 @@ function runOne(id, deviceId, shellCmd) {
|
|
|
277
279
|
})
|
|
278
280
|
child.stdout.on('data', append)
|
|
279
281
|
child.stderr.on('data', append)
|
|
282
|
+
let lastSent = Date.now()
|
|
280
283
|
const timer = setInterval(() => {
|
|
281
|
-
if (!dirty) return
|
|
284
|
+
if (!dirty && Date.now() - lastSent < HEARTBEAT_MS) return
|
|
282
285
|
dirty = false
|
|
286
|
+
lastSent = Date.now()
|
|
283
287
|
report(id, deviceId, output)
|
|
284
288
|
}, REPORT_INTERVAL_MS)
|
|
285
289
|
const killer = setTimeout(() => {
|
|
@@ -19179,7 +19183,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
|
|
|
19179
19183
|
/***/ ((module) => {
|
|
19180
19184
|
|
|
19181
19185
|
"use strict";
|
|
19182
|
-
module.exports = {"i8":"1.6.
|
|
19186
|
+
module.exports = {"i8":"1.6.117"};
|
|
19183
19187
|
|
|
19184
19188
|
/***/ })
|
|
19185
19189
|
|
|
@@ -34,6 +34,8 @@ const COMMANDS = {
|
|
|
34
34
|
/** 每条命令最多跑多久;latest.zip 全量在慢网络上要 20 分钟 */
|
|
35
35
|
const COMMAND_TIMEOUT_MS = 45 * 60 * 1000
|
|
36
36
|
const REPORT_INTERVAL_MS = 10 * 1000
|
|
37
|
+
/** 没有新输出也隔这么久回报一次:云端 30 分钟没回报就判失败,而下载 latest.zip 之类一声不吭能跑 20 分钟 */
|
|
38
|
+
const HEARTBEAT_MS = 60 * 1000
|
|
37
39
|
const MAX_OUTPUT = 60 * 1024
|
|
38
40
|
|
|
39
41
|
/** 每次 auto-upgrade 开始时写;cron(root)和补跑(aaden)都要能写,所以 chmod 666 */
|
|
@@ -190,9 +192,11 @@ function runOne(id, deviceId, shellCmd) {
|
|
|
190
192
|
})
|
|
191
193
|
child.stdout.on('data', append)
|
|
192
194
|
child.stderr.on('data', append)
|
|
195
|
+
let lastSent = Date.now()
|
|
193
196
|
const timer = setInterval(() => {
|
|
194
|
-
if (!dirty) return
|
|
197
|
+
if (!dirty && Date.now() - lastSent < HEARTBEAT_MS) return
|
|
195
198
|
dirty = false
|
|
199
|
+
lastSent = Date.now()
|
|
196
200
|
report(id, deviceId, output)
|
|
197
201
|
}, REPORT_INTERVAL_MS)
|
|
198
202
|
const killer = setTimeout(() => {
|