mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-10 05:13:38 +00:00
Added workaround for macOS LaunchD placing all parameters within quotes
This commit is contained in:
@@ -1774,6 +1774,20 @@ duk_ret_t ILibDuktape_MeshAgent_getIdleTimeout(duk_context *ctx)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duk_ret_t ILibDuktape_MeshAgent_getStartupOptions(duk_context *ctx)
|
||||||
|
{
|
||||||
|
MeshAgentHostContainer *agent;
|
||||||
|
duk_push_this(ctx); // [MeshAgent]
|
||||||
|
agent = (MeshAgentHostContainer*)Duktape_GetPointerProperty(ctx, -1, MESH_AGENT_PTR);
|
||||||
|
|
||||||
|
int varLen = ILibSimpleDataStore_Cached_GetJSON(agent->masterDb, NULL, 0);
|
||||||
|
char *buffer = duk_push_fixed_buffer(ctx, varLen);
|
||||||
|
ILibSimpleDataStore_Cached_GetJSON(agent->masterDb, buffer, varLen);
|
||||||
|
duk_push_string(ctx, buffer);
|
||||||
|
duk_json_decode(ctx, -1);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
void ILibDuktape_MeshAgent_PUSH(duk_context *ctx, void *chain)
|
void ILibDuktape_MeshAgent_PUSH(duk_context *ctx, void *chain)
|
||||||
{
|
{
|
||||||
MeshAgentHostContainer *agent;
|
MeshAgentHostContainer *agent;
|
||||||
@@ -1845,6 +1859,7 @@ void ILibDuktape_MeshAgent_PUSH(duk_context *ctx, void *chain)
|
|||||||
ILibDuktape_CreateFinalizer(ctx, ILibDuktape_MeshAgent_Finalizer);
|
ILibDuktape_CreateFinalizer(ctx, ILibDuktape_MeshAgent_Finalizer);
|
||||||
ILibDuktape_CreateReadonlyProperty_int(ctx, "activeMicroLMS", (agent->microLMS != NULL ? 1 : 0));
|
ILibDuktape_CreateReadonlyProperty_int(ctx, "activeMicroLMS", (agent->microLMS != NULL ? 1 : 0));
|
||||||
ILibDuktape_CreateInstanceMethod(ctx, "restartCore", ILibDuktape_MeshAgent_dumpCoreModule, 0);
|
ILibDuktape_CreateInstanceMethod(ctx, "restartCore", ILibDuktape_MeshAgent_dumpCoreModule, 0);
|
||||||
|
ILibDuktape_CreateInstanceMethod(ctx, "getStartupOptions", ILibDuktape_MeshAgent_getStartupOptions, 0);
|
||||||
#ifdef _LINKVM
|
#ifdef _LINKVM
|
||||||
ILibDuktape_CreateReadonlyProperty_int(ctx, "hasKVM", 1);
|
ILibDuktape_CreateReadonlyProperty_int(ctx, "hasKVM", 1);
|
||||||
ILibDuktape_EventEmitter_CreateEventEx(emitter, "kvmConnected");
|
ILibDuktape_EventEmitter_CreateEventEx(emitter, "kvmConnected");
|
||||||
|
|||||||
@@ -114,6 +114,15 @@ void ILibSimpleDataStore_SHA384(char *data, int datalen, char* result) { util_sh
|
|||||||
|
|
||||||
void ILibSimpleDataStore_Cached(ILibSimpleDataStore dataStore, char* key, int keyLen, char* value, int valueLen)
|
void ILibSimpleDataStore_Cached(ILibSimpleDataStore dataStore, char* key, int keyLen, char* value, int valueLen)
|
||||||
{
|
{
|
||||||
|
if (valueLen > 2)
|
||||||
|
{
|
||||||
|
if (value[0] == '"' && value[valueLen - 1] == '"')
|
||||||
|
{
|
||||||
|
value = value + 1;
|
||||||
|
valueLen -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ILibSimpleDataStore_Root *root = (ILibSimpleDataStore_Root*)dataStore;
|
ILibSimpleDataStore_Root *root = (ILibSimpleDataStore_Root*)dataStore;
|
||||||
if (root->cacheTable == NULL) { root->cacheTable = ILibHashtable_Create(); }
|
if (root->cacheTable == NULL) { root->cacheTable = ILibHashtable_Create(); }
|
||||||
ILibSimpleDataStore_CacheEntry *entry = (ILibSimpleDataStore_CacheEntry*)ILibMemory_Allocate(sizeof(ILibSimpleDataStore_CacheEntry) + valueLen, 0, NULL, NULL);
|
ILibSimpleDataStore_CacheEntry *entry = (ILibSimpleDataStore_CacheEntry*)ILibMemory_Allocate(sizeof(ILibSimpleDataStore_CacheEntry) + valueLen, 0, NULL, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user