fixed broken waitforshare, work on mail, work on new plugin api endpoint

master
Kevin Froman 2019-02-08 00:19:05 -06:00
parent b038d758b9
commit 64be7ebff3
5 changed files with 26 additions and 4 deletions

View File

@ -410,7 +410,7 @@ class API:
return Response(resp) return Response(resp)
@app.route('/waitforshare/<name>', methods=['post']) @app.route('/waitforshare/<name>', methods=['post'])
def waitforshare(): def waitforshare(name):
assert name.isalnum() assert name.isalnum()
if name in self.publicAPI.hideBlocks: if name in self.publicAPI.hideBlocks:
self.publicAPI.hideBlocks.remove(name) self.publicAPI.hideBlocks.remove(name)
@ -454,6 +454,18 @@ class API:
@app.route('/getHumanReadable/<name>') @app.route('/getHumanReadable/<name>')
def getHumanReadable(name): def getHumanReadable(name):
return Response(self._core._utils.getHumanReadableID(name)) return Response(self._core._utils.getHumanReadableID(name))
@app.route('/apipoints/<path:subpath>')
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 = WSGIServer((self.host, bindPort), app, log=None, handler_class=FDSafeHandler)
self.httpServer.serve_forever() self.httpServer.serve_forever()

View File

@ -586,7 +586,7 @@ class OnionrCommunicatorDaemon:
proxyType = 'i2p' proxyType = 'i2p'
logger.info("Uploading block to " + peer) logger.info("Uploading block to " + peer)
if not self._core._utils.doPostRequest(url, data=data, proxyType=proxyType) == False: 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) finishedUploads.append(bl)
for x in finishedUploads: for x in finishedUploads:
try: try:

View File

@ -832,7 +832,7 @@ class Core:
retData = False retData = False
else: else:
# Tell the api server through localCommand to wait for the daemon to upload this block to make stastical analysis more difficult # 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.addToBlockDB(retData, selfInsert=True, dataSaved=True)
#self.setBlockType(retData, meta['type']) #self.setBlockType(retData, meta['type'])
self._utils.processBlockMetadata(retData) self._utils.processBlockMetadata(retData)

View File

@ -31,7 +31,7 @@
From: <input type='text' id='fromUser' readonly> Signature: <span id='sigValid'></span> From: <input type='text' id='fromUser' readonly> Signature: <span id='sigValid'></span>
</div> </div>
<div id='signatureValidity'></div> <div id='signatureValidity'></div>
<div id='threadDisplay'> <div id='threadDisplay' class='pre messageContent'>
</div> </div>
</div> </div>
</div> </div>

View File

@ -64,4 +64,14 @@ input{
.good{ .good{
color: greenyellow; color: greenyellow;
}
.pre{
padding-top: 1em;
word-wrap: break-word;
font-family: monospace;
white-space: pre;
}
.messageContent{
font-size: 1.5em;
} }