added url command

This commit is contained in:
Kevin Froman 2019-09-29 22:03:55 -05:00
parent 48e956c27c
commit 991c79b350
2 changed files with 15 additions and 0 deletions

View File

@ -21,6 +21,20 @@ import webbrowser
import logger
from onionrutils import getclientapiserver
import config
def get_url():
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' % (url, config.get('client.webpassword'))
logger.info('Onionr web interface URL: ' + url, terminal=True)
return url
get_url.onionr_help = "Shows the Onionr web interface URL with API key"
def open_home():
try:
url = getclientapiserver.get_client_API_server()

View File

@ -44,6 +44,7 @@ def get_arguments()->dict:
('restart',): restartonionr.restart,
('add-address', 'addaddress', 'addadder'): keyadders.add_address,
('openhome', 'gui', 'openweb', 'open-home', 'open-web'): openwebinterface.open_home,
('get-url', 'url', 'get-web'): openwebinterface.get_url,
('add-site', 'addsite', 'addhtml', 'add-html'): filecommands.add_html,
('addfile', 'add-file'): filecommands.add_file,
('get-file', 'getfile'): filecommands.get_file,