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
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

View File

@ -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 = []

View File

@ -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:

View File

@ -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)

View File

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

View File

@ -11,7 +11,7 @@
<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/styles-new.css">
<link rel="stylesheet" href="/shared/mail.css">
<link rel="stylesheet" href="/mail/mail.css">
</head>
<body>

View File

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

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