Adding quit message
This commit is contained in:
parent
c7f997ebe5
commit
3eb745c483
@ -3,8 +3,6 @@ var unirest = require('unirest');
|
|||||||
async function login(key, conns, MYKEY, USERNAME) {
|
async function login(key, conns, MYKEY, USERNAME) {
|
||||||
getUSERNAME(key)
|
getUSERNAME(key)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
process.stdout.write("\033[2J")
|
|
||||||
process.stdout.write("\033[0f")
|
|
||||||
console.log("Hello, " + data + "\nYou are now logged in.\n\n\n")
|
console.log("Hello, " + data + "\nYou are now logged in.\n\n\n")
|
||||||
USERNAME[0] = data
|
USERNAME[0] = data
|
||||||
MYKEY.push(key)
|
MYKEY.push(key)
|
||||||
|
19
sshChat.js
19
sshChat.js
@ -124,14 +124,14 @@ sidebarBox.setLabel("Connected Peers: (Currently None)")
|
|||||||
|
|
||||||
const originalLog = console.log;
|
const originalLog = console.log;
|
||||||
console.log = (...args) => {
|
console.log = (...args) => {
|
||||||
mainBox.setContent(mainBox.getContent() + `\n${args.join(' ')}`);
|
mainBox.setContent(mainBox.getContent() + `\n${args.join(' ')}`);
|
||||||
updateScroll()
|
updateScroll()
|
||||||
stdinBox.clearValue();
|
stdinBox.clearValue();
|
||||||
|
screen.render()
|
||||||
screen.render()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Generate a random public key
|
// Generate a random public key
|
||||||
const publicKey = crypto.randomBytes(32)
|
const publicKey = crypto.randomBytes(32)
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ setTimeout(() => {
|
|||||||
// The flushed promise will resolve when the topic has been fully announced to the DHT
|
// The flushed promise will resolve when the topic has been fully announced to the DHT
|
||||||
discovery.flushed().then(() => {
|
discovery.flushed().then(() => {
|
||||||
mainBox.setLabel("Topic: " + b4a.toString(topic, 'hex') + " (Share to connect)")
|
mainBox.setLabel("Topic: " + b4a.toString(topic, 'hex') + " (Share to connect)")
|
||||||
stdinBox.setLabel("To login: >login [TOKEN]")
|
stdinBox.setLabel("To login: >login [TOKEN] | To quit: >exit")
|
||||||
screen.render()
|
screen.render()
|
||||||
})
|
})
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@ -293,4 +293,9 @@ stdinBox.on('submit', (input) => {
|
|||||||
stdinBox.focus();
|
stdinBox.focus();
|
||||||
// Render the screen
|
// Render the screen
|
||||||
|
|
||||||
screen.render()
|
screen.render()
|
||||||
|
|
||||||
|
// Quit on Escape, q, or Control-C.
|
||||||
|
screen.key(['escape', 'q', 'C-c'], function(ch, key) {
|
||||||
|
return process.exit(0);
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user