work on mail settings, onionruser own key adding bug fix
This commit is contained in:
parent
862c6f2ea4
commit
b62e613e8e
@ -11,6 +11,7 @@ from onionrcrypto import hashers
|
|||||||
from onionrutils import bytesconverter
|
from onionrutils import bytesconverter
|
||||||
from onionrutils import mnemonickeys
|
from onionrutils import mnemonickeys
|
||||||
from onionrtypes import JSONSerializable
|
from onionrtypes import JSONSerializable
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -36,7 +36,6 @@ from onionrproofs import subprocesspow
|
|||||||
import logger
|
import logger
|
||||||
from onionrtypes import UserIDSecretKey
|
from onionrtypes import UserIDSecretKey
|
||||||
|
|
||||||
|
|
||||||
def _check_upload_queue():
|
def _check_upload_queue():
|
||||||
"""Returns the current upload queue len
|
"""Returns the current upload queue len
|
||||||
raises OverflowError if max, false if api not running
|
raises OverflowError if max, false if api not running
|
||||||
|
@ -10,6 +10,7 @@ from multiprocessing import Pipe, Process
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
import secrets
|
||||||
|
|
||||||
import logger
|
import logger
|
||||||
import onionrproofs
|
import onionrproofs
|
||||||
@ -109,7 +110,7 @@ class SubprocessPOW:
|
|||||||
|
|
||||||
def do_pow(self, pipe):
|
def do_pow(self, pipe):
|
||||||
"""find partial hash colision generating nonce for a block"""
|
"""find partial hash colision generating nonce for a block"""
|
||||||
nonce = BLOCK_NONCE_START_INT
|
nonce = -secrets.randbelow(10**10)
|
||||||
data = self.data
|
data = self.data
|
||||||
metadata = self.metadata
|
metadata = self.metadata
|
||||||
puzzle = self.puzzle
|
puzzle = self.puzzle
|
||||||
|
@ -23,6 +23,7 @@ import unpaddedbase32
|
|||||||
import nacl.exceptions
|
import nacl.exceptions
|
||||||
from coredb import keydb, dbfiles
|
from coredb import keydb, dbfiles
|
||||||
import onionrcrypto
|
import onionrcrypto
|
||||||
|
from onionrcrypto import getourkeypair
|
||||||
|
|
||||||
def deleteExpiredKeys():
|
def deleteExpiredKeys():
|
||||||
# Fetch the keys we generated for the peer, that are still around
|
# Fetch the keys we generated for the peer, that are still around
|
||||||
@ -64,7 +65,7 @@ class OnionrUser:
|
|||||||
self.trust = 0
|
self.trust = 0
|
||||||
self.publicKey = publicKey
|
self.publicKey = publicKey
|
||||||
|
|
||||||
if saveUser:
|
if saveUser and not publicKey == getourkeypair.get_keypair():
|
||||||
try:
|
try:
|
||||||
keydb.addkeys.add_peer(publicKey)
|
keydb.addkeys.add_peer(publicKey)
|
||||||
except (AssertionError, ValueError) as e:
|
except (AssertionError, ValueError) as e:
|
||||||
|
@ -27,6 +27,7 @@ from onionrplugins import onionrevents
|
|||||||
import onionrexceptions
|
import onionrexceptions
|
||||||
from onionrusers import onionrusers
|
from onionrusers import onionrusers
|
||||||
from onionrutils import updater
|
from onionrutils import updater
|
||||||
|
from gevent import sleep
|
||||||
|
|
||||||
def process_block_metadata(blockHash: str):
|
def process_block_metadata(blockHash: str):
|
||||||
'''
|
'''
|
||||||
@ -37,8 +38,8 @@ def process_block_metadata(blockHash: str):
|
|||||||
curTime = epoch.get_rounded_epoch(roundS=60)
|
curTime = epoch.get_rounded_epoch(roundS=60)
|
||||||
myBlock = onionrblockapi.Block(blockHash)
|
myBlock = onionrblockapi.Block(blockHash)
|
||||||
if myBlock.isEncrypted:
|
if myBlock.isEncrypted:
|
||||||
print(myBlock.hash, myBlock.decrypt())
|
myBlock.decrypt()
|
||||||
if myBlock.decrypted or not myBlock.isEncrypted:
|
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
|
blockType = myBlock.getMetadata('type') # we would use myBlock.getType() here, but it is bugged with encrypted blocks
|
||||||
|
|
||||||
signer = bytesconverter.bytes_to_str(myBlock.signer)
|
signer = bytesconverter.bytes_to_str(myBlock.signer)
|
||||||
|
@ -59,7 +59,6 @@ def on_insertblock(api, data={}):
|
|||||||
|
|
||||||
|
|
||||||
def on_processblocks(api, data=None):
|
def on_processblocks(api, data=None):
|
||||||
print('mail got block', data)
|
|
||||||
if data['type'] != 'pm':
|
if data['type'] != 'pm':
|
||||||
return
|
return
|
||||||
data['block'].decrypt()
|
data['block'].decrypt()
|
||||||
@ -73,7 +72,6 @@ def on_processblocks(api, data=None):
|
|||||||
else:
|
else:
|
||||||
signer = signer[:5]
|
signer = signer[:5]
|
||||||
|
|
||||||
print('detected mail', data['block'].hash)
|
|
||||||
if data['block'].decrypted:
|
if data['block'].decrypted:
|
||||||
config.reload()
|
config.reload()
|
||||||
if config.get('mail.notificationSetting', True):
|
if config.get('mail.notificationSetting', True):
|
||||||
|
@ -10,16 +10,16 @@
|
|||||||
},
|
},
|
||||||
"general": {
|
"general": {
|
||||||
"announce_node": true,
|
"announce_node": true,
|
||||||
"dev_mode": true,
|
"dev_mode": false,
|
||||||
"display_header": true,
|
"display_header": true,
|
||||||
"hide_created_blocks": true,
|
"hide_created_blocks": true,
|
||||||
"insert_deniable_blocks": false,
|
"insert_deniable_blocks": true,
|
||||||
"max_block_age": 2678400,
|
"max_block_age": 2678400,
|
||||||
"minimum_block_pow": 4,
|
"minimum_block_pow": 5,
|
||||||
"minimum_send_pow": 4,
|
"minimum_send_pow": 5,
|
||||||
"public_key": "",
|
"public_key": "",
|
||||||
"random_bind_ip": false,
|
"random_bind_ip": true,
|
||||||
"security_level": 1,
|
"security_level": 0,
|
||||||
"show_notifications": true,
|
"show_notifications": true,
|
||||||
"socket_servers": false,
|
"socket_servers": false,
|
||||||
"store_plaintext_blocks": true,
|
"store_plaintext_blocks": true,
|
||||||
@ -33,12 +33,12 @@
|
|||||||
},
|
},
|
||||||
"file": {
|
"file": {
|
||||||
"output": true,
|
"output": true,
|
||||||
"remove_on_exit": false
|
"remove_on_exit": true
|
||||||
},
|
},
|
||||||
"verbosity": "default"
|
"verbosity": "default"
|
||||||
},
|
},
|
||||||
"onboarding": {
|
"onboarding": {
|
||||||
"done": true
|
"done": false
|
||||||
},
|
},
|
||||||
"peers": {
|
"peers": {
|
||||||
"max_connect": 1000,
|
"max_connect": 1000,
|
||||||
@ -58,11 +58,11 @@
|
|||||||
"tor": {
|
"tor": {
|
||||||
"bridge_fingerprint": "",
|
"bridge_fingerprint": "",
|
||||||
"bridge_ip": "",
|
"bridge_ip": "",
|
||||||
"existing_control_password": "testt",
|
"existing_control_password": "",
|
||||||
"existing_control_port": 1338,
|
"existing_control_port": 0,
|
||||||
"existing_socks_port": 1337,
|
"existing_socks_port": 0,
|
||||||
"use_bridge": false,
|
"use_bridge": false,
|
||||||
"use_existing_tor": true,
|
"use_existing_tor": false,
|
||||||
"v3onions": true
|
"v3onions": true
|
||||||
},
|
},
|
||||||
"transports": {
|
"transports": {
|
||||||
|
@ -161,7 +161,7 @@
|
|||||||
<div class="column is-2">
|
<div class="column is-2">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<input id="messagePaddingSetting" type="checkbox"
|
<input id="messagePaddingSetting" type="checkbox"
|
||||||
class="switch is-rounded is-warning" checked>
|
class="switch is-rounded is-warning">
|
||||||
<label for="messagePaddingSetting"></label>
|
<label for="messagePaddingSetting"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user