should work (#320)
This commit is contained in:
parent
23f1493d0a
commit
d4b861fbbd
68
js/main.js
68
js/main.js
|
@ -8,54 +8,26 @@
|
||||||
|
|
||||||
/* Localstorage fix */
|
/* Localstorage fix */
|
||||||
(function() {
|
(function() {
|
||||||
|
const localStorage = (() => {
|
||||||
const __fs = window.require("fs");
|
const req = webpackJsonp.push([[], {__extra_id__: (module, exports, req) => module.exports = req}, [["__extra_id__"]]]);
|
||||||
const __process = window.require("process");
|
delete req.m.__extra_id__;
|
||||||
const __platform = __process.platform;
|
delete req.c.__extra_id__;
|
||||||
const __dataPath = (__platform === "win32" ? __process.env.APPDATA : __platform === "darwin" ? __process.env.HOME + "/Library/Preferences" : process.env.HOME + "/.config") + "/BetterDiscord/";
|
const filter = theModule => theModule.remove && theModule.set && theModule.clear && theModule.get && !theModule.sort;
|
||||||
const localStorageFile = "localStorage.json";
|
for (const i in req.c) {
|
||||||
|
if (!req.c.hasOwnProperty(i)) continue;
|
||||||
let __data = {};
|
const m = req.c[i].exports;
|
||||||
if (__fs.existsSync(`${__dataPath}${localStorageFile}`)) {
|
if (m && m.__esModule && m.default && filter(m.default)) return m.default;
|
||||||
try {
|
if (m && filter(m)) return m;
|
||||||
__data = JSON.parse(__fs.readFileSync(`${__dataPath}${localStorageFile}`));
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
})();
|
||||||
|
|
||||||
|
if (localStorage) {
|
||||||
|
const email_cache = localStorage.get("email_cache");
|
||||||
|
localStorage.remove("email_cache");
|
||||||
|
localStorage.remove("token");
|
||||||
|
window.addEventListener("beforeunload", () => {localStorage.set("email_cache", email_cache);});
|
||||||
}
|
}
|
||||||
else if (__fs.existsSync(localStorageFile)) {
|
|
||||||
try {
|
|
||||||
__data = JSON.parse(__fs.readFileSync(localStorageFile));
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const __ls = __data;
|
|
||||||
__ls.setItem = function(i, v) {
|
|
||||||
__ls[i] = v;
|
|
||||||
this.save();
|
|
||||||
};
|
|
||||||
__ls.getItem = function(i) {
|
|
||||||
return __ls[i] || null;
|
|
||||||
};
|
|
||||||
__ls.save = function() {
|
|
||||||
__fs.writeFileSync(`${__dataPath}${localStorageFile}`, JSON.stringify(this), null, 4);
|
|
||||||
};
|
|
||||||
|
|
||||||
const __proxy = new Proxy(__ls, {
|
|
||||||
set: function(target, name, val) {
|
|
||||||
__ls[name] = val;
|
|
||||||
__ls.save();
|
|
||||||
},
|
|
||||||
get: function(target, name) {
|
|
||||||
return __ls[name] || null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.localStorage = __proxy;
|
|
||||||
|
|
||||||
const oOpen = XMLHttpRequest.prototype.open;
|
const oOpen = XMLHttpRequest.prototype.open;
|
||||||
XMLHttpRequest.prototype.open = function() {
|
XMLHttpRequest.prototype.open = function() {
|
||||||
|
@ -2714,11 +2686,13 @@ class V2 {
|
||||||
delete req.c.__extra_id__;
|
delete req.c.__extra_id__;
|
||||||
|
|
||||||
const protect = theModule => {
|
const protect = theModule => {
|
||||||
if (!theModule.getToken && !theModule.getEmail) return theModule;
|
if (theModule.remove && theModule.set && theModule.clear && theModule.get && !theModule.sort) return null;
|
||||||
|
if (!theModule.getToken && !theModule.getEmail && !theModule.showToken) return theModule;
|
||||||
return new Proxy(theModule, {
|
return new Proxy(theModule, {
|
||||||
get: function(obj, func) {
|
get: function(obj, func) {
|
||||||
if (func == "getToken") return () => "mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa";
|
if (func == "getToken") return () => "mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa";
|
||||||
if (func == "getEmail") return () => "puppet11112@gmail.com";
|
if (func == "getEmail") return () => "puppet11112@gmail.com";
|
||||||
|
if (func == "showToken") return () => true;
|
||||||
return obj[func];
|
return obj[func];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue