🏅 Sync 2026-04-10 20:27:54

This commit is contained in:
github-actions[bot] 2026-04-10 20:27:54 +08:00
parent f77cc351d0
commit 3981d90bc4
5 changed files with 90 additions and 45 deletions

View File

@ -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:=13
PKG_RELEASE:=14
PKG_MAINTAINER:=10000ge10000 <10000ge10000@users.noreply.github.com>
PKG_LICENSE:=GPL-3.0

View File

@ -1196,23 +1196,31 @@ function action_wechat_install()
-- 在启动安装前,确保网关端口可用(自动清理残留 gateway 进程)
local port = uci:get("openclaw", "main", "port") or "18789"
ensure_port_free(port)
local install_cmd = string.format(
"( " ..
"echo '开始安装微信插件...' > /tmp/openclaw-wechat-install.log; " ..
"echo '安装路径: %s' >> /tmp/openclaw-wechat-install.log; " ..
"echo 'npx 路径: %s' >> /tmp/openclaw-wechat-install.log; " ..
-- 修复 npm 缓存目录权限 (避免 root 创建的缓存导致 openclaw 用户写入失败)
"chown -R openclaw:openclaw %s/.npm 2>/dev/null; " ..
"cd %s && " ..
"su -s /bin/sh openclaw -c 'HOME=%s OPENCLAW_HOME=%s OPENCLAW_STATE_DIR=%s/.openclaw " ..
"PATH=%s/node/bin:%s/global/bin:$PATH " ..
"%s -y @tencent-weixin/openclaw-weixin-cli install' >> /tmp/openclaw-wechat-install.log 2>&1; " ..
"RC=$?; echo $RC > /tmp/openclaw-wechat-install.exit; " ..
"if [ $RC -eq 0 ]; then echo '✅ 微信插件安装成功!' >> /tmp/openclaw-wechat-install.log; " ..
"else echo '❌ 安装失败 (exit: '$RC')' >> /tmp/openclaw-wechat-install.log; fi " ..
") & echo $! > /tmp/openclaw-wechat-install.pid",
install_path, npx_bin, oc_data, install_path, oc_data, oc_data, oc_data, install_path, install_path, npx_bin
) sys.exec(install_cmd)
-- 微信插件安装目录路径 (用于安装后权限修复)
local wechat_ext_dir = install_path .. "/data/.openclaw/extensions/openclaw-weixin"
local install_cmd = string.format(
"( " ..
"echo '开始安装微信插件...' > /tmp/openclaw-wechat-install.log; " ..
"echo '安装路径: %s' >> /tmp/openclaw-wechat-install.log; " ..
"echo 'npx 路径: %s' >> /tmp/openclaw-wechat-install.log; " ..
-- 修复 npm 缓存目录权限 (避免 root 创建的缓存导致 openclaw 用户写入失败)
"chown -R openclaw:openclaw %s/.npm 2>/dev/null; " ..
"cd %s && " ..
"su -s /bin/sh openclaw -c 'HOME=%s OPENCLAW_HOME=%s OPENCLAW_STATE_DIR=%s/.openclaw " ..
"PATH=%s/node/bin:%s/global/bin:$PATH " ..
"%s -y @tencent-weixin/openclaw-weixin-cli install' >> /tmp/openclaw-wechat-install.log 2>&1; " ..
"RC=$?; echo $RC > /tmp/openclaw-wechat-install.exit; " ..
-- 关键修复: 安装完成后强制修复插件目录权限 (确保 Gateway 可读取插件)
-- 原因: npx/npm 以 root 身份创建目录,默认权限 700 导致其他用户无法读取
-- 注意: 保持 root:root 属主 (OpenClaw v2026.4.9+ 安全要求),仅修复权限模式
"chown -R root:root %s 2>/dev/null; chmod -R 755 %s 2>/dev/null; " ..
"if [ $RC -eq 0 ]; then echo '✅ 微信插件安装成功!' >> /tmp/openclaw-wechat-install.log; " ..
"else echo '❌ 安装失败 (exit: '$RC')' >> /tmp/openclaw-wechat-install.log; fi " ..
") & echo $! > /tmp/openclaw-wechat-install.pid",
install_path, npx_bin, oc_data, install_path, oc_data, oc_data, oc_data, install_path, install_path, npx_bin,
wechat_ext_dir, wechat_ext_dir
)
sys.exec(install_cmd)
http.prepare_content("application/json")
http.write_json({ status = "ok", message = "微信插件安装已在后台启动..." })
@ -1529,28 +1537,34 @@ function action_wechat_upgrade_plugin()
return
end
-- 后台执行升级 (其实就是重新安装最新版)
-- 后台执行升级 (其实就是重新安装最新版)
-- 在启动升级前,确保网关端口可用(自动清理残留 gateway 进程)
local port = uci:get("openclaw", "main", "port") or "18789"
ensure_port_free(port)
-- 微信插件安装目录路径 (用于升级后权限修复)
local wechat_ext_dir = install_path .. "/data/.openclaw/extensions/openclaw-weixin"
local upgrade_cmd = string.format(
"( " ..
"echo '正在升级微信插件...' > /tmp/openclaw-wechat-install.log; " ..
"echo '安装路径: %s' >> /tmp/openclaw-wechat-install.log; " ..
"echo 'npx 路径: %s' >> /tmp/openclaw-wechat-install.log; " ..
-- 修复 npm 缓存目录权限 (避免 root 创建的缓存导致 openclaw 用户写入失败)
"chown -R openclaw:openclaw %s/.npm 2>/dev/null; " ..
"cd %s && " ..
"su -s /bin/sh openclaw -c 'HOME=%s OPENCLAW_HOME=%s OPENCLAW_STATE_DIR=%s/.openclaw " ..
"PATH=%s/node/bin:%s/global/bin:$PATH " ..
"%s -y @tencent-weixin/openclaw-weixin-cli install' >> /tmp/openclaw-wechat-install.log 2>&1; " ..
"RC=$?; echo $RC > /tmp/openclaw-wechat-install.exit; " ..
"if [ $RC -eq 0 ]; then echo '✅ 微信插件升级成功!' >> /tmp/openclaw-wechat-install.log; " ..
"else echo '❌ 升级失败 (exit: '$RC')' >> /tmp/openclaw-wechat-install.log; fi " ..
") & echo $! > /tmp/openclaw-wechat-install.pid",
install_path, npx_bin, oc_data, install_path, oc_data, oc_data, oc_data, install_path, install_path, npx_bin
) sys.exec(upgrade_cmd)
"( " ..
"echo '正在升级微信插件...' > /tmp/openclaw-wechat-install.log; " ..
"echo '安装路径: %s' >> /tmp/openclaw-wechat-install.log; " ..
"echo 'npx 路径: %s' >> /tmp/openclaw-wechat-install.log; " ..
-- 修复 npm 缓存目录权限 (避免 root 创建的缓存导致 openclaw 用户写入失败)
"chown -R openclaw:openclaw %s/.npm 2>/dev/null; " ..
"cd %s && " ..
"su -s /bin/sh openclaw -c 'HOME=%s OPENCLAW_HOME=%s OPENCLAW_STATE_DIR=%s/.openclaw " ..
"PATH=%s/node/bin:%s/global/bin:$PATH " ..
"%s -y @tencent-weixin/openclaw-weixin-cli install' >> /tmp/openclaw-wechat-install.log 2>&1; " ..
"RC=$?; echo $RC > /tmp/openclaw-wechat-install.exit; " ..
-- 关键修复: 升级完成后强制修复插件目录权限 (确保 Gateway 可读取插件)
-- 注意: 保持 root:root 属主 (OpenClaw v2026.4.9+ 安全要求),仅修复权限模式
"chown -R root:root %s 2>/dev/null; chmod -R 755 %s 2>/dev/null; " ..
"if [ $RC -eq 0 ]; then echo '✅ 微信插件升级成功!' >> /tmp/openclaw-wechat-install.log; " ..
"else echo '❌ 升级失败 (exit: '$RC')' >> /tmp/openclaw-wechat-install.log; fi " ..
") & echo $! > /tmp/openclaw-wechat-install.pid",
install_path, npx_bin, oc_data, install_path, oc_data, oc_data, oc_data, install_path, install_path, npx_bin,
wechat_ext_dir, wechat_ext_dir
)
sys.exec(upgrade_cmd)
http.prepare_content("application/json")
http.write_json({ status = "ok", message = "微信插件升级已在后台启动..." })

View File

@ -314,25 +314,50 @@ fi
# v2026.4.9: 修复插件目录权限 (OpenClaw 要求插件目录属主为 root)
# 详见: https://github.com/nicepkg/openclaw/releases/tag/v2026.4.9
# v2026.4.10 补充: 同时修复权限模式为 755确保 Gateway 可读取插件
# 原因: npm/npx 以 root 创建目录时默认权限 700其他用户无法读取
local ext_dir="${OC_DATA}/.openclaw/extensions"
if [ -d "$ext_dir" ]; then
chown -R root:root "$ext_dir" 2>/dev/null || true
chmod -R 755 "$ext_dir" 2>/dev/null || true
fi
# v2026.4.x: 清理 jiti 缓存目录 (修复微信插件加载权限问题)
# jiti 编译 TypeScript 时会在 /tmp/jiti 创建缓存,如果由 root 创建则 openclaw 用户无法写入
rm -rf /tmp/jiti 2>/dev/null || true
# v2026.4.5: 执行 OpenClaw 官方配置迁移工具
# 自动迁移遗留配置到新版本格式
# v2026.4.10: 优化配置迁移 - 只在版本变更时运行 doctor --fix
# 原因: doctor --fix 耗时 ~50 秒,每次重启都运行严重影响启动速度
# 策略: 使用标记文件记录已运行的版本,只在版本变化时才执行迁移
_run_config_migration() {
local oc_entry="$1"
[ -z "$oc_entry" ] && return
logger -t openclaw "执行配置迁移 (doctor --fix)..."
OPENCLAW_HOME="$OC_DATA" OPENCLAW_CONFIG_PATH="$CONFIG_FILE" \
"$NODE_BIN" "$oc_entry" doctor --fix 2>/dev/null && \
logger -t openclaw "配置迁移完成" || \
logger -t openclaw "配置迁移失败,请手动检查"
# 获取当前 OpenClaw 版本号 (只取数字版本,如 2026.4.9)
local current_ver=""
current_ver=$("$NODE_BIN" "$oc_entry" --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
[ -z "$current_ver" ] && current_ver="unknown"
# 检查标记文件
local version_marker="${OC_DATA}/.openclaw/.doctor_ran_version"
local last_ver=""
if [ -f "$version_marker" ]; then
last_ver=$(cat "$version_marker" 2>/dev/null | tr -d '[:space:]')
fi
# 只在版本变化时才运行 doctor --fix
if [ "$current_ver" != "$last_ver" ]; then
logger -t openclaw "检测到版本变更 ($last_ver -> $current_ver),执行配置迁移 (doctor --fix)..."
OPENCLAW_HOME="$OC_DATA" OPENCLAW_CONFIG_PATH="$CONFIG_FILE" \
"$NODE_BIN" "$oc_entry" doctor --fix 2>/dev/null && \
logger -t openclaw "配置迁移完成" || \
logger -t openclaw "配置迁移失败,请手动检查"
# 更新标记文件
echo "$current_ver" > "$version_marker" 2>/dev/null
chown openclaw:openclaw "$version_marker" 2>/dev/null || true
else
logger -t openclaw "版本未变化 ($current_ver),跳过 doctor --fix"
fi
}
_run_config_migration "$oc_entry"
@ -422,8 +447,10 @@ if(d.gateway&&d.gateway.auth&&d.gateway.auth.token)process.stdout.write(d.gatewa
chmod 755 "$agent_dir" 2>/dev/null || true
fi
# extensions 目录除外 - 必须保持 root 权限 (OpenClaw 安全要求)
# 同时修复权限模式为 755确保 Gateway 可读取插件
if [ -d "${OC_DATA}/.openclaw/extensions" ]; then
chown -R root:root "${OC_DATA}/.openclaw/extensions" 2>/dev/null || true
chmod -R 755 "${OC_DATA}/.openclaw/extensions" 2>/dev/null || true
fi
# Patch iframe 安全头,允许 LuCI 嵌入

View File

@ -1474,6 +1474,7 @@ configure_qq() {
echo -e " ${YELLOW}⚠️ qqbot 插件已安装但未能正常加载${NC}"
echo -e " ${CYAN}正在修复插件目录权限...${NC}"
chown -R root:root "$qqbot_ext_dir" 2>/dev/null
chmod -R 755 "$qqbot_ext_dir" 2>/dev/null
echo -e " ${GREEN}✅ 权限已修复,重启 Gateway 后生效${NC}"
plugin_installed=1
fi
@ -1482,6 +1483,7 @@ configure_qq() {
echo -e " ${YELLOW}⚠️ qqbot 插件目录存在但未能加载${NC}"
echo -e " ${CYAN}正在修复插件目录权限...${NC}"
chown -R root:root "$qqbot_ext_dir" 2>/dev/null
chmod -R 755 "$qqbot_ext_dir" 2>/dev/null
echo -e " ${GREEN}✅ 权限已修复${NC}"
plugin_installed=1
fi
@ -1500,8 +1502,10 @@ configure_qq() {
local install_rc=$?
# 关键: 安装后立即修复插件目录权限为 root (OpenClaw 安全策略要求)
# 同时修复权限模式为 755确保 Gateway 可读取插件
if [ -d "$qqbot_ext_dir" ]; then
chown -R root:root "$qqbot_ext_dir" 2>/dev/null
chmod -R 755 "$qqbot_ext_dir" 2>/dev/null
fi
if [ $install_rc -eq 0 ]; then

View File

@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sing-box
PKG_VERSION:=1.13.6
PKG_RELEASE:=6
PKG_VERSION:=1.13.7
PKG_RELEASE:=7
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/SagerNet/sing-box/tar.gz/v$(PKG_VERSION)?