From f8080cddfc06643b64c70d18db6d22d98f2e5f84 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 10 Apr 2026 15:47:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=B8=20Sync=202026-04-10=2015:47:03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luci-app-momo/Makefile | 2 +- .../luci-static/resources/view/momo/log.js | 4 +- luci-app-openclaw/Makefile | 2 +- .../luasrc/controller/openclaw.lua | 10 +++- luci-app-openclaw/root/etc/init.d/openclaw | 46 ++++++++++++++----- .../share/openclaw/oc-config-interactive.js | 2 + .../root/usr/share/openclaw/oc-config.sh | 3 ++ luci-app-openclaw/scripts/build_ipk.sh | 2 +- luci-app-openclaw/scripts/build_run.sh | 2 +- 9 files changed, 54 insertions(+), 19 deletions(-) diff --git a/luci-app-momo/Makefile b/luci-app-momo/Makefile index c612361f..40b888d4 100644 --- a/luci-app-momo/Makefile +++ b/luci-app-momo/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_VERSION:=1.2.0 -PKG_RELEASE:=4 +PKG_RELEASE:=5 LUCI_TITLE:=LuCI Support for momo LUCI_DEPENDS:=+luci-base +momo diff --git a/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js b/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js index 7fdc9c5c..0bd81cf1 100644 --- a/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js +++ b/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js @@ -72,7 +72,7 @@ return view.extend({ poll.add(L.bind(function () { const option = this; return L.resolveDefault(momo.getAppLog()).then(function (log) { - option.getUIElement('placeholder').setValue(log); + option.getUIElement('log').setValue(log); }); }, o)); @@ -105,7 +105,7 @@ return view.extend({ poll.add(L.bind(function () { const option = this; return L.resolveDefault(momo.getCoreLog()).then(function (log) { - option.getUIElement('placeholder').setValue(log); + option.getUIElement('log').setValue(log); }); }, o)); diff --git a/luci-app-openclaw/Makefile b/luci-app-openclaw/Makefile index e22cfd25..d1335c66 100644 --- a/luci-app-openclaw/Makefile +++ b/luci-app-openclaw/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-openclaw PKG_VERSION:=$(strip $(shell cat $(CURDIR)/VERSION 2>/dev/null || echo "1.0.0")) -PKG_RELEASE:=10 +PKG_RELEASE:=11 PKG_MAINTAINER:=10000ge10000 <10000ge10000@users.noreply.github.com> PKG_LICENSE:=GPL-3.0 diff --git a/luci-app-openclaw/luasrc/controller/openclaw.lua b/luci-app-openclaw/luasrc/controller/openclaw.lua index f9babce5..75792d32 100644 --- a/luci-app-openclaw/luasrc/controller/openclaw.lua +++ b/luci-app-openclaw/luasrc/controller/openclaw.lua @@ -513,7 +513,15 @@ function action_uninstall() -- 设置 UCI enabled=0 sys.exec("uci set openclaw.main.enabled=0; uci commit openclaw 2>/dev/null") -- 删除 Node.js + OpenClaw 运行环境 (包含所有插件: qqbot, 飞书等) - sys.exec("rm -rf " .. install_path) + -- 尝试先解绑可能挂载的目录 + sys.exec("umount " .. install_path .. " 2>/dev/null") + -- 强制赋予最大权限避免 EACCES 阻挡 + sys.exec("chmod -R 777 " .. install_path .. " /root/.openclaw 2>/dev/null") + -- 删除 Node.js + OpenClaw 运行环境 + sys.exec("rm -rf " .. install_path) + -- OverlayFS 兼容: 确保 upper 层的残留也被暴力清空 + sys.exec("[ -d /overlay/upper" .. install_path .. " ] && rm -rf /overlay/upper" .. install_path .. " 2>/dev/null") + -- 清理旧数据迁移后可能残留的目录 sys.exec("rm -rf /root/.openclaw 2>/dev/null") -- 清理临时文件 diff --git a/luci-app-openclaw/root/etc/init.d/openclaw b/luci-app-openclaw/root/etc/init.d/openclaw index b3f6c6ca..95021b4b 100755 --- a/luci-app-openclaw/root/etc/init.d/openclaw +++ b/luci-app-openclaw/root/etc/init.d/openclaw @@ -216,7 +216,7 @@ if(d.plugins.installs){ const match=inst.installPath.match(/\/([^\/]+)\/?$/); if(match&&match[1]&&!d.plugins.allow.includes(match[1])){ d.plugins.allow.push(match[1]); - } + } } }); } @@ -284,27 +284,27 @@ fi if(!d.plugins.allow.includes(newName)){ d.plugins.allow[idx]=newName; modified=true; - }else{ + }else{ d.plugins.allow.splice(idx,1); modified=true; - } } } + } // 同时修复 plugins.entries 中的键名 if(d.plugins.entries && d.plugins.entries['openclaw-qqbot']){ if(!d.plugins.entries['@tencent-connect/openclaw-qqbot']){ d.plugins.entries['@tencent-connect/openclaw-qqbot']=d.plugins.entries['openclaw-qqbot']; - } + } delete d.plugins.entries['openclaw-qqbot']; modified=true; - } + } if(modified){ fs.writeFileSync('${CONFIG_FILE}',JSON.stringify(d,null,2)); console.log('FIXED'); - } - }catch(e){} + } + }catch(e){} " 2>/dev/null && chown openclaw:openclaw "$CONFIG_FILE" 2>/dev/null } fix_plugin_config @@ -388,20 +388,42 @@ fs.writeFileSync(f, JSON.stringify(d, null, 2)); } _ensure_critical_config + # v2026.4.10: doctor --fix 后再次同步 token (关键!) + # doctor --fix 可能修改了 JSON 中的 token,必须同步回 UCI + # 否则 LuCI 显示的 token 与 Gateway 实际使用的 token 不一致 + _sync_token_after_doctor() { + [ ! -f "$CONFIG_FILE" ] && return + [ ! -x "$NODE_BIN" ] && return + local json_token uci_token + json_token=$("$NODE_BIN" -e " +try{const d=JSON.parse(require('fs').readFileSync('${CONFIG_FILE}','utf8')); +if(d.gateway&&d.gateway.auth&&d.gateway.auth.token)process.stdout.write(d.gateway.auth.token);}catch(e){} + " 2>/dev/null) + uci_token=$(uci -q get openclaw.main.token || echo "") + + # JSON 有 token 且与 UCI 不同时,以 JSON 为准更新 UCI + if [ -n "$json_token" ] && [ "$json_token" != "$uci_token" ]; then + uci set openclaw.main.token="$json_token" + uci commit openclaw 2>/dev/null + logger -t openclaw "Token 同步 (doctor 后): JSON -> UCI" + fi + } + _sync_token_after_doctor + # v2026.4.10: 最终权限修复 - 确保 Gateway 启动前所有数据目录权限正确 # doctor --fix 或 _ensure_critical_config 可能创建新的目录/文件 # 关键: agents 目录下的 agent 子目录必须可被 openclaw 用户写入 - find "${OC_STATE_DIR}" -user root -type d -exec chown openclaw:openclaw {} \; 2>/dev/null || true - find "${OC_STATE_DIR}" -user root -type f -exec chown openclaw:openclaw {} \; 2>/dev/null || true + find "${OC_DATA}/.openclaw" -user root -type d -exec chown openclaw:openclaw {} \; 2>/dev/null || true + find "${OC_DATA}/.openclaw" -user root -type f -exec chown openclaw:openclaw {} \; 2>/dev/null || true # 特别确保 agents/main/agent 目录权限 (模型配置写入目录) - local agent_dir="${OC_STATE_DIR}/agents/main/agent" + local agent_dir="${OC_DATA}/.openclaw/agents/main/agent" if [ -d "$agent_dir" ]; then chown openclaw:openclaw "$agent_dir" 2>/dev/null || true chmod 755 "$agent_dir" 2>/dev/null || true fi # extensions 目录除外 - 必须保持 root 权限 (OpenClaw 安全要求) - if [ -d "${OC_STATE_DIR}/extensions" ]; then - chown -R root:root "${OC_STATE_DIR}/extensions" 2>/dev/null || true + if [ -d "${OC_DATA}/.openclaw/extensions" ]; then + chown -R root:root "${OC_DATA}/.openclaw/extensions" 2>/dev/null || true fi # Patch iframe 安全头,允许 LuCI 嵌入 diff --git a/luci-app-openclaw/root/usr/share/openclaw/oc-config-interactive.js b/luci-app-openclaw/root/usr/share/openclaw/oc-config-interactive.js index 0143e735..fef9e5c4 100644 --- a/luci-app-openclaw/root/usr/share/openclaw/oc-config-interactive.js +++ b/luci-app-openclaw/root/usr/share/openclaw/oc-config-interactive.js @@ -95,6 +95,7 @@ function writeConfig(config) { fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2)); try { execSync(`chown openclaw:openclaw "${CONFIG_FILE}"`, { stdio: 'ignore' }); + execSync(`find "${OC_STATE_DIR}" -user root ! -path "*/extensions*" -exec chown openclaw:openclaw {} \; 2>/dev/null || true`, { stdio: 'ignore' }); } catch {} } @@ -221,6 +222,7 @@ function authSetApikey(provider, apiKey, profileId) { fs.writeFileSync(authFile, JSON.stringify(authData, null, 2)); try { execSync(`chown openclaw:openclaw "${authFile}"`, { stdio: 'ignore' }); + execSync(`find "${OC_STATE_DIR}" -user root ! -path "*/extensions*" -exec chown openclaw:openclaw {} \; 2>/dev/null || true`, { stdio: 'ignore' }); } catch {} } diff --git a/luci-app-openclaw/root/usr/share/openclaw/oc-config.sh b/luci-app-openclaw/root/usr/share/openclaw/oc-config.sh index 3c06136b..41dc2398 100755 --- a/luci-app-openclaw/root/usr/share/openclaw/oc-config.sh +++ b/luci-app-openclaw/root/usr/share/openclaw/oc-config.sh @@ -74,6 +74,7 @@ oc_cmd() { "$NODE_BIN" "$OC_ENTRY" "$@" 2>&1 local rc=$? # 修复权限: oc_cmd 以 root 运行但配置文件应属于 openclaw 用户 + find "$OC_STATE_DIR" -user root ! -path "*/extensions*" -exec chown openclaw:openclaw {} \; 2>/dev/null || true chown openclaw:openclaw "$CONFIG_FILE" 2>/dev/null || true chown openclaw:openclaw "${CONFIG_FILE}.bak" 2>/dev/null || true return $rc @@ -2495,6 +2496,7 @@ launch_interactive_menu() { "$NODE_BIN" "$OC_INTERACTIVE" 2>&1 local rc=$? + find "$OC_STATE_DIR" -user root ! -path "*/extensions*" -exec chown openclaw:openclaw {} \; 2>/dev/null || true # 返回后刷新配置权限 chown openclaw:openclaw "$CONFIG_FILE" 2>/dev/null || true return $rc @@ -2512,6 +2514,7 @@ launch_interactive_model_config() { "$NODE_BIN" "$OC_INTERACTIVE" model 2>&1 local rc=$? + find "$OC_STATE_DIR" -user root ! -path "*/extensions*" -exec chown openclaw:openclaw {} \; 2>/dev/null || true chown openclaw:openclaw "$CONFIG_FILE" 2>/dev/null || true return $rc } diff --git a/luci-app-openclaw/scripts/build_ipk.sh b/luci-app-openclaw/scripts/build_ipk.sh index cc1c452e..70d5aa58 100755 --- a/luci-app-openclaw/scripts/build_ipk.sh +++ b/luci-app-openclaw/scripts/build_ipk.sh @@ -68,7 +68,7 @@ mkdir -p "$DATA_DIR/usr/share/openclaw" cp "$PKG_DIR/VERSION" "$DATA_DIR/usr/share/openclaw/VERSION" cp "$PKG_DIR/root/usr/share/openclaw/oc-config.sh" "$DATA_DIR/usr/share/openclaw/" chmod +x "$DATA_DIR/usr/share/openclaw/oc-config.sh" -cp "$PKG_DIR/root/usr/share/openclaw/web-pty.js" "$DATA_DIR/usr/share/openclaw/" +cp "$PKG_DIR/root/usr/share/openclaw/"*.js "$DATA_DIR/usr/share/openclaw/" # Web PTY UI cp -r "$PKG_DIR/root/usr/share/openclaw/ui" "$DATA_DIR/usr/share/openclaw/" diff --git a/luci-app-openclaw/scripts/build_run.sh b/luci-app-openclaw/scripts/build_run.sh index 4ca62352..2133a748 100755 --- a/luci-app-openclaw/scripts/build_run.sh +++ b/luci-app-openclaw/scripts/build_run.sh @@ -71,7 +71,7 @@ install_files() { cp "$PKG_DIR/VERSION" "$dest/usr/share/openclaw/VERSION" cp "$PKG_DIR/root/usr/share/openclaw/oc-config.sh" "$dest/usr/share/openclaw/" chmod +x "$dest/usr/share/openclaw/oc-config.sh" - cp "$PKG_DIR/root/usr/share/openclaw/web-pty.js" "$dest/usr/share/openclaw/" + cp "$PKG_DIR/root/usr/share/openclaw/"*.js "$dest/usr/share/openclaw/" # Web PTY UI (recursive copy) cp -r "$PKG_DIR/root/usr/share/openclaw/ui" "$dest/usr/share/openclaw/"