Browse Source

Merge branch 'master' of ssh://git.voidnet.tech:/kev/Onionr

username-system
Kevin Froman 1 year ago
parent
commit
c28e5dea74
  1. 2
      src/communicator/__init__.py
  2. 24
      src/onionrcommands/daemonlaunch/geturl.py
  3. 17
      src/onionrcommands/openwebinterface.py

2
src/communicator/__init__.py

@ -141,11 +141,11 @@ class OnionrCommunicatorDaemon:
daemoneventhooks.daemon_event_handlers(shared_state)
get_url()
if not config.get('onboarding.done', True):
logger.info(
'First run detected. Run openhome to get setup.',
terminal=True)
get_url()
while not config.get('onboarding.done', True) and \
not self.shared_state.get_by_string(

24
src/onionrcommands/daemonlaunch/geturl.py

@ -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

17
src/onionrcommands/openwebinterface.py

@ -9,6 +9,8 @@ import logger
from onionrutils import getclientapiserver
import config
from onionrutils.localcommand import local_command
from .daemonlaunch import geturl
"""
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
@ -43,20 +45,7 @@ def _wait_for_ui_to_be_ready():
def get_url() -> 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
return geturl.get_url(config)
get_url.onionr_help = "Shows the Onionr " # type: ignore

Loading…
Cancel
Save