diff --git a/src/netcontroller/torcontrol/onionservicecreator.py b/src/netcontroller/torcontrol/onionservicecreator.py index 721da938..0bbe5d3d 100644 --- a/src/netcontroller/torcontrol/onionservicecreator.py +++ b/src/netcontroller/torcontrol/onionservicecreator.py @@ -23,8 +23,8 @@ def create_onion_service(port=80): controller = get_controller() hs = controller.create_ephemeral_hidden_service( {80: port}, - key_type='NEW', - key_content='ED25519-V3', + key_type = 'NEW', + key_content = 'ED25519-V3', await_publication=True, detached=True) return (hs.service_id, hs.private_key) diff --git a/src/onionrcommands/daemonlaunch/__init__.py b/src/onionrcommands/daemonlaunch/__init__.py index 37b84930..73c37f88 100755 --- a/src/onionrcommands/daemonlaunch/__init__.py +++ b/src/onionrcommands/daemonlaunch/__init__.py @@ -114,7 +114,10 @@ def daemon(): if use_existing_tor: net.socksPort = config.get('tor.existing_socks_port') - net.myID = create_onion_service(port=get_open_port()) + net.myID = create_onion_service( + port=net.apiServerIP + ':' + str(net.hsPort))[0] + if not net.myID.endswith('.onion'): + net.myID += '.onion' with open(filepaths.tor_hs_address_file, 'w') as tor_file: tor_file.write(net.myID) else: @@ -141,6 +144,11 @@ def daemon(): if not offline_mode and not use_existing_tor: net.killTor() + else: + try: + os.remove(filepaths.tor_hs_address_file) + except FileNotFoundError: + pass better_sleep(5)