Unbrick Vencord - Pt 1
This commit is contained in:
parent
d0940a8b19
commit
6398dd25d2
|
@ -7,8 +7,8 @@ export default definePlugin({
|
||||||
patches: [{
|
patches: [{
|
||||||
find: "setDevtoolsCallbacks",
|
find: "setDevtoolsCallbacks",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\.default=function.+$/,
|
match: /\.setDevtoolsCallbacks\(.+?else/,
|
||||||
replace: ".default=function(){}}"
|
replace: ".setDevtoolsCallbacks(null,null);else"
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,20 +8,20 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "sendMessage:function",
|
find: "sendMessage:function",
|
||||||
replacement: [{
|
replacement: [{
|
||||||
match: /(?<=sendMessage:function\(.{1,2},.{1,2},.{1,2},.{1,2}\)){/,
|
match: /(?<=_sendMessage:function\([^)]+\)){/,
|
||||||
replace: "{Vencord.Api.MessageEvents._handlePreSend(...arguments);"
|
replace: "{Vencord.Api.MessageEvents._handlePreSend(...arguments);"
|
||||||
}, {
|
}, {
|
||||||
match: /(?<=editMessage:function\(.{1,2},.{1,2},.{1,2}\)){/,
|
match: /(?<=\beditMessage:function\([^)]+\)){/,
|
||||||
replace: "{Vencord.Api.MessageEvents._handlePreEdit(...arguments);"
|
replace: "{Vencord.Api.MessageEvents._handlePreEdit(...arguments);"
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "if(e.altKey){",
|
find: "if(e.altKey){",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\.useClickMessage=function\((.{1,2}),(.{1,2})\).+?function\((.{1,2})\){/,
|
match: /var \w=(\w)\.id,\w=(\w)\.id;return .{1,2}\.useCallback\(\(?function\((.{1,2})\){/,
|
||||||
replace: (m, message, channel, event) =>
|
replace: (m, message, channel, event) =>
|
||||||
// the message param is shadowed by the event param, so need to alias them
|
// the message param is shadowed by the event param, so need to alias them
|
||||||
`${m.replace("{", `{var _msg=${message};var _chan=${channel};`)}Vencord.Api.MessageEvents._handleClick(_msg, _chan, ${event});`
|
`var _msg=${message},_chan=${channel};${m}Vencord.Api.MessageEvents._handleClick(_msg, _chan, ${event});`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import definePlugin from "../utils/types";
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "cumcord",
|
|
||||||
description: "Loads cumcord. That's it",
|
|
||||||
author: "Vendicated",
|
|
||||||
async start() {
|
|
||||||
const cum = await fetch("https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js");
|
|
||||||
(0, eval)(await cum.text());
|
|
||||||
},
|
|
||||||
stop() {
|
|
||||||
window.cumcord?.uninject();
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -7,17 +7,14 @@ export default definePlugin({
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: '.displayName="SpotifyStore"',
|
find: '.displayName="SpotifyStore"',
|
||||||
replacement: {
|
replacement: [{
|
||||||
match: /\.isPremium=.;/,
|
match: /\.isPremium=.;/,
|
||||||
replace: ".isPremium=true;",
|
replace: ".isPremium=true;",
|
||||||
},
|
}, ...["SPEAKING", "VOICE_STATE_UPDATES", "MEDIA_ENGINE_SET_DESKTOP_SOURCE"].map(event => ({
|
||||||
},
|
|
||||||
{
|
|
||||||
find: '.displayName="SpotifyStore"',
|
|
||||||
replacement: ["SPEAKING", "VOICE_STATE_UPDATES", "MEDIA_ENGINE_SET_DESKTOP_SOURCE"].map(event => ({
|
|
||||||
match: new RegExp(`${event}:function\\(.\\){.+?}(,|}\\))`),
|
match: new RegExp(`${event}:function\\(.\\){.+?}(,|}\\))`),
|
||||||
replace: (_, ending) => `${event}:function(){}${ending}`,
|
replace: (_, ending) => `${event}:function(){}${ending}`,
|
||||||
})),
|
})),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ export default definePlugin({
|
||||||
start() {
|
start() {
|
||||||
const { deleteMessage, startEditMessage } = findByProps("deleteMessage");
|
const { deleteMessage, startEditMessage } = findByProps("deleteMessage");
|
||||||
const { can } = findByProps("can", "initialize");
|
const { can } = findByProps("can", "initialize");
|
||||||
const { Permissions: { MANAGE_MESSAGES } } = find(m => m.Permissions?.MANAGE_MESSAGES);
|
const { MANAGE_MESSAGES } = find(m => typeof m.MANAGE_MESSAGES === "bigint");
|
||||||
const { isEditing } = findByProps("isEditing");
|
const { isEditing } = findByProps("isEditing");
|
||||||
|
|
||||||
document.addEventListener("keydown", keydown);
|
document.addEventListener("keydown", keydown);
|
||||||
|
|
|
@ -9,14 +9,14 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "TRACKING_URL:",
|
find: "TRACKING_URL:",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /=\(0,.\.analyticsTrackingStoreMaker\)/,
|
match: /^.+$/,
|
||||||
replace: "=(function(){})",
|
replace: "()=>{}",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "window.DiscordSentry=",
|
find: "window.DiscordSentry=",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /window\.DiscordSentry=\(0,.\.initSentry\)\(\)/,
|
match: /window\.DiscordSentry=function.+\}\(\)/,
|
||||||
replace: "",
|
replace: "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,33 +7,27 @@ export default definePlugin({
|
||||||
author: "Vendicated",
|
author: "Vendicated",
|
||||||
required: true,
|
required: true,
|
||||||
patches: [{
|
patches: [{
|
||||||
find: "default.versionHash",
|
find: "().versionHash",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /return .{1,2}\("div"/,
|
match: /\w\.createElement\(.{1,2}.Fragment,.{0,30}\{[^}]+\},"Host ".+?\):null/,
|
||||||
replace: (m) => {
|
|
||||||
return `var versions=VencordNative.getVersions();${m}`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
match: /\w\.createElement.+?["']Host ["'].+?\):null/,
|
|
||||||
replace: m => {
|
replace: m => {
|
||||||
const idx = m.indexOf("Host") - 1;
|
const idx = m.indexOf("Host") - 1;
|
||||||
const template = m.slice(0, idx);
|
const template = m.slice(0, idx);
|
||||||
return `${m}, ${template}"Vencord ", "${gitHash}"), " "), ` +
|
return `${m}, ${template}"Vencord ", "${gitHash}"), " "), ` +
|
||||||
`${template} "Electron ", versions.electron), " "), ` +
|
`${template} "Electron ",VencordNative.getVersions().electron)," "), ` +
|
||||||
`${template} "Chrome ", versions.chrome), " ")`;
|
`${template} "Chrome ",VencordNative.getVersions().chrome)," ")`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
find: "Messages.ACTIVITY_SETTINGS",
|
find: "Messages.ACTIVITY_SETTINGS",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\{section:(.{1,2})\.SectionTypes\.HEADER,\s*label:(.{1,2})\.default\.Messages\.ACTIVITY_SETTINGS\}/,
|
match: /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.ACTIVITY_SETTINGS\}/,
|
||||||
replace: (m, mod) =>
|
replace: (m, mod) =>
|
||||||
`{section:${mod}.SectionTypes.HEADER,label:"Vencord"},` +
|
`{section:${mod}.ID.HEADER,label:"Vencord"},` +
|
||||||
`{section:"Vencord",label:"Vencord",element:Vencord.Components.Settings},` +
|
`{section:"Vencord",label:"Vencord",element:Vencord.Components.Settings},` +
|
||||||
`{section:${mod}.SectionTypes.DIVIDER},${m}`
|
`{section:${mod}.ID.DIVIDER},${m}`
|
||||||
|
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -65,9 +65,11 @@ function patchPush() {
|
||||||
if (filter(exports)) {
|
if (filter(exports)) {
|
||||||
subscriptions.delete(filter);
|
subscriptions.delete(filter);
|
||||||
callback(exports);
|
callback(exports);
|
||||||
} else if (exports.default && filter(exports.default)) {
|
} else for (const nested in exports) {
|
||||||
|
if (exports[nested] && filter(exports[nested])) {
|
||||||
subscriptions.delete(filter);
|
subscriptions.delete(filter);
|
||||||
callback(exports.default);
|
callback(exports[nested]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error("Error while firing callback for webpack chunk", err);
|
logger.error("Error while firing callback for webpack chunk", err);
|
||||||
|
|
|
@ -32,15 +32,22 @@ export function find(filter: FilterFn, getDefault = true) {
|
||||||
|
|
||||||
for (const key in cache) {
|
for (const key in cache) {
|
||||||
const mod = cache[key];
|
const mod = cache[key];
|
||||||
if (mod?.exports && filter(mod.exports))
|
if (!mod?.exports) continue;
|
||||||
|
|
||||||
|
if (filter(mod.exports))
|
||||||
return mod.exports;
|
return mod.exports;
|
||||||
if (mod?.exports?.default && filter(mod.exports.default))
|
if (mod.exports.default && filter(mod.exports.default))
|
||||||
return getDefault ? mod.exports.default : mod.exports;
|
return getDefault ? mod.exports.default : mod.exports;
|
||||||
|
for (const nestedMod in mod.exports) {
|
||||||
|
const nested = mod.exports[nestedMod];
|
||||||
|
if (nested && filter(nested)) return nested;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO fix
|
||||||
export function findAll(filter: FilterFn, getDefault = true) {
|
export function findAll(filter: FilterFn, getDefault = true) {
|
||||||
if (typeof filter !== "function") throw new Error("Invalid filter. Expected a function got", filter);
|
if (typeof filter !== "function") throw new Error("Invalid filter. Expected a function got", filter);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue