Fix Some Bugs

This commit is contained in:
thororen1234 2025-02-02 22:50:39 -05:00
parent 7f4834d967
commit 01d6e7f771
5 changed files with 99 additions and 80 deletions

View file

@ -10,7 +10,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
### Extra included plugins ### Extra included plugins
<details> <details>
<summary>146 additional plugins</summary> <summary>147 additional plugins</summary>
### All Platforms ### All Platforms
- AllCallTimers by MaxHerbold & D3SOX - AllCallTimers by MaxHerbold & D3SOX
@ -91,6 +91,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
- MessagePeek by HypedDomi - MessagePeek by HypedDomi
- MessageTranslate by Samwich - MessageTranslate by Samwich
- MoreStickers by Leko & Arjix - MoreStickers by Leko & Arjix
- MoreThemes by Kyuuhachi
- NeverPausePreviews by vappstar - NeverPausePreviews by vappstar
- NewPluginsManager by Sqaaakoi - NewPluginsManager by Sqaaakoi
- NoAppsAllowed by kvba - NoAppsAllowed by kvba

View file

@ -108,7 +108,7 @@ export default definePlugin({
}, },
{ {
// Emoji category list // Emoji category list
find: "#{intl::EMOJI_CATEGORY_TOP_GUILD_EMOJI}", find: "#{intl::EMOJI_CATEGORY_TOP_GUILD_EMOJI},{guildName:",
replacement: { replacement: {
match: /(?<=(\i)\.unshift\((\i)\):)(?=\1\.push\(\2\))/, match: /(?<=(\i)\.unshift\((\i)\):)(?=\1\.push\(\2\))/,
replace: "$2.isNitroLocked||" replace: "$2.isNitroLocked||"

View file

@ -84,59 +84,71 @@ function BookmarkFolderOpenMenu(props: BookmarkProps) {
onClose={() => FluxDispatcher.dispatch({ type: "CONTEXT_MENU_CLOSE" })} onClose={() => FluxDispatcher.dispatch({ type: "CONTEXT_MENU_CLOSE" })}
aria-label="Bookmark Folder Menu" aria-label="Bookmark Folder Menu"
> >
{bookmark.bookmarks.map((b, i) => <><Menu.MenuItem {bookmark.bookmarks.map((b, i) => (
key={`bookmark-folder-entry-${b.channelId}`} <Menu.MenuItem
id={`bookmark-folder-entry-${b.channelId}`} key={`bookmark-folder-entry-${b.channelId}`}
label={<div style={{ id={`bookmark-folder-entry-${b.channelId}`}
display: "flex", label={
alignItems: "center", <div
gap: "0.25rem" style={{
}}> display: "flex",
<span style={{ overflow: "hidden", textOverflow: "ellipsis" }}> alignItems: "center",
{b.name} gap: "0.25rem"
</span> }}>
{bookmarkNotificationDot && <NotificationDot channelIds={[b.channelId]} />} <span
</div>} style={{
icon={() => <BookmarkIcon bookmark={b} />} overflow: "hidden",
showIconFirst={true} textOverflow: "ellipsis"
action={() => switchChannel(b)} /><span> }}>
( {b.name}
bookmarkNotificationDot && <Menu.MenuGroup> </span>
<Menu.MenuItem {bookmarkNotificationDot && <NotificationDot channelIds={[b.channelId]} />}
key="mark-as-read" </div>
id="mark-as-read" }
label={getIntlMessage("MARK_AS_READ")} icon={() => <BookmarkIcon bookmark={b} />}
disabled={!ReadStateStore.hasUnread(b.channelId)} showIconFirst={true}
action={() => ReadStateUtils.ackChannel(ChannelStore.getChannel(b.channelId))} /> action={() => switchChannel(b)}
</Menu.MenuGroup> >
) {bookmarkNotificationDot && (
</span><span> <Menu.MenuGroup>
<Menu.MenuItem
key="mark-as-read"
id="mark-as-read"
label={getIntlMessage("MARK_AS_READ")}
disabled={!ReadStateStore.hasUnread(b.channelId)}
action={() => ReadStateUtils.ackChannel(ChannelStore.getChannel(b.channelId))}
/>
</Menu.MenuGroup>
)}
<Menu.MenuGroup key="bookmarks"> <Menu.MenuGroup key="bookmarks">
<Menu.MenuItem <Menu.MenuItem
key="edit-bookmark" key="edit-bookmark"
id="edit-bookmark" id="edit-bookmark"
label="Edit Bookmark" label="Edit Bookmark"
action={() => { action={() => {
const key = openModal(modalProps => <EditModal const key = openModal(modalProps =>
modalProps={modalProps} <EditModal
modalKey={key} modalProps={modalProps}
bookmark={b} modalKey={key}
onSave={name => { bookmark={b}
const newBookmarks = [...bookmark.bookmarks]; onSave={name => {
newBookmarks[i].name = name; const newBookmarks = [...bookmark.bookmarks];
methods.editBookmark(index, { bookmarks: newBookmarks }); newBookmarks[i].name = name;
closeModal(key); methods.editBookmark(index, { bookmarks: newBookmarks });
}} /> closeModal(key);
}}
/>
); );
}} /> }}
/>
<Menu.MenuItem <Menu.MenuItem
key="delete-bookmark" key="delete-bookmark"
id="delete-bookmark" id="delete-bookmark"
label="Delete Bookmark" label="Delete Bookmark"
action={() => { action={() => {
methods.deleteBookmark(i, index); methods.deleteBookmark(i, index);
}} /> }}
/>
<Menu.MenuItem <Menu.MenuItem
key="remove-bookmark-from-folder" key="remove-bookmark-from-folder"
id="remove-bookmark-from-folder" id="remove-bookmark-from-folder"
@ -144,14 +156,14 @@ function BookmarkFolderOpenMenu(props: BookmarkProps) {
action={() => { action={() => {
const newBookmarks = [...bookmark.bookmarks]; const newBookmarks = [...bookmark.bookmarks];
newBookmarks.splice(i, 1); newBookmarks.splice(i, 1);
methods.addBookmark(b); methods.addBookmark(b);
methods.editBookmark(index, { bookmarks: newBookmarks }); methods.editBookmark(index, { bookmarks: newBookmarks });
}} /> }}
/>
</Menu.MenuGroup> </Menu.MenuGroup>
</span> </Menu.MenuItem>
</>)} ))}
</Menu.Menu > </Menu.Menu>
); );
} }

View file

@ -1,6 +1,6 @@
/* /*
* Vencord, a Discord client mod * Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors * Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
@ -10,35 +10,10 @@ import { definePluginSettings } from "@api/Settings";
import { getUserSettingLazy } from "@api/UserSettings"; import { getUserSettingLazy } from "@api/UserSettings";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { proxyLazy } from "@utils/lazy";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findComponentByCodeLazy } from "@webpack"; import { findComponentByCodeLazy } from "@webpack";
import { ChannelStore, Constants, Forms, MessageStore, RestAPI, Tooltip, useEffect, useState, useStateFromStores } from "@webpack/common"; import { ChannelStore, Constants, MessageStore, RestAPI, Tooltip, useEffect, useState, useStateFromStores } from "@webpack/common";
import type { ComponentType, HTMLAttributes } from "react"; import type { ComponentType } from "react";
declare enum SpinnerTypes {
WANDERING_CUBES = "wanderingCubes",
CHASING_DOTS = "chasingDots",
PULSING_ELLIPSIS = "pulsingEllipsis",
SPINNING_CIRCLE = "spinningCircle",
SPINNING_CIRCLE_SIMPLE = "spinningCircleSimple",
LOW_MOTION = "lowMotion",
}
type Spinner = ComponentType<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
type?: SpinnerTypes;
animated?: boolean;
className?: string;
itemClassName?: string;
"aria-label"?: string;
}> & {
Type: typeof SpinnerTypes;
};
const { Spinner } = proxyLazy(() => Forms as any as {
Spinner: Spinner,
SpinnerTypes: typeof SpinnerTypes;
});
const MessageDisplayCompact = getUserSettingLazy("textAndImages", "messageDisplayCompact")!; const MessageDisplayCompact = getUserSettingLazy("textAndImages", "messageDisplayCompact")!;
@ -104,7 +79,7 @@ export default definePlugin({
find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}", find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}",
replacement: { replacement: {
// Should match two places // Should match two places
match: /(\i\.clickable),\{/g, match: /(\i\.\i),\{(?=className:\i\(\)\(\i\.repliedTextPreview,\i\.clickable)/g,
replace: "$self.ReplyTooltip,{Component:$1,vcProps:arguments[0]," replace: "$self.ReplyTooltip,{Component:$1,vcProps:arguments[0],"
}, },
predicate: () => settings.store.onReply, predicate: () => settings.store.onReply,
@ -112,8 +87,8 @@ export default definePlugin({
{ {
find: "#{intl::MESSAGE_FORWARDED}", find: "#{intl::MESSAGE_FORWARDED}",
replacement: { replacement: {
match: /(null:.{0,20})(\i\.\i\i),\{/, match: /(\i\.\i),\{(?=className:\i\.footerContainer)/g,
replace: "$1$self.ForwardTooltip,{Component:$2,vcProps:arguments[0]," replace: "$self.ForwardTooltip,{Component:$1,vcProps:arguments[0],"
}, },
predicate: () => settings.store.onForward, predicate: () => settings.store.onForward,
}, },
@ -159,9 +134,8 @@ function MessagePreview({ channelId, messageId }) {
const compact = settings.store.display === "compact" ? true : settings.store.display === "cozy" ? false : rawCompact; const compact = settings.store.display === "compact" ? true : settings.store.display === "cozy" ? false : rawCompact;
// TODO handle load failure
if (!message) { if (!message) {
return <Spinner type={Spinner.Type.PULSING_ELLIPSIS} />; return <span>Loading...</span>;
} }
return <ChannelMessage return <ChannelMessage

View file

@ -0,0 +1,32 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "MoreThemes",
description: "Enables Darker and Midnight themes",
authors: [Devs.Kyuuhachi],
patches: [
{ // matches twice: the settings menu and the settings context menu
find: '("appearance_settings")',
replacement: {
match: /\("appearance_settings"\)/,
replace: "$&||true"
},
all: true,
},
{ // make it actually save the setting instead of falling back to dark
find: ')("ThemeStore"))return',
replacement: {
match: /(?<=\)\("ThemeStore"\))(?=\)return)/,
replace: "&&false"
},
}
],
});