From 69b349da77a069dd5c780fc555fc40125079c7ae Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 30 Mar 2024 00:28:15 +0100 Subject: [PATCH 01/16] 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 82c38b6b..1955f7dc 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 9e5a1cef..0738a8c2 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 02/16] 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 eb993195..d6822d97 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 f3626aaa..53f9934b 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 03/16] 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 79cf4174..eeebd0aa 100644 --- a/src/plugins/reviewDB/settings.tsx +++ b/src/plugins/reviewDB/settings.tsx @@ -71,7 +71,7 @@ export const settings = definePluginSettings({