@leoqlin/openclaw-qqbot 1.6.12 → 1.6.14
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.
|
@@ -29,11 +29,15 @@ export function createMediaTagRegex() {
|
|
|
29
29
|
export function fixPathEncoding(mediaPath, log) {
|
|
30
30
|
// 1. 双反斜杠 -> 单反斜杠(Markdown 转义)
|
|
31
31
|
let result = mediaPath.replace(/\\\\/g, "\\");
|
|
32
|
+
// Skip octal escape decoding for Windows local paths (e.g. C:\Users\1\file.txt)
|
|
33
|
+
// where backslash-digit sequences like \1, \2 ... \7 are directory separators,
|
|
34
|
+
// not octal escape sequences.
|
|
35
|
+
const isWinLocal = /^[a-zA-Z]:[\\/]/.test(mediaPath) || mediaPath.startsWith("\\\\");
|
|
32
36
|
// 2. 八进制转义序列 + UTF-8 双重编码修复
|
|
33
37
|
try {
|
|
34
38
|
const hasOctal = /\\[0-7]{1,3}/.test(result);
|
|
35
39
|
const hasNonASCII = /[\u0080-\u00FF]/.test(result);
|
|
36
|
-
if (hasOctal || hasNonASCII) {
|
|
40
|
+
if (!isWinLocal && (hasOctal || hasNonASCII)) {
|
|
37
41
|
log?.debug?.(`Decoding path with mixed encoding: ${result}`);
|
|
38
42
|
// Step 1: 将八进制转义转换为字节
|
|
39
43
|
let decoded = result.replace(/\\([0-7]{1,3})/g, (_, octal) => String.fromCharCode(parseInt(octal, 8)));
|
package/package.json
CHANGED
|
@@ -103,6 +103,18 @@ cleanup_config_snapshot() {
|
|
|
103
103
|
[ -n "$CONFIG_SNAPSHOT_FILE" ] && rm -f "$CONFIG_SNAPSHOT_FILE" 2>/dev/null || true
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
# _PREV_RELOAD_MODE: 安装前读取的原始值
|
|
107
|
+
# 非空 → config set 恢复;空(配置中本无此项)→ config unset 删除我们写入的值
|
|
108
|
+
_PREV_RELOAD_MODE=""
|
|
109
|
+
restore_reload_mode() {
|
|
110
|
+
if [ -n "$_PREV_RELOAD_MODE" ]; then
|
|
111
|
+
openclaw config set gateway.reload.mode "$_PREV_RELOAD_MODE" 2>/dev/null || true
|
|
112
|
+
else
|
|
113
|
+
openclaw config unset gateway.reload.mode 2>/dev/null || true
|
|
114
|
+
fi
|
|
115
|
+
_PREV_RELOAD_MODE="" # 防止重复执行
|
|
116
|
+
}
|
|
117
|
+
|
|
106
118
|
rollback_plugin_dir() {
|
|
107
119
|
local reason="${1:-未知原因}"
|
|
108
120
|
if [ -n "$BACKUP_DIR" ] && [ -d "$BACKUP_DIR/$PLUGIN_ID" ]; then
|
|
@@ -317,6 +329,7 @@ cleanup_on_exit() {
|
|
|
317
329
|
|
|
318
330
|
[ -n "$TEMP_CONFIG_FILE" ] && rm -f "$TEMP_CONFIG_FILE" 2>/dev/null || true
|
|
319
331
|
[ -n "$BACKUP_DIR" ] && rm -rf "$BACKUP_DIR" 2>/dev/null || true
|
|
332
|
+
restore_reload_mode
|
|
320
333
|
cleanup_config_snapshot
|
|
321
334
|
cleanup_pack
|
|
322
335
|
find "${EXTENSIONS_DIR:-/dev/null}" -maxdepth 1 -name ".openclaw-install-stage-*" -exec rm -rf {} + 2>/dev/null || true
|
|
@@ -470,13 +483,21 @@ verify_builtin_disabled() {
|
|
|
470
483
|
# ============================================================================
|
|
471
484
|
echo ""
|
|
472
485
|
|
|
486
|
+
# 快照提前到所有写操作前(包括 [前置] 的 disable_builtin_plugins)
|
|
487
|
+
snapshot_config
|
|
488
|
+
|
|
489
|
+
# hybrid 模式下写 openclaw.json 会触发 gateway restart,导致脚本被 cgroup kill
|
|
490
|
+
# 在整个安装窗口内切换为 hot(只热更新,不重启),退出前从变量恢复原值
|
|
491
|
+
# 原值为空说明用户从未手动设置过,退出时 unset 删掉我们写入的值
|
|
492
|
+
_PREV_RELOAD_MODE="$(node -e "try{const c=JSON.parse(require('fs').readFileSync('$CONFIG_FILE','utf8'));process.stdout.write(c?.gateway?.reload?.mode||'')}catch{}" 2>/dev/null || true)"
|
|
493
|
+
openclaw config set gateway.reload.mode hot 2>/dev/null || true
|
|
494
|
+
|
|
473
495
|
# 默认禁用内置冲突插件(openclaw ≥2026.3.31 内置了 qqbot 插件,与我们的 openclaw-qqbot 冲突)
|
|
474
496
|
echo "[前置] 检查并禁用内置冲突插件..."
|
|
475
497
|
disable_builtin_plugins
|
|
476
498
|
echo ""
|
|
477
499
|
|
|
478
500
|
echo "[1/4] 安装/升级插件..."
|
|
479
|
-
snapshot_config
|
|
480
501
|
setup_temp_config
|
|
481
502
|
|
|
482
503
|
# 清理历史遗留 ID 的配置记录(qqbot/openclaw-qq 是旧版本使用的 ID,
|
|
@@ -773,6 +794,8 @@ fi
|
|
|
773
794
|
# ============================================================================
|
|
774
795
|
echo ""
|
|
775
796
|
|
|
797
|
+
restore_reload_mode
|
|
798
|
+
|
|
776
799
|
# startup-marker 防重复通知
|
|
777
800
|
if [ -n "$NEW_VERSION" ] && [ "$NEW_VERSION" != "unknown" ]; then
|
|
778
801
|
MARKER_DIR="$OPENCLAW_HOME/qqbot/data"; mkdir -p "$MARKER_DIR"
|
package/src/utils/media-send.ts
CHANGED
|
@@ -72,12 +72,16 @@ export function fixPathEncoding(mediaPath: string, log?: { debug?: (msg: string)
|
|
|
72
72
|
// 1. 双反斜杠 -> 单反斜杠(Markdown 转义)
|
|
73
73
|
let result = mediaPath.replace(/\\\\/g, "\\");
|
|
74
74
|
|
|
75
|
+
// Skip octal escape decoding for Windows local paths (e.g. C:\Users\1\file.txt)
|
|
76
|
+
// where backslash-digit sequences like \1, \2 ... \7 are directory separators,
|
|
77
|
+
// not octal escape sequences.
|
|
78
|
+
const isWinLocal = /^[a-zA-Z]:[\\/]/.test(mediaPath) || mediaPath.startsWith("\\\\");
|
|
75
79
|
// 2. 八进制转义序列 + UTF-8 双重编码修复
|
|
76
80
|
try {
|
|
77
81
|
const hasOctal = /\\[0-7]{1,3}/.test(result);
|
|
78
82
|
const hasNonASCII = /[\u0080-\u00FF]/.test(result);
|
|
79
83
|
|
|
80
|
-
if (hasOctal || hasNonASCII) {
|
|
84
|
+
if (!isWinLocal && (hasOctal || hasNonASCII)) {
|
|
81
85
|
log?.debug?.(`Decoding path with mixed encoding: ${result}`);
|
|
82
86
|
|
|
83
87
|
// Step 1: 将八进制转义转换为字节
|