From 64be7ebff38ba093567dd0785b8c28d7b14171ae Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Fri, 8 Feb 2019 00:19:05 -0600 Subject: [PATCH] fixed broken waitforshare, work on mail, work on new plugin api endpoint --- onionr/api.py | 14 +++++++++++++- onionr/communicator.py | 2 +- onionr/core.py | 2 +- onionr/static-data/www/mail/index.html | 2 +- onionr/static-data/www/mail/mail.css | 10 ++++++++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/onionr/api.py b/onionr/api.py index e6754edd..ac1a7eaa 100755 --- a/onionr/api.py +++ b/onionr/api.py @@ -410,7 +410,7 @@ class API: return Response(resp) @app.route('/waitforshare/', methods=['post']) - def waitforshare(): + def waitforshare(name): assert name.isalnum() if name in self.publicAPI.hideBlocks: self.publicAPI.hideBlocks.remove(name) @@ -454,6 +454,18 @@ class API: @app.route('/getHumanReadable/') def getHumanReadable(name): return Response(self._core._utils.getHumanReadableID(name)) + + @app.route('/apipoints/') + def pluginEndpoints(subpath=''): + # TODO have a variable for the plugin to set data to that we can use for the response + if len(subpath) > 1: + data = subpath.split('/') + if len(data) > 1: + plName = data[0] + events.event('pluginRequest', plName, subpath) + else: + abort(404) + return Response('Success') self.httpServer = WSGIServer((self.host, bindPort), app, log=None, handler_class=FDSafeHandler) self.httpServer.serve_forever() diff --git a/onionr/communicator.py b/onionr/communicator.py index 336258d4..52f41871 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -586,7 +586,7 @@ class OnionrCommunicatorDaemon: proxyType = 'i2p' logger.info("Uploading block to " + peer) if not self._core._utils.doPostRequest(url, data=data, proxyType=proxyType) == False: - self._core._utils.localCommand('waitforshare/' + bl) + self._core._utils.localCommand('waitforshare/' + bl, post=True) finishedUploads.append(bl) for x in finishedUploads: try: diff --git a/onionr/core.py b/onionr/core.py index 47f0e1ad..90e44f5e 100755 --- a/onionr/core.py +++ b/onionr/core.py @@ -832,7 +832,7 @@ class Core: retData = False else: # Tell the api server through localCommand to wait for the daemon to upload this block to make stastical analysis more difficult - self._utils.localCommand('waitforshare/' + retData) + self._utils.localCommand('/waitforshare/' + retData, post=True) self.addToBlockDB(retData, selfInsert=True, dataSaved=True) #self.setBlockType(retData, meta['type']) self._utils.processBlockMetadata(retData) diff --git a/onionr/static-data/www/mail/index.html b/onionr/static-data/www/mail/index.html index 051e280b..9830725b 100755 --- a/onionr/static-data/www/mail/index.html +++ b/onionr/static-data/www/mail/index.html @@ -31,7 +31,7 @@ From: Signature:
-
+
diff --git a/onionr/static-data/www/mail/mail.css b/onionr/static-data/www/mail/mail.css index c7bd8ed8..ea1cf169 100755 --- a/onionr/static-data/www/mail/mail.css +++ b/onionr/static-data/www/mail/mail.css @@ -64,4 +64,14 @@ input{ .good{ color: greenyellow; +} + +.pre{ + padding-top: 1em; + word-wrap: break-word; + font-family: monospace; + white-space: pre; +} +.messageContent{ + font-size: 1.5em; } \ No newline at end of file