Merge pull request #5 from crimera/main

Only generate uuid for new username strings
This commit is contained in:
AMIAY
2026-01-16 14:56:42 +01:00
committed by GitHub

View File

@@ -685,7 +685,7 @@ async function launchGame(playerName = 'Player', progressCallback, javaPathOverr
throw new Error(`Game client missing. Tried: ${attempted}`);
}
const uuid = uuidv4();
const uuid = getUuidForUser(playerName);
const args = [
'--app-dir', gameLatest,
'--java-exec', javaBin,
@@ -717,6 +717,21 @@ function loadUsername() {
return config.username || 'Player';
}
function getUuidForUser(username) {
const config = loadConfig();
const userUuids = config.userUuids || {};
if (userUuids[username]) {
return userUuids[username];
}
const newUuid = uuidv4();
userUuids[username] = newUuid;
saveConfig({ userUuids });
return newUuid;
}
function saveJavaPath(javaPath) {
const trimmed = (javaPath || '').trim();
saveConfig({ javaPath: trimmed });