fix(setup): print the hub's public URL, not the host the reader typed
The setup pages build commands that get pasted into a terminal on a *different* machine, but they built them from location.origin. Open the console by LAN IP or over a tunnel and the enrolment one-liner told the target machine to curl an address it may not resolve at all. /docs and /enroll/:token are now served through a template that stamps in config.baseUrl — PUBLIC_URL where set, the proxied request host otherwise — with location.origin left as a fallback for the unsubstituted file. The remaining 127.0.0.1 references are the loopback VNC port on the machine being registered, which is meant to be literal. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -293,7 +293,11 @@
|
||||
|
||||
<script src="/particles.js"></script>
|
||||
<script>
|
||||
const origin = location.origin;
|
||||
// Substituted by the server with this hub's public address. These commands run
|
||||
// on a different machine, so location.origin would be wrong whenever the reader
|
||||
// reached this page by IP or over a tunnel. Falls back only if served unmodified.
|
||||
const stamped = '__HUB__';
|
||||
const origin = stamped.indexOf('__') === 0 ? location.origin : stamped;
|
||||
|
||||
const commands = {
|
||||
'cmd-macos': `curl -fsSL ${origin}/install.sh?token=TOKEN | sh`,
|
||||
|
||||
+6
-2
@@ -119,8 +119,12 @@
|
||||
|
||||
<script>
|
||||
const token = location.pathname.split('/').filter(Boolean).pop();
|
||||
const origin = location.origin;
|
||||
const link = `${origin}/enroll/${token}`;
|
||||
|
||||
// Substituted by the server with this hub's public address — the commands below
|
||||
// are pasted into a terminal on this machine and have to reach the hub by a name
|
||||
// it can resolve, not by whatever host the reader used to open this page.
|
||||
const stamped = '__HUB__';
|
||||
const origin = stamped.indexOf('__') === 0 ? location.origin : stamped;
|
||||
|
||||
// The hub stamps its own address and this token into the install scripts, so
|
||||
// each of these really is the whole command — nothing to fill in by hand.
|
||||
|
||||
Reference in New Issue
Block a user