diff --git a/onionr/api.py b/onionr/api.py index d9b9e920..e6754edd 100755 --- a/onionr/api.py +++ b/onionr/api.py @@ -294,8 +294,10 @@ class API: @app.after_request 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'" - 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'" + if request.endpoint == 'site': + 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-Content-Type-Options'] = "nosniff" resp.headers['X-API'] = onionr.API_VERSION diff --git a/onionr/communicator.py b/onionr/communicator.py index 6104fd2c..336258d4 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -269,10 +269,7 @@ class OnionrCommunicatorDaemon: content = content.encode() except AttributeError: pass - try: - content = base64.b64decode(content) # content is base64 encoded in transport - except binascii.Error: - pass + realHash = self._core._crypto.sha3Hash(content) try: realHash = realHash.decode() # bytes on some versions for some reason diff --git a/onionr/onionr.py b/onionr/onionr.py index 06aaa694..d767140d 100755 --- a/onionr/onionr.py +++ b/onionr/onionr.py @@ -1002,7 +1002,8 @@ class Onionr: try: with open(filename, 'rb') as singleFile: 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: logger.error('Failed to save file in block.', timestamp = False) else: diff --git a/onionr/onionrproofs.py b/onionr/onionrproofs.py index f1645a49..2c479a8a 100755 --- a/onionr/onionrproofs.py +++ b/onionr/onionrproofs.py @@ -41,9 +41,9 @@ def getDifficultyModifier(coreOrUtilsInst=None): if percentUse >= 0.50: retData += 1 elif percentUse >= 0.75: - retData += 2 + retData += 2 elif percentUse >= 0.95: - retData += 3 + retData += 3 return retData @@ -68,7 +68,7 @@ def getDifficultyForNewBlock(data, ourBlock=True): else: 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 def getHashDifficulty(h): diff --git a/onionr/static-data/connect-check.txt b/onionr/static-data/connect-check.txt index 009a2a9a..7be85aa0 100755 --- a/onionr/static-data/connect-check.txt +++ b/onionr/static-data/connect-check.txt @@ -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 diff --git a/onionr/static-data/default_config.json b/onionr/static-data/default_config.json index eeefe49a..ba5e5566 100755 --- a/onionr/static-data/default_config.json +++ b/onionr/static-data/default_config.json @@ -2,8 +2,8 @@ "general" : { "dev_mode" : true, "display_header" : false, - "minimum_block_pow": 1, - "minimum_send_pow": 1, + "minimum_block_pow": 4, + "minimum_send_pow": 4, "socket_servers": false, "security_level": 0, "max_block_age": 2678400,