[API CHANGE] Add a new field to the "rpc/identify" API call output

{
namespace : rpc,
name : identify,
id : junk,
args : junk
}

Return args:
args : {
  type : [server/client/bridge],
  hostname : <hostname>
}
This commit is contained in:
Ken Moore
2016-06-03 15:08:05 -04:00
parent 9343ce5e52
commit 0f3ec82dc1
3 changed files with 6 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
#include "BridgeConnection.h"
#include <unistd.h>
#include <QHostInfo>
#define DEBUG 0
#define IDLETIMEOUTMINS 30
@@ -130,6 +131,7 @@ void BridgeConnection::HandleAPIMessage(QString msg){
if(id=="sysadm_bridge_request_ident"){
//qDebug() << "Got ident reply:" << JM;
serverconn = (JM.value("args").toObject().value("type").toString() == "server");
}else if("bridge_request_list_keys"){
QStringList keys = JsonArrayToStringList(JM.value("args").toObject().value("md5_keys").toArray());
//Now see what has changed (if anything)
@@ -153,6 +155,7 @@ void BridgeConnection::HandleAPIMessage(QString msg){
if(namesp == "rpc" && name=="identify"){
QJsonObject tmp;
tmp.insert("type","bridge");
tmp.insert("hostname", QHostInfo::localHostName() );
outargs = tmp;
}else if(namesp == "rpc" && name=="auth_ssl"){

View File

@@ -118,9 +118,7 @@ void BridgeServer::NewSocketConnection(){
//qDebug() << "New incoming connection..";
QWebSocket *ws = this->nextPendingConnection();
if(allowConnection(ws->peerAddress()) ){
QString name = ws->peerName();
if(name.isEmpty()){ name = ws->peerAddress().toString(); }
sock = new BridgeConnection( this, ws, generateID(name) );
sock = new BridgeConnection( this, ws, generateID("") );
}else{
ws->abort();
}

View File

@@ -6,6 +6,7 @@
#include "WebSocket.h"
#include <QtConcurrent>
#include <QHostInfo>
#include <unistd.h>
#define DEBUG 0
@@ -239,6 +240,7 @@ void WebSocket::EvaluateRequest(const RestInputStruct &REQ){
if(out.in_struct.name == "identify"){
QJsonObject obj;
obj.insert("type", "server");
obj.insert("hostname",QHostInfo::localHostName() );
out.out_args = obj;
out.CODE = RestOutputStruct::OK;
}else if(out.in_struct.name.startsWith("auth")){