From fd0759e4736aee3c3c3f6c91fdef053ffbdc09af Mon Sep 17 00:00:00 2001 From: Ben Ford Date: Thu, 10 Dec 2015 08:53:04 -0800 Subject: [PATCH] Add a reconnect button on logout Prior to this, the only way to return to a session after logging out or login timeout was to manually reload the page. This gives you a nice button to do it for you. Ping @joshsamuelson --- app.js | 3 ++- public/wetty/index.html | 15 +++++++++++++++ public/wetty/wetty.js | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index d00e6a4..0cc895b 100644 --- a/app.js +++ b/app.js @@ -120,7 +120,8 @@ io.on('connection', function(socket){ socket.emit('output', data); }); term.on('exit', function(code) { - console.log((new Date()) + " PID=" + term.pid + " ENDED") + console.log((new Date()) + " PID=" + term.pid + " ENDED"); + socket.emit('logout'); }); socket.on('resize', function(data) { term.resize(data.col, data.row); diff --git a/public/wetty/index.html b/public/wetty/index.html index f28eb79..ddd0f70 100644 --- a/public/wetty/index.html +++ b/public/wetty/index.html @@ -14,6 +14,20 @@ width: 100%; margin: 0px; } + #overlay { + position: absolute; + height: 100%; + width: 100%; + background-color: rgba(0,0,0,0.75);; + display: none; + } + #overlay input { + display: block; + margin: auto; + position: relative; + top: 50%; + transform: translateY(-50%); + } #terminal { display: block; position: relative; @@ -24,6 +38,7 @@ +
diff --git a/public/wetty/wetty.js b/public/wetty/wetty.js index d7068a8..96048e5 100644 --- a/public/wetty/wetty.js +++ b/public/wetty/wetty.js @@ -59,6 +59,11 @@ socket.on('output', function(data) { term.io.writeUTF16(data); }); +socket.on('logout', function(data) { + console.log("user logout"); + document.getElementById("overlay").style.display = "block"; +}); + socket.on('disconnect', function() { console.log("Socket.io connection closed"); });