Browse Source

Reconnect button (#3)

* 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

* Forgot the z-index

* Whoa, there's two copies?

Not sure why there are two index.html files, but...

* Forgot the z-index
pull/126/head
Cian Butler 8 years ago
committed by GitHub
parent
commit
d344abb87f
  1. 3
      app.js
  2. 15
      public/index.html
  3. 16
      public/wetty/index.html
  4. 5
      public/wetty/wetty.js

3
app.js

@ -120,7 +120,8 @@ io.on('connection', function(socket){
socket.emit('output', data); socket.emit('output', data);
}); });
term.on('exit', function(code) { 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) { socket.on('resize', function(data) {
term.resize(data.col, data.row); term.resize(data.col, data.row);

15
public/index.html

@ -14,6 +14,20 @@
width: 100%; width: 100%;
margin: 0px; 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 { #terminal {
display: block; display: block;
position: relative; position: relative;
@ -24,6 +38,7 @@
</head> </head>
<body> <body>
<div id="overlay"><input type="button" onclick="javascript:location.reload();" value="reconnect" /></div>
<div id="terminal"></div> <div id="terminal"></div>
<script type="application/javascript"> <script type="application/javascript">
window.addEventListener('beforeunload', function(e) { window.addEventListener('beforeunload', function(e) {

16
public/wetty/index.html

@ -14,6 +14,21 @@
width: 100%; width: 100%;
margin: 0px; margin: 0px;
} }
#overlay {
position: absolute;
height: 100%;
width: 100%;
background-color: rgba(0,0,0,0.75);;
display: none;
z-index: 100;
}
#overlay input {
display: block;
margin: auto;
position: relative;
top: 50%;
transform: translateY(-50%);
}
#terminal { #terminal {
display: block; display: block;
position: relative; position: relative;
@ -24,6 +39,7 @@
</head> </head>
<body> <body>
<div id="overlay"><input type="button" onclick="javascript:location.reload();" value="reconnect" /></div>
<div id="terminal"></div> <div id="terminal"></div>
</body> </body>

5
public/wetty/wetty.js

@ -59,6 +59,11 @@ socket.on('output', function(data) {
term.io.writeUTF16(data); term.io.writeUTF16(data);
}); });
socket.on('logout', function(data) {
console.log("user logout");
document.getElementById("overlay").style.display = "block";
});
socket.on('disconnect', function() { socket.on('disconnect', function() {
console.log("Socket.io connection closed"); console.log("Socket.io connection closed");
}); });

Loading…
Cancel
Save