feat(profiles): WAN-mode / conditional-override profiles [T2] — the real §7 feature
The Profiles page was a stub for the actual catalog §7 feature (WAN-mode / failover conditional overrides); this implements it. A `config profile` defines conditions (active default-route interface, a connectivity probe up/down, a time window — all AND'd) and overrides (force-enable/disable named rules, override the default catch-all target/egress). The highest-priority profile whose conditions all hold is active; its overrides are applied at gen/reconcile time and the cron re-applies when the active profile flips. - model.go/uci.go: Profile struct + `config profile` parse. - profile_wanmode.go: defaultIface() (ip route), profileProbeUp() (HTTP), condition eval, activeWanProfile() (priority + AND conditions; no-condition profile never auto-activates), ProfileStatusJSON. strSet helper. - generate.go: builder.activeProfile set in buildConfigInternal; buildRoutingRules applies enable/disable-by-name + injects a default-target catch-all when active. - schedule.go: scheduleSignature includes the active profile name, so shater-cron reconciles on a profile transition (iface/probe/time boundary). - main.go: `xrayctl wanmode`. shater.uc `wanmode` ubus + acl. - profiles.js: rewritten to host WAN-mode Profiles (config profile GridSection) + active-profile banner + Config snapshots + Backup/Restore + xray compatibility. - tests: profile_wanmode_test.go (iface/schedule/AND conditions, priority selection, no-condition never active, override enable/disable, default-target injection, inactive-no-override). Verified live on the 512M VM: `wanmode` reports active sim-mode (iface eth1); force-enabled a disabled rule (profileonly.example appears); flipping the iface condition deactivates it; schedule condition active at 22:30 / inactive at 12:00; xray -test OK. Playwright: Profiles page renders the WAN-mode form + active banner + snapshots + backup + compat with 0 console errors. r16. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
21ee972df1
commit
6c01d8db41
14 files changed
+595
-138
No files matched your search
@@ -14,7 +14,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=shater-core
|
||||
PKG_VERSION:=0.1.0
|
||||
PKG_RELEASE:=15
|
||||
PKG_RELEASE:=16
|
||||
|
||||
PKG_MAINTAINER:=Shater <maqrota@icloud.com>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
|
||||
Reference in new issue
Block a user