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.
This commit is contained in:
nhmall
2026-05-03 13:06:54 -04:00
parent 4eefeb30dd
commit ced26a2cea
+6 -2
View File
@@ -800,6 +800,7 @@ after_opt_showpaths(const char *dir)
void void
get_nhuuid(void) get_nhuuid(void)
{ {
char *uuid = NULL;
unsigned char stmp[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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]) if (svn.nhuuid[0])
return; return;
/* FIXME: fill in a useful valid UUID somehow */ uuid = emscripten_run_script_string("crypto.randomUUID()");
Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", (char *) stmp); if (!uuid) {
uuid = (char *) &stmp[0];
}
Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", uuid);
} }
void void