work on plugins doing http endpoints
This commit is contained in:
parent
11625b297a
commit
c89bf5b430
31 changed files with 76 additions and 17 deletions
0
onionr/static-data/default-plugins/contactmanager/info.json
Normal file → Executable file
0
onionr/static-data/default-plugins/contactmanager/info.json
Normal file → Executable file
0
onionr/static-data/default-plugins/contactmanager/main.py
Normal file → Executable file
0
onionr/static-data/default-plugins/contactmanager/main.py
Normal file → Executable file
|
@ -23,15 +23,21 @@ import logger, config, threading, time, readline, datetime
|
|||
from onionrblockapi import Block
|
||||
import onionrexceptions
|
||||
from onionrusers import onionrusers
|
||||
from flask import Response, request, redirect, Blueprint
|
||||
import locale, sys, os, json
|
||||
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
|
||||
plugin_name = 'pms'
|
||||
PLUGIN_VERSION = '0.0.1'
|
||||
flask_blueprint = Blueprint('mail', __name__)
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
|
||||
import sentboxdb # import after path insert
|
||||
|
||||
plugin_name = 'pms'
|
||||
PLUGIN_VERSION = '0.0.1'
|
||||
@flask_blueprint.route('/mailhello')
|
||||
def mailhello():
|
||||
return "hello world from mail"
|
||||
|
||||
def draw_border(text):
|
||||
#https://stackoverflow.com/a/20757491
|
||||
|
@ -190,7 +196,6 @@ class OnionrMail:
|
|||
finally:
|
||||
if choice == '-q':
|
||||
entering = False
|
||||
|
||||
return
|
||||
|
||||
def get_sent_list(self, display=True):
|
||||
|
@ -293,6 +298,15 @@ class OnionrMail:
|
|||
logger.warn('Invalid choice.')
|
||||
return
|
||||
|
||||
def add_deleted(keyStore, bHash):
|
||||
existing = keyStore.get('deleted_mail')
|
||||
if existing is None:
|
||||
existing = []
|
||||
else:
|
||||
if bHash in existing:
|
||||
return
|
||||
keyStore.put('deleted_mail', existing.append(bHash))
|
||||
|
||||
def on_insertblock(api, data={}):
|
||||
sentboxTools = sentboxdb.SentBox(api.get_core())
|
||||
meta = json.loads(data['meta'])
|
||||
|
@ -306,11 +320,17 @@ def on_pluginrequest(api, data=None):
|
|||
postData = {}
|
||||
blockID = ''
|
||||
sentboxTools = sentboxdb.SentBox(api.get_core())
|
||||
keyStore = api.get_core().keyStore
|
||||
if data['name'] == 'mail':
|
||||
path = data['path']
|
||||
print(cmd)
|
||||
cmd = path.split('/')[1]
|
||||
if cmd == 'sentbox':
|
||||
resp = OnionrMail(api).get_sent_list(display=False)
|
||||
elif cmd == 'deletemsg':
|
||||
print('path', data['path'])
|
||||
#add_deleted(keyStore, data['path'].split('/')[2])
|
||||
resp = 'success'
|
||||
if resp != '':
|
||||
api.get_onionr().clientAPIInst.pluginResponses[data['pluginResponse']] = resp
|
||||
|
||||
|
@ -325,4 +345,5 @@ def on_init(api, data = None):
|
|||
mail = OnionrMail(pluginapi)
|
||||
api.commands.register(['mail'], mail.menu)
|
||||
api.commands.register_help('mail', 'Interact with OnionrMail')
|
||||
print("YEET2")
|
||||
return
|
||||
|
|
0
onionr/static-data/www/friends/friends.js
Normal file → Executable file
0
onionr/static-data/www/friends/friends.js
Normal file → Executable file
0
onionr/static-data/www/friends/index.html
Normal file → Executable file
0
onionr/static-data/www/friends/index.html
Normal file → Executable file
0
onionr/static-data/www/friends/style.css
Normal file → Executable file
0
onionr/static-data/www/friends/style.css
Normal file → Executable file
|
@ -233,7 +233,6 @@ for (var i = 0; i < idStrings.length; i++){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < document.getElementsByClassName('refresh').length; i++){
|
||||
document.getElementsByClassName('refresh')[i].style.float = 'right'
|
||||
}
|
||||
|
|
0
onionr/static-data/www/mail/sendmail.js
Normal file → Executable file
0
onionr/static-data/www/mail/sendmail.js
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue