diff options
author | IkiWiki <ikiwiki.info> | 2020-03-03 15:56:27 -0500 |
---|---|---|
committer | IkiWiki <ikiwiki.info> | 2020-03-03 15:56:27 -0500 |
commit | 7f6df89a48a2d57a6d09c8fd6dcf0a0ca0a5018a (patch) | |
tree | 89a1a7a1241b7461a2c561784a42f3919cf60171 /backend/resilient/bsv_metanet.py | |
parent | 4b743a1f2435454da297ff55d531157101d77f7e (diff) | |
download | standingwithresilience-7f6df89a48a2d57a6d09c8fd6dcf0a0ca0a5018a.tar.gz standingwithresilience-7f6df89a48a2d57a6d09c8fd6dcf0a0ca0a5018a.zip |
Diffstat (limited to 'backend/resilient/bsv_metanet.py')
-rw-r--r-- | backend/resilient/bsv_metanet.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/backend/resilient/bsv_metanet.py b/backend/resilient/bsv_metanet.py index 62bf6c1..98956bb 100644 --- a/backend/resilient/bsv_metanet.py +++ b/backend/resilient/bsv_metanet.py @@ -24,13 +24,18 @@ class bsvup(): with open(self.keyfile) as f: self.privkey = f.read() self.configdir = self.keyfile + '.bsv' if bsvup.found: - if not os.path.isdir(self.configdir): - os.mkdir(self.configdir) + if not os.path.isfile(os.path.join(self.configdir, 'key')): + if os.path.isdir(self.configdir): + os.remove(os.path.join(self.configdir, '.bsv')) + else: + os.mkdir(self.configdir) os.symlink(".", os.path.join(self.configdir, ".bsv")) - proc = subprocess.Popen([bsvup.binary, 'init'], stdin=subprocess.PIPE, cwd=self.configdir) - proc.stdin.write(self.privkey + "\n") - time.sleep(1) - proc.communicate("\n") + proc = subprocess.Popen([bsvup.binary, '-p', '', '-r', '250', 'init'], stdin=subprocess.PIPE, cwd=self.configdir) + result = proc.communicate(self.privkey + "\n"); + print(result[0]) + print(result[1]) + if not os.path.isfile(os.path.join(self.configdir, 'key')): + raise "key not generated" open(os.path.join(self.configdir, "info", ".keepme"), "a").close() open(os.path.join(self.configdir, "objects", ".keepme"), "a").close() open(os.path.join(self.configdir, "tx", ".keepme"), "a").close() @@ -44,7 +49,7 @@ class bsvup(): # add files to bsv metanet orig_dir = os.path.abspath(".") - proc = subprocess.Popen([bsvup.binary, '-f', html_path, 'upload'], stdin=subprocess.PIPE, cwd=self.configdir) + proc = subprocess.Popen([bsvup.binary, '-p', '', '-r', '250', '-f', html_path, 'upload'], stdin=subprocess.PIPE, cwd=self.configdir) proc.stdin.write("\n") time.sleep(1) proc.stdin.write("Y\n") |