parent
5b3d76067a
commit
646a7c0b80
|
@ -15,5 +15,4 @@
|
||||||
* add BCC support to mail
|
* add BCC support to mail
|
||||||
|
|
||||||
|
|
||||||
* prevent local insertion success of duplicate block content
|
|
||||||
* truncate last N blocks when sharing list
|
* truncate last N blocks when sharing list
|
||||||
|
|
|
@ -23,7 +23,7 @@ import filepaths
|
||||||
DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA"
|
DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA"
|
||||||
PASSWORD_LENGTH = 25
|
PASSWORD_LENGTH = 25
|
||||||
ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net'
|
ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net'
|
||||||
ONIONR_VERSION = '5.1.0'
|
ONIONR_VERSION = '5.2.0'
|
||||||
ONIONR_VERSION_CODENAME = 'Genesis'
|
ONIONR_VERSION_CODENAME = 'Genesis'
|
||||||
ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION)
|
ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION)
|
||||||
API_VERSION = '3' # increments of 1; only change when something fundamental about how the API works changes. This way other nodes know how to communicate without learning too much information about you.
|
API_VERSION = '3' # increments of 1; only change when something fundamental about how the API works changes. This way other nodes know how to communicate without learning too much information about you.
|
||||||
|
|
|
@ -7,7 +7,7 @@ import nacl.encoding, nacl.hash, nacl.utils
|
||||||
|
|
||||||
import config
|
import config
|
||||||
import logger
|
import logger
|
||||||
from onionrblocks import onionrblockapi, storagecounter
|
from onionrblocks import onionrblockapi
|
||||||
from onionrutils import bytesconverter
|
from onionrutils import bytesconverter
|
||||||
from onionrcrypto import hashers
|
from onionrcrypto import hashers
|
||||||
|
|
||||||
|
@ -28,16 +28,6 @@ from .blocknoncestart import BLOCK_NONCE_START_INT
|
||||||
"""
|
"""
|
||||||
config.reload()
|
config.reload()
|
||||||
|
|
||||||
storage_counter = storagecounter.StorageCounter()
|
|
||||||
|
|
||||||
def getDifficultyModifier():
|
|
||||||
"""returns the difficulty modifier for block storage based
|
|
||||||
on a variety of factors, currently only disk use.
|
|
||||||
"""
|
|
||||||
percentUse = storage_counter.get_percent()
|
|
||||||
difficultyIncrease = math.floor(4 * percentUse) # difficulty increase is a step function
|
|
||||||
|
|
||||||
return difficultyIncrease
|
|
||||||
|
|
||||||
def getDifficultyForNewBlock(data):
|
def getDifficultyForNewBlock(data):
|
||||||
"""
|
"""
|
||||||
|
@ -49,16 +39,18 @@ def getDifficultyForNewBlock(data):
|
||||||
dataSizeInBytes = len(bytesconverter.str_to_bytes(data))
|
dataSizeInBytes = len(bytesconverter.str_to_bytes(data))
|
||||||
|
|
||||||
minDifficulty = config.get('general.minimum_send_pow', 4)
|
minDifficulty = config.get('general.minimum_send_pow', 4)
|
||||||
totalDifficulty = max(minDifficulty, math.floor(dataSizeInBytes / 1000000.0)) + getDifficultyModifier()
|
totalDifficulty = max(minDifficulty, math.floor(dataSizeInBytes / 1000000.0))
|
||||||
|
|
||||||
return totalDifficulty
|
return totalDifficulty
|
||||||
|
|
||||||
|
|
||||||
def getHashDifficulty(h: str):
|
def getHashDifficulty(h: str):
|
||||||
"""
|
"""
|
||||||
Return the amount of leading zeroes in a hex hash string (hexHash)
|
Return the amount of leading zeroes in a hex hash string (hexHash)
|
||||||
"""
|
"""
|
||||||
return len(h) - len(h.lstrip('0'))
|
return len(h) - len(h.lstrip('0'))
|
||||||
|
|
||||||
|
|
||||||
def hashMeetsDifficulty(hexHash):
|
def hashMeetsDifficulty(hexHash):
|
||||||
"""
|
"""
|
||||||
Return bool for a hash string to see if it meets pow difficulty defined in config
|
Return bool for a hash string to see if it meets pow difficulty defined in config
|
||||||
|
|
|
@ -108,6 +108,7 @@ def remove_from_cache(board, name):
|
||||||
|
|
||||||
@flask_blueprint.route('/circles/getpopular/<count>')
|
@flask_blueprint.route('/circles/getpopular/<count>')
|
||||||
def get_popular(count):
|
def get_popular(count):
|
||||||
|
read_only_cache.refresh()
|
||||||
boards = json.loads(read_only_cache.get_raw_json())
|
boards = json.loads(read_only_cache.get_raw_json())
|
||||||
for board in boards:
|
for board in boards:
|
||||||
boards[board] = len(boards[board])
|
boards[board] = len(boards[board])
|
||||||
|
|
|
@ -94,6 +94,11 @@ function appendMessages(msg, blockHash, beforeHash, channel) {
|
||||||
if (typeof msg['meta']['signer'] != 'undefined' && msg['meta']['signer'].length > 0){
|
if (typeof msg['meta']['signer'] != 'undefined' && msg['meta']['signer'].length > 0){
|
||||||
div[3].textContent = msg['meta']['signer'].substr(0, 5)
|
div[3].textContent = msg['meta']['signer'].substr(0, 5)
|
||||||
setHumanReadableIDOnPost(div[3], msg['meta']['signer'])
|
setHumanReadableIDOnPost(div[3], msg['meta']['signer'])
|
||||||
|
div[3].onclick = function(){
|
||||||
|
navigator.clipboard.writeText(div[3].title).then(function() {
|
||||||
|
PNotify.notice("Copied poster identity to clipboard")
|
||||||
|
})
|
||||||
|
}
|
||||||
div[3].title = msg['meta']['signer']
|
div[3].title = msg['meta']['signer']
|
||||||
userIcon(msg['meta']['signer']).then(function(data){
|
userIcon(msg['meta']['signer']).then(function(data){
|
||||||
identicon[0].src = "data:image/svg+xml;base64," + data
|
identicon[0].src = "data:image/svg+xml;base64," + data
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
</header>
|
</header>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="field">
|
<div class="field" data-tooltip="Site public key or hash (not onion)">
|
||||||
<label class="label">Open Site</label>
|
<label class="label">Open Site</label>
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<p class="control is-expanded">
|
<p class="control is-expanded">
|
||||||
|
|
Loading…
Reference in New Issue