diff --git a/src/apiservers/private/register_private_blueprints.py b/src/apiservers/private/register_private_blueprints.py
index 0a33a8dd..bbbad6d7 100644
--- a/src/apiservers/private/register_private_blueprints.py
+++ b/src/apiservers/private/register_private_blueprints.py
@@ -5,7 +5,7 @@ This file registers blueprints for the private api server
from threading import Thread
from gevent import sleep
-from httpapi import security, friendsapi, configapi, insertblock
+from httpapi import security, friendsapi, configapi
from httpapi import miscclientapi, onionrsitesapi, apiutils
from httpapi import themeapi
from httpapi import fileoffsetreader
@@ -33,8 +33,6 @@ def register_private_blueprints(private_api, app):
private_api).client_api_security_bp)
app.register_blueprint(friendsapi.friends)
app.register_blueprint(configapi.config_BP)
- app.register_blueprint(insertblock.ib)
- app.register_blueprint(miscclientapi.getblocks.client_get_blocks)
app.register_blueprint(miscclientapi.endpoints.PrivateEndpoints(
private_api).private_endpoints_bp)
app.register_blueprint(miscclientapi.motd.bp)
diff --git a/src/filepaths/__init__.py b/src/filepaths/__init__.py
index 5160b791..5de161ff 100644
--- a/src/filepaths/__init__.py
+++ b/src/filepaths/__init__.py
@@ -13,7 +13,6 @@ bootstrap_file_location = 'static-data/bootstrap-nodes.txt'
data_nonce_file = home + 'block-nonces.dat'
forward_keys_file = home + 'forward-keys.db'
cached_storage = home + 'cachedstorage.dat'
-announce_cache = home + 'announcecache.dat'
export_location = home + 'block-export/'
upload_list = home + 'upload-list.json'
config_file = home + 'config.json'
diff --git a/src/httpapi/insertblock.py b/src/httpapi/insertblock.py
deleted file mode 100644
index bafe41e1..00000000
--- a/src/httpapi/insertblock.py
+++ /dev/null
@@ -1,91 +0,0 @@
-"""Onionr - Private P2P Communication.
-
-Create blocks with the client api server
-"""
-import ujson as json
-import threading
-from typing import TYPE_CHECKING
-
-from flask import Blueprint, Response, request, g
-
-if TYPE_CHECKING:
- from deadsimplekv import DeadSimpleKV
-
-import onionrblocks
-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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-"""
-ib = Blueprint('insertblock', __name__)
-
-
-@ib.route('/insertblock', methods=['POST'])
-def client_api_insert_block():
- insert_data: JSONSerializable = request.get_json(force=True)
- message = insert_data['message']
- message_hash = bytesconverter.bytes_to_str(hashers.sha3_hash(message))
- kv: 'DeadSimpleKV' = g.too_many.get_by_string('DeadSimpleKV')
-
- # Detect if message (block body) is not specified
- if type(message) is None:
- return 'failure due to unspecified message', 400
-
- # Detect if block with same message is already being inserted
- if message_hash in kv.get('generating_blocks'):
- return 'failure due to duplicate insert', 400
- else:
- kv.get('generating_blocks').append(message_hash)
-
- encrypt_type = ''
- sign = True
- meta = {}
- to = ''
- try:
- if insert_data['encrypt']:
- to = insert_data['to'].strip()
- if "-" in to:
- to = mnemonickeys.get_base32(to)
- encrypt_type = 'asym'
- except KeyError:
- pass
- try:
- if not insert_data['sign']:
- sign = False
- except KeyError:
- pass
- try:
- bType = insert_data['type']
- except KeyError:
- bType = 'bin'
- try:
- meta = json.loads(insert_data['meta'])
- except KeyError:
- pass
-
- try:
- # Setting in the mail UI is for if forward secrecy is *enabled*
- disable_forward_secrecy = not insert_data['forward']
- except KeyError:
- disable_forward_secrecy = False
-
- threading.Thread(
- target=onionrblocks.insert, args=(message,),
- kwargs={'header': bType, 'encryptType': encrypt_type,
- 'sign': sign, 'asymPeer': to, 'meta': meta,
- 'disableForward': disable_forward_secrecy}).start()
- return Response('success')
diff --git a/src/httpapi/miscclientapi/__init__.py b/src/httpapi/miscclientapi/__init__.py
index dadcb97c..b850723c 100644
--- a/src/httpapi/miscclientapi/__init__.py
+++ b/src/httpapi/miscclientapi/__init__.py
@@ -1 +1 @@
-from . import getblocks, staticfiles, endpoints, motd
\ No newline at end of file
+from . import staticfiles, endpoints, motd
\ No newline at end of file
diff --git a/src/httpapi/miscclientapi/getblocks.py b/src/httpapi/miscclientapi/getblocks.py
deleted file mode 100644
index 4e7fd58e..00000000
--- a/src/httpapi/miscclientapi/getblocks.py
+++ /dev/null
@@ -1,65 +0,0 @@
-'''
- Onionr - Private P2P Communication
-
- Create blocks with the client api server
-'''
-'''
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-'''
-from flask import Blueprint, Response, abort
-from onionrblocks import onionrblockapi
-from .. import apiutils
-from onionrutils import stringvalidators
-from coredb import blockmetadb
-
-client_get_block = apiutils.GetBlockData()
-
-client_get_blocks = Blueprint('miscclient', __name__)
-
-@client_get_blocks.route('/getblocksbytype/')
-def get_blocks_by_type_endpoint(name):
- blocks = blockmetadb.get_blocks_by_type(name)
- return Response(','.join(blocks))
-
-@client_get_blocks.route('/getblockbody/')
-def getBlockBodyData(name):
- resp = ''
- if stringvalidators.validate_hash(name):
- try:
- resp = onionrblockapi.Block(name, decrypt=True).bcontent
- except TypeError:
- pass
- else:
- abort(404)
- return Response(resp)
-
-@client_get_blocks.route('/getblockdata/')
-def getData(name):
- resp = ""
- if stringvalidators.validate_hash(name):
- if name in blockmetadb.get_block_list():
- try:
- resp = client_get_block.get_block_data(name, decrypt=True)
- except ValueError:
- pass
- else:
- abort(404)
- else:
- abort(404)
- return Response(resp)
-
-@client_get_blocks.route('/getblockheader/')
-def getBlockHeader(name):
- resp = client_get_block.get_block_data(name, decrypt=True, headerOnly=True)
- return Response(resp)
\ No newline at end of file
diff --git a/src/setupkvvars/__init__.py b/src/setupkvvars/__init__.py
index e5774db3..3707f4cd 100644
--- a/src/setupkvvars/__init__.py
+++ b/src/setupkvvars/__init__.py
@@ -10,37 +10,24 @@ from onionrutils import epoch
if TYPE_CHECKING:
from deadsimplekv import DeadSimpleKV
"""
- 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+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
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
"""
def setup_kv(shared_vars: 'DeadSimpleKV'):
"""Init initial pseudo-globals."""
- shared_vars.put('plaintextDisabledPeers', {})
- shared_vars.put('blockQueue', {})
shared_vars.put('shutdown', False)
- shared_vars.put('onlinePeers', [])
- shared_vars.put('offlinePeers', [])
- shared_vars.put('peerProfiles', [])
- shared_vars.put('connectTimes', {})
- shared_vars.put('currentDownloading', [])
- shared_vars.put('announceCache', {})
- shared_vars.put('newPeers', [])
- shared_vars.put('dbTimestamps', {})
- shared_vars.put('blocksToUpload', [])
- shared_vars.put('cooldownPeer', {})
shared_vars.put('generating_blocks', [])
- shared_vars.put('lastNodeSeen', None)
shared_vars.put('startTime', epoch.get_epoch())
shared_vars.put('isOnline', True)