Compare commits

..

No commits in common. "1efec854943ec285617431ad0683512b9fbcaa10" and "13cb96af14b0350336f2de30e4a5b310ba8e9d54" have entirely different histories.

View File

@ -18,7 +18,7 @@ goodbye(() => swarm.destroy())
const conns = []
let USERPWD = "/"
let DAPI_KEY = {}
let USERNAME = "anon" + rand
let USERNAME = "annon" + rand
let LOGGEDIN = false
async function clearCursor() {
@ -105,10 +105,6 @@ swarm.on('connection', conn => {
})
})
swarm.on('error', (err) => {
console.log('Error connecting to peer:', err);
});
// Use readline to accept input from the user
const rl = readline.createInterface({
input: process.stdin,
@ -149,8 +145,6 @@ rl.on('line', input => {
}
const execute = input.startsWith(">")
if (input.startsWith("/") || input.startsWith("!")) return
if (execute) {
let inputdata = input.split(2)
const cmdToRun = inputdata.join(" ").replace("> ", "").replace(">", "")
@ -175,6 +169,7 @@ rl.on('line', input => {
})
}
const start = input.startsWith("/start")
if (start) {
startContainer(DAPI_KEY.key).then((data) => {
@ -229,20 +224,11 @@ rl.on('line', input => {
// Join a common topic
const topic = process.argv[2] ? b4a.from(process.argv[2], 'hex') : crypto.randomBytes(32)
const discovery = swarm.join(topic, { client: true, server: true })
setTimeout(() => {
const discovery = swarm.join(topic, {
lookup: true,
announce: true
});
// 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(() => {
console.log(`joined topic: ${b4a.toString(topic, 'hex')}\n(Share this key to others so they may join.)`)
console.log('You are now in a chatroom for your topic, feel free to chat.\n')
console.log('Want to login to the SSH.SURF API? Type "/login [APIKEY]" to login.\n\n')
})
}, 3000);