From a4deaeacaea620077dbc22bf14065b769b6410d0 Mon Sep 17 00:00:00 2001 From: Weston Blieden Date: Sat, 11 Apr 2026 20:59:35 +0200 Subject: [PATCH] Fix empty syslog: pipe tailscaled output via --verbose=1 to logger, add app list API fallback to all variants --- aarch64/app/Tailscale_VPN | 5 ++-- aarch64/app/html/index.html | 29 ++++++++++++++++++++++- aarch64_ROOT/app/Tailscale_VPN | 5 ++-- aarch64_ROOT/app/html/index.html | 28 +++++++++++++++++++++- aarch64_custom/app/html/index.html | 28 +++++++++++++++++++++- aarch64_custom/app/lib/start_tailscale.sh | 3 ++- arm/app/Tailscale_VPN | 5 ++-- arm/app/html/index.html | 28 +++++++++++++++++++++- arm_ROOT/app/Tailscale_VPN | 5 ++-- arm_ROOT/app/html/index.html | 28 +++++++++++++++++++++- arm_custom/app/html/index.html | 28 +++++++++++++++++++++- arm_custom/app/lib/start_tailscale.sh | 3 ++- 12 files changed, 179 insertions(+), 16 deletions(-) diff --git a/aarch64/app/Tailscale_VPN b/aarch64/app/Tailscale_VPN index 82c875d..09ee36b 100755 --- a/aarch64/app/Tailscale_VPN +++ b/aarch64/app/Tailscale_VPN @@ -17,13 +17,14 @@ logger -t "Tailscale_VPN" "Starting tailscaled daemon (userspace networking)" --state="$STATE_DIR/tailscaled.state" \ --socket="$STATE_DIR/tailscaled.sock" \ --socks5-server=localhost:1055 \ - --tun=userspace-networking & + --tun=userspace-networking \ + --verbose=1 2>&1 | logger -t "Tailscale_VPN" & TAILSCALED_PID=$! sleep 2 logger -t "Tailscale_VPN" "Connecting to Tailscale network (scroll to bottom for auth URL if prompted)" -"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up +"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up 2>&1 | logger -t "Tailscale_VPN" logger -t "Tailscale_VPN" "Tailscale VPN is running" wait $TAILSCALED_PID diff --git a/aarch64/app/html/index.html b/aarch64/app/html/index.html index 08a901d..1fad3ab 100644 --- a/aarch64/app/html/index.html +++ b/aarch64/app/html/index.html @@ -566,12 +566,39 @@ ('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2); } + var APP_LIST_URL = '/axis-cgi/applications/list.cgi'; + + function checkAppRunning() { + return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' }) + .then(function(r) { return r.text(); }) + .then(function(xml) { + var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"')); + return m && m[1] === 'Running'; + }) + .catch(function() { return false; }); + } + function refresh() { fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' }) .then(function(r) { return r.text(); }) .then(function(txt) { - render(parse(txt)); + var result = parse(txt); renderLogs(txt); + if (result.state !== 'disconnected') { + render(result); + } else { + // Syslog may be empty/rotated - check app status API + checkAppRunning().then(function(running) { + if (running) { + result.state = 'connected'; + result.ip = result.ip || cacheGet('ip'); + result.node = result.node || cacheGet('node'); + result.tailnet = result.tailnet || cacheGet('tailnet'); + result.version = result.version || cacheGet('version'); + } + render(result); + }); + } }) .catch(function() { document.getElementById('status-text').textContent = 'Unable to fetch logs'; diff --git a/aarch64_ROOT/app/Tailscale_VPN b/aarch64_ROOT/app/Tailscale_VPN index eff7e43..8c60ed7 100755 --- a/aarch64_ROOT/app/Tailscale_VPN +++ b/aarch64_ROOT/app/Tailscale_VPN @@ -15,13 +15,14 @@ killall tailscaled 2>/dev/null || true logger -t "Tailscale_VPN" "Starting tailscaled daemon" "$APP_DIR/lib/tailscaled" \ --state="$STATE_DIR/tailscaled.state" \ - --socket="$STATE_DIR/tailscaled.sock" & + --socket="$STATE_DIR/tailscaled.sock" \ + --verbose=1 2>&1 | logger -t "Tailscale_VPN" & TAILSCALED_PID=$! sleep 2 logger -t "Tailscale_VPN" "Connecting to Tailscale network (scroll to bottom for auth URL if prompted)" -"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up --accept-routes +"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up --accept-routes 2>&1 | logger -t "Tailscale_VPN" logger -t "Tailscale_VPN" "Tailscale VPN is running" wait $TAILSCALED_PID diff --git a/aarch64_ROOT/app/html/index.html b/aarch64_ROOT/app/html/index.html index 08a901d..dc5174d 100644 --- a/aarch64_ROOT/app/html/index.html +++ b/aarch64_ROOT/app/html/index.html @@ -566,12 +566,38 @@ ('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2); } + var APP_LIST_URL = '/axis-cgi/applications/list.cgi'; + + function checkAppRunning() { + return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' }) + .then(function(r) { return r.text(); }) + .then(function(xml) { + var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"')); + return m && m[1] === 'Running'; + }) + .catch(function() { return false; }); + } + function refresh() { fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' }) .then(function(r) { return r.text(); }) .then(function(txt) { - render(parse(txt)); + var result = parse(txt); renderLogs(txt); + if (result.state !== 'disconnected') { + render(result); + } else { + checkAppRunning().then(function(running) { + if (running) { + result.state = 'connected'; + result.ip = result.ip || cacheGet('ip'); + result.node = result.node || cacheGet('node'); + result.tailnet = result.tailnet || cacheGet('tailnet'); + result.version = result.version || cacheGet('version'); + } + render(result); + }); + } }) .catch(function() { document.getElementById('status-text').textContent = 'Unable to fetch logs'; diff --git a/aarch64_custom/app/html/index.html b/aarch64_custom/app/html/index.html index 3de2f10..113c06d 100644 --- a/aarch64_custom/app/html/index.html +++ b/aarch64_custom/app/html/index.html @@ -566,12 +566,38 @@ ('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2); } + var APP_LIST_URL = '/axis-cgi/applications/list.cgi'; + + function checkAppRunning() { + return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' }) + .then(function(r) { return r.text(); }) + .then(function(xml) { + var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"')); + return m && m[1] === 'Running'; + }) + .catch(function() { return false; }); + } + function refresh() { fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' }) .then(function(r) { return r.text(); }) .then(function(txt) { - render(parse(txt)); + var result = parse(txt); renderLogs(txt); + if (result.state !== 'disconnected') { + render(result); + } else { + checkAppRunning().then(function(running) { + if (running) { + result.state = 'connected'; + result.ip = result.ip || cacheGet('ip'); + result.node = result.node || cacheGet('node'); + result.tailnet = result.tailnet || cacheGet('tailnet'); + result.version = result.version || cacheGet('version'); + } + render(result); + }); + } }) .catch(function() { document.getElementById('status-text').textContent = 'Unable to fetch logs'; diff --git a/aarch64_custom/app/lib/start_tailscale.sh b/aarch64_custom/app/lib/start_tailscale.sh index 2a358db..62d7de5 100644 --- a/aarch64_custom/app/lib/start_tailscale.sh +++ b/aarch64_custom/app/lib/start_tailscale.sh @@ -42,7 +42,8 @@ $TAILSCALED_PATH \ --state="$STATE_DIR/tailscaled.state" \ --socket=$SOCKET_PATH \ --socks5-server=localhost:1055 \ - --tun=userspace-networking & + --tun=userspace-networking \ + --verbose=1 2>&1 | logger -t "tailscale_script" & TAILSCALED_PID=$! # Wait for tailscaled to initialize diff --git a/arm/app/Tailscale_VPN b/arm/app/Tailscale_VPN index 82c875d..09ee36b 100755 --- a/arm/app/Tailscale_VPN +++ b/arm/app/Tailscale_VPN @@ -17,13 +17,14 @@ logger -t "Tailscale_VPN" "Starting tailscaled daemon (userspace networking)" --state="$STATE_DIR/tailscaled.state" \ --socket="$STATE_DIR/tailscaled.sock" \ --socks5-server=localhost:1055 \ - --tun=userspace-networking & + --tun=userspace-networking \ + --verbose=1 2>&1 | logger -t "Tailscale_VPN" & TAILSCALED_PID=$! sleep 2 logger -t "Tailscale_VPN" "Connecting to Tailscale network (scroll to bottom for auth URL if prompted)" -"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up +"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up 2>&1 | logger -t "Tailscale_VPN" logger -t "Tailscale_VPN" "Tailscale VPN is running" wait $TAILSCALED_PID diff --git a/arm/app/html/index.html b/arm/app/html/index.html index 08a901d..dc5174d 100644 --- a/arm/app/html/index.html +++ b/arm/app/html/index.html @@ -566,12 +566,38 @@ ('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2); } + var APP_LIST_URL = '/axis-cgi/applications/list.cgi'; + + function checkAppRunning() { + return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' }) + .then(function(r) { return r.text(); }) + .then(function(xml) { + var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"')); + return m && m[1] === 'Running'; + }) + .catch(function() { return false; }); + } + function refresh() { fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' }) .then(function(r) { return r.text(); }) .then(function(txt) { - render(parse(txt)); + var result = parse(txt); renderLogs(txt); + if (result.state !== 'disconnected') { + render(result); + } else { + checkAppRunning().then(function(running) { + if (running) { + result.state = 'connected'; + result.ip = result.ip || cacheGet('ip'); + result.node = result.node || cacheGet('node'); + result.tailnet = result.tailnet || cacheGet('tailnet'); + result.version = result.version || cacheGet('version'); + } + render(result); + }); + } }) .catch(function() { document.getElementById('status-text').textContent = 'Unable to fetch logs'; diff --git a/arm_ROOT/app/Tailscale_VPN b/arm_ROOT/app/Tailscale_VPN index eff7e43..8c60ed7 100755 --- a/arm_ROOT/app/Tailscale_VPN +++ b/arm_ROOT/app/Tailscale_VPN @@ -15,13 +15,14 @@ killall tailscaled 2>/dev/null || true logger -t "Tailscale_VPN" "Starting tailscaled daemon" "$APP_DIR/lib/tailscaled" \ --state="$STATE_DIR/tailscaled.state" \ - --socket="$STATE_DIR/tailscaled.sock" & + --socket="$STATE_DIR/tailscaled.sock" \ + --verbose=1 2>&1 | logger -t "Tailscale_VPN" & TAILSCALED_PID=$! sleep 2 logger -t "Tailscale_VPN" "Connecting to Tailscale network (scroll to bottom for auth URL if prompted)" -"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up --accept-routes +"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up --accept-routes 2>&1 | logger -t "Tailscale_VPN" logger -t "Tailscale_VPN" "Tailscale VPN is running" wait $TAILSCALED_PID diff --git a/arm_ROOT/app/html/index.html b/arm_ROOT/app/html/index.html index 08a901d..dc5174d 100644 --- a/arm_ROOT/app/html/index.html +++ b/arm_ROOT/app/html/index.html @@ -566,12 +566,38 @@ ('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2); } + var APP_LIST_URL = '/axis-cgi/applications/list.cgi'; + + function checkAppRunning() { + return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' }) + .then(function(r) { return r.text(); }) + .then(function(xml) { + var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"')); + return m && m[1] === 'Running'; + }) + .catch(function() { return false; }); + } + function refresh() { fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' }) .then(function(r) { return r.text(); }) .then(function(txt) { - render(parse(txt)); + var result = parse(txt); renderLogs(txt); + if (result.state !== 'disconnected') { + render(result); + } else { + checkAppRunning().then(function(running) { + if (running) { + result.state = 'connected'; + result.ip = result.ip || cacheGet('ip'); + result.node = result.node || cacheGet('node'); + result.tailnet = result.tailnet || cacheGet('tailnet'); + result.version = result.version || cacheGet('version'); + } + render(result); + }); + } }) .catch(function() { document.getElementById('status-text').textContent = 'Unable to fetch logs'; diff --git a/arm_custom/app/html/index.html b/arm_custom/app/html/index.html index 3de2f10..113c06d 100644 --- a/arm_custom/app/html/index.html +++ b/arm_custom/app/html/index.html @@ -566,12 +566,38 @@ ('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2); } + var APP_LIST_URL = '/axis-cgi/applications/list.cgi'; + + function checkAppRunning() { + return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' }) + .then(function(r) { return r.text(); }) + .then(function(xml) { + var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"')); + return m && m[1] === 'Running'; + }) + .catch(function() { return false; }); + } + function refresh() { fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' }) .then(function(r) { return r.text(); }) .then(function(txt) { - render(parse(txt)); + var result = parse(txt); renderLogs(txt); + if (result.state !== 'disconnected') { + render(result); + } else { + checkAppRunning().then(function(running) { + if (running) { + result.state = 'connected'; + result.ip = result.ip || cacheGet('ip'); + result.node = result.node || cacheGet('node'); + result.tailnet = result.tailnet || cacheGet('tailnet'); + result.version = result.version || cacheGet('version'); + } + render(result); + }); + } }) .catch(function() { document.getElementById('status-text').textContent = 'Unable to fetch logs'; diff --git a/arm_custom/app/lib/start_tailscale.sh b/arm_custom/app/lib/start_tailscale.sh index 2a358db..62d7de5 100644 --- a/arm_custom/app/lib/start_tailscale.sh +++ b/arm_custom/app/lib/start_tailscale.sh @@ -42,7 +42,8 @@ $TAILSCALED_PATH \ --state="$STATE_DIR/tailscaled.state" \ --socket=$SOCKET_PATH \ --socks5-server=localhost:1055 \ - --tun=userspace-networking & + --tun=userspace-networking \ + --verbose=1 2>&1 | logger -t "tailscale_script" & TAILSCALED_PID=$! # Wait for tailscaled to initialize