Saving now works over insecure networks.
This commit is contained in:
@ -51,6 +51,12 @@ class HomeplayEmulator {
|
||||
window.EJS_onLoadState = this.onEJSLoadState;
|
||||
window.onmessage = this.onMessage;
|
||||
|
||||
// Now check if we have the libs we NEED.
|
||||
if(!window.JSZip || !window.CryptoJS) {
|
||||
this.send({ message: 'error', error: 'Missing required libraries' });
|
||||
return;
|
||||
}
|
||||
|
||||
// Begin the init interval
|
||||
this.initInterval = setInterval(() => {
|
||||
this.send({ message: 'iframe_loaded' });
|
||||
@ -66,7 +72,7 @@ class HomeplayEmulator {
|
||||
await this.save();
|
||||
}
|
||||
} catch(e) {
|
||||
console.error('Error checking for save updates', e);
|
||||
this.send({ message: 'error', error: e.message });
|
||||
} finally {
|
||||
this.saveLock = false;
|
||||
}
|
||||
@ -147,16 +153,22 @@ class HomeplayEmulator {
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error('Website sent invalid message', data);
|
||||
this.send({ message: 'error', error: 'Unknown message' });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
getFileMD5 = async path => {
|
||||
const buffer = window.EJS_emulator.gameManager.FS.readFile(path);
|
||||
const hash = await crypto.subtle.digest('SHA-256', buffer);
|
||||
const hashArray = Array.from(new Uint8Array(hash));
|
||||
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
||||
return hashHex;
|
||||
|
||||
// Convert buffer to string, likely going to need to change later.
|
||||
const bufferArray = Array.from(new Uint8Array(buffer));
|
||||
const bufferString = bufferArray.map(b => String.fromCharCode(b)).join('');
|
||||
|
||||
// Hash string
|
||||
const hash = window.CryptoJS.MD5(bufferString);
|
||||
const hashString = hash.toString(CryptoJS.enc.Base64);
|
||||
return hashString;
|
||||
}
|
||||
|
||||
getRetroArchCfg = (gameManager) => {
|
||||
|
Reference in New Issue
Block a user