1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 09:24:48 +00:00
This commit is contained in:
zumbiepig 2024-09-07 07:31:07 -07:00
parent ef24b8af48
commit 5d939b1553
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE

View File

@ -224,7 +224,8 @@ const storage = {
get: function (key: string) {
const item = localStorage.getItem('minexlauncher');
if (item !== null) {
const json = JSON.parse(item);
const decoded = atob(item);
const json = JSON.parse(decoded);
if (json[key] !== undefined) {
return json[key];
}
@ -233,13 +234,21 @@ const storage = {
return undefined;
},
set: function (key: string, value: string | number | object | boolean | null | undefined) {
let item = localStorage.getItem('minexlauncher');
const item = localStorage.getItem('minexlauncher');
if (item === null) {
item = '{}';
const json: Record<string, unknown> = {};
json[key] = value;
const string = JSON.stringify(json);
const encoded = btoa(string);
localStorage.setItem('minexlauncher', encoded);
} else {
const decoded = atob(item);
const json = JSON.parse(decoded);
json[key] = value;
const string = JSON.stringify(json);
const encoded = btoa(string);
localStorage.setItem('minexlauncher', encoded);
}
const json = JSON.parse(item);
json[key] = value;
localStorage.setItem('minexlauncher', JSON.stringify(json));
},
},
session: {