Skip to content

Commit 9f03f39

Browse files
committed
feat(webui): 统一三套管理面板入口
将 NetProxy WebUI、zashboard 与 sing-box Dashboard 统一规划到 webroot。 新增安全区适配的根入口页,内置两套 Dashboard,隔离 WebUI 构建目录,并同步资源更新、面板配置与 CLI 地址输出。
1 parent c45dc3c commit 9f03f39

87 files changed

Lines changed: 818 additions & 21 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/build-module/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ runs:
2626
cache: npm
2727
cache-dependency-path: src/webui/package-lock.json
2828

29-
- name: 构建 WebUI(产物 → src/module/webroot)
29+
- name: 构建 WebUI(产物 → src/module/webroot/netproxy
3030
shell: bash
3131
working-directory: src/webui
3232
run: |

.github/resources.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,18 @@
2323
],
2424
"githubRelease": [
2525
{
26-
"path": "src/module/bin/zashboard",
26+
"path": "src/module/webroot/zashboard",
2727
"repo": "Zephyruso/zashboard",
2828
"assetPattern": "dist-no-fonts.zip",
2929
"currentVersion": "v3.16.1"
3030
}
31+
],
32+
"githubArchive": [
33+
{
34+
"path": "src/module/webroot/sing-box-dashboard",
35+
"repo": "SagerNet/sing-box-dashboard",
36+
"ref": "gh-pages",
37+
"currentCommit": "4254b9c42e70b622953dca6c79bf3451bc50a489"
38+
}
3139
]
3240
}

.github/workflows/update-resources.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,60 @@ jobs:
115115
echo "ZASHBOARD_EOF"
116116
} >> "$GITHUB_OUTPUT"
117117
118+
- name: 更新 sing-box Dashboard
119+
id: singbox_dashboard
120+
env:
121+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
run: |
123+
repo="$(jq -r '.githubArchive[0].repo' .github/resources.json)"
124+
ref="$(jq -r '.githubArchive[0].ref' .github/resources.json)"
125+
dest="$(jq -r '.githubArchive[0].path' .github/resources.json)"
126+
current="$(jq -r '.githubArchive[0].currentCommit' .github/resources.json)"
127+
latest="$(gh api "repos/${repo}/commits/${ref}" --jq '.sha')"
128+
129+
echo "sing-box Dashboard 当前: '${current:-无}',最新: '$latest'"
130+
131+
summary=""
132+
if [ "$latest" != "$current" ]; then
133+
echo "发现上游更新,开始同步..."
134+
rm -rf tmp-sing-box-dashboard
135+
mkdir -p tmp-sing-box-dashboard/extract
136+
137+
if curl -fsSL --retry 3 --connect-timeout 15 \
138+
"https://github.com/${repo}/archive/${latest}.zip" \
139+
-o tmp-sing-box-dashboard/dashboard.zip; then
140+
unzip -q tmp-sing-box-dashboard/dashboard.zip -d tmp-sing-box-dashboard/extract
141+
srcdir="$(find tmp-sing-box-dashboard/extract -mindepth 1 -maxdepth 1 -type d | head -n 1)"
142+
143+
if [ -n "$srcdir" ] && [ -f "$srcdir/index.html" ]; then
144+
rm -rf "$dest"
145+
mkdir -p "$dest"
146+
cp -r "$srcdir"/. "$dest"/
147+
148+
tmpjson="$(mktemp)"
149+
jq --arg commit "$latest" \
150+
'.githubArchive[0].currentCommit = $commit' \
151+
.github/resources.json > "$tmpjson"
152+
mv "$tmpjson" .github/resources.json
153+
summary="- ${dest}:sing-box Dashboard ${current:0:7} → ${latest:0:7}"
154+
else
155+
echo "::warning::归档中没有找到 Dashboard 入口文件,跳过更新"
156+
fi
157+
else
158+
echo "::warning::下载 sing-box Dashboard 失败,跳过更新"
159+
fi
160+
161+
rm -rf tmp-sing-box-dashboard
162+
else
163+
echo "已是最新,跳过"
164+
fi
165+
166+
{
167+
echo "summary<<SING_BOX_DASHBOARD_EOF"
168+
printf '%s\n' "$summary"
169+
echo "SING_BOX_DASHBOARD_EOF"
170+
} >> "$GITHUB_OUTPUT"
171+
118172
- name: 更新 npm 依赖
119173
id: npm
120174
run: |
@@ -230,6 +284,7 @@ jobs:
230284
### 内置资源
231285
${{ steps.raw.outputs.summary }}
232286
${{ steps.zashboard.outputs.summary }}
287+
${{ steps.singbox_dashboard.outputs.summary }}
233288
234289
### npm 依赖
235290
${{ steps.npm.outputs.summary }}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
# Claude Code 本地项目指引 (不纳入仓库)
88
CLAUDE.md
99

10-
# WebUI 构建产物 (由 src/webui 构建生成,不纳入仓库)
11-
src/module/webroot/
10+
# NetProxy WebUI 构建产物由 src/webui 构建生成,不纳入仓库
11+
src/module/webroot/netproxy/

src/module/config/singbox/confdir/02_experimental.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
"default_mode": "Rule",
1010
"external_controller": "0.0.0.0:9999",
1111
"secret": "singbox",
12-
"external_ui": "/data/adb/modules/netproxy/bin/zashboard",
13-
"external_ui_download_url": "https://github.com/Zephyruso/zashboard/releases/latest/download/dist.zip"
12+
"external_ui": "/data/adb/modules/netproxy/webroot"
1413
}
1514
}
1615
}

src/module/config/singbox/confdir/08_services.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
"secret": "singbox",
88
"dashboard": {
99
"enabled": true,
10-
"path": "dashboard",
11-
"download_url": "https://github.com/SagerNet/sing-box-dashboard/archive/refs/heads/gh-pages.zip",
12-
"http_client": "rule-set-download",
13-
"update_interval": "1d"
10+
"path": "/data/adb/modules/netproxy/webroot"
1411
}
1512
}
1613
]

src/module/module.prop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ versionCode=2
55
author=Fanju
66
description=基于 sing-box eBPF 入站的 Android 透明代理工具
77
updateJson=https://github.com/Fanju6/NetProxy-Magisk/releases/latest/download/update.json
8-
webuiIcon=webroot/favicon.svg
8+
webuiIcon=webroot/netproxy/favicon.svg

src/module/scripts/cli

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,16 +758,18 @@ cmd_api_close_all() {
758758
info "全部连接已关闭"
759759
}
760760

761-
# 显示控制器与面板访问地址及密钥
761+
# 显示控制接口与面板访问地址及密钥
762762
cmd_api_ui() {
763763
local ip
764764

765765
ip="$(detect_primary_ipv4)"
766766
[ -n "$ip" ] || ip="<设备IP>"
767767

768-
printf "控制地址: http://%s:9999\n" "$ip"
769-
printf "面板地址: http://%s:9999/ui\n" "$ip"
770-
printf "密钥: %s\n" "$(api_secret)"
768+
printf "Clash API: http://%s:9999\n" "$ip"
769+
printf "zashboard: http://%s:9999/ui/\n" "$ip"
770+
printf "Service API: http://%s:9090\n" "$ip"
771+
printf "sing-box Dashboard: http://%s:9090/dashboard/\n" "$ip"
772+
printf "控制密钥: %s\n" "$(api_secret)"
771773
}
772774

773775
# api 命令组分发

0 commit comments

Comments
 (0)