|
|
|
@ -14,20 +14,20 @@ const API_URL = '/api/wsjtx';
|
|
|
|
const DECODES_URL = '/api/wsjtx/decodes';
|
|
|
|
const DECODES_URL = '/api/wsjtx/decodes';
|
|
|
|
|
|
|
|
|
|
|
|
// Generate or retrieve persistent session ID
|
|
|
|
// Generate or retrieve persistent session ID
|
|
|
|
|
|
|
|
// NOTE: Kept short (8 chars) intentionally — long UUIDs in query strings
|
|
|
|
|
|
|
|
// trigger false positives in Bitdefender and similar security software
|
|
|
|
function getSessionId() {
|
|
|
|
function getSessionId() {
|
|
|
|
const KEY = 'ohc-wsjtx-session';
|
|
|
|
const KEY = 'ohc-wsjtx-session';
|
|
|
|
|
|
|
|
const generate = () => Math.random().toString(36).substring(2, 10);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
let id = localStorage.getItem(KEY);
|
|
|
|
let id = localStorage.getItem(KEY);
|
|
|
|
if (id && id.length >= 16) return id;
|
|
|
|
if (id && id.length >= 8) return id;
|
|
|
|
// Generate a random ID
|
|
|
|
id = generate();
|
|
|
|
id = (typeof crypto !== 'undefined' && crypto.randomUUID)
|
|
|
|
|
|
|
|
? crypto.randomUUID()
|
|
|
|
|
|
|
|
: Math.random().toString(36).substring(2) + Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
|
|
|
|
|
|
localStorage.setItem(KEY, id);
|
|
|
|
localStorage.setItem(KEY, id);
|
|
|
|
return id;
|
|
|
|
return id;
|
|
|
|
} catch {
|
|
|
|
} catch {
|
|
|
|
// Fallback for privacy browsers that block localStorage
|
|
|
|
// Fallback for privacy browsers that block localStorage
|
|
|
|
return Math.random().toString(36).substring(2) + Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
|
|
return generate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|