v46.1-ui-mt76: Argon theme + hardened WG tunnel + Link Health dashboard

基于 v46 正式版(mt76)只恢复 UI 层:
- luci-theme-argon 2.4.3: local-background-wins 登录页 + bg1.jpg fallback
- luci-app-argon-config: 去 ui.changes.apply, ACL mutator 移 write
- luci-app-wgtunnel: rpcd ucode 后端(get/status/prepare/apply/rollback/reconnect),
  JSONMap 前端, 60s 一次性 token, 快照回滚, 无全局 network ACL
- luci-app-tr3000-status: 只读 rpcd ucode + 5s 轮询仪表盘
- tools/: audit_ui_packages.py + install_preview.sh + rollback_watchdog.sh
- docs/: 开发经历与翻车记录 + 固件哈希记录

固件本体(含烤入 WG 私钥/PSK)不入 git, 仅 K 盘保存.
kernel 成员与 v46 byte-identical; 尚未刷机.
This commit is contained in:
2026-08-19 15:04:02 +08:00
parent c6c90c1db8
commit 29cf67154a
92 changed files with 16036 additions and 0 deletions
@@ -0,0 +1,12 @@
#!/bin/sh
if [ "$PKG_UPGRADE" != 1 ]; then
uci get luci.themes.Argon >/dev/null 2>&1 || \
uci batch <<-EOF
set luci.themes.Argon=/luci-static/argon
set luci.main.mediaurlbase=/luci-static/argon
commit luci
EOF
fi
exit 0
@@ -0,0 +1,108 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-only
. /usr/share/libubox/jshn.sh
src="$(uci -q get argon.@global[0].online_wallpaper || echo bing)"
case "$src" in
bing|none|ghser|unsplash|wallhaven) WEB_PIC_SRC="$src" ;;
unsplash_[0-9]*|wallhaven_[0-9]*) WEB_PIC_SRC="$src" ;;
*) WEB_PIC_SRC="bing" ;;
esac
API_KEY="$(uci -q get argon.@global[0].use_api_key)"
EXACT_RESO="$(uci -q get argon.@global[0].use_exact_resolution || echo '1')"
case "$API_KEY" in *[!A-Za-z0-9_.-]*|????????????????????????????????????????????????????????????????*) API_KEY="" ;; esac
case "$EXACT_RESO" in 1) ;; *) EXACT_RESO=0 ;; esac
cache_key="$(echo "$WEB_PIC_SRC" | tr -c 'A-Za-z0-9_-' '_')"
CACHE="/var/run/argon_${cache_key}.url"
WRLOCK="/var/lock/argon_${cache_key}.lock"
valid_url() {
case "$1" in
https://www.bing.com/*|//www.bing.com/*|https://api.vvhan.com/*|https://images.unsplash.com/*|https://wallhaven.cc/*) return 0 ;;
esac
return 1
}
fetch_pic_url() {
case "$WEB_PIC_SRC" in
bing)
local picpath="$(wget -T3 -qO- "https://www.bing.com/HPImageArchive.aspx?format=js&n=1" | jsonfilter -qe '@.images[0].url' | sed 's/1920x1080/UHD/g')"
[ -n "$picpath" ] && echo "//www.bing.com${picpath}"
;;
ghser)
echo "https://api.vvhan.com/api/wallpaper/acg"
;;
unsplash)
if [ -z "$API_KEY" ]; then
local pic_id="$(wget -T3 --spider "https://source.unsplash.com/1920x1080/daily?wallpapers" 2>&1 | grep -Eo "photo-\w+-\w+" | head -n1)"
[ -n "$pic_id" ] && echo "https://images.unsplash.com/${pic_id}?fm=jpg&fit=crop&w=1920&h=1080"
else
wget -T3 -qO- "https://api.unsplash.com/photos/random?client_id=${API_KEY}" | jsonfilter -qe '@["urls"]["regular"]'
fi
;;
unsplash_*)
local collection_id="${WEB_PIC_SRC#unsplash_}"
if [ -z "$API_KEY" ]; then
local pic_id="$(wget -T3 --spider "https://source.unsplash.com/collection/${collection_id}/1920x1080" 2>&1 | grep -Eo "photo-\w+-\w+" | head -n1)"
[ -n "$pic_id" ] && echo "https://images.unsplash.com/${pic_id}?fm=jpg&fit=crop&w=1920&h=1080"
else
wget -T3 -qO- "https://api.unsplash.com/photos/random?client_id=${API_KEY}&collections=${collection_id}" | jsonfilter -qe '@["urls"]["regular"]'
fi
;;
wallhaven)
wget -T3 -qO- "https://wallhaven.cc/api/v1/search?resolutions=1920x1080&sorting=random" | jsonfilter -qe '@.data[0].path'
;;
wallhaven_*)
local tag_id="${WEB_PIC_SRC#wallhaven_}"
local use_reso="resolutions"
[ "$EXACT_RESO" -eq 1 ] || use_reso="atleast"
[ -z "$API_KEY" ] || API_KEY="apikey=$API_KEY&"
wget -T3 -qO- "https://wallhaven.cc/api/v1/search?${API_KEY}q=id%3A${tag_id}&${use_reso}=1920x1080&sorting=random" | jsonfilter -qe '@.data[0].path'
;;
esac
}
try_update() {
exec 200>"$WRLOCK"
if flock -n 200 >/dev/null 2>&1; then
local picurl="$(fetch_pic_url)"
if valid_url "$picurl"; then
printf '%s\n' "$picurl" > "$CACHE"
printf '%s\n' "$picurl"
elif [ -s "$CACHE" ]; then
cat "$CACHE"
else
: > "$CACHE"
fi
flock -u 200 >/dev/null 2>&1
elif [ -s "$CACHE" ]; then
cat "$CACHE"
fi
}
case "$1" in
"list")
json_init; json_add_object "get_url"; json_close_object; json_dump; json_cleanup
;;
"call")
case "$2" in
"get_url")
read -r input
if [ -f "$CACHE" ]; then
idle_t="$(($(date '+%s') - $(date -r "$CACHE" '+%s' 2>/dev/null || echo '0')))"
if [ -s "$CACHE" ] && [ "$idle_t" -le 43200 ]; then
url="$(cat "$CACHE")"
valid_url "$url" || url=""
json_init; json_add_string "url" "$url"; json_dump; json_cleanup; return 0
elif [ ! -s "$CACHE" ] && [ "$idle_t" -le 120 ]; then
echo '{ "url": "" }'; return 1
fi
fi
json_init; json_add_string "url" "$(try_update)"; json_dump; json_cleanup; return 0
;;
esac
;;
esac
@@ -0,0 +1,8 @@
{
"luci-theme-argon": {
"description": "Grant UCI access for luci-theme-argon",
"read": {
"uci": [ "argon" ]
}
}
}