Skip to content

Commit

Permalink
Merge branch 'add-mentionavatars-settings' of https://github.com/Luna…
Browse files Browse the repository at this point in the history
…-devv/Vencord into add-mentionavatars-settings
  • Loading branch information
Luna-devv committed Jul 26, 2024
2 parents 89b5651 + 13305b4 commit 605eab2
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vencord",
"private": "true",
"version": "1.9.5",
"version": "1.9.6",
"description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": {
Expand Down
18 changes: 9 additions & 9 deletions src/debug/loadLazyChunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export async function loadLazyChunks() {
try {
LazyChunkLoaderLogger.log("Loading all chunks...");

const validChunks = new Set<string>();
const invalidChunks = new Set<string>();
const deferredRequires = new Set<string>();
const validChunks = new Set<number>();
const invalidChunks = new Set<number>();
const deferredRequires = new Set<number>();

let chunksSearchingResolve: (value: void | PromiseLike<void>) => void;
const chunksSearchingDone = new Promise<void>(r => chunksSearchingResolve = r);
Expand All @@ -29,14 +29,14 @@ export async function loadLazyChunks() {

async function searchAndLoadLazyChunks(factoryCode: string) {
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
// the chunk containing the component
const shouldForceDefer = factoryCode.includes(".Messages.GUILD_FEED_UNFEATURE_BUTTON_TEXT");

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) {
return;
Expand All @@ -61,7 +61,7 @@ export async function loadLazyChunks() {
}

if (!invalidChunkGroup) {
validChunkGroups.add([chunkIds, entryPoint]);
validChunkGroups.add([chunkIds, Number(entryPoint)]);
}
}));

Expand Down Expand Up @@ -131,14 +131,14 @@ export async function loadLazyChunks() {
}

// 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:
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];
if (id == null) continue;

allChunks.push(id);
allChunks.push(Number(id));
}

if (allChunks.length === 0) throw new Error("Failed to get all chunks");
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/clientTheme/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function onPickColor(color: number) {
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) {
saveClientTheme({ theme });
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/imageZoom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default definePlugin({
find: ".handleImageLoad)",
replacement: [
{
match: /placeholderVersion:\i,/,
match: /placeholderVersion:\i,(?=.{0,50}children:)/,
replace: "...$self.makeProps(this),$&"
},

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/pictureInPicture/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default definePlugin({
{
find: ".nonMediaMosaicItem]",
replacement: {
match: /\.nonMediaMosaicItem\]:!(\i).{0,10}children:\[(\S)/,
match: /\.nonMediaMosaicItem\]:!(\i).{0,50}?children:\[(\S)/,
replace: "$&,$1&&$2&&$self.renderPiPButton(),"
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/spotifyControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default definePlugin({
},
patches: [
{
find: '"AccountConnected"',
find: "this.isCopiedStreakGodlike",
replacement: {
// react.jsx)(AccountPanel, { ..., showTaglessAccountPanel: blah })
match: /(?<=\i\.jsxs?\)\()(\i),{(?=[^}]*?userTag:\i,hidePrivateData:)/,
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/viewIcons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ export default definePlugin({
replacement: {
match: /avatarSrc:(\i),eventHandlers:(\i).+?"div",{...\2,/,
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"
}
},
all: true
},
// Old Profiles Modal pfp
{
Expand Down
6 changes: 5 additions & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,11 @@ export const Devs = /* #__PURE__*/ Object.freeze({
Antti: {
name: "Antti",
id: 312974985876471810n
}
},
Joona: {
name: "Joona",
id: 297410829589020673n
},
} satisfies Record<string, Dev>);

// iife so #__PURE__ works correctly
Expand Down
4 changes: 2 additions & 2 deletions src/webpack/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ export async function extractAndLoadChunks(code: CodeFilter, matcher: RegExp = D
}

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)));
}

Expand All @@ -559,7 +559,7 @@ export async function extractAndLoadChunks(code: CodeFilter, matcher: RegExp = D
return false;
}

wreq(entryPointId);
wreq(Number(entryPointId));
return true;
}

Expand Down

0 comments on commit 605eab2

Please sign in to comment.