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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user