show web url every time onionr daemon starts
This commit is contained in:
parent
1042676f26
commit
ad91a3222f
@ -141,11 +141,11 @@ class OnionrCommunicatorDaemon:
|
|||||||
|
|
||||||
daemoneventhooks.daemon_event_handlers(shared_state)
|
daemoneventhooks.daemon_event_handlers(shared_state)
|
||||||
|
|
||||||
|
get_url()
|
||||||
if not config.get('onboarding.done', True):
|
if not config.get('onboarding.done', True):
|
||||||
logger.info(
|
logger.info(
|
||||||
'First run detected. Run openhome to get setup.',
|
'First run detected. Run openhome to get setup.',
|
||||||
terminal=True)
|
terminal=True)
|
||||||
get_url()
|
|
||||||
|
|
||||||
while not config.get('onboarding.done', True) and \
|
while not config.get('onboarding.done', True) and \
|
||||||
not self.shared_state.get_by_string(
|
not self.shared_state.get_by_string(
|
||||||
|
24
src/onionrcommands/daemonlaunch/geturl.py
Normal file
24
src/onionrcommands/daemonlaunch/geturl.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
"""Onionr - Private P2P Communication.
|
||||||
|
|
||||||
|
Open the web interface properly into a web browser, and return it
|
||||||
|
"""
|
||||||
|
import logger
|
||||||
|
from onionrutils import getclientapiserver
|
||||||
|
|
||||||
|
|
||||||
|
def get_url(config) -> str:
|
||||||
|
"""Build UI URL string and return it."""
|
||||||
|
onboarding = ""
|
||||||
|
if not config.get('onboarding.done', False):
|
||||||
|
onboarding = "onboarding/"
|
||||||
|
try:
|
||||||
|
url = getclientapiserver.get_client_API_server()
|
||||||
|
except FileNotFoundError:
|
||||||
|
url = ""
|
||||||
|
logger.error(
|
||||||
|
'Onionr seems to not be running (could not get api host)',
|
||||||
|
terminal=True)
|
||||||
|
else:
|
||||||
|
url = 'http://%s/%s#%s' % (url, onboarding, config.get('client.webpassword'))
|
||||||
|
logger.info('Onionr web interface URL: ' + url, terminal=True)
|
||||||
|
return url
|
@ -9,6 +9,8 @@ import logger
|
|||||||
from onionrutils import getclientapiserver
|
from onionrutils import getclientapiserver
|
||||||
import config
|
import config
|
||||||
from onionrutils.localcommand import local_command
|
from onionrutils.localcommand import local_command
|
||||||
|
|
||||||
|
from .daemonlaunch import geturl
|
||||||
"""
|
"""
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -43,20 +45,7 @@ def _wait_for_ui_to_be_ready():
|
|||||||
|
|
||||||
def get_url() -> str:
|
def get_url() -> str:
|
||||||
"""Build UI URL string and return it."""
|
"""Build UI URL string and return it."""
|
||||||
onboarding = ""
|
geturl.get_url(config)
|
||||||
if not config.get('onboarding.done', False):
|
|
||||||
onboarding = "onboarding/"
|
|
||||||
try:
|
|
||||||
url = getclientapiserver.get_client_API_server()
|
|
||||||
except FileNotFoundError:
|
|
||||||
url = ""
|
|
||||||
logger.error(
|
|
||||||
'Onionr seems to not be running (could not get api host)',
|
|
||||||
terminal=True)
|
|
||||||
else:
|
|
||||||
url = 'http://%s/%s#%s' % (url, onboarding, config.get('client.webpassword'))
|
|
||||||
logger.info('Onionr web interface URL: ' + url, terminal=True)
|
|
||||||
return url
|
|
||||||
|
|
||||||
|
|
||||||
get_url.onionr_help = "Shows the Onionr " # type: ignore
|
get_url.onionr_help = "Shows the Onionr " # type: ignore
|
||||||
|
Loading…
Reference in New Issue
Block a user