1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-03 09:03:48 +00:00

Added ability to query Server Info, and Proxy Config

This commit is contained in:
Bryan Roe
2019-04-01 17:34:36 -07:00
parent 4e4a9f97a8
commit 69f76902cd
2 changed files with 62 additions and 0 deletions

View File

@@ -1650,6 +1650,25 @@ void ILibDuktape_MeshAgent_ConnectedHook(ILibDuktape_EventEmitter *sender, char
}
duk_set_top(sender->ctx, top);
}
duk_ret_t ILibDuktape_MeshAgent_ServerInfo(duk_context *ctx)
{
duk_push_this(ctx); // [agent]
MeshAgentHostContainer *agent = (MeshAgentHostContainer*)Duktape_GetPointerProperty(ctx, -1, MESH_AGENT_PTR);
duk_push_object(ctx);
util_tohex(agent->meshId, sizeof(agent->meshId), ILibScratchPad);
duk_push_string(ctx, ILibScratchPad); duk_put_prop_string(ctx, -2, "MeshID");
util_tohex(agent->serverHash, sizeof(agent->serverHash), ILibScratchPad);
duk_push_string(ctx, ILibScratchPad); duk_put_prop_string(ctx, -2, "ServerID");
duk_push_string(ctx, agent->serveruri); duk_put_prop_string(ctx, -2, "ServerUri");
return(1);
}
void ILibDuktape_MeshAgent_PUSH(duk_context *ctx, void *chain)
{
MeshAgentHostContainer *agent;
@@ -1703,6 +1722,8 @@ void ILibDuktape_MeshAgent_PUSH(duk_context *ctx, void *chain)
ILibDuktape_EventEmitter_CreateEventEx(emitter, "DesktopSessionChanged");
ILibDuktape_EventEmitter_AddHook(emitter, "Connected", ILibDuktape_MeshAgent_ConnectedHook);
ILibDuktape_CreateEventWithGetter(ctx, "ServerInfo", ILibDuktape_MeshAgent_ServerInfo);
ILibDuktape_CreateEventWithGetter(ctx, "isControlChannelConnected", ILibDuktape_MeshAgent_isControlChannelConnected);
ILibDuktape_EventEmitter_AddHook(emitter, "Ready", ILibDuktape_MeshAgent_Ready);