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 WebpackModules from "./modules/webpackModules";
// var settingsPanel, voiceMode, pluginModule, themeModule, dMode, publicServersModule, mainCore, BDV2;
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 minSupportedVersion = "0.3.0";

View File

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

View File

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

View File

@ -67,12 +67,24 @@ export default class V2C_AccountInfos extends React.Component {
*/
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}
+ Discriminator: ${user.discriminator}
+ Tag: ${user.tag}
+ ID: ${user.id}
+ 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
+ Flags: ${user.flags}
+ Has Nitro: ${user.hasPremiumSubscription ? "Yes" : "No"}

View File

@ -590,7 +590,10 @@ class Popout extends React.Component { // TODO: Probably use internal Components
userModule1
] = this.modules
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)
timestampClass = timestampClass || activityModule1.timestamp
@ -737,7 +740,10 @@ class Profile extends React.Component { // TODO: Probably use internal Component
render(){
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 [
flexModule1,
stylingModule1,

View File

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