mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 18:06:22 +00:00
Merge branch 'dev' into main
This commit is contained in:
commit
0ece0faf45
14 changed files with 45 additions and 36 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "vencord",
|
"name": "vencord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.9.5",
|
"version": "1.9.6",
|
||||||
"description": "The cutest Discord client mod",
|
"description": "The cutest Discord client mod",
|
||||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
"buildReporter": "pnpm buildWebStandalone --reporter --skip-extension",
|
"buildReporter": "pnpm buildWebStandalone --reporter --skip-extension",
|
||||||
"buildReporterDesktop": "pnpm build --reporter",
|
"buildReporterDesktop": "pnpm build --reporter",
|
||||||
"watch": "pnpm build --watch",
|
"watch": "pnpm build --watch",
|
||||||
|
"dev": "pnpm watch",
|
||||||
"watchWeb": "pnpm buildWeb --watch",
|
"watchWeb": "pnpm buildWeb --watch",
|
||||||
"generatePluginJson": "tsx scripts/generatePluginList.ts",
|
"generatePluginJson": "tsx scripts/generatePluginList.ts",
|
||||||
"generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types",
|
"generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types",
|
||||||
|
|
|
@ -15,9 +15,9 @@ export async function loadLazyChunks() {
|
||||||
try {
|
try {
|
||||||
LazyChunkLoaderLogger.log("Loading all chunks...");
|
LazyChunkLoaderLogger.log("Loading all chunks...");
|
||||||
|
|
||||||
const validChunks = new Set<string>();
|
const validChunks = new Set<number>();
|
||||||
const invalidChunks = new Set<string>();
|
const invalidChunks = new Set<number>();
|
||||||
const deferredRequires = new Set<string>();
|
const deferredRequires = new Set<number>();
|
||||||
|
|
||||||
let chunksSearchingResolve: (value: void | PromiseLike<void>) => void;
|
let chunksSearchingResolve: (value: void | PromiseLike<void>) => void;
|
||||||
const chunksSearchingDone = new Promise<void>(r => chunksSearchingResolve = r);
|
const chunksSearchingDone = new Promise<void>(r => chunksSearchingResolve = r);
|
||||||
|
@ -29,14 +29,14 @@ export async function loadLazyChunks() {
|
||||||
|
|
||||||
async function searchAndLoadLazyChunks(factoryCode: string) {
|
async function searchAndLoadLazyChunks(factoryCode: string) {
|
||||||
const lazyChunks = factoryCode.matchAll(LazyChunkRegex);
|
const lazyChunks = factoryCode.matchAll(LazyChunkRegex);
|
||||||
const validChunkGroups = new Set<[chunkIds: string[], entryPoint: string]>();
|
const validChunkGroups = new Set<[chunkIds: number[], entryPoint: number]>();
|
||||||
|
|
||||||
// Workaround for a chunk that depends on the ChannelMessage component but may be be force loaded before
|
// Workaround for a chunk that depends on the ChannelMessage component but may be be force loaded before
|
||||||
// the chunk containing the component
|
// the chunk containing the component
|
||||||
const shouldForceDefer = factoryCode.includes(".Messages.GUILD_FEED_UNFEATURE_BUTTON_TEXT");
|
const shouldForceDefer = factoryCode.includes(".Messages.GUILD_FEED_UNFEATURE_BUTTON_TEXT");
|
||||||
|
|
||||||
await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => {
|
await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => {
|
||||||
const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => m[1]) : [];
|
const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => Number(m[1])) : [];
|
||||||
|
|
||||||
if (chunkIds.length === 0) {
|
if (chunkIds.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -61,7 +61,7 @@ export async function loadLazyChunks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!invalidChunkGroup) {
|
if (!invalidChunkGroup) {
|
||||||
validChunkGroups.add([chunkIds, entryPoint]);
|
validChunkGroups.add([chunkIds, Number(entryPoint)]);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -131,14 +131,14 @@ export async function loadLazyChunks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// All chunks Discord has mapped to asset files, even if they are not used anymore
|
// All chunks Discord has mapped to asset files, even if they are not used anymore
|
||||||
const allChunks = [] as string[];
|
const allChunks = [] as number[];
|
||||||
|
|
||||||
// Matches "id" or id:
|
// Matches "id" or id:
|
||||||
for (const currentMatch of wreq!.u.toString().matchAll(/(?:"(\d+?)")|(?:(\d+?):)/g)) {
|
for (const currentMatch of wreq!.u.toString().matchAll(/(?:"([\deE]+?)")|(?:([\deE]+?):)/g)) {
|
||||||
const id = currentMatch[1] ?? currentMatch[2];
|
const id = currentMatch[1] ?? currentMatch[2];
|
||||||
if (id == null) continue;
|
if (id == null) continue;
|
||||||
|
|
||||||
allChunks.push(id);
|
allChunks.push(Number(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allChunks.length === 0) throw new Error("Failed to get all chunks");
|
if (allChunks.length === 0) throw new Error("Failed to get all chunks");
|
||||||
|
|
|
@ -91,7 +91,7 @@ export default definePlugin({
|
||||||
|
|
||||||
/* new profiles */
|
/* new profiles */
|
||||||
{
|
{
|
||||||
find: ".PANEL]:14",
|
find: ".FULL_SIZE]:26",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=(\i)=\(0,\i\.\i\)\(\i\);)return 0===\i.length\?/,
|
match: /(?<=(\i)=\(0,\i\.\i\)\(\i\);)return 0===\i.length\?/,
|
||||||
replace: "$1.unshift(...$self.getBadges(arguments[0].displayProfile));$&"
|
replace: "$1.unshift(...$self.getBadges(arguments[0].displayProfile));$&"
|
||||||
|
|
|
@ -30,7 +30,7 @@ function onPickColor(color: number) {
|
||||||
updateColorVars(hexColor);
|
updateColorVars(hexColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveClientTheme = findByCodeLazy('type:"UNSYNCED_USER_SETTINGS_UPDATE",settings:{useSystemTheme:"system"===');
|
const saveClientTheme = findByCodeLazy('type:"UNSYNCED_USER_SETTINGS_UPDATE', '"system"===');
|
||||||
|
|
||||||
function setTheme(theme: string) {
|
function setTheme(theme: string) {
|
||||||
saveClientTheme({ theme });
|
saveClientTheme({ theme });
|
||||||
|
|
|
@ -171,7 +171,7 @@ export default definePlugin({
|
||||||
find: ".handleImageLoad)",
|
find: ".handleImageLoad)",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /placeholderVersion:\i,/,
|
match: /placeholderVersion:\i,(?=.{0,50}children:)/,
|
||||||
replace: "...$self.makeProps(this),$&"
|
replace: "...$self.makeProps(this),$&"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.vc-mentionAvatars-avatar {
|
.vc-mentionAvatars-avatar {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
width: 1em;
|
width: 1em !important; /* insane discord sets width: 100% in channel topic */
|
||||||
height: 1em;
|
height: 1em;
|
||||||
margin: 0 4px 0.2rem 2px;
|
margin: 0 4px 0.2rem 2px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
|
|
@ -147,6 +147,7 @@ async function fetchMessage(channelID: string, messageID: string) {
|
||||||
if (!msg) return;
|
if (!msg) return;
|
||||||
|
|
||||||
const message: Message = MessageStore.getMessages(msg.channel_id).receiveMessage(msg).get(msg.id);
|
const message: Message = MessageStore.getMessages(msg.channel_id).receiveMessage(msg).get(msg.id);
|
||||||
|
if (!message) return;
|
||||||
|
|
||||||
messageCache.set(message.id, {
|
messageCache.set(message.id, {
|
||||||
message,
|
message,
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".nonMediaMosaicItem]",
|
find: ".nonMediaMosaicItem]",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\.nonMediaMosaicItem\]:!(\i).{0,10}children:\[(\S)/,
|
match: /\.nonMediaMosaicItem\]:!(\i).{0,50}?children:\[(\S)/,
|
||||||
replace: "$&,$1&&$2&&$self.renderPiPButton(),"
|
replace: "$&,$1&&$2&&$self.renderPiPButton(),"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -307,7 +307,7 @@ export default definePlugin({
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: '+1]})},"overflow"))',
|
find: '})},"overflow"))',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Create a variable for the channel prop
|
// Create a variable for the channel prop
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: '"AccountConnected"',
|
find: "this.isCopiedStreakGodlike",
|
||||||
replacement: {
|
replacement: {
|
||||||
// react.jsx)(AccountPanel, { ..., showTaglessAccountPanel: blah })
|
// react.jsx)(AccountPanel, { ..., showTaglessAccountPanel: blah })
|
||||||
match: /(?<=\i\.jsxs?\)\()(\i),{(?=[^}]*?userTag:\i,hidePrivateData:)/,
|
match: /(?<=\i\.jsxs?\)\()(\i),{(?=[^}]*?userTag:\i,hidePrivateData:)/,
|
||||||
|
|
|
@ -189,7 +189,8 @@ export default definePlugin({
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /avatarSrc:(\i),eventHandlers:(\i).+?"div",{...\2,/,
|
match: /avatarSrc:(\i),eventHandlers:(\i).+?"div",{...\2,/,
|
||||||
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"
|
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"
|
||||||
}
|
},
|
||||||
|
all: true
|
||||||
},
|
},
|
||||||
// Old Profiles Modal pfp
|
// Old Profiles Modal pfp
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,14 +43,23 @@ function fetchReactions(msg: Message, emoji: ReactionEmoji, type: number) {
|
||||||
},
|
},
|
||||||
oldFormErrors: true
|
oldFormErrors: true
|
||||||
})
|
})
|
||||||
.then(res => FluxDispatcher.dispatch({
|
.then(res => {
|
||||||
type: "MESSAGE_REACTION_ADD_USERS",
|
for (const user of res.body) {
|
||||||
channelId: msg.channel_id,
|
FluxDispatcher.dispatch({
|
||||||
messageId: msg.id,
|
type: "USER_UPDATE",
|
||||||
users: res.body,
|
user
|
||||||
emoji,
|
});
|
||||||
reactionType: type
|
}
|
||||||
}))
|
|
||||||
|
FluxDispatcher.dispatch({
|
||||||
|
type: "MESSAGE_REACTION_ADD_USERS",
|
||||||
|
channelId: msg.channel_id,
|
||||||
|
messageId: msg.id,
|
||||||
|
users: res.body,
|
||||||
|
emoji,
|
||||||
|
reactionType: type
|
||||||
|
});
|
||||||
|
})
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
.finally(() => sleep(250));
|
.finally(() => sleep(250));
|
||||||
}
|
}
|
||||||
|
@ -148,13 +157,6 @@ export default definePlugin({
|
||||||
const reactions = getReactionsWithQueue(message, emoji, type);
|
const reactions = getReactionsWithQueue(message, emoji, type);
|
||||||
const users = Object.values(reactions).filter(Boolean) as User[];
|
const users = Object.values(reactions).filter(Boolean) as User[];
|
||||||
|
|
||||||
for (const user of users) {
|
|
||||||
FluxDispatcher.dispatch({
|
|
||||||
type: "USER_UPDATE",
|
|
||||||
user
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{ marginLeft: "0.5em", transform: "scale(0.9)" }}
|
style={{ marginLeft: "0.5em", transform: "scale(0.9)" }}
|
||||||
|
|
|
@ -538,7 +538,11 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
Antti: {
|
Antti: {
|
||||||
name: "Antti",
|
name: "Antti",
|
||||||
id: 312974985876471810n
|
id: 312974985876471810n
|
||||||
}
|
},
|
||||||
|
Joona: {
|
||||||
|
name: "Joona",
|
||||||
|
id: 297410829589020673n
|
||||||
|
},
|
||||||
} satisfies Record<string, Dev>);
|
} satisfies Record<string, Dev>);
|
||||||
|
|
||||||
// iife so #__PURE__ works correctly
|
// iife so #__PURE__ works correctly
|
||||||
|
|
|
@ -544,7 +544,7 @@ export async function extractAndLoadChunks(code: CodeFilter, matcher: RegExp = D
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawChunkIds) {
|
if (rawChunkIds) {
|
||||||
const chunkIds = Array.from(rawChunkIds.matchAll(ChunkIdsRegex)).map((m: any) => m[1]);
|
const chunkIds = Array.from(rawChunkIds.matchAll(ChunkIdsRegex)).map((m: any) => Number(m[1]));
|
||||||
await Promise.all(chunkIds.map(id => wreq.e(id)));
|
await Promise.all(chunkIds.map(id => wreq.e(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ export async function extractAndLoadChunks(code: CodeFilter, matcher: RegExp = D
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wreq(entryPointId);
|
wreq(Number(entryPointId));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue