airloom 0.1.2 → 0.1.3
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 +12 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1211,6 +1211,7 @@ Environment variables:
|
|
|
1211
1211
|
OPENAI_API_KEY API key for the OpenAI adapter.
|
|
1212
1212
|
ABLY_API_KEY Your own Ably key (overrides default community relay).
|
|
1213
1213
|
RELAY_URL Self-hosted WebSocket relay URL (disables Ably).
|
|
1214
|
+
VIEWER_URL Public viewer URL (default: GitHub Pages).
|
|
1214
1215
|
HOST_PORT Same as --port (CLI flag takes precedence).
|
|
1215
1216
|
`.trimStart());
|
|
1216
1217
|
}
|
|
@@ -1220,6 +1221,8 @@ if (cliArgs.help) {
|
|
|
1220
1221
|
process.exit(0);
|
|
1221
1222
|
}
|
|
1222
1223
|
var DEFAULT_ABLY_KEY = "SfHSAQ.IRTOQQ:FBbi9a7ZV6jIu0Gdo_UeYhIN4rzpMrud5-LldURNh9s";
|
|
1224
|
+
var DEFAULT_VIEWER_URL = "https://bobstrogg.github.io/Airloom/";
|
|
1225
|
+
var VIEWER_URL = process.env.VIEWER_URL ?? DEFAULT_VIEWER_URL;
|
|
1223
1226
|
var RELAY_URL = process.env.RELAY_URL;
|
|
1224
1227
|
var ABLY_API_KEY = process.env.ABLY_API_KEY ?? (RELAY_URL ? void 0 : DEFAULT_ABLY_KEY);
|
|
1225
1228
|
var ABLY_TOKEN_TTL = parseInt(process.env.ABLY_TOKEN_TTL ?? String(24 * 60 * 60 * 1e3), 10);
|
|
@@ -1360,19 +1363,22 @@ async function main() {
|
|
|
1360
1363
|
console.log("[host] Viewer dist not found \u2014 QR will open raw JSON fallback");
|
|
1361
1364
|
}
|
|
1362
1365
|
const { server, broadcast, port } = await createHostServer({ port: HOST_PORT, state, viewerDir });
|
|
1363
|
-
const lanIP = getLanIP();
|
|
1364
|
-
const host = lanIP ?? "localhost";
|
|
1365
|
-
const baseUrl = `http://${host}:${port}`;
|
|
1366
1366
|
const pairingBase64 = Buffer.from(pairingJSON).toString("base64url");
|
|
1367
|
-
const
|
|
1367
|
+
const viewerBase = VIEWER_URL.replace(/\/+$/, "");
|
|
1368
|
+
const qrContent = `${viewerBase}/#${pairingBase64}`;
|
|
1369
|
+
const lanIP = getLanIP();
|
|
1370
|
+
const lanHost = lanIP ?? "localhost";
|
|
1371
|
+
const lanBaseUrl = `http://${lanHost}:${port}`;
|
|
1372
|
+
const lanViewerUrl = viewerDir ? `${lanBaseUrl}/viewer/#${pairingBase64}` : null;
|
|
1368
1373
|
const qrDataUrl = await QRCode.toDataURL(qrContent, { width: 300, margin: 2 });
|
|
1369
1374
|
const qrTerminal = await QRCode.toString(qrContent, { type: "terminal", small: true });
|
|
1370
1375
|
state.pairingQR = qrDataUrl;
|
|
1371
1376
|
console.log("\nPairing QR Code:");
|
|
1372
1377
|
console.log(qrTerminal);
|
|
1373
1378
|
console.log(`Pairing Code: ${displayCode}`);
|
|
1374
|
-
|
|
1375
|
-
|
|
1379
|
+
console.log(`Viewer URL: ${qrContent}`);
|
|
1380
|
+
if (lanViewerUrl) {
|
|
1381
|
+
console.log(`LAN Viewer: ${lanViewerUrl}`);
|
|
1376
1382
|
}
|
|
1377
1383
|
if (!useAbly) console.log(`Relay: ${RELAY_URL}`);
|
|
1378
1384
|
const localUrl = `http://localhost:${port}`;
|