diff --git a/src/main/utils/extensions.ts b/src/main/utils/extensions.ts index d8f843774..8a211baf7 100644 --- a/src/main/utils/extensions.ts +++ b/src/main/utils/extensions.ts @@ -71,13 +71,16 @@ export async function installExt(id: string) { // React Devtools v4.25 // v4.27 is broken in Electron, see https://github.com/facebook/react/issues/25843 // Unfortunately, Google does not serve old versions, so this is the only way + // This zip file is pinned to long commit hash so it cannot be changed remotely ? "https://raw.githubusercontent.com/Vendicated/random-files/f6f550e4c58ac5f2012095a130406c2ab25b984d/fmkadmapgofadopljbjfkapdkoienihi.zip" - : `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=32`; + : `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=${process.versions.chrome}`; + const buf = await get(url, { headers: { - "User-Agent": "Vencord (https://github.com/Vendicated/Vencord)" + "User-Agent": `Electron ${process.versions.electron} ~ Vencord (https://github.com/Vendicated/Vencord)` } }); + await extract(crxToZip(buf), extDir).catch(console.error); } diff --git a/src/plugins/noUnblockToJump/README.md b/src/plugins/noUnblockToJump/README.md new file mode 100644 index 000000000..326bca3b8 --- /dev/null +++ b/src/plugins/noUnblockToJump/README.md @@ -0,0 +1,5 @@ +# No Unblock To Jump + +Removes the popup preventing you to jump to a message from a blocked/ignored user (eg: in search results) + +![A modal popup telling you to unblock a user to jump their message](https://github.com/user-attachments/assets/0e4b859d-f3b3-4101-9a83-829afb473d1e) diff --git a/src/plugins/noUnblockToJump/index.ts b/src/plugins/noUnblockToJump/index.ts index cde0e19e5..621129269 100644 --- a/src/plugins/noUnblockToJump/index.ts +++ b/src/plugins/noUnblockToJump/index.ts @@ -26,25 +26,46 @@ export default definePlugin({ authors: [Devs.dzshn], patches: [ { + // Clicking on search results to jump find: '.id,"Search Results"', - replacement: { - match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/, - replace: "if(false)$1" - } + replacement: [ + { + match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/, + replace: "if(false)$1" + }, + { + match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNIGNORE_TO_JUMP_TITLE})/, + replace: "if(false)$1" + }, + ] }, { + // Jump buttton in top right corner of messages find: "renderJumpButton()", - replacement: { - match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/, - replace: "if(false)$1" - } + replacement: [ + { + match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/, + replace: "if(false)$1" + }, + { + match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNIGNORE_TO_JUMP_TITLE})/, + replace: "if(false)$1" + }, + ] }, { + // Clicking on replied messages to jump find: "flash:!0,returnMessageId", - replacement: { - match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/, - replace: "false?$1" - } + replacement: [ + { + match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/, + replace: "false?$1" + }, + { + match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNIGNORE_TO_JUMP_TITLE})/, + replace: "false?$1" + }, + ] } ] }); diff --git a/src/plugins/openInApp/index.ts b/src/plugins/openInApp/index.ts index 2d27c2b20..09fc2f3b7 100644 --- a/src/plugins/openInApp/index.ts +++ b/src/plugins/openInApp/index.ts @@ -57,7 +57,7 @@ const UrlReplacementRules: Record = { description: "Open Tidal links in the Tidal app", }, itunes: { - match: /^https:\/\/music\.apple\.com\/([a-z]{2}\/)?(album|artist|playlist|song|curator)\/([^/?#]+)\/?([^/?#]+)?(?:\?.*)?(?:#.*)?$/, + match: /^https:\/\/(?:geo\.)?music\.apple\.com\/([a-z]{2}\/)?(album|artist|playlist|song|curator)\/([^/?#]+)\/?([^/?#]+)?(?:\?.*)?(?:#.*)?$/, replace: (_, lang, type, name, id) => id ? `itunes://music.apple.com/us/${type}/${name}/${id}` : `itunes://music.apple.com/us/${type}/${name}`, description: "Open Apple Music links in the iTunes app" }, diff --git a/src/plugins/quickReply/index.ts b/src/plugins/quickReply/index.ts index ac2a38705..4a7060c59 100644 --- a/src/plugins/quickReply/index.ts +++ b/src/plugins/quickReply/index.ts @@ -20,7 +20,7 @@ import { definePluginSettings, Settings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; -import { ChannelStore, FluxDispatcher as Dispatcher, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common"; +import { ChannelStore, ComponentDispatch, FluxDispatcher as Dispatcher, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common"; import { Message } from "discord-types/general"; const Kangaroo = findByPropsLazy("jumpToMessage"); @@ -60,24 +60,24 @@ export default definePlugin({ settings, start() { - Dispatcher.subscribe("DELETE_PENDING_REPLY", onDeletePendingReply); - Dispatcher.subscribe("MESSAGE_END_EDIT", onEndEdit); - Dispatcher.subscribe("MESSAGE_START_EDIT", onStartEdit); - Dispatcher.subscribe("CREATE_PENDING_REPLY", onCreatePendingReply); document.addEventListener("keydown", onKeydown); }, stop() { - Dispatcher.unsubscribe("DELETE_PENDING_REPLY", onDeletePendingReply); - Dispatcher.unsubscribe("MESSAGE_END_EDIT", onEndEdit); - Dispatcher.unsubscribe("MESSAGE_START_EDIT", onStartEdit); - Dispatcher.unsubscribe("CREATE_PENDING_REPLY", onCreatePendingReply); document.removeEventListener("keydown", onKeydown); }, -}); -const onDeletePendingReply = () => replyIdx = -1; -const onEndEdit = () => editIdx = -1; + flux: { + DELETE_PENDING_REPLY() { + replyIdx = -1; + }, + MESSAGE_END_EDIT() { + editIdx = -1; + }, + MESSAGE_START_EDIT: onStartEdit, + CREATE_PENDING_REPLY: onCreatePendingReply + } +}); function calculateIdx(messages: Message[], id: string) { const idx = messages.findIndex(m => m.id === id); @@ -109,6 +109,8 @@ function onKeydown(e: KeyboardEvent) { if (!isUp && e.key !== "ArrowDown") return; if (!isCtrl(e) || isAltOrMeta(e)) return; + e.preventDefault(); + if (e.shiftKey) nextEdit(isUp); else @@ -194,9 +196,10 @@ function nextReply(isUp: boolean) { channel, message, shouldMention: shouldMention(message), - showMentionToggle: channel.guild_id !== null && message.author.id !== meId, + showMentionToggle: channel.isPrivate() && message.author.id !== meId, _isQuickReply: true }); + ComponentDispatch.dispatchToLastSubscribed("TEXTAREA_FOCUS"); jumpIfOffScreen(channel.id, message.id); } diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index a5cf81294..6ee131a8d 100644 --- a/src/plugins/showHiddenThings/index.ts +++ b/src/plugins/showHiddenThings/index.ts @@ -30,9 +30,7 @@ const opt = (description: string) => ({ const settings = definePluginSettings({ showTimeouts: opt("Show member timeout icons in chat."), showInvitesPaused: opt("Show the invites paused tooltip in the server list."), - showModView: opt("Show the member mod view context menu item in all servers."), - disableDiscoveryFilters: opt("Disable filters in Server Discovery search that hide servers that don't meet discovery criteria."), - disableDisallowedDiscoveryFilters: opt("Disable filters in Server Discovery search that hide NSFW & disallowed servers."), + showModView: opt("Show the member mod view context menu item in all servers.") }); export default definePlugin({ @@ -40,6 +38,8 @@ export default definePlugin({ tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"], description: "Displays various hidden & moderator-only things regardless of permissions.", authors: [Devs.Dolfies], + settings, + patches: [ { find: "showCommunicationDisabledStyles", @@ -82,43 +82,6 @@ export default definePlugin({ match: /\i(?=\?null)/, replace: "false" } - }, - { - find: "prod_discoverable_guilds", - predicate: () => settings.store.disableDiscoveryFilters, - replacement: { - match: /\{"auto_removed:.*?\}/, - replace: "{}" - } - }, - // remove the 200 server minimum - { - find: '">200"', - predicate: () => settings.store.disableDiscoveryFilters, - replacement: { - match: '">200"', - replace: '">0"' - } - }, - // empty word filter - { - find: '"pepe","nude"', - predicate: () => settings.store.disableDisallowedDiscoveryFilters, - replacement: { - match: /(?<=[?=])\["pepe",.+?\]/, - replace: "[]", - }, - }, - // patch request that queries if term is allowed - { - find: ".GUILD_DISCOVERY_VALID_TERM,query:", - predicate: () => settings.store.disableDisallowedDiscoveryFilters, - all: true, - replacement: { - match: /\i\.\i\.get\(\{url:\i\.\i\.GUILD_DISCOVERY_VALID_TERM,query:\{term:\i\},oldFormErrors:!0,rejectWithError:!1\}\)/g, - replace: "Promise.resolve({ body: { valid: true } })" - } } - ], - settings, + ] });