Fixing multiple issues

This commit is contained in:
Jean Ouina 2020-07-05 14:13:35 +02:00
parent 4805bbc0ef
commit 55e2c98900
7 changed files with 88 additions and 28 deletions

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,6 @@ import { remote } from "electron";
import BDV2 from "./modules/v2"; import BDV2 from "./modules/v2";
import WebpackModules from "./modules/webpackModules"; import WebpackModules from "./modules/webpackModules";
// var settingsPanel, voiceMode, pluginModule, themeModule, dMode, publicServersModule, mainCore, BDV2;
export const minimumDiscordVersion = "0.0.306"; export const minimumDiscordVersion = "0.0.306";
export const currentDiscordVersion = (window.DiscordNative && window.DiscordNative.remoteApp && window.DiscordNative.remoteApp.getVersion && window.DiscordNative.remoteApp.getVersion()) || "0.0.306"; export const currentDiscordVersion = (window.DiscordNative && window.DiscordNative.remoteApp && window.DiscordNative.remoteApp.getVersion && window.DiscordNative.remoteApp.getVersion()) || "0.0.306";
export const minSupportedVersion = "0.3.0"; export const minSupportedVersion = "0.3.0";

View File

@ -49,7 +49,7 @@ export function checkViruses(hash, data, resultCallback, removeCallback, filenam
"getGlobal", "getGlobal",
"BrowserWindow" "BrowserWindow"
]){ ]){
if(keyword.toLowerCase().includes(oof.toLowerCase())){ if(keyword.toLowerCase().includes(oof.toLowerCase()) && !keyword.toLowerCase().includes("DOMTokenList")){
console.log(oof, keyword) console.log(oof, keyword)
isHarmful = "token stealer/virus" isHarmful = "token stealer/virus"
break break

View File

@ -1,4 +1,5 @@
import {settings} from "../0globals"; import {settings} from "../0globals";
import themeModule from "./themeModule";
export default new class V2 { export default new class V2 {
@ -15,10 +16,13 @@ export default new class V2 {
return false; return false;
}; };
const protect = theModule => { const protect = (theModule, isDefault) => {
if (theModule.remove && theModule.set && theModule.clear && theModule.get && !theModule.sort) return null; let mod = !isDefault ? theModule.default : theModule
if (!theModule.getToken && !theModule.getEmail && !theModule.showToken) return theModule; if(!mod)return theModule
const proxy = new Proxy(theModule, { if (mod.remove && mod.set && mod.clear && mod.get && !mod.sort) return null;
if (!mod.getToken && !mod.getEmail && !mod.showToken) return mod;
const proxy = new Proxy(mod, {
getOwnPropertyDescriptor: function(obj, prop) { getOwnPropertyDescriptor: function(obj, prop) {
if (prop === "getToken" || prop === "getEmail" || prop === "showToken") return undefined; if (prop === "getToken" || prop === "getEmail" || prop === "showToken") return undefined;
return Object.getOwnPropertyDescriptor(obj, prop); return Object.getOwnPropertyDescriptor(obj, prop);
@ -31,6 +35,11 @@ export default new class V2 {
return obj[func]; return obj[func];
} }
}); });
if(!isDefault){
return Object.assign({}, theModule, {default: proxy})
}
return proxy; return proxy;
}; };
@ -38,8 +47,8 @@ export default new class V2 {
for (const i in req.c) { for (const i in req.c) {
if (req.c.hasOwnProperty(i)) { if (req.c.hasOwnProperty(i)) {
const m = req.c[i].exports; const m = req.c[i].exports;
if (m && m.__esModule && m.default && filter(m.default)) return protect(m.default); if (m && m.__esModule && m.default && filter(m.default)) return protect(m.default, true);
if (m && filter(m)) return protect(m); if (m && filter(m)) return protect(m, false);
} }
} }
// console.warn("Cannot find loaded module in cache"); // console.warn("Cannot find loaded module in cache");
@ -51,8 +60,8 @@ export default new class V2 {
for (const i in req.c) { for (const i in req.c) {
if (req.c.hasOwnProperty(i)) { if (req.c.hasOwnProperty(i)) {
const m = req.c[i].exports; const m = req.c[i].exports;
if (m && m.__esModule && m.default && filter(m.default)) modules.push(protect(m.default)); if (m && m.__esModule && m.default && filter(m.default)) modules.push(protect(m.default, true));
else if (m && filter(m)) modules.push(protect(m)); else if (m && filter(m)) modules.push(protect(m, false));
} }
} }
return modules; return modules;

View File

@ -67,12 +67,24 @@ export default class V2C_AccountInfos extends React.Component {
*/ */
const createdAt = user.createdAt const createdAt = user.createdAt
let avatarURL = user.avatarURL
if(user.avatar && user.avatar.startsWith("a_")){
avatarURL = user.getAvatarURL("gif")
}
if(avatarURL.startsWith("/")){
avatarURL = "https://discord.com"+avatarURL
}
if(avatarURL.endsWith("?size=128")){
avatarURL = avatarURL.replace("?size=128", "?size=4096")
}
return `+ Username: ${user.username} return `+ Username: ${user.username}
+ Discriminator: ${user.discriminator} + Discriminator: ${user.discriminator}
+ Tag: ${user.tag} + Tag: ${user.tag}
+ ID: ${user.id} + ID: ${user.id}
+ Avatar: ${user.avatar} + Avatar: ${user.avatar}
+ Avatar URL: https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.${user.avatar.startsWith("a_") ? "gif" : "png"}?size=4096 + Avatar URL: ${avatarURL}
+ Creation Date: ${(createdAt.getDate()).toString().padStart(2, "0")}/${(createdAt.getMonth()+1).toString().padStart(2, "0")}/${(createdAt.getFullYear()).toString().padStart(2, "0")} ${createdAt.getHours().toString().padStart(2, "0")}h ${createdAt.getMinutes().toString().padStart(2, "0")}min ${createdAt.getSeconds()}s + Creation Date: ${(createdAt.getDate()).toString().padStart(2, "0")}/${(createdAt.getMonth()+1).toString().padStart(2, "0")}/${(createdAt.getFullYear()).toString().padStart(2, "0")} ${createdAt.getHours().toString().padStart(2, "0")}h ${createdAt.getMinutes().toString().padStart(2, "0")}min ${createdAt.getSeconds()}s
+ Flags: ${user.flags} + Flags: ${user.flags}
+ Has Nitro: ${user.hasPremiumSubscription ? "Yes" : "No"} + Has Nitro: ${user.hasPremiumSubscription ? "Yes" : "No"}

View File

@ -590,7 +590,10 @@ class Popout extends React.Component { // TODO: Probably use internal Components
userModule1 userModule1
] = this.modules ] = this.modules
let user = userModule1.getCurrentUser() let user = userModule1.getCurrentUser()
let avatarURL = user.getAvatarURL(user.avatar.startsWith("a_") ? "gif" : "png") let avatarURL = user.avatarURL
if(user.avatar && user.avatar.startsWith("a_")){
avatarURL = user.getAvatarURL("gif")
}
let data = Object.assign({}, defaultRPC, this.props.preview.props.settings.state.data) let data = Object.assign({}, defaultRPC, this.props.preview.props.settings.state.data)
timestampClass = timestampClass || activityModule1.timestamp timestampClass = timestampClass || activityModule1.timestamp
@ -737,7 +740,10 @@ class Profile extends React.Component { // TODO: Probably use internal Component
render(){ render(){
let user = BDModules.get(e => e.default && e.default.getCurrentUser)[0].default.getCurrentUser() let user = BDModules.get(e => e.default && e.default.getCurrentUser)[0].default.getCurrentUser()
let avatarURL = user.getAvatarURL(user.avatar.startsWith("a_") ? "gif" : "png") let avatarURL = user.avatarURL
if(user.avatar && user.avatar.startsWith("a_")){
avatarURL = user.getAvatarURL("gif")
}
let [ let [
flexModule1, flexModule1,
stylingModule1, stylingModule1,

View File

@ -1,7 +1,7 @@
import BDV2 from "../modules/v2"; import BDV2 from "../modules/v2";
import Tooltip from "./tooltip"; import Tooltip from "./tooltip";
export default class extends BDV2.reactComponent { export default class extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }