new front end #33
This commit is contained in:
+19
-12
@@ -8,20 +8,27 @@ const conf = require('../app').conf;
|
||||
const socket = new SocketServerJson({
|
||||
socketFile: conf.socketFile,
|
||||
onData: function(data, clientSocket) {
|
||||
let host = Host.lookUp(data['domain']) || {host: 'none'};
|
||||
|
||||
for (const [key, value] of Object.entries(host)) {
|
||||
host[key] = String(value);
|
||||
};
|
||||
|
||||
clientSocket.write(JSON.stringify(host));
|
||||
if(host.ip){
|
||||
try{
|
||||
Host.addCache(data['domain'], host)
|
||||
}catch(error){
|
||||
console.error('Should never get this error...', error)
|
||||
try{
|
||||
console.log('socket lookup for', data)
|
||||
let parentHost = Host.lookUp(data['domain']) || {host: 'none'};
|
||||
console.log('found', parentHost)
|
||||
if(!parentHost.wildcard_parent){
|
||||
parentHost.wildcard_parent = parentHost.host;
|
||||
Host.addCache(data['domain'], parentHost);
|
||||
}
|
||||
|
||||
for(const [key, value] of Object.entries(parentHost)) {
|
||||
parentHost[key] = String(value);
|
||||
};
|
||||
|
||||
|
||||
console.log('To send socket', JSON.stringify(parentHost))
|
||||
|
||||
clientSocket.write(JSON.stringify(parentHost));
|
||||
}catch(error){
|
||||
console.error('controler/hosts onData error', error)
|
||||
}
|
||||
|
||||
},
|
||||
onListen: function(){
|
||||
console.log('listening')
|
||||
|
||||
Reference in New Issue
Block a user