added url command

master
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 import logger
from onionrutils import getclientapiserver from onionrutils import getclientapiserver
import config 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(): def open_home():
try: try:
url = getclientapiserver.get_client_API_server() url = getclientapiserver.get_client_API_server()

View File

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