@rubytech/create-maxy 1.0.775 → 1.0.776
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -157,8 +157,31 @@ get_wifi_ip() {
|
|
|
157
157
|
|
|
158
158
|
scan_networks() {
|
|
159
159
|
log "scanning WiFi networks"
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
|
|
161
|
+
# `nmcli device wifi list --rescan yes` triggers a rescan but returns the
|
|
162
|
+
# currently cached list immediately — on cold boot the cache is empty
|
|
163
|
+
# because the radio hasn't completed its first scan yet. Trigger an
|
|
164
|
+
# explicit rescan, then poll the cached list until it has at least one
|
|
165
|
+
# visible (non-hidden) SSID, up to a hard timeout.
|
|
166
|
+
nmcli device wifi rescan 2>/dev/null || true
|
|
167
|
+
local raw=""
|
|
168
|
+
local elapsed=0
|
|
169
|
+
local max_wait=15
|
|
170
|
+
while [ "$elapsed" -lt "$max_wait" ]; do
|
|
171
|
+
raw=$(nmcli -t -f SSID,SIGNAL,SECURITY device wifi list 2>/dev/null) || true
|
|
172
|
+
# Lines have form SSID:SIGNAL:SECURITY; a leading ':' means hidden SSID.
|
|
173
|
+
# Break as soon as at least one line starts with a non-':' character.
|
|
174
|
+
if [ -n "$raw" ] && echo "$raw" | grep -qE '^[^:]'; then
|
|
175
|
+
break
|
|
176
|
+
fi
|
|
177
|
+
sleep 1
|
|
178
|
+
elapsed=$((elapsed + 1))
|
|
179
|
+
done
|
|
180
|
+
if [ "$elapsed" -ge "$max_wait" ]; then
|
|
181
|
+
log "scan timeout: no visible networks after ${max_wait}s — proceeding with empty list"
|
|
182
|
+
else
|
|
183
|
+
log "scan settled in ${elapsed}s"
|
|
184
|
+
fi
|
|
162
185
|
|
|
163
186
|
# Parse nmcli terse output into JSON using jq for safe escaping.
|
|
164
187
|
# Terse mode uses colon separators and escapes literal colons as \:
|