Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ajax.pair(pairData, (err, data) => {
if (data.result === 'wait') {
print('Incorrect pairing code');
commandLoop();
} else if (data.result === 'correct') {
localStorage['meta.id'] = data.id;
print('Devices paired');
commandLoop();
}
});
}, 30000);
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();
}
localStorage['meta.last'] = (new Date()).getTime();
}
}
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();
}
localStorage['meta.last'] = (new Date()).getTime();
}
}
who() {
print('id: ' + localStorage['meta.id']);
commandLoop();
},
info() {
setTimeout(() => {
const pairData = {
local: pairingCode,
remote: pcode,
id: localStorage['meta.id']
};
ajax.pair(pairData, (err, data) => {
if (data.result === 'wait') {
print('Incorrect pairing code');
commandLoop();
} else if (data.result === 'correct') {
localStorage['meta.id'] = data.id;
print('Devices paired');
commandLoop();
}
});
}, 30000);
} else if (data.result === 'correct') {