Skip to content

Commit f29fe4f

Browse files
authored
Show whether a feeder is registered vs. claimed in the UI (#59)
* feat(claim): surface real account-claim status in the UI Adds GET /api/claim/status, backed by a single-flight, identity-keyed cache over a read-only `apl-feed claim status` probe, and replaces the claim activity panel's secret-presence guess with the real registered-vs-claimed verdict, a freshness stamp, and a Check now button. * feat(claim): add account-claim status indicator to the Identity card A colored dot + label in the Identity card header reflects the /api/claim/status verdict — green claimed, blue registered, orange not registered, red action needed, grey unknown — refreshed on dashboard load and the status-snapshot poll. * fix(dashboard): order the readsb tile before airplanes-feed readsb is the local decoder every other 1090 tile depends on; surfacing it first matches the data path (decode → feed → mlat).
1 parent 612fe0d commit f29fe4f

10 files changed

Lines changed: 1173 additions & 78 deletions

File tree

cmd/devserver/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/airplanes-live/image-webconfig/internal/auth"
29+
"github.com/airplanes-live/image-webconfig/internal/claimstatus"
2930
"github.com/airplanes-live/image-webconfig/internal/devfakes"
3031
"github.com/airplanes-live/image-webconfig/internal/feedenv"
3132
"github.com/airplanes-live/image-webconfig/internal/identity"
@@ -110,6 +111,16 @@ func main() {
110111
status.WithWifi(devfakes.NewWifiProbe(state)),
111112
)
112113

114+
// Claim-status probe routed through the same fake runner; the dev-stub
115+
// argv lands in devfakes.claimStatusFeed, which reports a verdict
116+
// coherent with the simulated identity (unregistered → unclaimed once
117+
// the Register button materialises a secret).
118+
claimStatusProber := claimstatus.Prober{
119+
Runner: devfakes.Runner(state, priv),
120+
Argv: []string{"dev-stub", "apl-feed", "claim", "status", "--json"},
121+
}
122+
claimStatusCache := claimstatus.NewCache(claimStatusProber.Probe, nil)
123+
113124
handler := server.New(server.Deps{
114125
Version: "dev",
115126
Store: auth.NewPasswordStore(state.Paths.PasswordHash),
@@ -120,6 +131,7 @@ func main() {
120131
Identity: identity.NewReader(idPaths),
121132
FeedEnv: &feedenv.Reader{Path: state.Paths.FeedEnv},
122133
Status: statusReader,
134+
ClaimStatus: claimStatusCache,
123135
Logs: logs.NewStreamer(devfakes.StreamRunner(state)),
124136
Schema: schema,
125137
Runner: devfakes.Runner(state, priv),

cmd/webconfig/main.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"time"
1818

1919
"github.com/airplanes-live/image-webconfig/internal/auth"
20+
"github.com/airplanes-live/image-webconfig/internal/claimstatus"
2021
wexec "github.com/airplanes-live/image-webconfig/internal/exec"
2122
"github.com/airplanes-live/image-webconfig/internal/feedenv"
2223
"github.com/airplanes-live/image-webconfig/internal/hardware"
@@ -140,6 +141,11 @@ func main() {
140141
}
141142
loadCancel()
142143

144+
// Account-claim status: read-only, unprivileged `apl-feed claim status
145+
// --json` behind a single-flight, identity-keyed cache.
146+
claimStatusProber := claimstatus.Prober{Runner: wexec.RealRunner, Argv: claimstatus.DefaultArgv}
147+
claimStatusCache := claimstatus.NewCache(claimStatusProber.Probe, nil)
148+
143149
effectiveVersion := resolveVersion()
144150
srv := &http.Server{
145151
Addr: *listen,
@@ -161,9 +167,10 @@ func main() {
161167
)),
162168
status.WithWifi(wifi.NewSignalReader("/usr/bin/nmcli", nil)),
163169
),
164-
Logs: logs.NewStreamer(nil),
165-
Schema: cache,
166-
Privileged: priv,
170+
Logs: logs.NewStreamer(nil),
171+
Schema: cache,
172+
ClaimStatus: claimStatusCache,
173+
Privileged: priv,
167174
}),
168175
ReadHeaderTimeout: 5 * time.Second,
169176
ReadTimeout: 15 * time.Second,

0 commit comments

Comments
 (0)