diff --git a/AUTHORS.MD b/AUTHORS.MD new file mode 100644 index 00000000..519bbf8a --- /dev/null +++ b/AUTHORS.MD @@ -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 \ No newline at end of file diff --git a/onionr/notifier/__init__.py b/onionr/notifier/__init__.py new file mode 100644 index 00000000..5fdc696f --- /dev/null +++ b/onionr/notifier/__init__.py @@ -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 . +''' +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) diff --git a/onionr/onionrcommands/onionrstatistics.py b/onionr/onionrcommands/onionrstatistics.py index b4c5c20b..f165be2f 100755 --- a/onionr/onionrcommands/onionrstatistics.py +++ b/onionr/onionrcommands/onionrstatistics.py @@ -43,7 +43,7 @@ def show_stats(): # count stats '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/'))), 'Stored Blocks' : str(totalBlocks), 'Percent Blocks Signed' : str(round(100 * signedBlocks / max(totalBlocks, 1), 2)) + '%' @@ -95,23 +95,3 @@ def show_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) - -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 diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py index 40d0c9da..1dba4a08 100755 --- a/onionr/static-data/default-plugins/pms/main.py +++ b/onionr/static-data/default-plugins/pms/main.py @@ -22,9 +22,10 @@ import logger, config, threading, time, datetime from onionrblockapi import Block import onionrexceptions -from onionrusers import onionrusers +from onionrusers import onionrusers, contactmanager from utils import reconstructhash from onionrutils import stringvalidators, escapeansi, bytesconverter +import notifier import locale, sys, os, json locale.setlocale(locale.LC_ALL, '') @@ -52,13 +53,20 @@ def on_insertblock(api, data={}): sentboxTools = sentboxdb.SentBox() sentboxTools.addToSent(data['hash'], data['peer'], data['content'], meta['subject']) -def on_init(api, data = None): - ''' - This event is called after Onionr is initialized, but before the command - inputted is executed. Could be called when daemon is starting or when - just the client is running. - ''' +def on_processblocks(api, data=None): + if data['type'] != 'pm': + return + data['block'].decrypt() + 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'])) diff --git a/onionr/static-data/www/chat/index.html b/onionr/static-data/www/chat/index.html index 2616a5ef..b7d18141 100755 --- a/onionr/static-data/www/chat/index.html +++ b/onionr/static-data/www/chat/index.html @@ -12,6 +12,10 @@ + + + + @@ -56,7 +60,6 @@
-

Identity @@ -73,21 +76,16 @@

-
-
+
    -
    yeet
    +
    yeet
    - - - - \ No newline at end of file diff --git a/onionr/static-data/www/chat/js/main.js b/onionr/static-data/www/chat/js/main.js index c5027ca0..8373f380 100755 --- a/onionr/static-data/www/chat/js/main.js +++ b/onionr/static-data/www/chat/js/main.js @@ -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 +*/ friendList = {} convoListElement = document.getElementsByClassName('conversationList')[0] diff --git a/onionr/static-data/www/chat/js/message-feed.js b/onionr/static-data/www/chat/js/message-feed.js new file mode 100644 index 00000000..69ef94b7 --- /dev/null +++ b/onionr/static-data/www/chat/js/message-feed.js @@ -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 +*/ +let MessageCache = class { + +} \ No newline at end of file