proof of work adjustments, bugfixes, added connection check url

This commit is contained in:
Kevin Froman 2019-02-07 12:12:04 -06:00
parent 0e3fb41912
commit b038d758b9
6 changed files with 13 additions and 13 deletions

View File

@ -294,8 +294,10 @@ class API:
@app.after_request @app.after_request
def afterReq(resp): def afterReq(resp):
#resp.headers["Content-Security-Policy"] = "default-src 'none'; script-src 'none'; object-src 'none'; style-src data: 'unsafe-inline'; img-src data:; media-src 'none'; frame-src 'none'; font-src 'none'; connect-src 'none'" if request.endpoint == 'site':
resp.headers['Content-Security-Policy'] = "default-src 'none'; script-src 'self'; object-src 'none'; style-src 'self'; img-src 'self'; media-src 'none'; frame-src 'none'; font-src 'none'; connect-src 'self'" resp.headers['Content-Security-Policy'] = "default-src 'none'; style-src data: 'unsafe-inline'; img-src data:"
else:
resp.headers['Content-Security-Policy'] = "default-src 'none'; script-src 'self'; object-src 'none'; style-src 'self'; img-src 'self'; media-src 'none'; frame-src 'none'; font-src 'none'; connect-src 'self'"
resp.headers['X-Frame-Options'] = 'deny' resp.headers['X-Frame-Options'] = 'deny'
resp.headers['X-Content-Type-Options'] = "nosniff" resp.headers['X-Content-Type-Options'] = "nosniff"
resp.headers['X-API'] = onionr.API_VERSION resp.headers['X-API'] = onionr.API_VERSION

View File

@ -269,10 +269,7 @@ class OnionrCommunicatorDaemon:
content = content.encode() content = content.encode()
except AttributeError: except AttributeError:
pass pass
try:
content = base64.b64decode(content) # content is base64 encoded in transport
except binascii.Error:
pass
realHash = self._core._crypto.sha3Hash(content) realHash = self._core._crypto.sha3Hash(content)
try: try:
realHash = realHash.decode() # bytes on some versions for some reason realHash = realHash.decode() # bytes on some versions for some reason

View File

@ -1002,7 +1002,8 @@ class Onionr:
try: try:
with open(filename, 'rb') as singleFile: with open(filename, 'rb') as singleFile:
blockhash = self.onionrCore.insertBlock(base64.b64encode(singleFile.read()), header=blockType) blockhash = self.onionrCore.insertBlock(base64.b64encode(singleFile.read()), header=blockType)
logger.info('File %s saved in block %s' % (filename, blockhash)) if len(blockhash) > 0:
logger.info('File %s saved in block %s' % (filename, blockhash))
except: except:
logger.error('Failed to save file in block.', timestamp = False) logger.error('Failed to save file in block.', timestamp = False)
else: else:

View File

@ -41,9 +41,9 @@ def getDifficultyModifier(coreOrUtilsInst=None):
if percentUse >= 0.50: if percentUse >= 0.50:
retData += 1 retData += 1
elif percentUse >= 0.75: elif percentUse >= 0.75:
retData += 2 retData += 2
elif percentUse >= 0.95: elif percentUse >= 0.95:
retData += 3 retData += 3
return retData return retData
@ -68,7 +68,7 @@ def getDifficultyForNewBlock(data, ourBlock=True):
else: else:
minDifficulty = config.get('general.minimum_block_pow') minDifficulty = config.get('general.minimum_block_pow')
retData = max(minDifficulty, math.floor(dataSize / 1000000)) + getDifficultyModifier() retData = max(minDifficulty, math.floor(dataSize / 100000)) + getDifficultyModifier()
return retData return retData
def getHashDifficulty(h): def getHashDifficulty(h):

View File

@ -1 +1 @@
https://3g2upl4pq6kufc4m.onion/robots.txt,http://expyuzz4wqqyqhjn.onion/robots.txt,https://onionr.voidnet.tech/ https://3g2upl4pq6kufc4m.onion/robots.txt,http://expyuzz4wqqyqhjn.onion/robots.txt,http://archivecaslytosk.onion/robots.txt

View File

@ -2,8 +2,8 @@
"general" : { "general" : {
"dev_mode" : true, "dev_mode" : true,
"display_header" : false, "display_header" : false,
"minimum_block_pow": 1, "minimum_block_pow": 4,
"minimum_send_pow": 1, "minimum_send_pow": 4,
"socket_servers": false, "socket_servers": false,
"security_level": 0, "security_level": 0,
"max_block_age": 2678400, "max_block_age": 2678400,