From b7d4aaed9ab78d6868c0f374a7426133ccce45dd Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Mon, 29 Jul 2019 13:05:27 -0500 Subject: [PATCH] Fixed up mail CSS and message deletion --- .../default-plugins/pms/loadinbox.py | 5 +- .../default-plugins/pms/mailapi.py | 4 +- .../static-data/default-plugins/pms/main.py | 2 + .../default-plugins/pms/sentboxdb.py | 4 +- onionr/static-data/www/board/index.html | 2 +- onionr/static-data/www/mail/index.html | 2 +- onionr/static-data/www/mail/mail.css | 118 +++--------------- onionr/static-data/www/shared/mail.css | 32 ----- 8 files changed, 30 insertions(+), 139 deletions(-) delete mode 100644 onionr/static-data/www/shared/mail.css diff --git a/onionr/static-data/default-plugins/pms/loadinbox.py b/onionr/static-data/default-plugins/pms/loadinbox.py index ca49ea25..69d6f570 100755 --- a/onionr/static-data/default-plugins/pms/loadinbox.py +++ b/onionr/static-data/default-plugins/pms/loadinbox.py @@ -20,16 +20,17 @@ import onionrblockapi from coredb import blockmetadb import filepaths +from utils import reconstructhash, identifyhome import deadsimplekv as simplekv def load_inbox(): inbox_list = [] - deleted = simplekv.DeadSimpleKV(filepaths.cached_storage).get('deleted_mail') + deleted = simplekv.DeadSimpleKV(identifyhome.identify_home() + '/mailcache.dat').get('deleted_mail') if deleted is None: deleted = [] for blockHash in blockmetadb.get_blocks_by_type('pm'): block = onionrblockapi.Block(blockHash) block.decrypt() - if block.decrypted and blockHash not in deleted: + if block.decrypted and reconstructhash.deconstruct_hash(blockHash) not in deleted: inbox_list.append(blockHash) return inbox_list \ No newline at end of file diff --git a/onionr/static-data/default-plugins/pms/mailapi.py b/onionr/static-data/default-plugins/pms/mailapi.py index fd3c8ee7..34692a75 100755 --- a/onionr/static-data/default-plugins/pms/mailapi.py +++ b/onionr/static-data/default-plugins/pms/mailapi.py @@ -21,13 +21,14 @@ import sys, os, json from flask import Response, request, redirect, Blueprint, abort from onionrusers import contactmanager from onionrutils import stringvalidators +from utils import reconstructhash, identifyhome import filepaths import deadsimplekv as simplekv sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) import loadinbox, sentboxdb flask_blueprint = Blueprint('mail', __name__) -kv = simplekv.DeadSimpleKV(filepaths.cached_storage) +kv = simplekv.DeadSimpleKV(identifyhome.identify_home() + '/mailcache.dat') @flask_blueprint.route('/mail/ping') def mail_ping(): @@ -37,6 +38,7 @@ def mail_ping(): def mail_delete(block): if not stringvalidators.validate_hash(block): abort(504) + block = reconstructhash.deconstruct_hash(block) existing = kv.get('deleted_mail') if existing is None: existing = [] diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py index 4f1cc23a..40d0c9da 100755 --- a/onionr/static-data/default-plugins/pms/main.py +++ b/onionr/static-data/default-plugins/pms/main.py @@ -23,6 +23,7 @@ import logger, config, threading, time, datetime from onionrblockapi import Block import onionrexceptions from onionrusers import onionrusers +from utils import reconstructhash from onionrutils import stringvalidators, escapeansi, bytesconverter import locale, sys, os, json @@ -37,6 +38,7 @@ flask_blueprint = mailapi.flask_blueprint def add_deleted(keyStore, bHash): existing = keyStore.get('deleted_mail') + bHash = reconstructhash.reconstruct_hash(bHash) if existing is None: existing = [] else: diff --git a/onionr/static-data/default-plugins/pms/sentboxdb.py b/onionr/static-data/default-plugins/pms/sentboxdb.py index 28d2ab5d..fee62bce 100755 --- a/onionr/static-data/default-plugins/pms/sentboxdb.py +++ b/onionr/static-data/default-plugins/pms/sentboxdb.py @@ -19,7 +19,7 @@ ''' import sqlite3, os from onionrutils import epoch -from utils import identifyhome +from utils import identifyhome, reconstructhash class SentBox: def __init__(self): self.dbLocation = identifyhome.identify_home() + '/sentbox.db' @@ -58,6 +58,7 @@ class SentBox: return retData def addToSent(self, blockID, peer, message, subject=''): + blockID = reconstructhash.deconstruct_hash(blockID) self.connect() args = (blockID, peer, message, subject, epoch.get_epoch()) self.cursor.execute('INSERT INTO sent VALUES(?, ?, ?, ?, ?)', args) @@ -66,6 +67,7 @@ class SentBox: return def removeSent(self, blockID): + blockID = reconstructhash.deconstruct_hash(blockID) self.connect() args = (blockID,) self.cursor.execute('DELETE FROM sent where hash=?', args) diff --git a/onionr/static-data/www/board/index.html b/onionr/static-data/www/board/index.html index a0b1746e..c3e8011e 100755 --- a/onionr/static-data/www/board/index.html +++ b/onionr/static-data/www/board/index.html @@ -111,7 +111,7 @@ Refresh Feed

- + diff --git a/onionr/static-data/www/mail/index.html b/onionr/static-data/www/mail/index.html index 3cfeae30..8ff0ec79 100755 --- a/onionr/static-data/www/mail/index.html +++ b/onionr/static-data/www/mail/index.html @@ -11,7 +11,7 @@ - + diff --git a/onionr/static-data/www/mail/mail.css b/onionr/static-data/www/mail/mail.css index f2c31086..72240f55 100755 --- a/onionr/static-data/www/mail/mail.css +++ b/onionr/static-data/www/mail/mail.css @@ -1,86 +1,22 @@ -.threads div{ - padding-top: 1em; +.threadEntry{ + margin-bottom: 2%; } -.threads div span{ - padding-left: 0.2em; - padding-right: 0.2em; +.threadEntry button{ + margin-right: 1%; +} +.threadEntry span, .sentboxList span{ + padding-left: 1%; } -#threadPlaceholder{ - display: none; - margin-top: 1em; - font-size: 2em; -} - -input{ - background-color: white; +.overlayContent{ + background-color: lightgray; + border: 3px solid black; + border-radius: 3px; color: black; -} - -.btn-group button { - border: 1px solid black; - padding: 10px 24px; /* Some padding */ - cursor: pointer; /* Pointer/hand icon */ - float: left; /* Float the buttons side by side */ - } - - .btn-group button:hover { - background-color: darkgray; - } - - .btn-group { - margin-bottom: 2em; - } - -#tabBtns{ - margin-bottom: 3em; - display: block; -} - - .activeTab{ - color: black; - background-color: gray; - } - - .overlayContent{ - background-color: lightgray; - border: 3px solid black; - border-radius: 3px; - color: black; - font-family: Verdana, Geneva, Tahoma, sans-serif; - min-height: 100%; - padding: 1em; - margin: 1em; - } - - .mailPing{ - color: orange; - } - - #addUnknownContact, .mailPing{ - display: none; - } - -.danger{ - color: red; -} - -.warn{ - color: orange; -} - -.good{ - color: greenyellow; -} - -.pre{ - padding-top: 1em; - word-wrap: break-word; - font-family: monospace; - white-space: pre; -} -.messageContent{ - font-size: 1.5em; + font-family: Verdana, Geneva, Tahoma, sans-serif; + min-height: 100%; + padding: 1em; + margin: 1em; } #draftText{ @@ -95,26 +31,6 @@ input{ color: black; } -.break-up{ - margin-top: 1em; -} - -.primaryBtn{ - border-radius: 3px; - padding: 3px; - color: black; - width: 5%; -} - -.successBtn{ - background-color: #28a745; - border-radius: 3px; - padding: 5px; - color: black; - font-size: 1.5em; - width: 10%; -} - -.content{ - min-height: 1000px; +.sentboxList{ + padding-top: 1em; } \ No newline at end of file diff --git a/onionr/static-data/www/shared/mail.css b/onionr/static-data/www/shared/mail.css deleted file mode 100644 index 5e9de2f6..00000000 --- a/onionr/static-data/www/shared/mail.css +++ /dev/null @@ -1,32 +0,0 @@ -.threadEntry{ - margin-bottom: 2%; -} -.threadEntry button{ - margin-right: 1%; -} -.threadEntry span, .sentboxList span{ - padding-left: 1%; -} - -.overlayContent{ - background-color: lightgray; - border: 3px solid black; - border-radius: 3px; - color: black; - font-family: Verdana, Geneva, Tahoma, sans-serif; - min-height: 100%; - padding: 1em; - margin: 1em; -} - -#draftText{ - margin-top: 1em; - margin-bottom: 1em; - display: block; - width: 50%; - height: 75%; - min-width: 2%; - min-height: 5%; - background: white; - color: black; -} \ No newline at end of file