fix: LND UI use protocol-aware fetch, default backend URL

- fetchConnectInfo: use window.location.protocol instead of hardcoded http://
- getBackendUrl: default to current origin when no ?backend= param
- Fixes mixed content errors on HTTPS Tailscale servers
- Also fixed: nginx needed reload on Tailscale servers, Arch 2 missing
  /lnd-connect-info nginx location

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian 2026-03-16 16:06:07 +00:00
parent ec916892de
commit 2339946e6a

View File

@ -434,7 +434,7 @@
function getBackendUrl() { function getBackendUrl() {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
return params.get('backend') || ''; return params.get('backend') || (window.location.protocol + '//' + window.location.hostname);
} }
function setSettingsTab(tabId) { function setSettingsTab(tabId) {
@ -629,7 +629,7 @@
async function fetchConnectInfo() { async function fetchConnectInfo() {
try { try {
const resp = await fetch('http://' + window.location.hostname + '/lnd-connect-info'); const resp = await fetch(window.location.protocol + '//' + window.location.hostname + '/lnd-connect-info');
if (!resp.ok) throw new Error('HTTP ' + resp.status); if (!resp.ok) throw new Error('HTTP ' + resp.status);
const data = await resp.json(); const data = await resp.json();
if (data.cert_base64url) { if (data.cert_base64url) {