From 7f6df89a48a2d57a6d09c8fd6dcf0a0ca0a5018a Mon Sep 17 00:00:00 2001 From: IkiWiki Date: Tue, 3 Mar 2020 15:56:27 -0500 Subject: bsv appears to upload successfully now, have not viewed the upload to check --- backend/dep/bsvup | 2 +- backend/resilient/bsv_metanet.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'backend') diff --git a/backend/dep/bsvup b/backend/dep/bsvup index 062592d..da1b635 160000 --- a/backend/dep/bsvup +++ b/backend/dep/bsvup @@ -1 +1 @@ -Subproject commit 062592d6f259780f3cc0a81c15662e43b39c8371 +Subproject commit da1b63529b81a44080fcd25c24e50d02a266afc1 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") -- cgit v1.2.3