Permalink
Browse files

gateone.py: Changed TerminalWebSocket.set_title() to use the SESSIONS…

… dict for tracking terminal titles instead of self.title. Keeping things consistent.

gateone.js:  Changed the error, "A communications disruption can mean only one thing..." (which was a quote from Star Wars...  To complete it, "INVASION!") to, "The WebSocket connection was closed.  Will attempt to reconnect every 5 seconds..."  The beta period is over so it is time to be a little more professional.
terminal.py:  Fixed a bug in Terminal.resize() where it was (re)setting the top and bottom margins even if there was no actual resize taking place (i.e. the rows and cols were the same as before).  This fixes the following problem (talk about niche situations!):  When editing a file in vi...  when you're at the bottom of the screen...  when in insert mode...  *if* you reload the page the terminal wouldn't 'scroll up' the screen properly when entering a newline (after all those steps =).
terminal.py:  Corrected the PNG header regex so that it uses re.DOTALL.
404.html:  Got rid of the references to Ubuntu Mono in the embedded stylesheet so we don't wind up with unnecessary 404 errors when clients try to load a font that isn't at the specified path.
  • Loading branch information...
liftoff committed Feb 22, 2012
1 parent 967ff90 commit 015973fc9c87890eb0937b8c6445afafe0da6b94
Showing with 22 additions and 39 deletions.
  1. +2 −5 gateone/auth.py
  2. +9 −4 gateone/gateone.py
  3. +1 −1 gateone/plugins/ssh/static/ssh.js
  4. +3 −27 gateone/static/404.html
  5. +1 −1 gateone/static/gateone.js
  6. +6 −1 gateone/terminal.py
View
@@ -137,10 +137,7 @@ def get(self):
Sets the 'user' cookie with a new random session ID (*go_session*) and
sets *go_upn* to 'ANONYMOUS'.
"""
- # % is valid on the filesystem but invalid for an actual username.
- # This ensures we won't have a conflict at some point with an actual
- # user.
- user = r'ANONYMOUS'
+ user = 'ANONYMOUS'
check = self.get_argument("check", None)
if check:
# This lets any origin check if the user has been authenticated
@@ -169,7 +166,7 @@ def user_login(self, user):
cookie. This is to ensure that anonymous users can't access each
other's sessions.
"""
- logging.debug("user_login(%s)" % user)
+ logging.debug("NullAuthHandler.user_login(%s)" % user)
# Make a directory to store this user's settings/files/logs/etc
user_dir = os.path.join(self.settings['user_dir'], user)
if not os.path.exists(user_dir):
View
@@ -1256,6 +1256,8 @@ def new_terminal(self, settings):
# This resets the screen diff
SESSIONS[self.session][term]['multiplex'].prev_output[
self.client_id] = [None for a in xrange(rows-1)]
+ # Remind the client about this terminal's title
+ self.set_title(term)
else:
# Tell the client this terminal is no more
message = {'term_ended': term}
@@ -1362,14 +1364,17 @@ def set_title(self, term):
Example message::
{'set_title': {'term': 1, 'title': "user@host"}}
+
+ .. note:: Why the complexity on something as simple as setting the title? Many prompts set the title. This means we'd be sending a 'title' message to the client with nearly every screen update which is a pointless waste of bandwidth if the title hasn't changed.
"""
logging.debug("set_title(%s)" % term)
title = SESSIONS[self.session][term]['multiplex'].term.get_title()
# Only send a title update if it actually changed
- if term not in self.titles: # There's a first time for everything
- self.titles[term] = ""
- if title != self.titles[term]:
- self.titles[term] = title
+ if 'title' not in SESSIONS[self.session][term]:
+ # There's a first time for everything
+ SESSIONS[self.session][term]['title'] = ''
+ if title != SESSIONS[self.session][term]['title']:
+ SESSIONS[self.session][term]['title'] = title
title_message = {'set_title': {'term': term, 'title': title}}
self.write_message(json_encode(title_message))
@@ -849,7 +849,7 @@ GateOne.Base.update(GateOne.SSH, {
for (var term in dict) {
go.terminals[term]['sshConnectString'] = dict[term];
// Also fix the title while we're at it
- go.Visual.setTitleAction({'term': term, 'title': dict[term]});
+// go.Visual.setTitleAction({'term': term, 'title': dict[term]});
}
},
keygenComplete: function(message) {
View
@@ -30,30 +30,6 @@
body {
padding: 0 0 0px;
}
-@font-face {
- font-family: 'Ubuntu Mono';
- font-style: normal;
- font-weight: bold;
- src: local('Ubuntu Mono Bold'), local('UbuntuMono-Bold'), url('/foo/static/ubuntumono-bold.woff') format('woff');
-}
-@font-face {
- font-family: 'Ubuntu Mono';
- font-style: normal;
- font-weight: normal;
- src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url('/foo/static/ubuntumono-normal.woff') format('woff');
-}
-@font-face {
- font-family: 'Ubuntu Mono';
- font-style: italic;
- font-weight: bold;
- src: local('Ubuntu Mono Bold Italic'), local('UbuntuMono-BoldItalic'), url('/foo/static/ubuntumono-bold-italic.woff') format('woff');
-}
-@font-face {
- font-family: 'Ubuntu Mono';
- font-style: italic;
- font-weight: normal;
- src: local('Ubuntu Mono Italic'), local('UbuntuMono-Italic'), url('/foo/static/ubuntumono-italic.woff') format('woff');
-}
#gateone {
position: absolute;
overflow: hidden;
@@ -246,7 +222,7 @@
background-color: #fff;
outline: none;
resize: none;
- font-family: 'Ubuntu Mono', monospace; /* For consistency */
+ font-family: monospace;
line-height: 1;
}
#gateone .terminal {
@@ -274,7 +250,7 @@
color: #90A3C5;
}
#gateone .terminal pre {
- font-family: 'Ubuntu Mono', monospace;
+ font-family: monospace;
font-size: 0.9em; /* For some reason when you use a .woff font it seems to show up slightly larger than it would normally */
line-height: 1;
/*height: auto;*/ /* Needs to be 100% when scrollback is enabled */
@@ -875,7 +851,7 @@
border: 0;
left: 0;
right: 2em;
- font-family: 'Ubuntu Mono', monospace;
+ font-family: monospace;
}
#go_playPause {
float: left;
@@ -1157,7 +1157,7 @@ GateOne.Base.update(GateOne.Net, {
// Passing 'true' here to keep the stuff in localStorage for this term.
go.Terminal.closeTerminal(termObj.id.split('term')[1], true);
});
- u.getNode('#'+go.prefs.prefix+'termwrapper').innerHTML = "A communications disruption can mean only one thing...";
+ u.getNode('#'+go.prefs.prefix+'termwrapper').innerHTML = "The WebSocket connection was closed. Will attempt to reconnect every 5 seconds...";
setTimeout(go.Net.connect, 5000);
},
connect: function() {
View
@@ -762,7 +762,7 @@ def initialize(self, rows=24, cols=80, em_dimensions=None):
3: False,
4: False
}
- png_header = re.compile('.*\x89PNG\r')
+ png_header = re.compile('.*\x89PNG\r', re.DOTALL)
png_whole = re.compile('\x89PNG\r.+IEND\xaeB`\x82', re.DOTALL)
# NOTE: Only matching JFIF and Exif JPEGs because "\xff\xd8" is too
# ambiguous.
@@ -924,6 +924,10 @@ def resize(self, rows, cols, em_dimensions=None):
*self.em_dimensions* (which is currently only used by image output).
"""
logging.debug("resize(%s, %s)" % (rows, cols))
+ if em_dimensions:
+ self.em_dimensions = em_dimensions
+ if rows == self.rows and cols == self.cols:
+ return # Nothing to do--don't mess with the margins or the cursor
if rows < self.rows: # Remove rows from the top
for i in xrange(self.rows - rows):
self.screen.pop(0)
@@ -965,6 +969,7 @@ def _set_top_bottom(self, settings):
.. note:: This also handles restore/set "DEC Private Mode Values".
"""
+ logging.debug("_set_top_bottom(%s)" % settings)
# NOTE: Used by screen and vi so this needs to work and work well!
if len(settings):
if settings.startswith('?'):

0 comments on commit 015973f

Please sign in to comment.