From 14bbde33cb1b7da0268126ac7ed85f26591f2fe2 Mon Sep 17 00:00:00 2001 From: panbread <93918332+Panniku@users.noreply.github.com> Date: Wed, 26 Feb 2025 21:50:23 +0400 Subject: [PATCH] Drop DoNotLeak + Extras Co-Authored-By: thororen1234 Co-Authored-By: thororen <78185467+thororen1234@users.noreply.github.com> Co-Authored-By: sadan4 <117494111+sadan4@users.noreply.github.com> Co-Authored-By: ynot01 Co-Authored-By: MrDiamondDog <84212701+MrDiamondDog@users.noreply.github.com> Co-Authored-By: Crxaw <48805031+sitescript@users.noreply.github.com> --- README.md | 5 +- .../customUserColors/index.tsx | 4 +- src/equicordplugins/doNotLeak/index.ts | 85 ------------- src/equicordplugins/doNotLeak/style.ts | 116 ------------------ src/equicordplugins/hideMessage/index.tsx | 6 +- src/equicordplugins/statsfm/index.tsx | 7 +- .../unreadBadgeCount/index.tsx | 8 +- .../vcNarratorCustom/index.tsx | 2 +- src/plugins/_core/supportHelper.tsx | 6 +- src/plugins/gameActivityToggle/index.tsx | 2 +- src/plugins/hideAttachments/index.tsx | 5 +- src/plugins/lastfm/index.tsx | 7 +- .../translate/TranslationAccessory.tsx | 2 +- src/plugins/translate/index.tsx | 9 ++ src/plugins/translate/settings.ts | 5 + src/plugins/vcDoubleClick/index.ts | 20 ++- src/plugins/vcNarrator/index.tsx | 2 +- 17 files changed, 68 insertions(+), 223 deletions(-) delete mode 100644 src/equicordplugins/doNotLeak/index.ts delete mode 100644 src/equicordplugins/doNotLeak/style.ts diff --git a/README.md b/README.md index e8b71655..5393f9e3 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch ### Extra included plugins
-151 additional plugins +150 additional plugins ### All Platforms - AllCallTimers by MaxHerbold & D3SOX @@ -45,7 +45,6 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch - DeadMembers by Kyuuhachi - Demonstration by Samwich - DisableCameras by Joona -- DoNotLeak by Perny - DontFilterMe by Samwich - EmojiDumper by Cortex, Samwich, Woosh - Encryptcord by Inbestigator @@ -190,7 +189,7 @@ Linux - [AUR](https://aur.archlinux.org/packages?O=0&K=equicord) ```shell sh -c "$(curl -sS https://raw.githubusercontent.com/Equicord/Equicord/refs/heads/main/misc/install.sh)" -``` +``` ## Installing Equicord Devbuild ### Dependencies diff --git a/src/equicordplugins/customUserColors/index.tsx b/src/equicordplugins/customUserColors/index.tsx index 78d9c31a..1136829d 100644 --- a/src/equicordplugins/customUserColors/index.tsx +++ b/src/equicordplugins/customUserColors/index.tsx @@ -109,11 +109,11 @@ export default definePlugin({ }, colorIfServer(a: any): string | undefined { - const roleColor = a.author?.colorString ?? "inherit"; + const roleColor = a.author?.colorString; if (a?.channel?.guild_id && !settings.store.colorInServers) return roleColor; const color = getCustomColorString(a.message.author.id, true); - return color ?? roleColor; + return color ?? roleColor ?? undefined; } }); diff --git a/src/equicordplugins/doNotLeak/index.ts b/src/equicordplugins/doNotLeak/index.ts deleted file mode 100644 index 8c73fb53..00000000 --- a/src/equicordplugins/doNotLeak/index.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { definePluginSettings } from "@api/Settings"; -import { EquicordDevs } from "@utils/constants"; -import definePlugin, { OptionType } from "@utils/types"; - -import { getStyle } from "./style"; - -const settings = definePluginSettings({ - hoverToView: { - type: OptionType.BOOLEAN, - description: "When hovering over a message, show the contents.", - default: false, - onChange: () => { - console.log(settings.store.hoverToView); - updateClassList("hover-to-view", settings.store.hoverToView); - }, - }, - keybind: { - type: OptionType.STRING, - description: "The keybind to show the contents of a message.", - default: "Insert", - restartNeeded: false, - }, - enableForStream: { - type: OptionType.BOOLEAN, - description: "Blur all messages in streamer mode.", - default: false, - onChange: () => { - console.log(settings.store.enableForStream); - updateClassList( - "hide-in-streamer-mode", - settings.store.enableForStream - ); - }, - }, -}); - -export default definePlugin({ - name: "DoNotLeak", - tags: ["DontLeak"], - description: "Hide all message contents and attachments when you're streaming or sharing your screen.", - authors: [EquicordDevs.Perny], - settings, - start() { - const styles = getStyle(); - - const style = document.createElement("style"); - style.setAttribute("id", "vc-dont-leak-style"); - style.innerHTML = styles; - document.head.appendChild(style); - - document.addEventListener("keyup", keyUpHandler); - document.addEventListener("keydown", keyDownHandler); - updateClassList("hover-to-view", settings.store.hoverToView); - updateClassList("hide-in-streamer-mode", settings.store.enableForStream); - }, - stop() { - document.removeEventListener("keyup", keyUpHandler); - document.removeEventListener("keydown", keyDownHandler); - document.getElementById("vc-dont-leak-style")?.remove(); - }, -}); - -function updateClassList(className, condition) { - if (condition) { - document.body.classList.add(`vc-dnl-${className}`); - return; - } - document.body.classList.remove(`vc-dnl-${className}`); -} - -function keyUpHandler(e: KeyboardEvent) { - if (e.key !== settings.store.keybind) return; - updateClassList("show-messages", false); -} - -function keyDownHandler(e: KeyboardEvent) { - if (e.key !== settings.store.keybind) return; - updateClassList("show-messages", true); -} diff --git a/src/equicordplugins/doNotLeak/style.ts b/src/equicordplugins/doNotLeak/style.ts deleted file mode 100644 index e0443616..00000000 --- a/src/equicordplugins/doNotLeak/style.ts +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { findByProps } from "@webpack"; - -const CssFormatCode: string = `body:has( - div.{sidebar} - > section - div.{wrapper} - div.{actionButtons} - > button:nth-child(2).{buttonActive} -) -.{messageContent} { -filter: blur(12px); -} - -body:has( - div.{sidebar} - > section - div.{wrapper} - div.{actionButtons} - > button:nth-child(2).{buttonActive} -) -.{visualMediaItemContainer} { -filter: blur(50px) brightness(0.1); -} - -body:has( - div.{sidebar} - > section - div.{wrapper} - div.{actionButtons} - > button:nth-child(2).{buttonActive} -) -.{embedWrapper} { -filter: blur(50px); -} - -body.vc-dnl-hide-in-streamer-mode:has(.{notice}.{colorStreamerMode}) -.{visualMediaItemContainer} { -filter: blur(50px) brightness(0.1); -} - -body.vc-dnl-hide-in-streamer-mode:has(.{notice}.{colorStreamerMode}) -.{messageContent} { -filter: blur(12px); -} - -body.vc-dnl-hide-in-streamer-mode:has(.{notice}.{colorStreamerMode}) -.{embedWrapper} { -filter: blur(50px); -} - -body.vc-dnl-show-messages .{visualMediaItemContainer} { -filter: blur(0px) brightness(1) !important; -} - -body.vc-dnl-show-messages .{messageContent} { -filter: blur(0px) !important; -} - -body.vc-dnl-show-messages .{embedWrapper} { -filter: blur(0px) !important; -} - -body.vc-dnl-hover-to-view .{messageContent}:hover { -filter: blur(0px) brightness(1) !important; -} - -body.vc-dnl-hover-to-view .{embedWrapper}:hover { -filter: blur(0px) brightness(1) !important; -} - -body.vc-dnl-hover-to-view .{visualMediaItemContainer}:hover { -filter: blur(0px) brightness(1) !important; -}`; - -/* -[ - "sidebar", - "wrapper", - "actionButtons", - "buttonActive", - "messageContent", - "visualMediaItemContainer", - "embedWrapper", - "notice", - "colorStreamerMode", -] -*/ - -export function getStyle(): string { - const messageContent = findByProps("messageContent", "titleCase"); // ["messageContent","wrapper"] - const embedWrapper = findByProps("embedWrapper"); - const mediaContainer = findByProps("visualMediaItemContainer"); - const notice = findByProps("colorStreamerMode", "notice"); - const actionBar = findByProps("actionButtons", "buttonActive", "wrapper"); - const sidebar = findByProps("sidebar", "panels"); - const Classes = Object.assign( - {}, - actionBar, - notice, - mediaContainer, - embedWrapper, - messageContent, - sidebar - ); - let CssCode = CssFormatCode; - for (const className in Classes) { - CssCode = CssCode.replaceAll(`{${className}}`, Classes[className]); - } - return CssCode; -} diff --git a/src/equicordplugins/hideMessage/index.tsx b/src/equicordplugins/hideMessage/index.tsx index f0961cef..21265f17 100644 --- a/src/equicordplugins/hideMessage/index.tsx +++ b/src/equicordplugins/hideMessage/index.tsx @@ -32,7 +32,7 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = (children, { messag const { deleted, id, channel_id } = message; if (deleted || message.state !== "SENT") return; - const isHidden = hiddenMessages?.has(id) ?? false; + const isHidden = hiddenMessages?.has(id) || false; if (isHidden) { return children.push( { }; export const revealMessage = (id: string) => { - const isHidden = hiddenMessages?.has(id) ?? false; + const isHidden = hiddenMessages?.has(id) || false; if (isHidden) { hiddenMessages.delete(id); buildCss(); @@ -149,7 +149,7 @@ export default definePlugin({ } addMessageAccessory("vc-hide-message", ({ message }) => { - const isHidden = hiddenMessages?.has(message.id) ?? false; + const isHidden = hiddenMessages?.has(message.id) || false; if (isHidden && settings.store.showNotice) return ; return null; }); diff --git a/src/equicordplugins/statsfm/index.tsx b/src/equicordplugins/statsfm/index.tsx index 06d6d038..280dfc84 100644 --- a/src/equicordplugins/statsfm/index.tsx +++ b/src/equicordplugins/statsfm/index.tsx @@ -225,6 +225,11 @@ const settings = definePluginSettings({ description: "Show the Stats.fm next to the albums cover", type: OptionType.BOOLEAN, default: true, + }, + alwaysHideArt: { + description: "Disable downloading album art", + type: OptionType.BOOLEAN, + default: false, } }); @@ -295,7 +300,7 @@ export default definePlugin({ }, getLargeImage(track: TrackData): string | undefined { - if (track.imageUrl && !track.imageUrl.includes(placeholderId)) + if (!settings.store.alwaysHideArt && track.imageUrl && !track.imageUrl.includes(placeholderId)) return track.imageUrl; if (settings.store.missingArt === "placeholder") diff --git a/src/equicordplugins/unreadBadgeCount/index.tsx b/src/equicordplugins/unreadBadgeCount/index.tsx index 05cde5e3..d2dd9fcd 100644 --- a/src/equicordplugins/unreadBadgeCount/index.tsx +++ b/src/equicordplugins/unreadBadgeCount/index.tsx @@ -105,6 +105,10 @@ export default definePlugin({ if (unreadCount >= 100) { paddingValue = 4; } else if (unreadCount >= 10) { paddingValue = 2; } else paddingValue = 0; + let widthValue = 16; + if (unreadCount >= 100) { widthValue = 30; } else + if (unreadCount >= 10) { widthValue = 22; } else + widthValue = 16; return ( = 10 ? 22 : 16 - } + width={widthValue} padding={paddingValue} /> ); diff --git a/src/equicordplugins/vcNarratorCustom/index.tsx b/src/equicordplugins/vcNarratorCustom/index.tsx index 998a325c..9e9e9b77 100644 --- a/src/equicordplugins/vcNarratorCustom/index.tsx +++ b/src/equicordplugins/vcNarratorCustom/index.tsx @@ -211,7 +211,7 @@ const settings = definePluginSettings({ muteMessage: { type: OptionType.STRING, description: "Mute Message (only self for now)", - default: "{{DISPLAY_NAME}} Muted", + default: "{{DISPLAY_NAME}} muted", }, unmuteMessage: { type: OptionType.STRING, diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index d2fe060b..cd3372de 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -86,7 +86,11 @@ async function generateDebugInfoMessage() { `v${VERSION} • [${gitHash}]()` + `${SettingsPlugin.additionalInfo} - ${Intl.DateTimeFormat("en-GB", { dateStyle: "medium" }).format(BUILD_TIMESTAMP)}`, Client: `${RELEASE_CHANNEL} ~ ${client}`, - Platform: window.navigator.platform + Platform: typeof DiscordNative !== "undefined" ? + `${DiscordNative.process.platform === "darwin" ? + (DiscordNative.process.arch === "arm64" ? "MacSilicon" : "MacIntel") : + (DiscordNative.process.platform === "win32" && DiscordNative.process.arch === "x64" ? "Windows" : DiscordNative.process.platform)}` : + window.navigator.platform }; if (IS_DISCORD_DESKTOP) { diff --git a/src/plugins/gameActivityToggle/index.tsx b/src/plugins/gameActivityToggle/index.tsx index 37d0ca4c..c1301411 100644 --- a/src/plugins/gameActivityToggle/index.tsx +++ b/src/plugins/gameActivityToggle/index.tsx @@ -95,7 +95,7 @@ export default definePlugin({ { find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}", replacement: { - match: /this\.renderNameZone\(\).+?children:\[/, + match: /className:\i\.buttons,.{0,50}children:\[/, replace: "$&$self.GameActivityToggleButton()," } } diff --git a/src/plugins/hideAttachments/index.tsx b/src/plugins/hideAttachments/index.tsx index 58c5af6a..26f6a47a 100644 --- a/src/plugins/hideAttachments/index.tsx +++ b/src/plugins/hideAttachments/index.tsx @@ -63,7 +63,7 @@ export default definePlugin({ if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length && !hasAttachmentsInShapshots) return null; - const isHidden = hiddenMessages?.has(msg.id) ?? false; + const isHidden = hiddenMessages?.has(msg.id) || false; return { label: isHidden ? "Show Media" : "Hide Media", @@ -93,7 +93,8 @@ export default definePlugin({ }, shouldHide(messageId: string) { - return hiddenMessages?.has(messageId) ?? false; + return hiddenMessages?.has(messageId) || false; + }, async toggleHide(channelId: string, messageId: string) { diff --git a/src/plugins/lastfm/index.tsx b/src/plugins/lastfm/index.tsx index e4e9c209..75d9c7c3 100644 --- a/src/plugins/lastfm/index.tsx +++ b/src/plugins/lastfm/index.tsx @@ -197,6 +197,11 @@ const settings = definePluginSettings({ description: "show the Last.fm logo by the album cover", type: OptionType.BOOLEAN, default: true, + }, + alwaysHideArt: { + description: "Disable downloading album art", + type: OptionType.BOOLEAN, + default: false, } }); @@ -279,7 +284,7 @@ export default definePlugin({ }, getLargeImage(track: TrackData): string | undefined { - if (track.imageUrl && !track.imageUrl.includes(placeholderId)) + if (!settings.store.alwaysHideArt && track.imageUrl && !track.imageUrl.includes(placeholderId)) return track.imageUrl; if (settings.store.missingArt === "placeholder") diff --git a/src/plugins/translate/TranslationAccessory.tsx b/src/plugins/translate/TranslationAccessory.tsx index 9b6393cc..db9461d8 100644 --- a/src/plugins/translate/TranslationAccessory.tsx +++ b/src/plugins/translate/TranslationAccessory.tsx @@ -57,7 +57,7 @@ export function TranslationAccessory({ message }: { message: Message; }) { {Parser.parse(translation.text)} - {" "} +
(translated from {translation.sourceLanguage} - setTranslation(undefined)} />)
); diff --git a/src/plugins/translate/index.tsx b/src/plugins/translate/index.tsx index 363897d1..975f67ba 100644 --- a/src/plugins/translate/index.tsx +++ b/src/plugins/translate/index.tsx @@ -22,12 +22,21 @@ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/Co import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; import { ChannelStore, Menu } from "@webpack/common"; +import { Message } from "discord-types/general"; import { settings } from "./settings"; import { setShouldShowTranslateEnabledTooltip, TranslateChatBarIcon, TranslateIcon } from "./TranslateIcon"; import { handleTranslate, TranslationAccessory } from "./TranslationAccessory"; import { translate } from "./utils"; +interface IMessageCreate { + type: "MESSAGE_CREATE"; + optimistic: boolean; + isPushNotification: boolean; + channelId: string; + message: Message; +} + const messageCtxPatch: NavContextMenuPatchCallback = (children, { message }) => { if (!message.content) return; diff --git a/src/plugins/translate/settings.ts b/src/plugins/translate/settings.ts index 916c70bd..404ccfbf 100644 --- a/src/plugins/translate/settings.ts +++ b/src/plugins/translate/settings.ts @@ -78,6 +78,11 @@ export const settings = definePluginSettings({ description: "Show a tooltip on the ChatBar button whenever a message is automatically translated", default: true }, + disableOnSameLanguage: { + type: OptionType.BOOLEAN, + description: "Disable auto translate if the current language doesnt change", + default: true + } }).withPrivateSettings<{ showAutoTranslateAlert: boolean; }>(); diff --git a/src/plugins/vcDoubleClick/index.ts b/src/plugins/vcDoubleClick/index.ts index 8d4cae6a..d9310f51 100644 --- a/src/plugins/vcDoubleClick/index.ts +++ b/src/plugins/vcDoubleClick/index.ts @@ -18,7 +18,7 @@ import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; -import { ChannelStore, SelectedChannelStore } from "@webpack/common"; +import { ChannelRouter, ChannelStore, SelectedChannelStore } from "@webpack/common"; const timers = {} as Record "" + `onClick:(vcDoubleClickEvt)=>$self.shouldRunOnClick(vcDoubleClickEvt,${props})&&${onClick}()`, } + }, + // Voice channels in the active now section + { + find: ',["embedded_background"]', + replacement: { + // There are two onClick events for this section, one for the server icon, and another for the channel name + // The server icon takes you to the voice channel, but doesnt join it. The channel name joins the voice channel + match: /(?=children)(?<=selectVoiceChannel\((\i)\.id\).{0,100})/, + replace: "onClick:$self.goToChannel.bind(null,$1)," + } } ], + goToChannel(props: { id?: string; } | undefined) { + const { id } = props ?? {}; + if (!id) return console.error("No channel id found"); + ChannelRouter.transitionToChannel(id); + }, + shouldRunOnClick(e: MouseEvent, { channelId }) { const channel = ChannelStore.getChannel(channelId); if (!channel || ![2, 13].includes(channel.type)) return true; diff --git a/src/plugins/vcNarrator/index.tsx b/src/plugins/vcNarrator/index.tsx index 95be33be..56a2cb36 100644 --- a/src/plugins/vcNarrator/index.tsx +++ b/src/plugins/vcNarrator/index.tsx @@ -273,7 +273,7 @@ export default definePlugin({ muteMessage: { type: OptionType.STRING, description: "Mute Message (only self for now)", - default: "{{USER}} Muted" + default: "{{USER}} muted" }, unmuteMessage: { type: OptionType.STRING,