From ced26a2ceaa34a6dec0dc71e82c724c34b408733 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 3 May 2026 13:06:54 -0400 Subject: [PATCH] update get_nhuuid() for libnhmain Try using emscripten_run_script_string("crypto.randomUUID()"); I need to commit this to the repository to test it elsewhere. If there isn't a revert shortly after this, it must have at least built without issue. --- sys/libnh/libnhmain.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/libnh/libnhmain.c b/sys/libnh/libnhmain.c index b0c3f5297..93062ab7e 100644 --- a/sys/libnh/libnhmain.c +++ b/sys/libnh/libnhmain.c @@ -800,6 +800,7 @@ after_opt_showpaths(const char *dir) void get_nhuuid(void) { + char *uuid = NULL; unsigned char stmp[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -807,8 +808,11 @@ get_nhuuid(void) if (svn.nhuuid[0]) return; - /* FIXME: fill in a useful valid UUID somehow */ - Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", (char *) stmp); + uuid = emscripten_run_script_string("crypto.randomUUID()"); + if (!uuid) { + uuid = (char *) &stmp[0]; + } + Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", uuid); } void