mirror of
https://github.com/dw-0/kiauh.git
synced 2026-08-04 05:17:53 +05:00
feat(moongate): offer LAN-only mode during install (#819)
Moongate v0.9.51 added a cloud-free Direct (LAN/VPN) per-printer mode;
its installer supports it via MOONGATE_LAN_ONLY=1 / --lan-only. Ask the
question KIAUH-natively (get_confirm, default No = current behaviour)
and pass MOONGATE_LAN_ONLY through the existing env hand-off.
The env var is passed either way ("1"/"0"): Moongate's installer is
growing its own interactive terminal prompt for the same choice, and an
explicitly-set value suppresses it, so KIAUH users only ever see
KIAUH-styled dialogs.
Also: the pre-install ATTENTION dialog mentions the LAN-only option
(it skips the tunnel, auth proxy and Moonraker rebind), and the
success dialog's pairing step matches the chosen mode.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,19 +94,35 @@ class MoongateExtension(BaseExtension):
|
|||||||
if port is None:
|
if port is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# LAN-only mode skips the Cloudflare tunnel + auth proxy and keeps
|
||||||
|
# Moonraker reachable on the LAN - for users who reach their printer
|
||||||
|
# over their own VPN (WireGuard/Tailscale) and want no cloud at all.
|
||||||
|
lan_only = get_confirm(
|
||||||
|
"Install in LAN-only mode (no cloud tunnel, LAN/VPN access only)?",
|
||||||
|
default_choice=False,
|
||||||
|
allow_go_back=True,
|
||||||
|
)
|
||||||
|
if lan_only is None:
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._clone_or_update_repo()
|
self._clone_or_update_repo()
|
||||||
|
|
||||||
BackupService().backup_moonraker_conf()
|
BackupService().backup_moonraker_conf()
|
||||||
|
|
||||||
# Hand off to Moongate's own installer. It is idempotent,
|
# Hand off to Moongate's own installer. It is idempotent and
|
||||||
# non-interactive and env-driven: it installs cloudflared, adds the
|
# env-driven: it installs cloudflared, adds the two systemd
|
||||||
# two systemd services, patches moonraker.conf and restarts
|
# services, patches moonraker.conf and restarts Moonraker +
|
||||||
# Moonraker + Klipper itself.
|
# Klipper itself. MOONGATE_LAN_ONLY is passed either way: an
|
||||||
|
# explicit value also suppresses the installer's own terminal
|
||||||
|
# prompt, so KIAUH users only ever see KIAUH-styled questions.
|
||||||
self._run_script(
|
self._run_script(
|
||||||
MOONGATE_INSTALL_SCRIPT,
|
MOONGATE_INSTALL_SCRIPT,
|
||||||
moonraker,
|
moonraker,
|
||||||
extra_env={"MOONGATE_PORT": str(port)},
|
extra_env={
|
||||||
|
"MOONGATE_PORT": str(port),
|
||||||
|
"MOONGATE_LAN_ONLY": "1" if lan_only else "0",
|
||||||
|
},
|
||||||
)
|
)
|
||||||
except (GitException, CalledProcessError, OSError) as e:
|
except (GitException, CalledProcessError, OSError) as e:
|
||||||
Logger.print_error(f"Error during Moongate installation:\n{e}")
|
Logger.print_error(f"Error during Moongate installation:\n{e}")
|
||||||
@@ -119,8 +135,14 @@ class MoongateExtension(BaseExtension):
|
|||||||
"\n\n",
|
"\n\n",
|
||||||
"Next steps:",
|
"Next steps:",
|
||||||
"● Install the Moongate app on your Android device.",
|
"● Install the Moongate app on your Android device.",
|
||||||
"● Run MOONGATE_PAIR in the Klipper console (or open the pair "
|
(
|
||||||
"page printed above) and scan the QR code.",
|
"● In the app: Add printer > Direct (LAN/VPN), then run "
|
||||||
|
"MOONGATE_PAIR in the Klipper console and scan the QR (or "
|
||||||
|
"type the printer's address)."
|
||||||
|
if lan_only
|
||||||
|
else "● Run MOONGATE_PAIR in the Klipper console (or open "
|
||||||
|
"the pair page printed above) and scan the QR code."
|
||||||
|
),
|
||||||
"● Updates from now on: Mainsail/Fluidd > Software Updates > Moongate.",
|
"● Updates from now on: Mainsail/Fluidd > Software Updates > Moongate.",
|
||||||
],
|
],
|
||||||
margin_bottom=1,
|
margin_bottom=1,
|
||||||
@@ -214,6 +236,11 @@ class MoongateExtension(BaseExtension):
|
|||||||
"● bind Moonraker to 127.0.0.1 (the auth proxy fronts the tunnel)",
|
"● bind Moonraker to 127.0.0.1 (the auth proxy fronts the tunnel)",
|
||||||
"● add a tightly-scoped Avahi sudoers entry for LAN discovery",
|
"● add a tightly-scoped Avahi sudoers entry for LAN discovery",
|
||||||
"\n\n",
|
"\n\n",
|
||||||
|
"Prefer no cloud at all? A LAN-only option is offered after "
|
||||||
|
"this dialog - it skips the tunnel, the auth proxy and the "
|
||||||
|
"Moonraker rebind, and the printer stays reachable over your "
|
||||||
|
"LAN or your own VPN only.",
|
||||||
|
"\n\n",
|
||||||
"Remote access relies on cloud infrastructure operated by the "
|
"Remote access relies on cloud infrastructure operated by the "
|
||||||
"Moongate author. Moongate is licensed under PolyForm "
|
"Moongate author. Moongate is licensed under PolyForm "
|
||||||
"Noncommercial 1.0.0 (non-commercial use only).",
|
"Noncommercial 1.0.0 (non-commercial use only).",
|
||||||
|
|||||||
Reference in New Issue
Block a user