Merge branch 'immediate-finds' into immediate-finds-modules-proxy
This commit is contained in:
commit
67b5ecca51
|
@ -513,17 +513,24 @@ async function runtime(token: string) {
|
||||||
try {
|
try {
|
||||||
let result = null as any;
|
let result = null as any;
|
||||||
|
|
||||||
if (searchType === "webpackDependantLazy" || searchType === "webpackDependantLazyComponent") {
|
switch (searchType) {
|
||||||
|
case "webpackDependantLazy":
|
||||||
|
case "webpackDependantLazyComponent": {
|
||||||
const [factory] = args;
|
const [factory] = args;
|
||||||
result = factory();
|
result = factory();
|
||||||
} else if (searchType === "extractAndLoadChunks") {
|
break;
|
||||||
|
}
|
||||||
|
case "extractAndLoadChunks": {
|
||||||
const [code, matcher] = args;
|
const [code, matcher] = args;
|
||||||
|
|
||||||
const module = Vencord.Webpack.findModuleFactory(...code);
|
const module = Vencord.Webpack.findModuleFactory(...code);
|
||||||
if (module) {
|
if (module) {
|
||||||
result = module.toString().match(Vencord.Util.canonicalizeMatch(matcher));
|
result = module.toString().match(Vencord.Util.canonicalizeMatch(matcher));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
const findResult = args.shift();
|
const findResult = args.shift();
|
||||||
|
|
||||||
if (findResult != null) {
|
if (findResult != null) {
|
||||||
|
@ -539,6 +546,9 @@ async function runtime(token: string) {
|
||||||
result = findResult.$$vencordInner();
|
result = findResult.$$vencordInner();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
|
|
@ -73,6 +73,9 @@ if (!IS_VANILLA) {
|
||||||
const original = options.webPreferences.preload;
|
const original = options.webPreferences.preload;
|
||||||
options.webPreferences.preload = join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js");
|
options.webPreferences.preload = join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js");
|
||||||
options.webPreferences.sandbox = false;
|
options.webPreferences.sandbox = false;
|
||||||
|
// work around discord unloading when in background
|
||||||
|
options.webPreferences.backgroundThrottling = false;
|
||||||
|
|
||||||
if (settings.frameless) {
|
if (settings.frameless) {
|
||||||
options.frame = false;
|
options.frame = false;
|
||||||
} else if (process.platform === "win32" && settings.winNativeTitleBar) {
|
} else if (process.platform === "win32" && settings.winNativeTitleBar) {
|
||||||
|
@ -136,6 +139,9 @@ if (!IS_VANILLA) {
|
||||||
}
|
}
|
||||||
return originalAppend.apply(this, args);
|
return originalAppend.apply(this, args);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Work around discord unloading when in background
|
||||||
|
app.commandLine.appendSwitch("disable-renderer-backgrounding");
|
||||||
} else {
|
} else {
|
||||||
console.log("[Vencord] Running in vanilla mode. Not loading Vencord");
|
console.log("[Vencord] Running in vanilla mode. Not loading Vencord");
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,13 +73,13 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "instantBatchUpload:function",
|
find: "instantBatchUpload:function",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /uploadFiles:(.{1,2}),/,
|
match: /uploadFiles:(\i),/,
|
||||||
replace:
|
replace:
|
||||||
"uploadFiles:(...args)=>(args[0].uploads.forEach(f=>f.filename=$self.anonymise(f)),$1(...args)),",
|
"uploadFiles:(...args)=>(args[0].uploads.forEach(f=>f.filename=$self.anonymise(f)),$1(...args)),",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "message.attachments",
|
find: 'addFilesTo:"message.attachments"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(\i.uploadFiles\((\i),)/,
|
match: /(\i.uploadFiles\((\i),)/,
|
||||||
replace: "$2.forEach(f=>f.filename=$self.anonymise(f)),$1"
|
replace: "$2.forEach(f=>f.filename=$self.anonymise(f)),$1"
|
||||||
|
|
|
@ -295,12 +295,9 @@ export default definePlugin({
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
// Pass through editHistory & deleted & original attachments to the "edited message" transformer
|
// Pass through editHistory & deleted & original attachments to the "edited message" transformer
|
||||||
match: /interactionData:(\i)\.interactionData/,
|
match: /(?<=null!=\i\.edited_timestamp\)return )\i\(\i,\{reactions:(\i)\.reactions.{0,50}\}\)/,
|
||||||
replace:
|
replace:
|
||||||
"interactionData:$1.interactionData," +
|
"Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory, attachments:$1.attachments })"
|
||||||
"deleted:$1.deleted," +
|
|
||||||
"editHistory:$1.editHistory," +
|
|
||||||
"attachments:$1.attachments"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -88,6 +88,16 @@ Object.defineProperty(Function.prototype, "O", {
|
||||||
};
|
};
|
||||||
|
|
||||||
onChunksLoaded.toString = originalOnChunksLoaded.toString.bind(originalOnChunksLoaded);
|
onChunksLoaded.toString = originalOnChunksLoaded.toString.bind(originalOnChunksLoaded);
|
||||||
|
|
||||||
|
// Returns whether a chunk has been loaded
|
||||||
|
Object.defineProperty(onChunksLoaded, "j", {
|
||||||
|
set(v) {
|
||||||
|
delete onChunksLoaded.j;
|
||||||
|
onChunksLoaded.j = v;
|
||||||
|
originalOnChunksLoaded.j = v;
|
||||||
|
},
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.defineProperty(this, "O", {
|
Object.defineProperty(this, "O", {
|
||||||
|
|
Loading…
Reference in a new issue