Merge branch 'dev' into immediate-finds

This commit is contained in:
Nuckyz 2024-05-08 00:19:49 -03:00
commit 4753efa33c
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
10 changed files with 195 additions and 3 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "vencord", "name": "vencord",
"private": "true", "private": "true",
"version": "1.8.1", "version": "1.8.2",
"description": "The cutest Discord client mod", "description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme", "homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": { "bugs": {

View file

@ -77,7 +77,8 @@ const enum NameFormat {
ArtistFirst = "artist-first", ArtistFirst = "artist-first",
SongFirst = "song-first", SongFirst = "song-first",
ArtistOnly = "artist", ArtistOnly = "artist",
SongOnly = "song" SongOnly = "song",
AlbumName = "album"
} }
const applicationId = "1108588077900898414"; const applicationId = "1108588077900898414";
@ -147,6 +148,10 @@ const settings = definePluginSettings({
{ {
label: "Use song name only", label: "Use song name only",
value: NameFormat.SongOnly 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; return trackData.artist;
case NameFormat.SongOnly: case NameFormat.SongOnly:
return trackData.name; return trackData.name;
case NameFormat.AlbumName:
return trackData.album || settings.store.statusName;
default: default:
return settings.store.statusName; return settings.store.statusName;
} }

View file

@ -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)

View file

@ -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 { findByProps } from "@webpack";
import { Timestamp } from "@webpack/common";
import type { Message } from "discord-types/general";
import type { HTMLAttributes } from "react";
const { getMessageTimestampId } = findByProps("getMessageTimestampId");
const { calendarFormat, dateFormat, isSameDay } = findByProps("calendarFormat", "dateFormat", "isSameDay", "accessibilityLabelCalendarFormat");
const MessageClasses = findByProps("separator", "latin24CompactTimeStamp");
function Sep(props: HTMLAttributes<HTMLElement>) {
return <i className={MessageClasses.separator} aria-hidden={true} {...props} />;
}
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 (
<Timestamp
id={getMessageTimestampId(referencedMessage.message)}
className="vc-reply-timestamp"
compact={isSameDay(refTimestamp, baseTimestamp)}
timestamp={refTimestamp}
isInline={false}
>
<Sep>[</Sep>
{isSameDay(refTimestamp, baseTimestamp)
? dateFormat(refTimestamp, "LT")
: calendarFormat(refTimestamp)
}
<Sep>]</Sep>
</Timestamp>
);
}
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 }),
});

View file

@ -0,0 +1,3 @@
.vc-reply-timestamp {
margin-right: 0.25em;
}

View file

@ -9,3 +9,9 @@ Displays various moderator-only elements regardless of permissions.
- Show the invites paused tooltip in the server list - Show the invites paused tooltip in the server list
![](https://github.com/Vendicated/Vencord/assets/47677887/b6a923d2-ac55-40d9-b4f8-fa6fc117148b) ![](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

View file

@ -31,12 +31,22 @@ const settings = definePluginSettings({
description: "Show the invites paused tooltip in the server list.", description: "Show the invites paused tooltip in the server list.",
default: true, 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"); migratePluginSettings("ShowHiddenThings", "ShowTimeouts");
export default definePlugin({ export default definePlugin({
name: "ShowHiddenThings", name: "ShowHiddenThings",
tags: ["ShowTimeouts", "ShowInvitesPaused"], tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"],
description: "Displays various moderator-only elements regardless of permissions.", description: "Displays various moderator-only elements regardless of permissions.",
authors: [Devs.Dolfies], authors: [Devs.Dolfies],
patches: [ patches: [
@ -55,6 +65,22 @@ export default definePlugin({
match: /\i\.\i\.can\(\i\.Permissions.MANAGE_GUILD,\i\)/, match: /\i\.\i\.can\(\i\.Permissions.MANAGE_GUILD,\i\)/,
replace: "true", 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, settings,

View file

@ -0,0 +1,52 @@
/*
* 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 (
<a
className="vc-voice-download"
href={src}
download="voice-message.ogg"
onClick={e => e.stopPropagation()}
aria-label="Download voice message"
>
<this.Icon />
</a>
);
},
Icon: () => (
<svg
height="24"
width="24"
viewBox="0 0 24 24"
fill="currentColor"
>
<path
d="M12 2a1 1 0 0 1 1 1v10.59l3.3-3.3a1 1 0 1 1 1.4 1.42l-5 5a1 1 0 0 1-1.4 0l-5-5a1 1 0 1 1 1.4-1.42l3.3 3.3V3a1 1 0 0 1 1-1ZM3 20a1 1 0 1 0 0 2h18a1 1 0 1 0 0-2H3Z"
/>
</svg>
),
});

View file

@ -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);
}

View file

@ -430,6 +430,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "newwares", name: "newwares",
id: 421405303951851520n id: 421405303951851520n
}, },
puv: {
name: "puv",
id: 469441552251355137n
},
Kodarru: { Kodarru: {
name: "Kodarru", name: "Kodarru",
id: 785227396218748949n id: 785227396218748949n