mirror of
https://gitlab.com/skysthelimit.dev/selenite.git
synced 2025-06-15 18:12:08 -05:00
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
getMainSave()
|
|
function getMainSave() {
|
|
var mainSave = {};
|
|
// List of items in localStorage that should not be saved
|
|
|
|
// Convert localStorage to an array of key-value pairs and remove the items that should not be saved
|
|
localStorageSave = Object.entries(localStorage);
|
|
|
|
|
|
// Convert the localStorage array to a base64-encoded JSON string
|
|
localStorageSave = btoa(JSON.stringify(localStorageSave));
|
|
|
|
// Add the localStorage data to the mainSave object
|
|
mainSave.localStorage = localStorageSave;
|
|
|
|
// Get the cookies data and add it to the mainSave object
|
|
cookiesSave = document.cookie;
|
|
cookiesSave = btoa(cookiesSave);
|
|
mainSave.cookies = cookiesSave;
|
|
|
|
// Convert the mainSave object to a base64-encoded JSON string
|
|
mainSave = btoa(JSON.stringify(mainSave));
|
|
|
|
// Encrypt the mainSave data using AES encryption with the key 'save'
|
|
mainSave = CryptoJS.AES.encrypt(mainSave, "egamepass").toString();
|
|
|
|
// Return the encrypted mainSave data
|
|
return mainSave;
|
|
}
|
|
|
|
// Function to download the main save data as a file
|
|
function downloadMainSave() {
|
|
var data = new Blob([getMainSave()]);
|
|
var dataURL = URL.createObjectURL(data);
|
|
|
|
var fakeElement = document.createElement("a");
|
|
fakeElement.href = dataURL;
|
|
fakeElement.download = "your.selenite.save";
|
|
fakeElement.click();
|
|
URL.revokeObjectURL(dataURL);
|
|
}
|