From 13705c9e94dfa1d6c34f9895dc0a8b1ff97957f5 Mon Sep 17 00:00:00 2001 From: Karl Semich <0xloem@gmail.com> Date: Sun, 4 Sep 2016 08:51:51 -0400 Subject: launch zeronet if not running and ZERONETDIR provided --- backend/resilient/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'backend/resilient') diff --git a/backend/resilient/__init__.py b/backend/resilient/__init__.py index c42b5d1..ba994a6 100644 --- a/backend/resilient/__init__.py +++ b/backend/resilient/__init__.py @@ -126,10 +126,6 @@ class ikiwiki: class zeronet: - running = url200('http://127.0.0.1:43110/1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D') - if not running: - print("WARNING: ZeroNet not running, won't be used") - found = 'ZERONETDIR' in os.environ if found: zn_datadir = os.path.join(os.environ['ZERONETDIR'], 'ZeroNet/data') @@ -138,6 +134,15 @@ class zeronet: if not found: print("WARNING: ZeroNet bundle not found in ZERONETDIR, public zeronet site won't be updated") + running = url200('http://127.0.0.1:43110/1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D') + if found and not running: + proc = subprocess.Popen([zn_script]) + while not running and proc.returncode == None: + time.sleep(0.5) + running = url200('http://127.0.0.1:43110/1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D') + if not running: + print("WARNING: ZeroNet not running, won't be used") + def __init__(self, addr, key): self.addr = addr self.key = key -- cgit v1.2.3