Merge remote-tracking branch 'upstream/dev' into modules-proxy-patches

This commit is contained in:
Nuckyz 2024-05-23 03:12:46 -03:00
commit deb0f7b9c6
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
4 changed files with 19 additions and 15 deletions

View file

@ -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) {
@ -128,14 +131,8 @@ if (!IS_VANILLA) {
process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord"); process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord");
// Monkey patch commandLine to disable WidgetLayering: Fix DevTools context menus https://github.com/electron/electron/issues/38790 // work around discord unloading when in background
const originalAppend = app.commandLine.appendSwitch; app.commandLine.appendSwitch("disable-renderer-backgrounding");
app.commandLine.appendSwitch = function (...args) {
if (args[0] === "disable-features" && !args[1]?.includes("WidgetLayering")) {
args[1] += ",WidgetLayering";
}
return originalAppend.apply(this, args);
};
} else { } else {
console.log("[Vencord] Running in vanilla mode. Not loading Vencord"); console.log("[Vencord] Running in vanilla mode. Not loading Vencord");
} }

View file

@ -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"

View file

@ -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"
}, },
// { // {

View file

@ -87,6 +87,16 @@ Object.defineProperty(Function.prototype, "O", {
} as WebpackRequire["O"]; } as WebpackRequire["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", {