1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-02-06 11:43:15 +00:00

Added 'isService' property to MeshAgent object

This commit is contained in:
Bryan Roe
2019-03-06 16:40:05 -08:00
parent 2a8347be26
commit 780ef826c3

View File

@@ -1696,6 +1696,28 @@ void ILibDuktape_MeshAgent_PUSH(duk_context *ctx, void *chain)
ILibDuktape_CreateInstanceMethod(ctx, "eval", ILibDuktape_MeshAgent_eval, 1);
Duktape_CreateEnum(ctx, "ContainerPermissions", (char*[]) { "DEFAULT", "NO_AGENT", "NO_MARSHAL", "NO_PROCESS_SPAWNING", "NO_FILE_SYSTEM_ACCESS", "NO_NETWORK_ACCESS" }, (int[]) { 0x00, 0x10000000, 0x08000000, 0x04000000, 0x00000001, 0x00000002 }, 6);
#ifdef WIN32
#ifdef _WINSERVICE
duk_push_boolean(ctx, agent->runningAsConsole == 0);
#else
duk_push_false(ctx);
#endif
ILibDuktape_CreateReadonlyProperty(ctx, "isService");
#else
#ifndef __APPLE__
// Determine if we're running as service on Linux
if (duk_peval_string(ctx, "require('service-manager').manager.getService('meshagent').isMe();") == 0)
{
ILibDuktape_CreateReadonlyProperty(ctx, "isService");
}
else
{
duk_pop(ctx);
}
#endif
#endif
}
ILibDuktape_CreateInstanceMethod(ctx, "GenerateCertificate", ILibDuktape_MeshAgent_GenerateCertificate, 1);