Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function initStorage() {
if (!window.localStorage) {
print('Local storage is not available.<br>Unsupported device.');
} else {
if (localStorage['meta.ver']) {
localStorage['meta.ver'] = METARHIA_VERSION;
const lastActivity = new Date(parseInt(localStorage['meta.last'], 10));
print(
'Local storage found<br>Last activity: ' + lastActivity.toUTCString()
);
if (localStorage['meta.id']) {
//print('System ready');
} else {
localStorage['meta.id'] = generateUnique();
print('New id generated');
}
} else {
print('Local storage initialization...');
localStorage['meta.ver'] = METARHIA_VERSION;
localStorage['meta.id'] = generateUnique();
print('New id generated');
enterKey();
}
'Local storage found<br>Last activity: ' + lastActivity.toUTCString()
);
if (localStorage['meta.id']) {
//print('System ready');
} else {
localStorage['meta.id'] = generateUnique();
print('New id generated');
}
} else {
print('Local storage initialization...');
localStorage['meta.ver'] = METARHIA_VERSION;
localStorage['meta.id'] = generateUnique();
print('New id generated');
enterKey();
}
localStorage['meta.last'] = (new Date()).getTime();
}
}