@rubytech/create-maxy 1.0.782 → 1.0.783
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
|
@@ -39,6 +39,10 @@ const RESULT_FILE = args["result-file"] || "/tmp/wifi-provision-result";
|
|
|
39
39
|
const BRAND_JSON = args["brand-json"] || "";
|
|
40
40
|
const HOSTNAME = args.hostname || "maxy";
|
|
41
41
|
const PORTAL_HOST = args["portal-host"] || "";
|
|
42
|
+
// Brand service port (e.g. 19200). Distinct from PORT, which is the
|
|
43
|
+
// captive portal's own listen port (always 80). Used only to render the
|
|
44
|
+
// post-connect URL.
|
|
45
|
+
const DEVICE_PORT = parseInt(args["device-port"] || "19200", 10);
|
|
42
46
|
|
|
43
47
|
// ── Load brand config ─────────────────────────────────────────────────
|
|
44
48
|
// All visual surfaces (colour, font, logo) come from brand.json so the
|
|
@@ -243,9 +247,11 @@ function portalHTML() {
|
|
|
243
247
|
}
|
|
244
248
|
.address-box a {
|
|
245
249
|
color: ${colors.primary};
|
|
246
|
-
text-decoration:
|
|
250
|
+
text-decoration: underline;
|
|
247
251
|
font-size: 16px;
|
|
248
252
|
font-weight: 600;
|
|
253
|
+
display: block;
|
|
254
|
+
-webkit-tap-highlight-color: ${colors.primary};
|
|
249
255
|
}
|
|
250
256
|
.hint { color: #888; font-size: 13px; margin-top: 12px; line-height: 1.5; }
|
|
251
257
|
</style>
|
|
@@ -287,11 +293,11 @@ function portalHTML() {
|
|
|
287
293
|
<h1>Connected!</h1>
|
|
288
294
|
<p class="hint">${escapedBrandName} is now online. Redirecting in <span id="redirect-countdown">20</span>s…</p>
|
|
289
295
|
<div class="address-box">
|
|
290
|
-
<a id="device-link" href="#"
|
|
296
|
+
<a id="device-link" href="#"></a>
|
|
291
297
|
</div>
|
|
292
298
|
<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>
|
|
293
299
|
<div class="address-box" id="ip-fallback-box" style="display:none">
|
|
294
|
-
<a id="device-link-ip" href="#"
|
|
300
|
+
<a id="device-link-ip" href="#"></a>
|
|
295
301
|
</div>
|
|
296
302
|
<p class="hint">This access point will close shortly.<br>Your phone will reconnect to your WiFi automatically.</p>
|
|
297
303
|
</div>
|
|
@@ -301,7 +307,10 @@ function portalHTML() {
|
|
|
301
307
|
(function() {
|
|
302
308
|
"use strict";
|
|
303
309
|
var selectedSSID = "";
|
|
304
|
-
|
|
310
|
+
// The brand service port (19200, configurable via --port), NOT the
|
|
311
|
+
// captive portal port (always 80). devicePort is appended to the
|
|
312
|
+
// post-connect URL so the link points at the admin server.
|
|
313
|
+
var devicePort = ${DEVICE_PORT === 80 ? '""' : JSON.stringify(":" + DEVICE_PORT)};
|
|
305
314
|
var deviceHostname = ${JSON.stringify(HOSTNAME)};
|
|
306
315
|
|
|
307
316
|
// Safe text insertion — no innerHTML for user-controlled content
|
|
@@ -60,6 +60,24 @@ LOG_FILE="${LOG_DIR}/wifi-provision.log"
|
|
|
60
60
|
|
|
61
61
|
mkdir -p "$LOG_DIR"
|
|
62
62
|
|
|
63
|
+
# Resolve the brand service's public port so the captive portal can render
|
|
64
|
+
# the post-connect URL with the correct port (the captive portal itself
|
|
65
|
+
# runs on :80, but the device's admin URL is on the brand port). Mirrors
|
|
66
|
+
# the same precedence as the installer: ~/{configDir}/.env override, then
|
|
67
|
+
# the systemd unit's Environment=PORT, then the documented default.
|
|
68
|
+
BRAND_PORT="19200"
|
|
69
|
+
if [ -f "${MAXY_DIR}/.env" ]; then
|
|
70
|
+
_p=$(grep -E '^PORT=' "${MAXY_DIR}/.env" 2>/dev/null | tail -1 | cut -d= -f2 | tr -d '"' | tr -d "'")
|
|
71
|
+
[ -n "$_p" ] && BRAND_PORT="$_p"
|
|
72
|
+
fi
|
|
73
|
+
if [ "$BRAND_PORT" = "19200" ]; then
|
|
74
|
+
_svc="${INSTALL_HOME}/.config/systemd/user/${HOSTNAME_NAME}.service"
|
|
75
|
+
if [ -f "$_svc" ]; then
|
|
76
|
+
_p=$(grep -E '^Environment=PORT=' "$_svc" 2>/dev/null | tail -1 | cut -d= -f3)
|
|
77
|
+
[ -n "$_p" ] && BRAND_PORT="$_p"
|
|
78
|
+
fi
|
|
79
|
+
fi
|
|
80
|
+
|
|
63
81
|
# ── Derived constants ────────────────────────────────────────────────
|
|
64
82
|
# SSID: lowercase the product name and replace spaces with hyphens — gives
|
|
65
83
|
# `maxy`, `real-agent`, etc. (kebab-case, no "-Setup" suffix). The user's
|
|
@@ -290,6 +308,7 @@ DNSMASQ_EOF
|
|
|
290
308
|
--brand-json "$BRAND_JSON" \
|
|
291
309
|
--hostname "$HOSTNAME_NAME" \
|
|
292
310
|
--portal-host "$PORTAL_HOST" \
|
|
311
|
+
--device-port "$BRAND_PORT" \
|
|
293
312
|
>> "$LOG_FILE" 2>&1 &
|
|
294
313
|
HTTP_SERVER_PID=$!
|
|
295
314
|
sleep 1
|