diff --git a/src/communicator/daemoneventhooks/__init__.py b/src/communicator/daemoneventhooks/__init__.py index 1a933014..16050202 100644 --- a/src/communicator/daemoneventhooks/__init__.py +++ b/src/communicator/daemoneventhooks/__init__.py @@ -78,4 +78,3 @@ def daemon_event_handlers(shared_state: 'TooMany'): events_api.register_listener(print_test) events_api.register_listener(upload_event) events_api.register_listener(test_runtime) - diff --git a/src/communicator/uploadqueue/__init__.py b/src/communicator/uploadqueue/__init__.py index e8b8eb78..6b1331cc 100644 --- a/src/communicator/uploadqueue/__init__.py +++ b/src/communicator/uploadqueue/__init__.py @@ -48,7 +48,8 @@ class UploadQueue: self.communicator = communicator cache: deadsimplekv.DeadSimpleKV = deadsimplekv.DeadSimpleKV( UPLOAD_MEMORY_FILE) - self.kv: "DeadSimpleKV" = communicator.shared_state.get_by_string("DeadSimpleKV") + self.kv: "DeadSimpleKV" = \ + communicator.shared_state.get_by_string("DeadSimpleKV") self.store_obj = cache cache = cache.get('uploads') if cache is None: diff --git a/src/etc/onionrvalues.py b/src/etc/onionrvalues.py index e222a3cb..afaaae2c 100755 --- a/src/etc/onionrvalues.py +++ b/src/etc/onionrvalues.py @@ -29,6 +29,7 @@ ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION API_VERSION = '1' # 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. MIN_PY_VERSION = 7 # min version of 7 so we can take advantage of non-cyclic type hints DEVELOPMENT_MODE = False +IS_QUBES = False """limit type length for a block (soft enforced, ignored if invalid but block still stored).""" MAX_BLOCK_TYPE_LENGTH = 15 """limit clock timestamp for new blocks to be skewed in the future in seconds, @@ -74,3 +75,5 @@ else: SCRIPT_NAME = 'start-daemon.sh' else: SCRIPT_NAME = 'onionr.sh' +if 'qubes' in platform.release().lower(): + IS_QUBES = True diff --git a/src/httpapi/miscclientapi/endpoints.py b/src/httpapi/miscclientapi/endpoints.py index bd67dc76..aa64b462 100644 --- a/src/httpapi/miscclientapi/endpoints.py +++ b/src/httpapi/miscclientapi/endpoints.py @@ -160,3 +160,11 @@ class PrivateEndpoints: 'generating_blocks' )) ) + + @private_endpoints_bp.route('/getblockstoupload') + def get_blocks_to_upload() -> Response: + return Response( + ','.join( + g.too_many.get_by_string('DeadSimpleKV').get('blocksToUpload') + ) + ) diff --git a/src/onionrblocks/insert/main.py b/src/onionrblocks/insert/main.py index c8cdaa71..360b83ff 100644 --- a/src/onionrblocks/insert/main.py +++ b/src/onionrblocks/insert/main.py @@ -101,8 +101,8 @@ def insert_block(data: Union[str, bytes], header: str = 'txt', except FileNotFoundError: pass # record nonce - with open(filepaths.data_nonce_file, 'a') as nonceFile: - nonceFile.write(dataNonce + '\n') + with open(filepaths.data_nonce_file, 'a') as nonce_file: + nonce_file.write(dataNonce + '\n') plaintext = data plaintextMeta = {} @@ -263,7 +263,8 @@ def insert_block(data: Union[str, bytes], header: str = 'txt', '/daemon-event/remove_from_insert_queue_wrapper', post=True, post_data={'block_hash': - bytesconverter.bytes_to_str(crypto.hashers.sha3_hash(data))}, + bytesconverter.bytes_to_str( + crypto.hashers.sha3_hash(data))}, is_json=True ).get(timeout=5) return retData diff --git a/src/onionrcommands/daemonlaunch/__init__.py b/src/onionrcommands/daemonlaunch/__init__.py index 4f2e0d43..29a1321e 100755 --- a/src/onionrcommands/daemonlaunch/__init__.py +++ b/src/onionrcommands/daemonlaunch/__init__.py @@ -184,13 +184,17 @@ def daemon(): events.event('init', threaded=False) events.event('daemon_start') if config.get('transports.lan', True): - Thread(target=LANServer(shared_state).start_server, - daemon=True).start() - LANManager(shared_state).start() + if not onionrvalues.IS_QUBES: + Thread(target=LANServer(shared_state).start_server, + daemon=True).start() + LANManager(shared_state).start() + else: + logger.warn('LAN not supported on Qubes', terminal=True) if config.get('transports.sneakernet', True): Thread(target=sneakernet_import_thread, daemon=True).start() - Thread(target=statistics_reporter, args=[shared_state], daemon=True).start() + Thread(target=statistics_reporter, + args=[shared_state], daemon=True).start() shared_state.get(DeadSimpleKV).put( 'proxyPort', net.socksPort)