mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
.
This commit is contained in:
parent
ef24b8af48
commit
5d939b1553
@ -224,7 +224,8 @@ const storage = {
|
|||||||
get: function (key: string) {
|
get: function (key: string) {
|
||||||
const item = localStorage.getItem('minexlauncher');
|
const item = localStorage.getItem('minexlauncher');
|
||||||
if (item !== null) {
|
if (item !== null) {
|
||||||
const json = JSON.parse(item);
|
const decoded = atob(item);
|
||||||
|
const json = JSON.parse(decoded);
|
||||||
if (json[key] !== undefined) {
|
if (json[key] !== undefined) {
|
||||||
return json[key];
|
return json[key];
|
||||||
}
|
}
|
||||||
@ -233,13 +234,21 @@ const storage = {
|
|||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
set: function (key: string, value: string | number | object | boolean | null | 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) {
|
if (item === null) {
|
||||||
item = '{}';
|
const json: Record<string, unknown> = {};
|
||||||
}
|
|
||||||
const json = JSON.parse(item);
|
|
||||||
json[key] = value;
|
json[key] = value;
|
||||||
localStorage.setItem('minexlauncher', JSON.stringify(json));
|
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);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
session: {
|
session: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user