Fixed up mail CSS and message deletion

This commit is contained in:
Kevin Froman 2019-07-29 13:05:27 -05:00
parent 000db2dda2
commit b7d4aaed9a
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
8 changed files with 30 additions and 139 deletions

View File

@ -20,16 +20,17 @@
import onionrblockapi import onionrblockapi
from coredb import blockmetadb from coredb import blockmetadb
import filepaths import filepaths
from utils import reconstructhash, identifyhome
import deadsimplekv as simplekv import deadsimplekv as simplekv
def load_inbox(): def load_inbox():
inbox_list = [] 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: if deleted is None:
deleted = [] deleted = []
for blockHash in blockmetadb.get_blocks_by_type('pm'): for blockHash in blockmetadb.get_blocks_by_type('pm'):
block = onionrblockapi.Block(blockHash) block = onionrblockapi.Block(blockHash)
block.decrypt() 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) inbox_list.append(blockHash)
return inbox_list return inbox_list

View File

@ -21,13 +21,14 @@ import sys, os, json
from flask import Response, request, redirect, Blueprint, abort from flask import Response, request, redirect, Blueprint, abort
from onionrusers import contactmanager from onionrusers import contactmanager
from onionrutils import stringvalidators from onionrutils import stringvalidators
from utils import reconstructhash, identifyhome
import filepaths import filepaths
import deadsimplekv as simplekv import deadsimplekv as simplekv
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
import loadinbox, sentboxdb import loadinbox, sentboxdb
flask_blueprint = Blueprint('mail', __name__) flask_blueprint = Blueprint('mail', __name__)
kv = simplekv.DeadSimpleKV(filepaths.cached_storage) kv = simplekv.DeadSimpleKV(identifyhome.identify_home() + '/mailcache.dat')
@flask_blueprint.route('/mail/ping') @flask_blueprint.route('/mail/ping')
def mail_ping(): def mail_ping():
@ -37,6 +38,7 @@ def mail_ping():
def mail_delete(block): def mail_delete(block):
if not stringvalidators.validate_hash(block): if not stringvalidators.validate_hash(block):
abort(504) abort(504)
block = reconstructhash.deconstruct_hash(block)
existing = kv.get('deleted_mail') existing = kv.get('deleted_mail')
if existing is None: if existing is None:
existing = [] existing = []

View File

@ -23,6 +23,7 @@ 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
from utils import reconstructhash
from onionrutils import stringvalidators, escapeansi, bytesconverter from onionrutils import stringvalidators, escapeansi, bytesconverter
import locale, sys, os, json import locale, sys, os, json
@ -37,6 +38,7 @@ flask_blueprint = mailapi.flask_blueprint
def add_deleted(keyStore, bHash): def add_deleted(keyStore, bHash):
existing = keyStore.get('deleted_mail') existing = keyStore.get('deleted_mail')
bHash = reconstructhash.reconstruct_hash(bHash)
if existing is None: if existing is None:
existing = [] existing = []
else: else:

View File

@ -19,7 +19,7 @@
''' '''
import sqlite3, os import sqlite3, os
from onionrutils import epoch from onionrutils import epoch
from utils import identifyhome from utils import identifyhome, reconstructhash
class SentBox: class SentBox:
def __init__(self): def __init__(self):
self.dbLocation = identifyhome.identify_home() + '/sentbox.db' self.dbLocation = identifyhome.identify_home() + '/sentbox.db'
@ -58,6 +58,7 @@ class SentBox:
return retData return retData
def addToSent(self, blockID, peer, message, subject=''): def addToSent(self, blockID, peer, message, subject=''):
blockID = reconstructhash.deconstruct_hash(blockID)
self.connect() self.connect()
args = (blockID, peer, message, subject, epoch.get_epoch()) args = (blockID, peer, message, subject, epoch.get_epoch())
self.cursor.execute('INSERT INTO sent VALUES(?, ?, ?, ?, ?)', args) self.cursor.execute('INSERT INTO sent VALUES(?, ?, ?, ?, ?)', args)
@ -66,6 +67,7 @@ class SentBox:
return return
def removeSent(self, blockID): def removeSent(self, blockID):
blockID = reconstructhash.deconstruct_hash(blockID)
self.connect() self.connect()
args = (blockID,) args = (blockID,)
self.cursor.execute('DELETE FROM sent where hash=?', args) self.cursor.execute('DELETE FROM sent where hash=?', args)

View File

@ -111,7 +111,7 @@
<a class="button is-success" id='refreshFeed'>Refresh Feed</a> <a class="button is-success" id='refreshFeed'>Refresh Feed</a>
</p> </p>
</div> </div>
<input type="checkbox" class="checkbox" id="refreshCheckbox" > <input type="checkbox" class="checkbox" id="refreshCheckbox" checked>
<label for="refreshCheckbox">Auto Refresh Feed</label> <label for="refreshCheckbox">Auto Refresh Feed</label>
</div> </div>
</div> </div>

View File

@ -11,7 +11,7 @@
<link rel='shortcut icon' type='image/ico' href='/shared/images/favicon.ico'> <link rel='shortcut icon' type='image/ico' href='/shared/images/favicon.ico'>
<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="/shared/mail.css"> <link rel="stylesheet" href="/mail/mail.css">
</head> </head>
<body> <body>

View File

@ -1,45 +1,11 @@
.threads div{ .threadEntry{
padding-top: 1em; margin-bottom: 2%;
} }
.threads div span{ .threadEntry button{
padding-left: 0.2em; margin-right: 1%;
padding-right: 0.2em;
} }
.threadEntry span, .sentboxList span{
#threadPlaceholder{ padding-left: 1%;
display: none;
margin-top: 1em;
font-size: 2em;
}
input{
background-color: white;
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{ .overlayContent{
@ -53,36 +19,6 @@ input{
margin: 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;
}
#draftText{ #draftText{
margin-top: 1em; margin-top: 1em;
margin-bottom: 1em; margin-bottom: 1em;
@ -95,26 +31,6 @@ input{
color: black; color: black;
} }
.break-up{ .sentboxList{
margin-top: 1em; padding-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;
} }

View File

@ -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;
}