From 76df29fba29f6b34ab9e8b6f392d465775f7aa4f Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:51:58 -0300 Subject: [PATCH 1/7] Actually stop searching for CSS debugging chunk --- src/debug/loadLazyChunks.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug/loadLazyChunks.ts b/src/debug/loadLazyChunks.ts index 6923d3a2..c7f8047d 100644 --- a/src/debug/loadLazyChunks.ts +++ b/src/debug/loadLazyChunks.ts @@ -27,11 +27,11 @@ export async function loadLazyChunks() { const LazyChunkRegex = canonicalizeMatch(/(?:(?:Promise\.all\(\[)?(\i\.e\("?[^)]+?"?\)[^\]]*?)(?:\]\))?)\.then\(\i\.bind\(\i,"?([^)]+?)"?\)\)/g); - const foundCssDebuggingLoad = false; + let foundCssDebuggingLoad = false; async function searchAndLoadLazyChunks(factoryCode: string) { // Workaround to avoid loading the CSS debugging chunk which turns the app pink - const hasCssDebuggingLoad = foundCssDebuggingLoad ? false : factoryCode.includes(".cssDebuggingEnabled&&"); + const hasCssDebuggingLoad = foundCssDebuggingLoad ? false : (foundCssDebuggingLoad = factoryCode.includes(".cssDebuggingEnabled&&")); const lazyChunks = factoryCode.matchAll(LazyChunkRegex); const validChunkGroups = new Set<[chunkIds: number[], entryPoint: number]>(); From 8558b1a58948625c2c1f29be439d2329c36dfc82 Mon Sep 17 00:00:00 2001 From: Frocat <65976911+ItsFrocat@users.noreply.github.com> Date: Thu, 14 Nov 2024 23:54:01 +0100 Subject: [PATCH 2/7] ShikiCodeblocks: Updated codeblocks themes (#3013) --- .../shikiCodeblocks.desktop/api/themes.ts | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/src/plugins/shikiCodeblocks.desktop/api/themes.ts b/src/plugins/shikiCodeblocks.desktop/api/themes.ts index f31ce60b..bc1dd184 100644 --- a/src/plugins/shikiCodeblocks.desktop/api/themes.ts +++ b/src/plugins/shikiCodeblocks.desktop/api/themes.ts @@ -1,6 +1,6 @@ /* * Vencord, a modification for Discord's desktop app - * Copyright (c) 2022 Vendicated and contributors + * Copyright (c) 2024 Vendicated and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,9 +18,9 @@ import { IShikiTheme } from "@vap/shiki"; -export const SHIKI_REPO = "shikijs/shiki"; -export const SHIKI_REPO_COMMIT = "0b28ad8ccfbf2615f2d9d38ea8255416b8ac3043"; -export const shikiRepoTheme = (name: string) => `https://raw.githubusercontent.com/${SHIKI_REPO}/${SHIKI_REPO_COMMIT}/packages/shiki/themes/${name}.json`; +export const SHIKI_REPO = "shikijs/textmate-grammars-themes"; +export const SHIKI_REPO_COMMIT = "2d87559c7601a928b9f7e0f0dda243d2fb6d4499"; +export const shikiRepoTheme = (name: string) => `https://raw.githubusercontent.com/${SHIKI_REPO}/${SHIKI_REPO_COMMIT}/packages/tm-themes/themes/${name}.json`; export const themes = { // Default @@ -30,33 +30,59 @@ export const themes = { MaterialCandy: "https://raw.githubusercontent.com/millsp/material-candy/master/material-candy.json", // More from Shiki repo + Andromeeda: shikiRepoTheme("andromeeda"), + AuroraX: shikiRepoTheme("aurora-x"), + AyuDark: shikiRepoTheme("ayu-dark"), + CatppuccinLatte: shikiRepoTheme("catppuccin-latte"), + CatppuccinFrappe: shikiRepoTheme("catppuccin-frappe"), + CatppuccinMacchiato: shikiRepoTheme("catppuccin-macchiato"), + CatppuccinMocha: shikiRepoTheme("catppuccin-mocha"), DraculaSoft: shikiRepoTheme("dracula-soft"), Dracula: shikiRepoTheme("dracula"), + EverforestDark: shikiRepoTheme("everforest-dark"), + EverforestLight: shikiRepoTheme("everforest-light"), + GithubDarkDefault: shikiRepoTheme("github-dark-default"), GithubDarkDimmed: shikiRepoTheme("github-dark-dimmed"), + GithubDarkHighContrast: shikiRepoTheme("github-dark-high-contrast"), GithubDark: shikiRepoTheme("github-dark"), + GithubLightDefault: shikiRepoTheme("github-light-default"), + GithubLightHighContrast: shikiRepoTheme("github-light-high-contrast"), GithubLight: shikiRepoTheme("github-light"), + Houston: shikiRepoTheme("houston"), + KanagawaDragon: shikiRepoTheme("kanagawa-dragon"), + KanagawaLotus: shikiRepoTheme("kanagawa-lotus"), + KanagawaWave: shikiRepoTheme("kanagawa-wave"), + LaserWave: shikiRepoTheme("laserwave"), LightPlus: shikiRepoTheme("light-plus"), - MaterialDarker: shikiRepoTheme("material-darker"), - MaterialDefault: shikiRepoTheme("material-default"), - MaterialLighter: shikiRepoTheme("material-lighter"), - MaterialOcean: shikiRepoTheme("material-ocean"), - MaterialPalenight: shikiRepoTheme("material-palenight"), + MaterialDarker: shikiRepoTheme("material-theme-darker"), + MaterialDefault: shikiRepoTheme("material-theme"), + MaterialLighter: shikiRepoTheme("material-theme-lighter"), + MaterialOcean: shikiRepoTheme("material-theme-ocean"), + MaterialPalenight: shikiRepoTheme("material-theme-palenight"), MinDark: shikiRepoTheme("min-dark"), MinLight: shikiRepoTheme("min-light"), Monokai: shikiRepoTheme("monokai"), + NightOwl: shikiRepoTheme("night-owl"), Nord: shikiRepoTheme("nord"), OneDarkPro: shikiRepoTheme("one-dark-pro"), + OneLight: shikiRepoTheme("one-light"), + Plastic: shikiRepoTheme("plastic"), Poimandres: shikiRepoTheme("poimandres"), + Red: shikiRepoTheme("red"), RosePineDawn: shikiRepoTheme("rose-pine-dawn"), RosePineMoon: shikiRepoTheme("rose-pine-moon"), RosePine: shikiRepoTheme("rose-pine"), SlackDark: shikiRepoTheme("slack-dark"), SlackOchin: shikiRepoTheme("slack-ochin"), + SnazzyLight: shikiRepoTheme("snazzy-light"), SolarizedDark: shikiRepoTheme("solarized-dark"), SolarizedLight: shikiRepoTheme("solarized-light"), + Synthwave84: shikiRepoTheme("synthwave-84"), + TokyoNight: shikiRepoTheme("tokyo-night"), + Vesper: shikiRepoTheme("vesper"), + VitesseBlack: shikiRepoTheme("vitesse-black"), VitesseDark: shikiRepoTheme("vitesse-dark"), VitesseLight: shikiRepoTheme("vitesse-light"), - CssVariables: shikiRepoTheme("css-variables"), }; export const themeCache = new Map(); From c4f6f151e6692c2fb3dafd103f89f63d578bad8b Mon Sep 17 00:00:00 2001 From: Lumap Date: Thu, 14 Nov 2024 23:57:16 +0100 Subject: [PATCH 3/7] PictureInPicture: Fix button not showing up (#3014) --- src/plugins/pictureInPicture/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/pictureInPicture/index.tsx b/src/plugins/pictureInPicture/index.tsx index 20cedf45..ef3d35ff 100644 --- a/src/plugins/pictureInPicture/index.tsx +++ b/src/plugins/pictureInPicture/index.tsx @@ -30,10 +30,10 @@ export default definePlugin({ { find: ".removeMosaicItemHoverButton),", replacement: { - match: /\.nonMediaMosaicItem\]:!(\i).{0,50}?children:\[\S,(\S)/, - replace: "$&,$1&&$2&&$self.renderPiPButton()," - }, - }, + match: /\.nonMediaMosaicItem\]:.{0,40}children:\[(?<=showDownload:(\i).+?isVisualMediaType:(\i).+?)/, + replace: "$&$1&&$2&&$self.renderPiPButton()," + } + } ], renderPiPButton: ErrorBoundary.wrap(() => { From 99458da3beb21dcba71abc64cb99c0f4f232cb81 Mon Sep 17 00:00:00 2001 From: nyx <60797172+verticalsync@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:00:11 +0200 Subject: [PATCH 4/7] ViewRaw: Add support for Group DMs (#3010) --- src/plugins/viewRaw/index.tsx | 1 + src/utils/constants.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/viewRaw/index.tsx b/src/plugins/viewRaw/index.tsx index 0134ea3e..8ee1ca8d 100644 --- a/src/plugins/viewRaw/index.tsx +++ b/src/plugins/viewRaw/index.tsx @@ -155,6 +155,7 @@ export default definePlugin({ "guild-context": MakeContextCallback("Guild"), "channel-context": MakeContextCallback("Channel"), "thread-context": MakeContextCallback("Channel"), + "gdm-context": MakeContextCallback("Channel"), "user-context": MakeContextCallback("User") }, diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 70eca56f..11ce4738 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -520,8 +520,8 @@ export const Devs = /* #__PURE__*/ Object.freeze({ id: 721717126523781240n, }, nyx: { - name: "verticalsync", - id: 328165170536775680n + name: "verticalsync.", + id: 1207087393929171095n }, nekohaxx: { name: "nekohaxx", @@ -575,7 +575,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "RamziAH", id: 1279957227612147747n, }, - SomeAspy: { + SomeAspy: { name: "SomeAspy", id: 516750892372852754n, }, From ea2772476dc6d042b1e3769ad24727b01b02878d Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 17 Nov 2024 18:45:07 -0300 Subject: [PATCH 5/7] RoleColorEverywhere: Poll Results & Cleanup Co-authored-by: jamesbt365 --- src/plugins/roleColorEverywhere/index.tsx | 133 ++++++++++++++-------- src/utils/constants.ts | 4 + 2 files changed, 90 insertions(+), 47 deletions(-) diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 204bc0be..055c3987 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -20,6 +20,7 @@ import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { makeRange } from "@components/PluginSettings/components"; import { Devs } from "@utils/constants"; +import { Logger } from "@utils/Logger"; import definePlugin, { OptionType } from "@utils/types"; import { findByCodeLazy } from "@webpack"; import { ChannelStore, GuildMemberStore, GuildStore } from "@webpack/common"; @@ -51,6 +52,12 @@ const settings = definePluginSettings({ description: "Show role colors in the reactors list", restartNeeded: true }, + pollResults: { + type: OptionType.BOOLEAN, + default: true, + description: "Show role colors in the poll results", + restartNeeded: true + }, colorChatMessages: { type: OptionType.BOOLEAN, default: false, @@ -62,14 +69,15 @@ const settings = definePluginSettings({ description: "Intensity of message coloring.", markers: makeRange(0, 100, 10), default: 30 - }, + } }); - export default definePlugin({ name: "RoleColorEverywhere", - authors: [Devs.KingFish, Devs.lewisakura, Devs.AutumnVN, Devs.Kyuuhachi], + authors: [Devs.KingFish, Devs.lewisakura, Devs.AutumnVN, Devs.Kyuuhachi, Devs.jamesbt365], description: "Adds the top role color anywhere possible", + settings, + patches: [ // Chat Mentions { @@ -77,100 +85,106 @@ export default definePlugin({ replacement: [ { match: /onContextMenu:\i,color:\i,\.\.\.\i(?=,children:)(?<=user:(\i),channel:(\i).{0,500}?)/, - replace: "$&,color:$self.getUserColor($1?.id,{channelId:$2?.id})" + replace: "$&,color:$self.getColorInt($1?.id,$2?.id)" } ], - predicate: () => settings.store.chatMentions, + predicate: () => settings.store.chatMentions }, // Slate { find: ".userTooltip,children", replacement: [ { - match: /let\{id:(\i),guildId:(\i)[^}]*\}.*?\.\i,{(?=children)/, - replace: "$&color:$self.getUserColor($1,{guildId:$2})," + match: /let\{id:(\i),guildId:\i,channelId:(\i)[^}]*\}.*?\.\i,{(?=children)/, + replace: "$&color:$self.getColorInt($1,$2)," } ], - predicate: () => settings.store.chatMentions, + predicate: () => settings.store.chatMentions }, + // Member List Role Headers { find: 'tutorialId:"whos-online', replacement: [ { match: /null,\i," — ",\i\]/, - replace: "null,$self.roleGroupColor(arguments[0])]" + replace: "null,$self.RoleGroupColor(arguments[0])]" }, ], - predicate: () => settings.store.memberList, + predicate: () => settings.store.memberList }, { find: "#{intl::THREAD_BROWSER_PRIVATE}", replacement: [ { match: /children:\[\i," — ",\i\]/, - replace: "children:[$self.roleGroupColor(arguments[0])]" + replace: "children:[$self.RoleGroupColor(arguments[0])]" }, ], - predicate: () => settings.store.memberList, + predicate: () => settings.store.memberList }, + // Voice Users { - find: "renderPrioritySpeaker", + find: "renderPrioritySpeaker(){", replacement: [ { match: /renderName\(\){.+?usernameSpeaking\]:.+?(?=children)/, - replace: "$&...$self.getVoiceProps(this.props)," + replace: "$&style:$self.getColorStyle(this?.props?.user?.id,this?.props?.guildId)," } ], - predicate: () => settings.store.voiceUsers, + predicate: () => settings.store.voiceUsers }, + // Reaction List { find: ".reactorDefault", replacement: { - match: /,onContextMenu:e=>.{0,15}\((\i),(\i),(\i)\).{0,250}tag:"strong"/, - replace: "$&,style:{color:$self.getColor($2?.id,$1)}" + match: /,onContextMenu:\i=>.{0,15}\((\i),(\i),(\i)\).{0,250}tag:"strong"/, + replace: "$&,style:$self.getColorStyle($2?.id,$1?.channel?.id)" }, predicate: () => settings.store.reactorsList, }, + // Poll Results + { + find: ",reactionVoteCounts", + replacement: { + match: /\.nickname,(?=children:)/, + replace: "$&style:$self.getColorStyle(arguments[0]?.user?.id,arguments[0]?.channel?.id)," + }, + predicate: () => settings.store.pollResults + }, + // Messages { find: "#{intl::MESSAGE_EDITED}", replacement: { match: /(?<=isUnsupported\]:(\i)\.isUnsupported\}\),)(?=children:\[)/, - replace: "style:{color:$self.useMessageColor($1)}," + replace: "style:$self.useMessageColorStyle($1)," }, - predicate: () => settings.store.colorChatMessages, - }, + predicate: () => settings.store.colorChatMessages + } ], - settings, - getColor(userId: string, { channelId, guildId }: { channelId?: string; guildId?: string; }) { - if (!(guildId ??= ChannelStore.getChannel(channelId!)?.guild_id)) return null; - return GuildMemberStore.getMember(guildId, userId)?.colorString ?? null; + getColorString(userId: string, channelOrGuildId: string) { + try { + const guildId = ChannelStore.getChannel(channelOrGuildId)?.guild_id ?? GuildStore.getGuild(channelOrGuildId)?.id; + if (guildId == null) return null; + + return GuildMemberStore.getMember(guildId, userId)?.colorString ?? null; + } catch (e) { + new Logger("RoleColorEverywhere").error("Failed to get color string", e); + } + + return null; }, - getUserColor(userId: string, ids: { channelId?: string; guildId?: string; }) { - const colorString = this.getColor(userId, ids); + getColorInt(userId: string, channelOrGuildId: string) { + const colorString = this.getColorString(userId, channelOrGuildId); return colorString && parseInt(colorString.slice(1), 16); }, - roleGroupColor: ErrorBoundary.wrap(({ id, count, title, guildId, label }: { id: string; count: number; title: string; guildId: string; label: string; }) => { - const role = GuildStore.getRole(guildId, id); + getColorStyle(userId: string, channelOrGuildId: string) { + const colorString = this.getColorString(userId, channelOrGuildId); - return ( - - {title ?? label} — {count} - - ); - }, { noop: true }), - - getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) { - return { - style: { - color: this.getColor(userId, { guildId }) - } + return colorString && { + color: colorString }; }, @@ -178,11 +192,36 @@ export default definePlugin({ try { const { messageSaturation } = settings.use(["messageSaturation"]); const author = useMessageAuthor(message); - if (author.colorString !== undefined && messageSaturation !== 0) + + if (author.colorString != null && messageSaturation !== 0) { return `color-mix(in oklab, ${author.colorString} ${messageSaturation}%, var(--text-normal))`; + } } catch (e) { - console.error("[RCE] failed to get message color", e); + new Logger("RoleColorEverywhere").error("Failed to get message color", e); } - return undefined; + + return null; }, + + useMessageColorStyle(message: any) { + const color = this.useMessageColor(message); + + return color && { + color + }; + }, + + RoleGroupColor: ErrorBoundary.wrap(({ id, count, title, guildId, label }: { id: string; count: number; title: string; guildId: string; label: string; }) => { + const role = GuildStore.getRole(guildId, id); + + return role != null && ( + + {title ?? label} — {count} + + ); + }, { noop: true }) }); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 11ce4738..362a22de 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -579,6 +579,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "SomeAspy", id: 516750892372852754n, }, + jamesbt365: { + name: "jamesbt365", + id: 158567567487795200n, + }, } satisfies Record); // iife so #__PURE__ works correctly From 5cf22113cff362ac7168cab9066c85236cd80b73 Mon Sep 17 00:00:00 2001 From: jenku <80538856+jenkuuuuuu@users.noreply.github.com> Date: Sun, 17 Nov 2024 21:55:33 +0000 Subject: [PATCH 6/7] Decor: Update notice about joining the server for clarity (#3021) --- src/plugins/decor/ui/modals/CreateDecorationModal.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx index f5596f39..57a39540 100644 --- a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx +++ b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx @@ -20,7 +20,7 @@ import { AvatarDecorationModalPreview } from "../components"; const FileUpload = findComponentByCodeLazy("fileUploadInput,"); const { HelpMessage, HelpMessageTypes } = mapMangledModuleLazy('POSITIVE=3]="POSITIVE', { - HelpMessageTypes: filters.byProps("POSITIVE", "WARNING"), + HelpMessageTypes: filters.byProps("POSITIVE", "WARNING", "INFO"), HelpMessage: filters.byCode(".iconDiv") }); @@ -119,8 +119,8 @@ function CreateDecorationModal(props: ModalProps) { /> - -
You can receive updates on your decoration's review by joining + To receive updates on your decoration's review, join { e.preventDefault(); @@ -138,8 +138,8 @@ function CreateDecorationModal(props: ModalProps) { }} > Decor's Discord server - . -
+ and allow direct messages. + From cd61f4e7449343acfcc7debf42ee20958fcebf20 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 17 Nov 2024 20:42:15 -0300 Subject: [PATCH 7/7] RoleColorEverywhere: Fix Online/Offline --- src/plugins/roleColorEverywhere/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 055c3987..090c35d3 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -214,9 +214,9 @@ export default definePlugin({ RoleGroupColor: ErrorBoundary.wrap(({ id, count, title, guildId, label }: { id: string; count: number; title: string; guildId: string; label: string; }) => { const role = GuildStore.getRole(guildId, id); - return role != null && ( + return (