@rubytech/create-maxy 1.0.779 → 1.0.781

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/dist/index.js CHANGED
@@ -430,6 +430,18 @@ function installSystemDeps() {
430
430
  console.log(` Avahi host-name: ${HOSTNAME_FLAG} (updated avahi-daemon.conf)`);
431
431
  }
432
432
  catch { /* avahi-daemon.conf may not exist — non-critical */ }
433
+ // Restart avahi-daemon so the new hostname takes effect immediately
434
+ // and any stale "maxytest-2" auto-renamed records from a previous
435
+ // boot's hostname-conflict cycle are withdrawn. Without this,
436
+ // avahi-resolve -n <hostname>.local times out from the device itself
437
+ // because the daemon is still advertising the previous identity.
438
+ try {
439
+ console.log(" [privileged] systemctl restart avahi-daemon");
440
+ shell("systemctl", ["restart", "avahi-daemon"], { sudo: true });
441
+ }
442
+ catch (err) {
443
+ console.error(` WARNING: avahi-daemon restart failed: ${err instanceof Error ? err.message : String(err)}`);
444
+ }
433
445
  }
434
446
  catch (err) {
435
447
  console.error(` WARNING: Failed to set hostname to '${HOSTNAME_FLAG}': ${err instanceof Error ? err.message : String(err)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/create-maxy",
3
- "version": "1.0.779",
3
+ "version": "1.0.781",
4
4
  "description": "Install Maxy — AI for Productive People",
5
5
  "bin": {
6
6
  "create-maxy": "./dist/index.js"
@@ -245,10 +245,14 @@ function portalHTML() {
245
245
  <div class="card" style="padding:32px 16px">
246
246
  <div class="success-icon">&#10003;</div>
247
247
  <h1>Connected!</h1>
248
- <p class="hint">${escapedBrandName} is now online. Open your browser and visit:</p>
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 addr = data.hostname
369
+ var hostnameAddr = data.hostname
366
370
  ? "http://" + data.hostname + ".local" + devicePort
367
- : "http://" + data.ip + devicePort;
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 = addr;
370
- link.textContent = addr;
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() {
@@ -361,6 +361,13 @@ handle_connect_requests() {
361
361
  assigned_ip=$(get_wifi_ip)
362
362
  log_state "connected" "ssid=\"${target_ssid}\" ip=\"${assigned_ip}\""
363
363
 
364
+ # Restart avahi-daemon so it withdraws any stale "<host>-2.local"
365
+ # auto-renamed records from a previous boot (where hostapd's wlan0
366
+ # transition triggered a self-conflict during withdraw/announce) and
367
+ # re-claims the canonical hostname on the freshly-connected network.
368
+ systemctl restart avahi-daemon 2>/dev/null || true
369
+ log "avahi-daemon restarted to refresh ${HOSTNAME_NAME}.local advertisement"
370
+
364
371
  # Write success result for the HTTP server
365
372
  echo "{\"success\":true,\"ip\":\"${assigned_ip}\",\"hostname\":\"${HOSTNAME_NAME}\"}" > "$RESULT_FILE"
366
373