From 7eaab3d6e2a703528602f71f3e2c4a3caedb0e43 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 1 Nov 2018 23:57:03 +0100 Subject: [PATCH] Show both domain and ip URL in issue banner --- usr/lib/python3.6/vmmgr/__init__.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/usr/lib/python3.6/vmmgr/__init__.py b/usr/lib/python3.6/vmmgr/__init__.py index 2cd6449..d6782f9 100644 --- a/usr/lib/python3.6/vmmgr/__init__.py +++ b/usr/lib/python3.6/vmmgr/__init__.py @@ -100,10 +100,10 @@ ISSUE_TEMPLATE = ''' device. Unauthorized attempts and actions to access or use this system may result in civil or criminal penalties. - - Pro přístup k aplikacím otevřete URL \x1b[1m{url}\x1b[0m ve Vašem + Pro přístup k aplikacím otevřete jednu z následujících URL ve Vašem internetovém prohlížeči. - + \x1b[1m{url}\x1b[0m + \x1b[1m{ip}\x1b[0m \x1b[0;30m ''' @@ -275,18 +275,15 @@ class VMMgr: f.write(NGINX_DEFAULT_TEMPLATE.format(port=self.port)) def rebuild_issue(self): - # Compile the HTTPS host displayed in terminal banner - domain = self.domain - # If the dummy host is used, take an IP address of a primary interface instead - if domain == 'spotter.vm': - domain = tools.get_local_ip(4) - if not domain: - domain = tools.get_local_ip(6) - if not domain: - domain = '127.0.0.1' + # Compile the URLs displayed in terminal banner + ip = tools.get_local_ip(4) + if not ip: + ip = tools.get_local_ip(6) + if not ip: + ip = '127.0.0.1' # Rebuild the terminal banner with open(ISSUE_FILE, 'w') as f: - f.write(ISSUE_TEMPLATE.format(url=tools.compile_url(domain, self.port))) + f.write(ISSUE_TEMPLATE.format(url=tools.compile_url(self.domain, self.port), ip=tools.compile_url(ip, self.port))) def update_common(self, email, gmaps_api_key): # Update common configuration values