bittorrent-relay
Advanced tools
Comparing version 13.0.5 to 13.0.6
{ | ||
"name": "bittorrent-relay", | ||
"description": "Uses the mainline dht to relay requests to other trackers in a swarm", | ||
"version": "13.0.5", | ||
"version": "13.0.6", | ||
"bin": { | ||
@@ -6,0 +6,0 @@ "bittorrent-relay": "./bin/cmd.js" |
@@ -126,2 +126,3 @@ import Debug from 'debug' | ||
this.name = this.user.pub | ||
this.title = crypto.createHash('sha1').update(this.name).digest('hex') | ||
this.emit('ev', 'signed data using key') | ||
@@ -133,2 +134,3 @@ } catch (error) { | ||
this.name = useCheck.pub | ||
this.title = crypto.createHash('sha1').update(this.name).digest('hex') | ||
this.emit('ev', 'new key data was created, check ' + path.join(this.dir, 'user') + ' for new key data, temp.txt will be deleted in 5 minutes') | ||
@@ -375,6 +377,6 @@ } | ||
} else if(req.method === 'GET' && req.url === '/infohash.html'){ | ||
} else if(req.method === 'GET' && req.url === '/hash.html'){ | ||
res.setHeader('Content-Type', 'text/html') | ||
res.end(`<html><head><title>Relay</title></head><body>${(() => {const arr = [];for(const testing of this.hashes.keys()){arr.push(testing)};return arr;})().join('\n')}</body></html>`) | ||
} else if(req.method === 'GET' && req.url === '/infohash.json'){ | ||
} else if(req.method === 'GET' && req.url === '/hash.json'){ | ||
res.setHeader('Content-Type', 'application/json') | ||
@@ -388,2 +390,14 @@ res.end(JSON.stringify(Array.from(this.hashes))) | ||
res.end(JSON.stringify((() => {const arr = [];this.sockets.forEach((data) => {arr.push(data.id)});return arr;})())) | ||
} else if(req.method === 'GET' && req.url === '/address.html'){ | ||
res.setHeader('Content-Type', 'text/html') | ||
res.end(`<html><head><title>Relay</title></head><body>${(() => {const arr = [];this.sockets.forEach((data) => {arr.push(data.address)});return arr;})().join('\n')}</body></html>`) | ||
} else if(req.method === 'GET' && req.url === '/address.json'){ | ||
res.setHeader('Content-Type', 'application/json') | ||
res.end(JSON.stringify((() => {const arr = [];this.sockets.forEach((data) => {arr.push(data.address)});return arr;})())) | ||
} else if(req.method === 'GET' && req.url === '/title.html'){ | ||
res.setHeader('Content-Type', 'text/html') | ||
res.end(`<html><head><title>Relay</title></head><body>${(() => {const arr = [];this.sockets.forEach((data) => {arr.push(data.title)});return arr;})().join('\n')}</body></html>`) | ||
} else if(req.method === 'GET' && req.url === '/title.json'){ | ||
res.setHeader('Content-Type', 'application/json') | ||
res.end(JSON.stringify((() => {const arr = [];this.sockets.forEach((data) => {arr.push(data.title)});return arr;})())) | ||
} else if(req.method === 'GET' && req.url === '/name.html'){ | ||
@@ -650,3 +664,3 @@ res.setHeader('Content-Type', 'text/html') | ||
this.sockets.set(socket.id, socket) | ||
socket.send(JSON.stringify({id: self.id, name: self.name, address: self.address, web: self.web, host: self.host, port: self.port, domain: self.domain, relay: getRelayHash, status: self.status, sig: self.sig, action: 'session'})) | ||
socket.send(JSON.stringify({id: self.id, title: self.title, name: self.name, address: self.address, web: self.web, host: self.host, port: self.port, domain: self.domain, relay: getRelayHash, status: self.status, sig: self.sig, action: 'session'})) | ||
this.onRelaySocketConnection(socket) | ||
@@ -662,3 +676,3 @@ } | ||
this.sockets.set(socket.id, socket) | ||
socket.send(JSON.stringify({id: self.id, name: self.name, address: self.address, web: self.web, host: self.host, port: self.port, domain: self.domain, relay: getRelayHash, status: self.status, sig: self.sig, action: 'session'})) | ||
socket.send(JSON.stringify({id: self.id, title: self.title, name: self.name, address: self.address, web: self.web, host: self.host, port: self.port, domain: self.domain, relay: getRelayHash, status: self.status, sig: self.sig, action: 'session'})) | ||
this.onRelaySocketConnection(socket) | ||
@@ -944,3 +958,3 @@ } | ||
} | ||
socket.send(JSON.stringify({id: self.id, name: self.name, address: self.address, web: self.web, host: self.host, port: self.port, domain: self.domain, relay: socket.relay, status: self.status, sig: self.sig, action: 'session'})) | ||
socket.send(JSON.stringify({id: self.id, title: self.title, name: self.name, address: self.address, web: self.web, host: self.host, port: self.port, domain: self.domain, relay: socket.relay, status: self.status, sig: self.sig, action: 'session'})) | ||
} | ||
@@ -947,0 +961,0 @@ socket.onError = function(err){ |
104020
2715