From 60f66781078d7a5c51265d841c5aa043dd2cb305 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Thu, 28 Mar 2024 12:57:28 -0300 Subject: [PATCH 001/292] Decor: Fix find targetting wrong module in some cases --- src/plugins/decor/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index d4f420c7d..5b2b6d0f0 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -49,7 +49,7 @@ export default definePlugin({ }, // Decoration modal module { - find: ".decorationGridItem", + find: ".decorationGridItem,", replacement: [ { match: /(?<==)\i=>{let{children.{20,100}decorationGridItem/, From 650f4050e10b90dc92c5921f8c6e2550e78079e1 Mon Sep 17 00:00:00 2001 From: Syncx <47534062+Syncxv@users.noreply.github.com> Date: Fri, 29 Mar 2024 07:40:47 +1100 Subject: [PATCH 002/292] fix(PinDMs): display properly when there are 0 unpinned dms (#2281) Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Co-authored-by: V --- .../pinDms/components/CreateCategoryModal.tsx | 2 +- src/plugins/pinDms/components/contextMenu.tsx | 6 ++-- src/plugins/pinDms/index.tsx | 35 ++++++++++--------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/plugins/pinDms/components/CreateCategoryModal.tsx b/src/plugins/pinDms/components/CreateCategoryModal.tsx index 309ca69ff..06e1c3568 100644 --- a/src/plugins/pinDms/components/CreateCategoryModal.tsx +++ b/src/plugins/pinDms/components/CreateCategoryModal.tsx @@ -53,7 +53,7 @@ function useCategory(categoryId: string | null, initalChannelId: string | null) setCategory({ id: Toasts.genId(), name: `Pin Category ${categories.length + 1}`, - color: 10070709, + color: DEFAULT_COLOR, collapsed: false, channels: [initalChannelId] }); diff --git a/src/plugins/pinDms/components/contextMenu.tsx b/src/plugins/pinDms/components/contextMenu.tsx index 0f5a198ba..f2bf9fae6 100644 --- a/src/plugins/pinDms/components/contextMenu.tsx +++ b/src/plugins/pinDms/components/contextMenu.tsx @@ -8,7 +8,7 @@ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/Co import { Menu } from "@webpack/common"; import { addChannelToCategory, canMoveChannelInDirection, categories, isPinned, moveChannel, removeChannelFromCategory } from "../data"; -import { forceUpdate, settings } from "../index"; +import { forceUpdate, PinOrder, settings } from "../index"; import { openCategoryModal } from "./CreateCategoryModal"; function createPinMenuItem(channelId: string) { @@ -52,7 +52,7 @@ function createPinMenuItem(channelId: string) { /> { - !settings.store.sortDmsByNewestMessage && canMoveChannelInDirection(channelId, -1) && ( + settings.store.pinOrder === PinOrder.Custom && canMoveChannelInDirection(channelId, -1) && ( instance?.props?._forceUpdate?.(); +export const enum PinOrder { + LastMessage, + Custom +} + export const settings = definePluginSettings({ - sortDmsByNewestMessage: { - type: OptionType.BOOLEAN, - description: "Sort DMs by newest message", - default: false, + pinOrder: { + type: OptionType.SELECT, + description: "Which order should pinned DMs be displayed in?", + options: [ + { label: "Most recent message", value: PinOrder.LastMessage, default: true }, + { label: "Custom (right click channels to reorder)", value: PinOrder.Custom } + ], onChange: () => forceUpdate() }, @@ -61,11 +69,6 @@ export default definePlugin({ { find: ".privateChannelsHeaderContainer,", replacement: [ - // Init - { - match: /(?<=componentDidMount\(\){).{1,100}scrollToChannel/, - replace: "$self._instance = this;$&" - }, { // Filter out pinned channels from the private channel list match: /(?<=\i,{channels:\i,)privateChannelIds:(\i)/, @@ -164,12 +167,15 @@ export default definePlugin({ getSections, getAllUncollapsedChannels, requireSettingsMenu, + makeProps(instance, { sections }: { sections: number[]; }) { + this._instance = instance; this.sections = sections; - this.sections.splice(1, 0, ...this.getPinCount(instance.props.privateChannelIds || [])); + this.sections.splice(1, 0, ...this.getSections()); if (this.instance?.props?.privateChannelIds?.length === 0) { + // dont render direct messages header this.sections[this.sections.length - 1] = 0; } @@ -199,10 +205,6 @@ export default definePlugin({ return (sectionHeaderSizePx + sections.reduce((acc, v) => acc += v + 44, 0) + DEFAULT_CHUNK_SIZE) * 1.5; }, - getPinCount(channelIds: string[]) { - return channelIds.length ? this.getSections() : []; - }, - isCategoryIndex(sectionIndex: number) { return this.sections && sectionIndex > 0 && sectionIndex < this.sections.length - 1; }, @@ -211,7 +213,7 @@ export default definePlugin({ if (settings.store.dmSectioncollapsed && sectionIndex !== 0) return true; const cat = categories[sectionIndex - 1]; - return this.isCategoryIndex(sectionIndex) && (cat.channels.length === 0 || cat?.channels[channelIndex]); + return this.isCategoryIndex(sectionIndex) && (cat?.channels?.length === 0 || cat?.channels[channelIndex]); }, isDMSectioncollapsed() { @@ -219,7 +221,6 @@ export default definePlugin({ }, collapseDMList() { - // console.log("HI"); settings.store.dmSectioncollapsed = !settings.store.dmSectioncollapsed; forceUpdate(); }, @@ -350,7 +351,7 @@ export default definePlugin({ getCategoryChannels(category: Category) { if (category.channels.length === 0) return []; - if (settings.store.sortDmsByNewestMessage) { + if (settings.store.pinOrder === PinOrder.LastMessage) { return PrivateChannelSortStore.getPrivateChannelIds().filter(c => category.channels.includes(c)); } From 69b349da77a069dd5c780fc555fc40125079c7ae Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 30 Mar 2024 00:28:15 +0100 Subject: [PATCH 003/292] fix minor updater bugs --- src/main/updater/git.ts | 5 +++-- src/main/updater/http.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/updater/git.ts b/src/main/updater/git.ts index 82c38b6bc..1955f7dce 100644 --- a/src/main/updater/git.ts +++ b/src/main/updater/git.ts @@ -28,7 +28,7 @@ const VENCORD_SRC_DIR = join(__dirname, ".."); const execFile = promisify(cpExecFile); -const isFlatpak = process.platform === "linux" && Boolean(process.env.FLATPAK_ID?.includes("discordapp") || process.env.FLATPAK_ID?.includes("Discord")); +const isFlatpak = process.platform === "linux" && !!process.env.FLATPAK_ID; if (process.platform === "darwin") process.env.PATH = `/usr/local/bin:${process.env.PATH}`; @@ -60,7 +60,8 @@ async function calculateGitChanges() { return commits ? commits.split("\n").map(line => { const [author, hash, ...rest] = line.split("/"); return { - hash, author, message: rest.join("/") + hash, author, + message: rest.join("/").split("\n")[0] }; }) : []; } diff --git a/src/main/updater/http.ts b/src/main/updater/http.ts index 9e5a1cef4..0738a8c24 100644 --- a/src/main/updater/http.ts +++ b/src/main/updater/http.ts @@ -53,7 +53,7 @@ async function calculateGitChanges() { // github api only sends the long sha hash: c.sha.slice(0, 7), author: c.author.login, - message: c.commit.message.substring(c.commit.message.indexOf("\n") + 1) + message: c.commit.message.split("\n")[0] })); } From b158cecd4b4b3e4486fc2092daa9b753b1c136fa Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sun, 31 Mar 2024 01:00:09 +0100 Subject: [PATCH 004/292] FakeNitro: Fix sending unavailable emotes of the current server --- src/plugins/fakeNitro/index.tsx | 25 +++++++++++++------------ src/utils/constants.ts | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index eb9931956..d6822d97d 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -25,6 +25,7 @@ import { Logger } from "@utils/Logger"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack"; import { Alerts, ChannelStore, EmojiStore, FluxDispatcher, Forms, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common"; +import type { CustomEmoji } from "@webpack/types"; import type { Message } from "discord-types/general"; import { applyPalette, GIFEncoder, quantize } from "gifenc"; import type { ReactElement, ReactNode } from "react"; @@ -784,6 +785,16 @@ export default definePlugin({ UploadHandler.promptToUpload([file], ChannelStore.getChannel(channelId), DRAFT_TYPE); }, + canUseEmote(e: CustomEmoji, channelId: string) { + if (e.require_colons === false) return true; + if (e.available === false) return false; + + if (this.canUseEmotes) + return e.guildId === this.guildId || hasExternalEmojiPerms(channelId); + else + return !e.animated && e.guildId === this.guildId; + }, + start() { const s = settings.store; @@ -882,12 +893,8 @@ export default definePlugin({ } if (s.enableEmojiBypass) { - const canUseEmotes = this.canUseEmotes && hasExternalEmojiPerms(channelId); - for (const emoji of messageObj.validNonShortcutEmojis) { - if (!emoji.require_colons) continue; - if (emoji.available !== false && canUseEmotes) continue; - if (emoji.guildId === guildId && !emoji.animated) continue; + if (this.canUseEmote(emoji, channelId)) continue; hasBypass = true; @@ -917,18 +924,12 @@ export default definePlugin({ this.preEdit = addPreEditListener(async (channelId, __, messageObj) => { if (!s.enableEmojiBypass) return; - const { guildId } = this; - let hasBypass = false; - const canUseEmotes = this.canUseEmotes && hasExternalEmojiPerms(channelId); - messageObj.content = messageObj.content.replace(/(?/ig, (emojiStr, emojiId, offset, origStr) => { const emoji = EmojiStore.getCustomEmojiById(emojiId); if (emoji == null) return emojiStr; - if (!emoji.require_colons) return emojiStr; - if (emoji.available !== false && canUseEmotes) return emojiStr; - if (emoji.guildId === guildId && !emoji.animated) return emojiStr; + if (this.canUseEmote(emoji, channelId)) return emojiStr; hasBypass = true; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index f3626aaa0..53f9934b1 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -155,7 +155,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({ }, kemo: { name: "kemo", - id: 299693897859465228n + id: 715746190813298788n }, dzshn: { name: "dzshn", From c623e447865b2798c99082ebe36039127c332b67 Mon Sep 17 00:00:00 2001 From: Koda!! <162957404+Kodarru@users.noreply.github.com> Date: Sat, 30 Mar 2024 19:33:03 -0700 Subject: [PATCH 005/292] ReviewDB: Fix website url (#2318) Co-authored-by: V --- src/plugins/reviewDB/settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/reviewDB/settings.tsx b/src/plugins/reviewDB/settings.tsx index 79cf4174e..eeebd0aa1 100644 --- a/src/plugins/reviewDB/settings.tsx +++ b/src/plugins/reviewDB/settings.tsx @@ -71,7 +71,7 @@ export const settings = definePluginSettings({