🛸 Sync 2026-04-10 15:47:03

This commit is contained in:
github-actions[bot] 2026-04-10 15:47:03 +08:00
parent c777116e7a
commit f8080cddfc
9 changed files with 54 additions and 19 deletions

View File

@ -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

View File

@ -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));

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

View File

@ -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")
-- 清理临时文件

View File

@ -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 嵌入

View File

@ -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 {}
}

View File

@ -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
}

View File

@ -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/"

View File

@ -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/"