+ added notifications for mail messages

+ added authors.md
master
Kevin Froman 2019-08-07 22:45:18 -05:00
parent 41368a2747
commit ef01d3b577
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
7 changed files with 105 additions and 38 deletions

12
AUTHORS.MD Normal file
View File

@ -0,0 +1,12 @@
# Incomplete List of Contributors
Onionr is created by a team of hard working volunteers.
In no order of importance, these people make Onionr happen:
* [Beardog](https://www.chaoswebs.net/) - Project owner and core developer
* [InvisaMage](https://invisamage.com/) - Web UI Bulma design
* [Arinerron](https://arinerron.com/) - Logger and config modules, testing and other contributions
* [Anhar Ismail](https://github.com/anharismail) - Created Onionr's logo
+ Other contributors and testers

View File

@ -0,0 +1,30 @@
'''
Onionr - Private P2P Communication
Desktop notification wrapper
'''
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
try:
import simplenotifications as simplenotify
except ImportError:
notifications_enabled = False
else:
notifications_enabled = True
def notify(title: str = "Onionr", message: str = ""):
"""cross platform method to show a notification"""
if not notifications_enabled: return
simplenotify.notify(title, message)

View File

@ -43,7 +43,7 @@ def show_stats():
# count stats # count stats
'div2' : True, 'div2' : True,
'Known Peers' : str(max(len(keydb.listkeys.list_peers()) - 1, 0)), 'Known Peers (nodes)' : str(max(len(keydb.listkeys.list_adders()) - 1, 0)),
'Enabled Plugins' : str(len(config.get('plugins.enabled', list()))) + ' / ' + str(len(os.listdir(home + 'plugins/'))), 'Enabled Plugins' : str(len(config.get('plugins.enabled', list()))) + ' / ' + str(len(os.listdir(home + 'plugins/'))),
'Stored Blocks' : str(totalBlocks), 'Stored Blocks' : str(totalBlocks),
'Percent Blocks Signed' : str(round(100 * signedBlocks / max(totalBlocks, 1), 2)) + '%' 'Percent Blocks Signed' : str(round(100 * signedBlocks / max(totalBlocks, 1), 2)) + '%'
@ -95,23 +95,3 @@ def show_details():
for detail in details: for detail in details:
logger.info('%s%s: \n%s%s\n' % (logger.colors.fg.lightgreen, detail, logger.colors.fg.green, details[detail]), terminal = True) logger.info('%s%s: \n%s%s\n' % (logger.colors.fg.lightgreen, detail, logger.colors.fg.green, details[detail]), terminal = True)
def show_peers(o_inst):
randID = str(uuid.uuid4())
daemonqueue.daemon_queue_add('connectedPeers', responseID=randID)
while True:
try:
time.sleep(3)
peers = daemonqueue.daemon_queue_get_response(randID)
except KeyboardInterrupt:
break
if not type(peers) is None:
if peers not in ('', 'failure', None):
if peers != False:
if peers == 'none':
print('No current outgoing connections.')
else:
logger.info('Peers: %s' % peers)
else:
logger.warn('Daemon probably not running. Unable to list connected peers.')
break

View File

@ -22,9 +22,10 @@
import logger, config, threading, time, datetime import logger, config, threading, time, datetime
from onionrblockapi import Block from onionrblockapi import Block
import onionrexceptions import onionrexceptions
from onionrusers import onionrusers from onionrusers import onionrusers, contactmanager
from utils import reconstructhash from utils import reconstructhash
from onionrutils import stringvalidators, escapeansi, bytesconverter from onionrutils import stringvalidators, escapeansi, bytesconverter
import notifier
import locale, sys, os, json import locale, sys, os, json
locale.setlocale(locale.LC_ALL, '') locale.setlocale(locale.LC_ALL, '')
@ -52,13 +53,20 @@ def on_insertblock(api, data={}):
sentboxTools = sentboxdb.SentBox() sentboxTools = sentboxdb.SentBox()
sentboxTools.addToSent(data['hash'], data['peer'], data['content'], meta['subject']) sentboxTools.addToSent(data['hash'], data['peer'], data['content'], meta['subject'])
def on_init(api, data = None): def on_processblocks(api, data=None):
''' if data['type'] != 'pm':
This event is called after Onionr is initialized, but before the command return
inputted is executed. Could be called when daemon is starting or when data['block'].decrypt()
just the client is running. metadata = data['block'].bmetadata # Get the block metadata
'''
pluginapi = api signer = bytesconverter.bytes_to_str(data['block'].signer)
user = contactmanager.ContactManager(signer, saveUser=False)
name = user.get_info("name")
if name != 'anonymous':
signer = name.title()
else:
signer = signer[:5]
return if data['block'].decrypted:
notifier.notify(title="Onionr Mail - New Message",
message="From: %s\n\nSubject: %s" % (signer, metadata['subject']))

View File

@ -12,6 +12,10 @@
<link rel="stylesheet" href="/shared/main/bulma.min.css"> <link rel="stylesheet" href="/shared/main/bulma.min.css">
<link rel="stylesheet" href="/shared/main/styles-new.css"> <link rel="stylesheet" href="/shared/main/styles-new.css">
<link rel="stylesheet" href="/chat/css/convos.css"> <link rel="stylesheet" href="/chat/css/convos.css">
<script defer src='/shared/navbar.js'></script>
<script defer src='/shared/misc.js'></script>
<script defer src='/chat/js/message-feed.js'></script>
<script defer src='/chat/js/main.js'></script>
</head> </head>
<body> <body>
@ -56,7 +60,6 @@
</div> </div>
<div class="column is-7"> <div class="column is-7">
<div class="field"> <div class="field">
<label class="label">Open Site</label>
<div class="field has-addons"> <div class="field has-addons">
<p class="control"> <p class="control">
<a class="button is-static">Identity</a> <a class="button is-static">Identity</a>
@ -73,21 +76,16 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</section> </section>
<br> <br>
<div class="columns chatContent"> <div class="columns chatContent">
<div class="column has-background-dark has-text-light is-one-fifths content convoListContainer"> <div class="column has-background-grey-dark has-text-light is-one-fifths content convoListContainer">
<ul class='conversationList'></ul> <ul class='conversationList'></ul>
</div> </div>
<div class="column chatBox has-text-dark has-background-dark is-four-fifths">yeet</div> <div class="column chatBox has-text-light has-background-dark is-four-fifths">yeet</div>
</div> </div>
<script src='/shared/navbar.js'></script>
<script src='/shared/misc.js'></script>
<script src='/chat/js/main.js'></script>
</body> </body>
</html> </html>

View File

@ -1,3 +1,21 @@
/*
Onionr - Private P2P Communication
Main Onionr chat UI script
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
*/
friendList = {} friendList = {}
convoListElement = document.getElementsByClassName('conversationList')[0] convoListElement = document.getElementsByClassName('conversationList')[0]

View File

@ -0,0 +1,21 @@
/*
Onionr - Private P2P Communication
This file manages chat messages in the chat UI
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
*/
let MessageCache = class {
}