From 6ae1d01f7fe21e2703bdf982df7353e7bb81a500 Mon Sep 17 00:00:00 2001 From: Dan McDougall Date: Sat, 25 Nov 2017 17:33:27 -0500 Subject: [PATCH] Added a new feature that saves the full connection URL as a server-side variable so applications/plugins can access that info without having to send a request to the client (which means they can have that info earlier on in the process of initializing things and opening terminals). It can be accessed from any application or plugin via self.ws.full_url --- gateone/__init__.py | 2 +- gateone/core/server.py | 8 ++++++-- gateone/static/gateone.js | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gateone/__init__.py b/gateone/__init__.py index 5ecf882b..613411e0 100644 --- a/gateone/__init__.py +++ b/gateone/__init__.py @@ -3,7 +3,7 @@ __version_info__ = (1, 2, 0) __license__ = "AGPLv3" # ...or proprietary (see LICENSE.txt) __author__ = 'Dan McDougall ' -__commit__ = "20171125153159" # Gets replaced by git (holds the date/time) +__commit__ = "20171125154235" # Gets replaced by git (holds the date/time) import os GATEONE_DIR = os.path.dirname(os.path.abspath(__file__)) diff --git a/gateone/core/server.py b/gateone/core/server.py index 7fd0a50a..ba0a376f 100755 --- a/gateone/core/server.py +++ b/gateone/core/server.py @@ -19,7 +19,7 @@ } } __author__ = 'Dan McDougall ' -__commit__ = "20171125153159" # Gets replaced by git (holds the date/time) +__commit__ = "20171125154235" # Gets replaced by git (holds the date/time) # NOTE: Docstring includes reStructuredText markup for use with Sphinx. __doc__ = '''\ @@ -2083,8 +2083,12 @@ def authenticate(self, settings): port=port, url_prefix=parsed.path) if orig_base_url != self.base_url: - self.logger.info(_( + self.auth_log.info(_( "Proxy in use: Client URL differs from server.")) + self.full_url = settings.get('href', None) # In case we need all of it + # NOTE: The full URL is only logged via debug() because it could contain + # sensitive info. + self.auth_log.debug(_("Client URL: {}".format(self.full_url))) auth_method = self.settings.get('auth', None) if auth_method and auth_method != 'api': # Regular, non-API authentication diff --git a/gateone/static/gateone.js b/gateone/static/gateone.js index 9b28eae3..6804eb0b 100644 --- a/gateone/static/gateone.js +++ b/gateone/static/gateone.js @@ -82,7 +82,7 @@ The base object for all Gate One modules/plugins. */ GateOne.__name__ = "GateOne"; GateOne.__version__ = "1.2"; -GateOne.__commit__ = "20171125153159"; +GateOne.__commit__ = "20171125154235"; GateOne.__repr__ = function () { return "[" + this.__name__ + " " + this.__version__ + "]"; }; @@ -2697,7 +2697,8 @@ GateOne.Base.update(GateOne.Net, { 'container': go.prefs.goDiv.split('#')[1], 'prefix': prefix, 'location': go.location, - 'url': go.prefs.url + 'url': go.prefs.url, // This is the base URL (e.g. https://somehost/) + 'href': window.location.href }; // Cancel our SSL error timeout since everything is working fine. clearTimeout(go.Net.sslErrorTimeout);