Merge branch 'dev' into CopyEmojiMarkdown

This commit is contained in:
vishnyanetchereshnya 2024-06-12 16:42:52 +03:00 committed by GitHub
commit dff95acdc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 39 additions and 9 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "vencord", "name": "vencord",
"private": "true", "private": "true",
"version": "1.8.8", "version": "1.8.9",
"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

@ -16,12 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { definePluginSettings } from "@api/Settings";
import { disableStyle, enableStyle } from "@api/Styles"; import { disableStyle, enableStyle } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { ErrorCard } from "@components/ErrorCard"; import { ErrorCard } from "@components/ErrorCard";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { Margins } from "@utils/margins"; import { Margins } from "@utils/margins";
import definePlugin from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
import { Forms, React } from "@webpack/common"; import { Forms, React } from "@webpack/common";
@ -29,6 +30,15 @@ import hideBugReport from "./hideBugReport.css?managed";
const KbdStyles = findByPropsLazy("key", "removeBuildOverride"); const KbdStyles = findByPropsLazy("key", "removeBuildOverride");
const settings = definePluginSettings({
toolbarDevMenu: {
type: OptionType.BOOLEAN,
description: "Change the Help (?) toolbar button (top right in chat) to Discord's developer menu",
default: false,
restartNeeded: true
}
});
export default definePlugin({ export default definePlugin({
name: "Experiments", name: "Experiments",
description: "Enable Access to Experiments & other dev-only features in Discord!", description: "Enable Access to Experiments & other dev-only features in Discord!",
@ -40,6 +50,8 @@ export default definePlugin({
Devs.Nuckyz Devs.Nuckyz
], ],
settings,
patches: [ patches: [
{ {
find: "Object.defineProperties(this,{isDeveloper", find: "Object.defineProperties(this,{isDeveloper",
@ -68,6 +80,16 @@ export default definePlugin({
replacement: { replacement: {
match: /\i\.isStaff\(\)/, match: /\i\.isStaff\(\)/,
replace: "true" replace: "true"
},
predicate: () => settings.store.toolbarDevMenu
},
// makes the Favourites Server experiment allow favouriting DMs and threads
{
find: "useCanFavoriteChannel",
replacement: {
match: /!\(\i\.isDM\(\)\|\|\i\.isThread\(\)\)/,
replace: "true",
} }
} }
], ],

View file

@ -338,7 +338,7 @@ export default definePlugin({
{ {
// Call our function to decide whether the embed should be ignored or not // Call our function to decide whether the embed should be ignored or not
predicate: () => settings.store.transformEmojis || settings.store.transformStickers, predicate: () => settings.store.transformEmojis || settings.store.transformStickers,
match: /(renderEmbeds\((\i)\){)(.+?embeds\.map\((\i)=>{)/, match: /(renderEmbeds\((\i)\){)(.+?embeds\.map\(\(?(\i)(?:,\i\))?=>{)/,
replace: (_, rest1, message, rest2, embed) => `${rest1}const fakeNitroMessage=${message};${rest2}if($self.shouldIgnoreEmbed(${embed},fakeNitroMessage))return null;` replace: (_, rest1, message, rest2, embed) => `${rest1}const fakeNitroMessage=${message};${rest2}if($self.shouldIgnoreEmbed(${embed},fakeNitroMessage))return null;`
}, },
{ {

View file

@ -281,6 +281,8 @@ function getChannelLabelAndIconUrl(channel: Channel) {
} }
function ChannelMessageEmbedAccessory({ message, channel }: MessageEmbedProps): JSX.Element | null { function ChannelMessageEmbedAccessory({ message, channel }: MessageEmbedProps): JSX.Element | null {
const compact = TextAndImagesSettingsStores.MessageDisplayCompact.useSetting();
const dmReceiver = UserStore.getUser(ChannelStore.getChannel(channel.id).recipients?.[0]); const dmReceiver = UserStore.getUser(ChannelStore.getChannel(channel.id).recipients?.[0]);
const [channelLabel, iconUrl] = getChannelLabelAndIconUrl(channel); const [channelLabel, iconUrl] = getChannelLabelAndIconUrl(channel);
@ -305,6 +307,7 @@ function ChannelMessageEmbedAccessory({ message, channel }: MessageEmbedProps):
message={message} message={message}
channel={channel} channel={channel}
subscribeToComponentDispatch={false} subscribeToComponentDispatch={false}
compact={compact}
/> />
</div> </div>
)} )}

View file

@ -302,7 +302,7 @@ export default definePlugin({
replace: "$1" + replace: "$1" +
".update($3,m =>" + ".update($3,m =>" +
" (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message, true)) ? m :" + " (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message, true)) ? m :" +
" $2.message.content !== m.editHistory?.[0]?.content && $2.message.content !== m.content ?" + " $2.message.edited_timestamp && $2.message.content !== m.content ?" +
" m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($2.message, m)]) :" + " m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($2.message, m)]) :" +
" m" + " m" +
")" + ")" +

View file

@ -6,7 +6,7 @@
import { classNameFactory } from "@api/Styles"; import { classNameFactory } from "@api/Styles";
import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModalLazy } from "@utils/modal"; import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModalLazy } from "@utils/modal";
import { extractAndLoadChunksLazy, findComponentByCodeLazy } from "@webpack"; import { extractAndLoadChunksLazy, filters, find, findComponentByCode, findComponentByCodeLazy, LazyComponentWebpack } from "@webpack";
import { Button, Forms, Text, TextInput, Toasts, useEffect, useState } from "@webpack/common"; import { Button, Forms, Text, TextInput, Toasts, useEffect, useState } from "@webpack/common";
import { DEFAULT_COLOR, SWATCHES } from "../constants"; import { DEFAULT_COLOR, SWATCHES } from "../constants";
@ -31,7 +31,12 @@ interface ColorPickerWithSwatchesProps {
} }
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)"); const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
const ColorPickerWithSwatches = findComponentByCodeLazy<ColorPickerWithSwatchesProps>("presets,", "customColor:"); // FIXME: Replace with the following when it reaches stable
// const ColorPickerWithSwatches = findExportedComponentLazy<ColorPickerWithSwatchesProps>("ColorPicker", "CustomColorPicker");
const ColorPickerWithSwatches = LazyComponentWebpack<ColorPickerWithSwatchesProps>(() =>
find(filters.byProps("ColorPicker", "CustomColorPicker"), { isIndirect: true })?.ColorPicker ||
findComponentByCode("presets,", "customColor:")
);
export const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}Promise\.all\((\[\i\.\i\(".+?"\).+?\])\).then\(\i\.bind\(\i,"(.+?)"\)\).{0,50}"UserSettings"/); export const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}Promise\.all\((\[\i\.\i\(".+?"\).+?\])\).then\(\i\.bind\(\i,"(.+?)"\)\).{0,50}"UserSettings"/);

View file

@ -184,7 +184,7 @@ export default definePlugin({
patches: [ patches: [
// Profiles Modal pfp // Profiles Modal pfp
...["User Profile Modal - Context Menu", ".UserProfileTypes.FULL_SIZE,hasProfileEffect:"].map(find => ({ ...[".UserProfileTypes.MODAL,hasProfileEffect", ".UserProfileTypes.FULL_SIZE,hasProfileEffect:"].map(find => ({
find, find,
replacement: { replacement: {
match: /\{src:(\i)(?=,avatarDecoration)/, match: /\{src:(\i)(?=,avatarDecoration)/,

View file

@ -38,7 +38,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({
id: 0n, id: 0n,
}, },
Ven: { Ven: {
name: "Vendicated", name: "Vee",
id: 343383572805058560n id: 343383572805058560n
}, },
Arjix: { Arjix: {
@ -327,7 +327,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({
id: 305288513941667851n id: 305288513941667851n
}, },
ImLvna: { ImLvna: {
name: "Luna <3", name: "lillith <3",
id: 799319081723232267n id: 799319081723232267n
}, },
rad: { rad: {