summaryrefslogtreecommitdiff
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
parentab765b1c2f392e5fd79f9180a93991c13299488e (diff)
downloadstandingwithresilience-13705c9e94dfa1d6c34f9895dc0a8b1ff97957f5.tar.gz
standingwithresilience-13705c9e94dfa1d6c34f9895dc0a8b1ff97957f5.zip
launch zeronet if not running and ZERONETDIR provided
-rw-r--r--backend/resilient/__init__.py13
-rwxr-xr-xbackend/update.py2
2 files changed, 10 insertions, 5 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
diff --git a/backend/update.py b/backend/update.py
index f97d0aa..50c3983 100755
--- a/backend/update.py
+++ b/backend/update.py
@@ -29,7 +29,7 @@ if resilient.freenet.freesitemgr.found and resilient.freenet.running:
git_repos = [
resilient.git('git://standingwithresilience.branchable.com/'),
resilient.git('fairlystable-guest:/srv/git/standingwithresilience'),
- resilient.git('https://gitlab.com/standingwithresilience/standingwithresilience.gitlab.io.git')
+ resilient.git('https://gitlab.com/standingwithresilience/standingwithresilience.gitlab.io.git', None)
]
for host in zeronet_urls: