diff --git a/docker/electrs-ui/index.html b/docker/electrs-ui/index.html
index 2971c2dc..09463362 100644
--- a/docker/electrs-ui/index.html
+++ b/docker/electrs-ui/index.html
@@ -346,25 +346,11 @@
}
}
- async function fetchTorInfo() {
- try {
- var resp = await fetch('/rpc/v1', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- credentials: 'include',
- body: JSON.stringify({ method: 'tor.list-services', params: {} })
- });
- var data = await resp.json();
- if (data.result && data.result.services) {
- var svc = data.result.services.find(function(s) {
- return s.name === 'electrumx' || s.name === 'electrs' || s.local_port === 50001;
- });
- if (svc && svc.onion_address) {
- torOnion = svc.onion_address;
- updateConnectionInfo();
- }
- }
- } catch(e) {}
+ function applyTorOnion(onion) {
+ if (onion) {
+ torOnion = onion;
+ updateConnectionInfo();
+ }
}
async function updateStatus() {
@@ -372,6 +358,11 @@
var resp = await fetch('electrs-status');
var data = await resp.json();
+ // Extract Tor onion from status response
+ if (data.tor_onion && !torOnion) {
+ applyTorOnion(data.tor_onion);
+ }
+
var indexedH = data.indexed_height || 0;
var networkH = data.network_height || 0;
var pct = data.progress_pct || 0;
@@ -426,7 +417,6 @@
updateStatus();
updateConnectionInfo();
- fetchTorInfo();
setInterval(updateStatus, 5000);