mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 02:20:17 +00:00
[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:
@@ -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"){
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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")){
|
||||
|
||||
Reference in New Issue
Block a user