diff options
| author | Li Zhineng <[email protected]> | 2025-06-12 22:26:20 +0800 |
|---|---|---|
| committer | Li Zhineng <[email protected]> | 2025-06-12 22:26:20 +0800 |
| commit | 77d86e8b70e7dc1a11132f17eac9cca2795a1f89 (patch) | |
| tree | cab0fd54411556ab66ddaa710d48215bbd542596 /main.mjs | |
| parent | 29c8378dca07b3731b150362a36f71a7e5c35337 (diff) | |
| download | setup-77d86e8b70e7dc1a11132f17eac9cca2795a1f89.tar.gz setup-77d86e8b70e7dc1a11132f17eac9cca2795a1f89.zip | |
wifi credentials
Diffstat (limited to 'main.mjs')
| -rw-r--r-- | main.mjs | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -140,6 +140,13 @@ async function delay(ms) { } async function connectToDevice() { + const ssid = document.getElementById('ssid') + const password = document.getElementById('password') + + if (ssid.value === '' || password.value === '') { + return + } + const device = await navigator.bluetooth.requestDevice({ filters: [{ name: DEVICE_NAME }], optionalServices: [MAIN_SERVICE_UUID] @@ -156,7 +163,7 @@ async function connectToDevice() { const dispatcher = new Dispatcher(writeChar) await dispatcher.dispatch(new HandshakeCommand()) - await dispatcher.dispatch(new ConfigureWifiCommand('<ssid>', '<password>')) + await dispatcher.dispatch(new ConfigureWifiCommand(ssid.value, password.value)) await dispatcher.dispatch(new RequestIdentityCommand()) } |
