summaryrefslogtreecommitdiff
path: root/backend/resilient
diff options
context:
space:
mode:
authorKarl Semich <0xloem@gmail.com>2016-09-04 08:51:51 -0400
committerKarl Semich <0xloem@gmail.com>2016-09-04 08:51:51 -0400
commit13705c9e94dfa1d6c34f9895dc0a8b1ff97957f5 (patch)
treeb9899cad7a5853e7c2d999e174bdc83c6f2ec9c0 /backend/resilient
parentab765b1c2f392e5fd79f9180a93991c13299488e (diff)
downloadstandingwithresilience-13705c9e94dfa1d6c34f9895dc0a8b1ff97957f5.tar.gz
standingwithresilience-13705c9e94dfa1d6c34f9895dc0a8b1ff97957f5.zip
launch zeronet if not running and ZERONETDIR provided
Diffstat (limited to 'backend/resilient')
-rw-r--r--backend/resilient/__init__.py13
1 files changed, 9 insertions, 4 deletions
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