Some Fixes

This commit is contained in:
thororen1234 2024-06-19 12:44:47 -04:00
parent 7adcfaa735
commit 319a058286
9 changed files with 37 additions and 176 deletions

View file

@ -21,7 +21,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
- Request for plugins from Discord. - Request for plugins from Discord.
<details> <details>
<summary>Extra included plugins (64 additional plugins)</summary> <summary>Extra included plugins (62 additional plugins)</summary>
- AllCallTimers by MaxHerbold and D3SOX - AllCallTimers by MaxHerbold and D3SOX
- AltKrispSwitch by newwares - AltKrispSwitch by newwares
@ -29,7 +29,6 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
- BetterActivities by D3SOX, Arjix, AutumnVN - BetterActivities by D3SOX, Arjix, AutumnVN
- BetterQuests by kvba - BetterQuests by kvba
- BetterQuickReact by Ven and Sqaaakoi - BetterQuickReact by Ven and Sqaaakoi
- BetterShopPreview by Tolgchu
- BlockKrsip by D3SOX - BlockKrsip by D3SOX
- BypassDND by Inbestigator - BypassDND by Inbestigator
- CleanChannelName by AutumnVN - CleanChannelName by AutumnVN
@ -78,7 +77,6 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
- SoundBoardLogger by Moxxie, fres, echo, thororen - SoundBoardLogger by Moxxie, fres, echo, thororen
- TalkInReverse by Tolgchu - TalkInReverse by Tolgchu
- ThemeLibrary by Fafa - ThemeLibrary by Fafa
- Title by Kyuuhachi
- UnlimitedAccounts by Balaclava and thororen - UnlimitedAccounts by Balaclava and thororen
- UserPFP by nexpid and thororen - UserPFP by nexpid and thororen
- VCSupport by thororen - VCSupport by thororen

View file

@ -246,9 +246,9 @@ export default definePlugin({
patches: [ patches: [
{ {
// Patch activity icons // Patch activity icons
find: "default.getHangStatusActivity():null!", find: ".getHangStatusActivity():null!",
replacement: { replacement: {
match: /null!=(\i)&&\i.some\(\i=>\(0,\i.default\)\(\i,\i\)\)\?/, match: /null!=(\i)&&\i.some\(\i=>\(0,\i.\i\)\(\i,\i\)\)\?/,
replace: "$self.patchActivityList(e),false?" replace: "$self.patchActivityList(e),false?"
}, },
predicate: () => settings.store.memberList, predicate: () => settings.store.memberList,

View file

@ -58,35 +58,33 @@ export default definePlugin({
replace: "($self.settings.store.frequentEmojis?[]:$1).concat" replace: "($self.settings.store.frequentEmojis?[]:$1).concat"
} }
}, },
// Override limit of emojis to display
{ {
find: "default.Messages.ADD_REACTION_NAMED.format", find: ".ADD_REACTION_NAMED.format",
replacement: { group: true,
match: /(\i)\.length>4&&\((\i)\.length=4\);/, replacement: [
replace: "let [betterQuickReactScrollValue,setBetterQuickReactScrollValue]=Vencord.Webpack.Common.React.useState(0);betterQuickReactScrollValue;" // Override limit of emojis to display with offset hook.
} {
}, match: /(\i)\.length>4&&\((\i)\.length=4\);/,
// Add a custom class to identify the quick reactions have been modified and a CSS variable for the number of columns to display replace: "let [betterQuickReactScrollValue,setBetterQuickReactScrollValue]=Vencord.Webpack.Common.React.useState(0);betterQuickReactScrollValue;"
{ },
find: "default.Messages.ADD_REACTION_NAMED.format", // Add a custom class to identify the quick reactions have been modified and a CSS variable for the number of columns to display
replacement: { {
match: /className:(\i)\.wrapper,/, match: /className:(\i)\.wrapper,/,
replace: "className:\"vc-better-quick-react \"+($self.settings.store.compactMode?\"vc-better-quick-react-compact \":\"\")+$1.wrapper,style:{\"--vc-better-quick-react-columns\":$self.settings.store.columns}," replace: "className:\"vc-better-quick-react \"+($self.settings.store.compactMode?\"vc-better-quick-react-compact \":\"\")+$1.wrapper,style:{\"--vc-better-quick-react-columns\":$self.settings.store.columns},"
} },
}, // Scroll handler + Apply the emoji count limit from earlier with custom logic
{ {
find: "default.Messages.ADD_REACTION_NAMED.format", match: /children:(\i)\.map\(/,
replacement: { replace: "onWheel:$self.onWheelWrapper(betterQuickReactScrollValue,setBetterQuickReactScrollValue,$1.length),children:$self.applyScroll($1,betterQuickReactScrollValue).map("
match: /children:(\i)\.map\(/, }
replace: "onWheel:$self.onWheelWrapper(betterQuickReactScrollValue,setBetterQuickReactScrollValue,$1.length),children:$self.applyScroll($1,betterQuickReactScrollValue).map(" ]
}
}, },
// MenuGroup doesn't accept styles or anything special by default :/ // MenuGroup doesn't accept styles or anything special by default :/
{ {
find: "{MenuGroup:function()", find: ".groupLabel,",
replacement: { replacement: {
match: /role:"group",/, match: /role:"group",/,
replace: "role:\"group\",style:arguments[0].style,onWheel:arguments[0].onWheel," replace: "$&style:arguments[0].style,onWheel:arguments[0].onWheel,"
} }
} }
], ],

View file

@ -1,88 +0,0 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { UserStore, useState } from "@webpack/common";
let avatarUrl = "";
const settings = definePluginSettings({
default: {
type: OptionType.BOOLEAN,
description: "Enable avatar preview by default.",
default: true
}
});
function toggle(enabled: boolean) {
const avatars = document.querySelectorAll(".shopCard__3d319 .avatarContainer_e11d35 .wrapper__3ed10 .mask_d5067d foreignObject .avatarStack__789b4");
for (const avatar of avatars) {
const img = avatar.querySelector("img");
if (img) img.src = enabled ? avatarUrl : "https://canary.discord.com/assets/6d8f0708e196aaad2550.png";
}
}
const PreviewToggle = () => {
const [enabled, setEnabled] = useState(settings.store.default);
toggle(enabled);
return (
<button type="button" className="fieldButton__1edf0 button__581d0 lookFilled__950dd colorPrimary_ebe632 sizeSmall_da7d10 grow__4c8a4" style={{
marginLeft: "8px"
}} onClick={() => {
setEnabled(!enabled);
toggle(!enabled);
}}>
<div className="contents__322f4">
{enabled ? "Disable" : "Enable"} Avatar Preview
</div>
</button>
);
};
export default definePlugin({
name: "Better Shop Preview",
description: "Uses your avatar for avatar decoration previews in the Discord Shop (without hovering).",
authors: [EquicordDevs.Tolgchu],
settings,
patches: [
{
find: ".Messages.COLLECTIBLES_SHOP})]}",
replacement: [{
match: /(children:\i.default.Messages.COLLECTIBLES_SHOP)}/,
replace: "$&,$self.PreviewToggle()"
}]
}
],
PreviewToggle,
async start() {
const user = UserStore.getCurrentUser();
const url = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.gif`;
await fetch(url).then(response => {
if (response.ok) avatarUrl = url;
else avatarUrl = url.replace(".gif", ".png");
});
},
stop() { }
});

View file

@ -16,7 +16,7 @@ export default definePlugin({
{ {
find: "Failed to load Krisp module", find: "Failed to load Krisp module",
replacement: { replacement: {
match: /await (\i).default.ensureModule\("discord_krisp"\)/, match: /await \i.\i.ensureModule\("discord_krisp"\)/,
replace: "throw new Error();$&" replace: "throw new Error();$&"
} }
}, },
@ -24,7 +24,7 @@ export default definePlugin({
{ {
find: "krisp_browser_models", find: "krisp_browser_models",
replacement: { replacement: {
match: /getKrispSDK:function\(\)\{/, match: /\i:function\(\)\{/,
replace: "$&return null;" replace: "$&return null;"
} }
}, },

View file

@ -23,7 +23,7 @@ let currentUser: User;
let keywordLog: Array<any> = []; let keywordLog: Array<any> = [];
const MenuHeader = findByCodeLazy(".useInDesktopNotificationCenterExperiment)()?"); const MenuHeader = findByCodeLazy(".useInDesktopNotificationCenterExperiment)()?");
const Popout = findByPropsLazy("ItemsPopout"); const Popout = findByCodeLazy("let{analyticsName:");
const recentMentionsPopoutClass = findByPropsLazy("recentMentionsPopout"); const recentMentionsPopoutClass = findByPropsLazy("recentMentionsPopout");
const KEYWORD_ENTRIES_KEY = "KeywordNotify_keywordEntries"; const KEYWORD_ENTRIES_KEY = "KeywordNotify_keywordEntries";
const KEYWORD_LOG_KEY = "KeywordNotify_log"; const KEYWORD_LOG_KEY = "KeywordNotify_log";
@ -92,7 +92,7 @@ function Collapsible({ title, children }) {
size={Button.Sizes.ICON} size={Button.Sizes.ICON}
className="keywordnotify-collapsible"> className="keywordnotify-collapsible">
<div style={{ display: "flex", alignItems: "center" }}> <div style={{ display: "flex", alignItems: "center" }}>
<div style={{ marginLeft: "auto", color: "var(--text-muted)" }}>{isOpen ? "▲" : "▼"}</div> <div style={{ marginLeft: "auto", color: "var(--text-muted)", paddingRight: "5px" }}>{isOpen ? "▼" : "▶"}</div>
<Forms.FormTitle tag="h4">{title}</Forms.FormTitle> <Forms.FormTitle tag="h4">{title}</Forms.FormTitle>
</div> </div>
</Button> </Button>
@ -393,6 +393,7 @@ export default definePlugin({
}; };
const messageRender = (e, t) => { const messageRender = (e, t) => {
console.log(this);
const msg = this.renderMsg({ const msg = this.renderMsg({
message: e, message: e,
gotoMessage: t, gotoMessage: t,
@ -410,9 +411,15 @@ export default definePlugin({
return [msg]; return [msg];
}; };
/* return (
<>
<p>hi uwu</p>
</>
);*/
return ( return (
<> <>
<Popout.default <Popout
className={recentMentionsPopoutClass.recentMentionsPopout} className={recentMentionsPopoutClass.recentMentionsPopout}
renderHeader={() => header} renderHeader={() => header}
renderMessage={messageRender} renderMessage={messageRender}

View file

@ -20,7 +20,7 @@ export default definePlugin({
} }
}, },
{ {
find: "{BackdropStyles:function(){", find: 'backdropFilter:"blur(0px)"',
replacement: { replacement: {
match: /\?0:300/, match: /\?0:300/,
replace: "?0:0", replace: "?0:0",

View file

@ -1,50 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";
const TitleManager = findByPropsLazy("setPageTitleNotificationCount", "flashPageTitle");
const rootTitle = { base: null as string | null };
export const settings = definePluginSettings({
title: {
type: OptionType.STRING,
default: "Vencord",
description: "Window title prefix",
onChange: setTitle,
},
});
function setTitle(v: string) {
rootTitle.base = v || null;
TitleManager.flashPageTitle({ messages: 0 })();
}
export default definePlugin({
name: "Title",
description: "Replaces the window title prefix",
authors: [Devs.Kyuuhachi],
settings,
patches: [
{
find: "setPageTitleNotificationCount:function()",
replacement: {
match: /(?<==)(?={base:)/,
replace: "$self.rootTitle??",
},
},
],
start() {
setTitle(settings.store.title);
},
rootTitle,
});

View file

@ -56,10 +56,6 @@ export default definePlugin({
{ {
match: /(getUserAvatarURL:)(\i),/, match: /(getUserAvatarURL:)(\i),/,
replace: "$1$self.getAvatarHook($2)," replace: "$1$self.getAvatarHook($2),"
},
{
match: /(getUserAvatarURL:\i\(\){return )(\i)}/,
replace: "$1$self.getAvatarHook($2)}"
} }
] ]
} }