From c1c3151a9f2689b44e4006a3266988de3b3602c3 Mon Sep 17 00:00:00 2001
From: 10000ge10000 <10000ge10000@users.noreply.github.com>
Date: Mon, 2 Mar 2026 16:23:52 +0800
Subject: [PATCH] =?UTF-8?q?release:=20v1.0.0=20=E2=80=94=20LuCI=20?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=E3=80=81=E4=B8=80=E9=94=AE?=
=?UTF-8?q?=E5=AE=89=E8=A3=85=E3=80=8112+=20AI=20=E6=A8=A1=E5=9E=8B?=
=?UTF-8?q?=E6=8F=90=E4=BE=9B=E5=95=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/build.yml | 114 ++
.gitignore | 18 +
CHANGELOG.md | 39 +
LICENSE | 26 +
Makefile | 92 ++
README.md | 155 ++
VERSION | 1 +
luasrc/controller/openclaw.lua | 384 +++++
luasrc/model/cbi/openclaw/basic.lua | 366 +++++
luasrc/view/openclaw/advanced.htm | 121 ++
luasrc/view/openclaw/console.htm | 168 +++
luasrc/view/openclaw/status.htm | 138 ++
po/zh-cn/openclaw.po | 482 ++++++
root/etc/config/openclaw | 6 +
root/etc/init.d/openclaw | 330 ++++
root/etc/uci-defaults/99-openclaw | 41 +
root/usr/bin/openclaw-env | 478 ++++++
root/usr/share/openclaw/oc-config.sh | 1326 +++++++++++++++++
.../usr/share/openclaw/ui/images/icon_256.png | Bin 0 -> 5202 bytes
root/usr/share/openclaw/ui/images/icon_64.png | Bin 0 -> 1074 bytes
root/usr/share/openclaw/ui/index.html | 280 ++++
.../share/openclaw/ui/lib/addon-fit.min.js | 8 +
.../openclaw/ui/lib/addon-web-links.min.js | 8 +
root/usr/share/openclaw/ui/lib/xterm.min.css | 8 +
root/usr/share/openclaw/ui/lib/xterm.min.js | 8 +
root/usr/share/openclaw/web-pty.js | 285 ++++
scripts/build_ipk.sh | 143 ++
scripts/build_run.sh | 235 +++
28 files changed, 5260 insertions(+)
create mode 100644 .github/workflows/build.yml
create mode 100644 .gitignore
create mode 100644 CHANGELOG.md
create mode 100644 LICENSE
create mode 100644 Makefile
create mode 100644 README.md
create mode 100644 VERSION
create mode 100644 luasrc/controller/openclaw.lua
create mode 100644 luasrc/model/cbi/openclaw/basic.lua
create mode 100644 luasrc/view/openclaw/advanced.htm
create mode 100644 luasrc/view/openclaw/console.htm
create mode 100644 luasrc/view/openclaw/status.htm
create mode 100644 po/zh-cn/openclaw.po
create mode 100644 root/etc/config/openclaw
create mode 100755 root/etc/init.d/openclaw
create mode 100755 root/etc/uci-defaults/99-openclaw
create mode 100755 root/usr/bin/openclaw-env
create mode 100755 root/usr/share/openclaw/oc-config.sh
create mode 100644 root/usr/share/openclaw/ui/images/icon_256.png
create mode 100644 root/usr/share/openclaw/ui/images/icon_64.png
create mode 100644 root/usr/share/openclaw/ui/index.html
create mode 100644 root/usr/share/openclaw/ui/lib/addon-fit.min.js
create mode 100644 root/usr/share/openclaw/ui/lib/addon-web-links.min.js
create mode 100644 root/usr/share/openclaw/ui/lib/xterm.min.css
create mode 100644 root/usr/share/openclaw/ui/lib/xterm.min.js
create mode 100644 root/usr/share/openclaw/web-pty.js
create mode 100755 scripts/build_ipk.sh
create mode 100755 scripts/build_run.sh
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..f0c7666
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,114 @@
+name: Build & Release
+
+on:
+ workflow_dispatch:
+ inputs:
+ version:
+ description: '版本号 (留空自动生成,格式: 1.0.0)'
+ required: false
+ default: ''
+ create_release:
+ description: '是否创建 Release'
+ required: false
+ type: boolean
+ default: true
+
+jobs:
+ build:
+ name: Build packages
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Determine version
+ id: version
+ run: |
+ INPUT_VER="${{ github.event.inputs.version }}"
+ if [ -n "$INPUT_VER" ]; then
+ VER="$INPUT_VER"
+ elif [ -f VERSION ]; then
+ VER="$(cat VERSION | tr -d '[:space:]')"
+ else
+ VER="$(date -u +%Y.%m.%d)"
+ fi
+ echo "version=$VER" >> "$GITHUB_OUTPUT"
+ echo "tag=v$VER" >> "$GITHUB_OUTPUT"
+ echo "Version: $VER"
+
+ - name: Inject version
+ run: |
+ VER="${{ steps.version.outputs.version }}"
+ echo "$VER" > VERSION
+ # 同步到 Makefile
+ sed -i "s/^PKG_VERSION:=.*/PKG_VERSION:=$VER/" Makefile
+
+ - name: Build .run installer
+ run: |
+ chmod +x scripts/build_run.sh
+ sh scripts/build_run.sh dist
+
+ - name: Build .ipk package
+ run: |
+ chmod +x scripts/build_ipk.sh
+ sh scripts/build_ipk.sh dist
+
+ - name: List outputs
+ run: ls -lh dist/
+
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: luci-app-openclaw-${{ steps.version.outputs.version }}
+ path: dist/*
+
+ - name: Create Release
+ if: ${{ github.event.inputs.create_release == 'true' }}
+ uses: softprops/action-gh-release@v2
+ with:
+ tag_name: ${{ steps.version.outputs.tag }}
+ name: luci-app-openclaw ${{ steps.version.outputs.tag }}
+ files: dist/*
+ draft: false
+ prerelease: false
+ body: |
+ ## luci-app-openclaw ${{ steps.version.outputs.tag }}
+
+ OpenClaw AI 网关的 OpenWrt LuCI 管理插件。
+
+ ### 下载说明
+
+ | 文件 | 说明 |
+ |------|------|
+ | `luci-app-openclaw_*.run` | 自解压安装包,适用于已运行的 OpenWrt / iStoreOS 系统 |
+ | `luci-app-openclaw_*.ipk` | 标准 opkg 安装包 |
+
+ ### 安装方法
+
+ **方式一:.run 安装包(推荐)**
+ ```bash
+ # 上传到路由器后执行
+ sh luci-app-openclaw_${{ steps.version.outputs.version }}.run
+ ```
+
+ **方式二:.ipk 安装**
+ ```bash
+ opkg install luci-app-openclaw_${{ steps.version.outputs.version }}-1_all.ipk
+ ```
+
+ ### 安装后使用
+
+ 1. 打开 LuCI → 服务 → OpenClaw
+ 2. 点击「安装运行环境」,等待安装完成后服务会自动启动
+ 3. 进入「Web 控制台」添加 AI 模型的 API Key 即可使用
+
+ ### 兼容性
+
+ - 系统:OpenWrt / iStoreOS / ImmortalWrt / KWRT 23.05+
+ - 架构:x86_64、aarch64
+ - C 库:glibc、musl(自动识别)
+
+ ---
+ [使用文档](https://github.com/10000ge10000/luci-app-openclaw#readme) · [问题反馈](https://github.com/10000ge10000/luci-app-openclaw/issues) · [B站](https://space.bilibili.com/59438380) · [博客](https://blog.910501.xyz/)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2b8324b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,18 @@
+# Node
+node_modules/
+*.tgz
+
+# Build artifacts
+dist/
+*.ipk
+*.run
+
+# OS
+.DS_Store
+Thumbs.db
+
+# Editor
+.vscode/
+*.swp
+*.swo
+*~
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..a038523
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,39 @@
+# Changelog
+
+本项目所有重大变更都将记录在此文件中。
+
+格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/)。
+
+## [1.0.0] - 2026-03-02
+
+### 新增
+- LuCI 管理界面:基本设置、配置管理(Web 终端)、Web 控制台
+- 一键安装 Node.js + OpenClaw 运行环境
+- 支持 x86_64 和 aarch64 架构,glibc / musl 自动检测
+- 支持 12+ AI 模型提供商配置向导
+- 支持 Telegram / Discord / 飞书 / Slack 消息渠道
+- `.run` 自解压包和 `.ipk` 安装包两种分发方式
+- OpenWrt SDK feeds 集成支持
+- GitHub Actions 自动构建与发布
+
+### 安全
+- WebSocket PTY 服务添加 token 认证
+- WebSocket 最大并发会话限制(默认 5)
+- PTY 服务默认绑定 127.0.0.1,不对外暴露
+- Token 不再嵌入 HTML 源码,改为 AJAX 动态获取
+- sync_uci_to_json 通过环境变量传递 token,避免 ps 泄露
+- 所有渠道 Token 输入统一 sanitize_input 清洗
+
+### 修复
+- Telegram Bot Token 粘贴时被 bracketed paste 转义序列污染
+- Web PTY 终端粘贴包含 ANSI 转义序列问题
+- 恢复出厂配置流程异常退出
+- Gemini CLI OAuth 登录在 OpenWrt 上失败
+- init.d status_service() 在无 netstat 的系统上报错
+- Makefile 损坏导致 OpenWrt SDK 编译失败
+
+### 改进
+- 所有 AI 提供商模型列表更新到最新版本
+- UID/GID 动态分配,避免与已有系统用户冲突
+- 版本号统一由 VERSION 文件管理
+- README.md 完善安装说明、FAQ 和项目结构
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f11cd79
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,26 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+Copyright (c) 2025-2026 10000ge10000
+Project: luci-app-openclaw — OpenClaw AI Gateway LuCI Plugin for OpenWrt
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
通过内嵌的交互式终端 (oc-config) 进行 OpenClaw 的完整配置管理。支持 AI 模型配置、消息渠道设置、健康检查等。
+OpenClaw 官方 Web 管理界面 — 在这里可以配置 AI 模型、消息渠道,直接与 AI 进行对话,以及管理所有功能。
+| 运行状态 | 加载中... |
| 网关服务 | - |
| 配置终端 | - |
| 进程 PID | - |
| 内存占用 | - |
| 运行时间 | - |
| Node.js | - |
| OpenClaw | - |
正在连接终端...
+ +⚡ 连接已断开
+配置脚本已退出或连接中断
+ +