work on mail settings, onionruser own key adding bug fix

master
Kevin Froman 2020-02-27 21:06:28 -06:00
parent 862c6f2ea4
commit b62e613e8e
8 changed files with 25 additions and 24 deletions

View File

@ -11,6 +11,7 @@ from onionrcrypto import hashers
from onionrutils import bytesconverter
from onionrutils import mnemonickeys
from onionrtypes import JSONSerializable
"""
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

View File

@ -36,7 +36,6 @@ from onionrproofs import subprocesspow
import logger
from onionrtypes import UserIDSecretKey
def _check_upload_queue():
"""Returns the current upload queue len
raises OverflowError if max, false if api not running

View File

@ -10,6 +10,7 @@ from multiprocessing import Pipe, Process
import threading
import time
import json
import secrets
import logger
import onionrproofs
@ -109,7 +110,7 @@ class SubprocessPOW:
def do_pow(self, pipe):
"""find partial hash colision generating nonce for a block"""
nonce = BLOCK_NONCE_START_INT
nonce = -secrets.randbelow(10**10)
data = self.data
metadata = self.metadata
puzzle = self.puzzle

View File

@ -23,6 +23,7 @@ import unpaddedbase32
import nacl.exceptions
from coredb import keydb, dbfiles
import onionrcrypto
from onionrcrypto import getourkeypair
def deleteExpiredKeys():
# Fetch the keys we generated for the peer, that are still around
@ -54,8 +55,8 @@ class OnionrUser:
def __init__(self, publicKey, saveUser=False):
'''
OnionrUser is an abstraction for "users" of the network.
OnionrUser is an abstraction for "users" of the network.
Takes a base32 encoded ed25519 public key, and a bool saveUser
saveUser determines if we should add a user to our peer database or not.
'''
@ -64,7 +65,7 @@ class OnionrUser:
self.trust = 0
self.publicKey = publicKey
if saveUser:
if saveUser and not publicKey == getourkeypair.get_keypair():
try:
keydb.addkeys.add_peer(publicKey)
except (AssertionError, ValueError) as e:
@ -220,7 +221,7 @@ class OnionrUser:
conn.commit()
conn.close()
return True
@classmethod
def list_friends(cls):
friendList = []

View File

@ -27,6 +27,7 @@ from onionrplugins import onionrevents
import onionrexceptions
from onionrusers import onionrusers
from onionrutils import updater
from gevent import sleep
def process_block_metadata(blockHash: str):
'''
@ -37,8 +38,8 @@ def process_block_metadata(blockHash: str):
curTime = epoch.get_rounded_epoch(roundS=60)
myBlock = onionrblockapi.Block(blockHash)
if myBlock.isEncrypted:
print(myBlock.hash, myBlock.decrypt())
if myBlock.decrypted or not myBlock.isEncrypted:
myBlock.decrypt()
if (myBlock.isEncrypted and myBlock.decrypted) or (not myBlock.isEncrypted):
blockType = myBlock.getMetadata('type') # we would use myBlock.getType() here, but it is bugged with encrypted blocks
signer = bytesconverter.bytes_to_str(myBlock.signer)

View File

@ -59,7 +59,6 @@ def on_insertblock(api, data={}):
def on_processblocks(api, data=None):
print('mail got block', data)
if data['type'] != 'pm':
return
data['block'].decrypt()
@ -73,7 +72,6 @@ def on_processblocks(api, data=None):
else:
signer = signer[:5]
print('detected mail', data['block'].hash)
if data['block'].decrypted:
config.reload()
if config.get('mail.notificationSetting', True):

View File

@ -10,16 +10,16 @@
},
"general": {
"announce_node": true,
"dev_mode": true,
"dev_mode": false,
"display_header": true,
"hide_created_blocks": true,
"insert_deniable_blocks": false,
"insert_deniable_blocks": true,
"max_block_age": 2678400,
"minimum_block_pow": 4,
"minimum_send_pow": 4,
"minimum_block_pow": 5,
"minimum_send_pow": 5,
"public_key": "",
"random_bind_ip": false,
"security_level": 1,
"random_bind_ip": true,
"security_level": 0,
"show_notifications": true,
"socket_servers": false,
"store_plaintext_blocks": true,
@ -33,12 +33,12 @@
},
"file": {
"output": true,
"remove_on_exit": false
"remove_on_exit": true
},
"verbosity": "default"
},
"onboarding": {
"done": true
"done": false
},
"peers": {
"max_connect": 1000,
@ -58,11 +58,11 @@
"tor": {
"bridge_fingerprint": "",
"bridge_ip": "",
"existing_control_password": "testt",
"existing_control_port": 1338,
"existing_socks_port": 1337,
"existing_control_password": "",
"existing_control_port": 0,
"existing_socks_port": 0,
"use_bridge": false,
"use_existing_tor": true,
"use_existing_tor": false,
"v3onions": true
},
"transports": {
@ -72,4 +72,4 @@
"ui": {
"theme": "dark"
}
}
}

View File

@ -161,7 +161,7 @@
<div class="column is-2">
<div class="field">
<input id="messagePaddingSetting" type="checkbox"
class="switch is-rounded is-warning" checked>
class="switch is-rounded is-warning">
<label for="messagePaddingSetting"></label>
</div>
</div>