forked from bitcoinafterlife/bal-electrum-plugin
v0.5.16: onion helpers + download filter
This commit is contained in:
@@ -72,6 +72,7 @@ from ...core.will import (AmountException, HeirChangeException,
|
|||||||
WillexecutorChangeException, WillExecutorNotPresent,
|
WillexecutorChangeException, WillExecutorNotPresent,
|
||||||
WillExpiredException, WillItem, WillPostponedException)
|
WillExpiredException, WillItem, WillPostponedException)
|
||||||
from ...core.willexecutors import Willexecutors
|
from ...core.willexecutors import Willexecutors
|
||||||
|
from ...core.willexecutors import is_onion_url, is_tor_active # noqa: F401
|
||||||
|
|
||||||
# --- Presentation helpers ---
|
# --- Presentation helpers ---
|
||||||
from .theme import server_status_text, server_status_tooltip, status_color
|
from .theme import server_status_text, server_status_tooltip, status_color
|
||||||
|
|||||||
@@ -1157,8 +1157,16 @@ class BalWindow:
|
|||||||
)
|
)
|
||||||
if resp:
|
if resp:
|
||||||
result = resp
|
result = resp
|
||||||
for w in result:
|
# Tor gating: if Electrum is NOT connected through Tor, drop
|
||||||
if w not in ("status", "url"):
|
# the .onion servers entirely - they are unreachable without
|
||||||
|
# Tor and would only waste time. When on Tor, keep them all.
|
||||||
|
tor_on = is_tor_active()
|
||||||
|
for w in list(result.keys()):
|
||||||
|
if w in ("status", "url"):
|
||||||
|
continue
|
||||||
|
if not tor_on and is_onion_url(w):
|
||||||
|
del result[w]
|
||||||
|
continue
|
||||||
Willexecutors.initialize_willexecutor(
|
Willexecutors.initialize_willexecutor(
|
||||||
result[w], w, None,
|
result[w], w, None,
|
||||||
old_willexecutors.get(w, None),
|
old_willexecutors.get(w, None),
|
||||||
|
|||||||
Reference in New Issue
Block a user