@rubytech/create-maxy 1.0.778 → 1.0.780
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
|
@@ -245,10 +245,14 @@ function portalHTML() {
|
|
|
245
245
|
<div class="card" style="padding:32px 16px">
|
|
246
246
|
<div class="success-icon">✓</div>
|
|
247
247
|
<h1>Connected!</h1>
|
|
248
|
-
<p class="hint">${escapedBrandName} is now online.
|
|
248
|
+
<p class="hint">${escapedBrandName} is now online. Redirecting in <span id="redirect-countdown">5</span>s…</p>
|
|
249
249
|
<div class="address-box">
|
|
250
250
|
<a id="device-link" href="#" target="_blank"></a>
|
|
251
251
|
</div>
|
|
252
|
+
<p class="hint" id="ip-fallback" style="display:none">If the page above doesn't load (some Android browsers don't resolve <code>.local</code>), use this direct IP:</p>
|
|
253
|
+
<div class="address-box" id="ip-fallback-box" style="display:none">
|
|
254
|
+
<a id="device-link-ip" href="#" target="_blank"></a>
|
|
255
|
+
</div>
|
|
252
256
|
<p class="hint">This access point will close shortly.<br>Your phone will reconnect to your WiFi automatically.</p>
|
|
253
257
|
</div>
|
|
254
258
|
</div>
|
|
@@ -362,13 +366,34 @@ function portalHTML() {
|
|
|
362
366
|
}
|
|
363
367
|
|
|
364
368
|
function showSuccess(data) {
|
|
365
|
-
var
|
|
369
|
+
var hostnameAddr = data.hostname
|
|
366
370
|
? "http://" + data.hostname + ".local" + devicePort
|
|
367
|
-
:
|
|
371
|
+
: null;
|
|
372
|
+
var ipAddr = data.ip ? "http://" + data.ip + devicePort : null;
|
|
373
|
+
var primary = hostnameAddr || ipAddr;
|
|
368
374
|
var link = document.getElementById("device-link");
|
|
369
|
-
link.href =
|
|
370
|
-
link.textContent =
|
|
375
|
+
link.href = primary;
|
|
376
|
+
link.textContent = primary;
|
|
377
|
+
if (hostnameAddr && ipAddr && hostnameAddr !== ipAddr) {
|
|
378
|
+
var ipLink = document.getElementById("device-link-ip");
|
|
379
|
+
ipLink.href = ipAddr;
|
|
380
|
+
ipLink.textContent = ipAddr;
|
|
381
|
+
document.getElementById("ip-fallback").style.display = "block";
|
|
382
|
+
document.getElementById("ip-fallback-box").style.display = "block";
|
|
383
|
+
}
|
|
371
384
|
showScreen("success-screen");
|
|
385
|
+
// Auto-redirect after 5s — gives the phone time to drop the AP and
|
|
386
|
+
// rejoin home WiFi before navigating to the .local / IP address.
|
|
387
|
+
var remaining = 5;
|
|
388
|
+
var countdownEl = document.getElementById("redirect-countdown");
|
|
389
|
+
var ticker = setInterval(function() {
|
|
390
|
+
remaining -= 1;
|
|
391
|
+
if (countdownEl) countdownEl.textContent = String(remaining);
|
|
392
|
+
if (remaining <= 0) {
|
|
393
|
+
clearInterval(ticker);
|
|
394
|
+
window.location.href = primary;
|
|
395
|
+
}
|
|
396
|
+
}, 1000);
|
|
372
397
|
}
|
|
373
398
|
|
|
374
399
|
function pollResult() {
|
|
@@ -332,12 +332,27 @@ handle_connect_requests() {
|
|
|
332
332
|
nmcli device set wlan0 managed yes 2>/dev/null
|
|
333
333
|
sleep 2
|
|
334
334
|
|
|
335
|
+
# NM's wifi-list cache is empty immediately after wlan0 is handed back
|
|
336
|
+
# from hostapd, so `nmcli device wifi connect` reports "No network with
|
|
337
|
+
# SSID 'X' found" even when hostapd's pre-AP scan saw it. Trigger a
|
|
338
|
+
# rescan and poll until the target SSID appears in the cache (or 15s
|
|
339
|
+
# timeout) before attempting the connect.
|
|
340
|
+
nmcli device wifi rescan 2>/dev/null || true
|
|
341
|
+
local rescan_elapsed=0
|
|
342
|
+
while [ "$rescan_elapsed" -lt 15 ]; do
|
|
343
|
+
if nmcli -t -f SSID device wifi list 2>/dev/null | grep -Fxq "$target_ssid"; then
|
|
344
|
+
break
|
|
345
|
+
fi
|
|
346
|
+
sleep 1
|
|
347
|
+
rescan_elapsed=$((rescan_elapsed + 1))
|
|
348
|
+
done
|
|
349
|
+
log "rescan-before-connect: target=\"${target_ssid}\" elapsed=${rescan_elapsed}s"
|
|
350
|
+
|
|
335
351
|
# Attempt WiFi connection. Capture exit code before || true so we
|
|
336
352
|
# get nmcli's actual exit status, not the unconditional 0 from || true.
|
|
337
353
|
local connect_output connect_exit
|
|
338
354
|
# `--wait` / `-w` is a top-level nmcli option (must precede the
|
|
339
|
-
# subcommand), not an argument to `device wifi connect`.
|
|
340
|
-
# after the subcommand fails with "invalid extra argument '--wait'".
|
|
355
|
+
# subcommand), not an argument to `device wifi connect`.
|
|
341
356
|
connect_output=$(nmcli --wait 30 device wifi connect "$target_ssid" password "$target_password" 2>&1)
|
|
342
357
|
connect_exit=$?
|
|
343
358
|
|