Skip to content

Commit

Permalink
gateone.py: Added some fixes to prevent non-options like combine_js f…
Browse files Browse the repository at this point in the history
…rom ending up in the auto-generated settings/10server.conf. Just keeps things tidy and prevents confusion. It wouldn't hurt anything to have them in the file (in case you've already got them in your 10server.conf, don't worry about it).

gateone.py:  Fixed a bug where you could get an exception with the 'api_keys' setting.  This should correct the problem reported in #226.
gateone.py:  Fixed a bug where users were being sent client-side plugins that had been disabled globally via the 'enabled_plugins' setting.
gateone.js:  Fixed a bug in GateOne.Utils.isVisible() that could cause a NS_ERROR_XPC_BAD_CONVERT_JS exception in Firefox.
  • Loading branch information
liftoff committed Mar 28, 2013
1 parent ab9afd7 commit 48a5856
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
5 changes: 3 additions & 2 deletions gateone/applications/terminal/app_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,9 @@ def authenticate(self):
else:
self.ws.send_js(js_file_path, requires='terminal_input.js')
self.ws.send_plugin_static_files(
os.path.join(
APPLICATION_PATH, 'plugins'), requires="terminal_input.js")
os.path.join(APPLICATION_PATH, 'plugins'),
application="terminal",
requires="terminal_input.js")
# Send the client the 256-color style information
self.send_256_colors()
sess = SESSIONS[self.ws.session]
Expand Down
20 changes: 17 additions & 3 deletions gateone/gateone.py
Original file line number Diff line number Diff line change
Expand Up @@ -2086,8 +2086,16 @@ def send_plugin_static_files(self,
self.logged_js_message = True
return
policy = applicable_policies(application, self.current_user, self.prefs)
globally_enabled_plugins = policy.get('enabled_plugins', [])
# This controls the client-side plugins that will be sent
allowed_client_side_plugins = policy.get('user_plugins', [])
# Remove non-globally-enabled plugins from user_plugins (if set)
if globally_enabled_plugins and list(allowed_client_side_plugins):
for p in allowed_client_side_plugins:
if p not in globally_enabled_plugins:
del allowed_client_side_plugins[p]
elif globally_enabled_plugins and not allowed_client_side_plugins:
allowed_client_side_plugins = globally_enabled_plugins
# Build a list of plugins
plugins = []
if not os.path.exists(plugins_dir):
Expand All @@ -2113,7 +2121,7 @@ def send_plugin_static_files(self,
css_file_path = os.path.join(plugin_static_path, f)
self.send_css(css_file_path)

# TODO: Separate generic Gate One css from the terminal-specific stuff.
# TODO: Add support for a setting that can control which themes are visible to users.
def enumerate_themes(self):
"""
Returns a JSON-encoded object containing the installed themes and text
Expand Down Expand Up @@ -2882,8 +2890,8 @@ def main():
# For whatever reason Tornado doesn't like unicode values
# for its own settings unless you're using Python 3...
value = str(value)
if key in ['origins']:
# Origins is special and taken care of further down...
if key in ['origins', 'api_keys']:
# These two settings are special and taken care of further down.
continue
options[key].set(value)
# Turn any API keys provided on the command line into a dict
Expand Down Expand Up @@ -3038,6 +3046,10 @@ def main():
config_defaults = all_setttings['*']['gateone']
# Don't need this in the actual settings file:
del config_defaults['settings_dir']
# Don't need non-options in there either:
for non_option in non_options:
if non_option in config_defaults:
del config_defaults[non_option]
# Generate a new cookie_secret
config_defaults['cookie_secret'] = generate_session_id()
# Separate out the authentication settings
Expand Down Expand Up @@ -3461,6 +3473,8 @@ def main():
else:
proto = "https://"
for option in options:
if option in non_options:
continue # These don't belong
if option not in go_settings:
go_settings[option] = options[option].value()
https_server = tornado.httpserver.HTTPServer(
Expand Down
3 changes: 3 additions & 0 deletions gateone/static/gateone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,9 @@ GateOne.Base.update(GateOne.Utils, {
if (!node) {
return false;
}
if (node === document) {
return true;
}
style = window.getComputedStyle(node, null);
if (style && style.display == 'none') {
return false;
Expand Down

0 comments on commit 48a5856

Please sign in to comment.