From d3acd7edc7d7972888f06ea6c919587d11e825ff Mon Sep 17 00:00:00 2001 From: Kyuuhachi <1547062+Kyuuhachi@users.noreply.github.com> Date: Wed, 8 May 2024 03:32:09 +0200 Subject: [PATCH 1/5] new plugin ReplyTimestamp: show timestamps of replied messages (#2296) Co-authored-by: vee --- src/plugins/replyTimestamp/README.md | 5 ++ src/plugins/replyTimestamp/index.tsx | 77 ++++++++++++++++++++++++++++ src/plugins/replyTimestamp/style.css | 3 ++ 3 files changed, 85 insertions(+) create mode 100644 src/plugins/replyTimestamp/README.md create mode 100644 src/plugins/replyTimestamp/index.tsx create mode 100644 src/plugins/replyTimestamp/style.css diff --git a/src/plugins/replyTimestamp/README.md b/src/plugins/replyTimestamp/README.md new file mode 100644 index 000000000..b7952bf3a --- /dev/null +++ b/src/plugins/replyTimestamp/README.md @@ -0,0 +1,5 @@ +# ReplyTimestamp + +Shows timestamps on the previews of replied-to messages. Pretty simple. + +![](https://github.com/Vendicated/Vencord/assets/1547062/62e2b67a-e567-4c7a-884d-4640f897f7e0) diff --git a/src/plugins/replyTimestamp/index.tsx b/src/plugins/replyTimestamp/index.tsx new file mode 100644 index 000000000..05ec28b1b --- /dev/null +++ b/src/plugins/replyTimestamp/index.tsx @@ -0,0 +1,77 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import "./style.css"; + +import ErrorBoundary from "@components/ErrorBoundary"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { findByPropsLazy } from "@webpack"; +import { Timestamp } from "@webpack/common"; +import type { Message } from "discord-types/general"; +import type { HTMLAttributes } from "react"; + +const { getMessageTimestampId } = findByPropsLazy("getMessageTimestampId"); +const { calendarFormat, dateFormat, isSameDay } = findByPropsLazy("calendarFormat", "dateFormat", "isSameDay", "accessibilityLabelCalendarFormat"); +const MessageClasses = findByPropsLazy("separator", "latin24CompactTimeStamp"); + +function Sep(props: HTMLAttributes) { + return ; +} + +const enum ReferencedMessageState { + LOADED = 0, + NOT_LOADED = 1, + DELETED = 2, +} + +type ReferencedMessage = { state: ReferencedMessageState.LOADED; message: Message; } | { state: ReferencedMessageState.NOT_LOADED | ReferencedMessageState.DELETED; }; + +function ReplyTimestamp({ + referencedMessage, + baseMessage, +}: { + referencedMessage: ReferencedMessage, + baseMessage: Message; +}) { + if (referencedMessage.state !== ReferencedMessageState.LOADED) return null; + const refTimestamp = referencedMessage.message.timestamp as any; + const baseTimestamp = baseMessage.timestamp as any; + return ( + + [ + {isSameDay(refTimestamp, baseTimestamp) + ? dateFormat(refTimestamp, "LT") + : calendarFormat(refTimestamp) + } + ] + + ); +} + +export default definePlugin({ + name: "ReplyTimestamp", + description: "Shows a timestamp on replied-message previews", + authors: [Devs.Kyuuhachi], + + patches: [ + { + find: "renderSingleLineMessage:function()", + replacement: { + match: /(?<="aria-label":\i,children:\[)(?=\i,\i,\i\])/, + replace: "$self.ReplyTimestamp(arguments[0])," + } + } + ], + + ReplyTimestamp: ErrorBoundary.wrap(ReplyTimestamp, { noop: true }), +}); diff --git a/src/plugins/replyTimestamp/style.css b/src/plugins/replyTimestamp/style.css new file mode 100644 index 000000000..f42371717 --- /dev/null +++ b/src/plugins/replyTimestamp/style.css @@ -0,0 +1,3 @@ +.vc-reply-timestamp { + margin-right: 0.25em; +} From 1317222c35a4f6dd2b7329507c7b7ac5a9854d9e Mon Sep 17 00:00:00 2001 From: puv Date: Wed, 8 May 2024 04:44:57 +0300 Subject: [PATCH 2/5] feat(plugin): VoiceDownload (#2280) Co-authored-by: vee --- src/plugins/voiceDownload/index.tsx | 53 +++++++++++++++++++++++++++++ src/plugins/voiceDownload/style.css | 12 +++++++ src/utils/constants.ts | 4 +++ 3 files changed, 69 insertions(+) create mode 100644 src/plugins/voiceDownload/index.tsx create mode 100644 src/plugins/voiceDownload/style.css diff --git a/src/plugins/voiceDownload/index.tsx b/src/plugins/voiceDownload/index.tsx new file mode 100644 index 000000000..453a522d3 --- /dev/null +++ b/src/plugins/voiceDownload/index.tsx @@ -0,0 +1,53 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import "./style.css"; + +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; + +export default definePlugin({ + name: "VoiceDownload", + description: "Adds a download to voice messages. (Opens a new browser tab)", + authors: [Devs.puv], + patches: [ + { + find: "rippleContainer,children", + replacement: { + match: /\(0,\i\.jsx\).{0,150},children:.{0,50}\("source",{src:(\i)}\)}\)/, + replace: "[$&, $self.renderDownload($1)]" + } + } + ], + + renderDownload(src: string) { + return ( + e.stopPropagation()} + aria-label="Download voice message" + > + + + ); + }, + + Icon: () => ( + + + + ), +}); diff --git a/src/plugins/voiceDownload/style.css b/src/plugins/voiceDownload/style.css new file mode 100644 index 000000000..2b776023f --- /dev/null +++ b/src/plugins/voiceDownload/style.css @@ -0,0 +1,12 @@ +.vc-voice-download { + width: 24px; + height: 24px; + color: var(--interactive-normal); + margin-left: 12px; + cursor: pointer; + position: relative; +} + +.vc-voice-download:hover { + color: var(--interactive-active); +} diff --git a/src/utils/constants.ts b/src/utils/constants.ts index ab6c0bb70..a0c4752dc 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -430,6 +430,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "newwares", id: 421405303951851520n }, + puv: { + name: "puv", + id: 469441552251355137n + }, Kodarru: { name: "Kodarru", id: 785227396218748949n From 5c787145e3a83dfe99ff4e595711298b96efe5d2 Mon Sep 17 00:00:00 2001 From: dolfies Date: Tue, 7 May 2024 21:50:26 -0400 Subject: [PATCH 3/5] showHiddenThings: also show ModView & hidden discovery servers (#2415) Co-authored-by: vee --- src/plugins/showHiddenThings/README.md | 6 ++++++ src/plugins/showHiddenThings/index.ts | 28 +++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/plugins/showHiddenThings/README.md b/src/plugins/showHiddenThings/README.md index b41e2d94d..e969391e4 100644 --- a/src/plugins/showHiddenThings/README.md +++ b/src/plugins/showHiddenThings/README.md @@ -9,3 +9,9 @@ Displays various moderator-only elements regardless of permissions. - Show the invites paused tooltip in the server list ![](https://github.com/Vendicated/Vencord/assets/47677887/b6a923d2-ac55-40d9-b4f8-fa6fc117148b) + +- Show the member mod view context menu item in all servers + +![](https://github.com/Vendicated/Vencord/assets/47677887/3dac95dd-841c-4c15-ad87-2db7bd1e4dab) + +- Disable filters in Server Discovery search that hide servers that don't meet discovery criteria diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index e7be929bf..1858582a8 100644 --- a/src/plugins/showHiddenThings/index.ts +++ b/src/plugins/showHiddenThings/index.ts @@ -31,12 +31,22 @@ const settings = definePluginSettings({ description: "Show the invites paused tooltip in the server list.", default: true, }, + showModView: { + type: OptionType.BOOLEAN, + description: "Show the member mod view context menu item in all servers.", + default: true, + }, + disableDiscoveryFilters: { + type: OptionType.BOOLEAN, + description: "Disable filters in Server Discovery search that hide servers that don't meet discovery criteria.", + default: true, + }, }); migratePluginSettings("ShowHiddenThings", "ShowTimeouts"); export default definePlugin({ name: "ShowHiddenThings", - tags: ["ShowTimeouts", "ShowInvitesPaused"], + tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"], description: "Displays various moderator-only elements regardless of permissions.", authors: [Devs.Dolfies], patches: [ @@ -55,6 +65,22 @@ export default definePlugin({ match: /\i\.\i\.can\(\i\.Permissions.MANAGE_GUILD,\i\)/, replace: "true", }, + }, + { + find: "canAccessGuildMemberModViewWithExperiment:", + predicate: () => settings.store.showModView, + replacement: { + match: /return \i\.hasAny\(\i\.computePermissions\(\{user:\i,context:\i,checkElevated:!1\}\),\i\.MemberSafetyPagePermissions\)/, + replace: "return true", + } + }, + { + find: "auto_removed:", + predicate: () => settings.store.disableDiscoveryFilters, + replacement: { + match: /filters:\i\.join\(" AND "\),facets:\[/, + replace: "facets:[" + } } ], settings, From dd3b7e534651bbe42fdd80b12c8b5815026760b7 Mon Sep 17 00:00:00 2001 From: KK2-5 <120592920+KK2-5@users.noreply.github.com> Date: Tue, 7 May 2024 22:55:32 -0300 Subject: [PATCH 4/5] LastfmRichPresence: Add option to use album name as status name (#2400) Co-authored-by: vee --- src/plugins/lastfm/index.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/lastfm/index.tsx b/src/plugins/lastfm/index.tsx index 5dfec8a32..1213ece29 100644 --- a/src/plugins/lastfm/index.tsx +++ b/src/plugins/lastfm/index.tsx @@ -77,7 +77,8 @@ const enum NameFormat { ArtistFirst = "artist-first", SongFirst = "song-first", ArtistOnly = "artist", - SongOnly = "song" + SongOnly = "song", + AlbumName = "album" } const applicationId = "1108588077900898414"; @@ -147,6 +148,10 @@ const settings = definePluginSettings({ { label: "Use song name only", value: NameFormat.SongOnly + }, + { + label: "Use album name (falls back to custom status text if song has no album)", + value: NameFormat.AlbumName } ], }, @@ -313,6 +318,8 @@ export default definePlugin({ return trackData.artist; case NameFormat.SongOnly: return trackData.name; + case NameFormat.AlbumName: + return trackData.album || settings.store.statusName; default: return settings.store.statusName; } From 449f95500ae3124f55bb51fe7e8f8e29e7fb10a2 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 8 May 2024 03:56:25 +0200 Subject: [PATCH 5/5] bump to v1.8.2 --- package.json | 2 +- src/plugins/voiceDownload/index.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 97d3da576..9fd84f9b8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.8.1", + "version": "1.8.2", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": { diff --git a/src/plugins/voiceDownload/index.tsx b/src/plugins/voiceDownload/index.tsx index 453a522d3..8586b9f91 100644 --- a/src/plugins/voiceDownload/index.tsx +++ b/src/plugins/voiceDownload/index.tsx @@ -39,7 +39,6 @@ export default definePlugin({ Icon: () => (