-
Notifications
You must be signed in to change notification settings - Fork 21
feat(captive-portal): full setup wizard, REST API migration, and WiFi CRUD overhaul #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
84309a7
Fix WiFi CRUD for hidden networks, add stepper wizard and advanced mode
hhvrc e69aed1
Merge remote-tracking branch 'origin/develop' into feat/wifi-crud-fix…
hhvrc 05c6666
Fix errors
hhvrc 1cf5026
feat(captive-portal): migrate simple WS commands to HTTP REST endpoints
hhvrc fd0c837
fix(wifi): use creds.id instead of undeclared credsId in Forget()
hhvrc a36fa99
feat(captive-portal): migrate all LocalToHub WS commands to HTTP REST
hhvrc 0f9f992
Document necessary changes
hhvrc 158bedb
Update schemas
hhvrc a3b204e
Merge branch 'develop' into feat/wifi-crud-fixes-and-advanced-mode
hhvrc 6a9d58d
Massive improvements
hhvrc 4dfc18a
More progress
hhvrc 21accc8
More progress
hhvrc 673d6ae
Add shocker test step
hhvrc cd21aa8
Clean up Advanced tab
hhvrc 2979965
Update Advanced.svelte
hhvrc c98231c
docs: update CLAUDE.md with full architecture docs, update FLATBUFFER…
hhvrc 69e3de9
feat(wifi): broadcast WifiGotIpEvent on DHCP, show IP toast in frontend
hhvrc 334a91e
fix(frontend): restore eslint ignores for generated and vendored code
hhvrc 2e6f9ea
fix: null checks on cJSON, response validation in frontend, config re…
hhvrc 1959c0e
feat(security): add rate limiting to account link REST endpoint
hhvrc cee53db
Remove disconnect button from saved networks list
hhvrc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| [submodule "schemas"] | ||
| path = schemas | ||
| url = https://github.com/OpenShock/flatbuffers-schemas | ||
| branch = local-comms-revamp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # FlatBuffers Schema Changes | ||
|
|
||
| **Repository:** https://github.com/OpenShock/flatbuffers-schemas | ||
| **Branch:** `local-comms-revamp` | ||
|
|
||
| These schema changes have been applied to the submodule and are tracked by this branch. They are breaking changes that accompany the WS-to-REST migration. | ||
|
|
||
| ## Applied Changes | ||
|
|
||
| ### `HubToLocalMessage.fbs` | ||
| - Removed all command result types (`AccountLinkCommandResult`, `SetRfTxPinCommandResult`, `SetEstopPinCommandResult`, `SetEstopEnabledCommandResult`, `SetGPIOResultCode`, `AccountLinkResultCode`) | ||
| - Removed all WS command types from `HubToLocalMessagePayload` union that were migrated to REST | ||
| - Added `AccountLinkStatusEvent` — broadcast when auth token is validated on gateway connect | ||
| - Added `has_standardized_pins` field to `ReadyMessage` | ||
|
|
||
| ### `LocalToHubMessage.fbs` | ||
| - Removed all command types except `Common_ShockerCommandList` (WiFi, OTA, Account, GPIO commands moved to REST) | ||
| - `ShockerCommandList` moved to `Common` namespace, shared between gateway and local | ||
|
|
||
| ### `HubConfig.fbs` | ||
| - Added `MacAddress` struct (6-byte fixed-size array) | ||
| - Added `auth_mode` (WifiAuthMode enum) and `bssid` (MacAddress) fields to `WiFiCredentials` for security pinning | ||
|
|
||
| ### `Common/ShockerCommand.fbs` (new) | ||
| - Extracted `ShockerCommand` and `ShockerCommandList` tables into shared Common namespace | ||
|
|
||
| ### `GatewayToHubMessage.fbs` | ||
| - Updated `ShockerCommandList` reference to `Common_ShockerCommandList` | ||
|
|
||
| ## Pending | ||
| - Push `local-comms-revamp` branch to schemas repo and create PR | ||
| - After merge, update submodule pointer in firmware repo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Copy this file to .env and adjust as needed. | ||
|
|
||
| # When the frontend is served locally (localhost / 127.0.0.1), HTTP and WebSocket | ||
| # requests are redirected to this host so they reach the real device. | ||
| # Defaults to 4.3.2.1 if not set. | ||
| VITE_LOCAL_DEVICE_HOST=4.3.2.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,88 +1,40 @@ | ||
| <script lang="ts"> | ||
| import { SerializeAccountLinkCommand } from '$lib/Serializers/AccountLinkCommand'; | ||
| import { SerializeSetEstopPinCommand } from '$lib/Serializers/SetEstopPinCommand'; | ||
| import { SerializeSetRfTxPinCommand } from '$lib/Serializers/SetRfTxPinCommand'; | ||
| import { WebSocketClient } from '$lib/WebSocketClient'; | ||
| import GpioPinSelector from '$lib/components/GpioPinSelector.svelte'; | ||
| import Footer from '$lib/components/Layout/Footer.svelte'; | ||
| import Header from '$lib/components/Layout/Header.svelte'; | ||
| import WiFiList from '$lib/components/WiFiList.svelte'; | ||
| import { Button } from '$lib/components/ui/button'; | ||
| import { Input } from '$lib/components/ui/input'; | ||
| import { Label } from '$lib/components/ui/label'; | ||
| import Landing from '$lib/views/Landing.svelte'; | ||
| import Guided from '$lib/views/Guided.svelte'; | ||
| import Advanced from '$lib/views/Advanced.svelte'; | ||
| import Success from '$lib/views/Success.svelte'; | ||
| import { Toaster } from '$lib/components/ui/sonner'; | ||
| import { hubState, initializeDarkModeStore } from '$lib/stores'; | ||
| import { initializeDarkModeStore, ViewModeStore } from '$lib/stores'; | ||
| import { closePortal } from '$lib/portalClose'; | ||
| import { fetchBoardInfo } from '$lib/api'; | ||
| import { onMount } from 'svelte'; | ||
|
|
||
| onMount(() => { | ||
| initializeDarkModeStore(); | ||
| fetchBoardInfo(); | ||
| WebSocketClient.Instance.Connect(); | ||
| }); | ||
|
|
||
| function isValidLinkCode(str: string) { | ||
| if (typeof str != 'string') return false; | ||
|
|
||
| for (var i = 0; i < str.length; i++) { | ||
| if (str[i] < '0' || str[i] > '9') return false; | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| let linkCode: string = $state(''); | ||
| let linkCodeValid = $derived(isValidLinkCode(linkCode)); | ||
|
|
||
| function linkAccount() { | ||
| if (!linkCodeValid) return; | ||
| const data = SerializeAccountLinkCommand(linkCode!); | ||
| WebSocketClient.Instance.Send(data); | ||
| } | ||
| let showSuccess = $state(false); | ||
| </script> | ||
|
|
||
| <Toaster position="top-center" /> | ||
|
|
||
| <div class="flex min-h-screen flex-col"> | ||
| <Header /> | ||
|
|
||
| <div class="flex flex-1 flex-col items-center justify-center px-2"> | ||
| <div class="w-full max-w-md flex-col space-y-5"> | ||
| <WiFiList /> | ||
|
|
||
| <div class="flex flex-col space-y-2"> | ||
| <Label for="account-link-code" class="scroll-m-20 text-xl font-semibold tracking-tight"> | ||
| Account Linking | ||
| </Label> | ||
| <div class="flex space-x-2"> | ||
| <Input | ||
| class={linkCodeValid ? '' : 'input-error'} | ||
| type="text" | ||
| id="account-link-code" | ||
| inputmode="numeric" | ||
| pattern="[0-9]*" | ||
| placeholder="Link Code" | ||
| bind:value={linkCode} | ||
| /> | ||
| <Button onclick={linkAccount} disabled={!linkCodeValid || linkCode.length < 6}> | ||
| Link | ||
| </Button> | ||
| </div> | ||
| </div> | ||
|
|
||
| <GpioPinSelector | ||
| name="RF TX Pin" | ||
| currentPin={hubState.config?.rf?.txPin ?? null} | ||
| serializer={SerializeSetRfTxPinCommand} | ||
| /> | ||
|
|
||
| <!-- TODO: Add EStop Enable/Disable toggle --> | ||
|
|
||
| <GpioPinSelector | ||
| name="EStop Pin" | ||
| currentPin={hubState.config?.estop?.gpioPin ?? null} | ||
| serializer={SerializeSetEstopPinCommand} | ||
| /> | ||
| </div> | ||
| {#if showSuccess} | ||
| <Success onClose={closePortal} /> | ||
| {:else} | ||
| <div class="flex min-h-screen flex-col"> | ||
| {#if $ViewModeStore === 'landing'} | ||
| <Landing /> | ||
| {:else} | ||
| <Header /> | ||
| {#if $ViewModeStore === 'advanced'} | ||
| <Advanced /> | ||
| {:else} | ||
| <Guided onComplete={() => (showSuccess = true)} /> | ||
| {/if} | ||
| {/if} | ||
| </div> | ||
|
|
||
| <Footer /> | ||
| </div> | ||
| {/if} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.