second batch of fixes (#2596)
Co-authored-by: programminglaboratorys <107296738+programminglaboratorys@users.noreply.github.com> Co-authored-by: Haruka <personal@shiroko.me> Co-authored-by: Amia <9750071+aamiaa@users.noreply.github.com> Co-authored-by: AutumnVN <autumnvnchino@gmail.com> Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
This commit is contained in:
parent
d6f1209438
commit
d19b0aeb5b
20 changed files with 58 additions and 63 deletions
|
@ -15,8 +15,8 @@ export default definePlugin({
|
|||
patches: [{
|
||||
find: '"sticker")',
|
||||
replacement: {
|
||||
match: /!\i\.isMobile(?=.+?(\i)\.push\(.{0,50}"gift")/,
|
||||
replace: "$& &&(Vencord.Api.ChatButtons._injectButtons($1,arguments[0]),true)"
|
||||
match: /return\(!\i\.\i&&(?=\(\i\.isDM.+?(\i)\.push\(.{0,50}"gift")/,
|
||||
replace: "$&(Vencord.Api.ChatButtons._injectButtons($1,arguments[0]),true)&&"
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ export default definePlugin({
|
|||
replacement: {
|
||||
// props.chatInputType...then((function(isMessageValid)... var parsedMessage = b.c.parse(channel,... var replyOptions = f.g.getSendMessageOptionsForReply(pendingReply);
|
||||
// Lookbehind: validateMessage)({openWarningPopout:..., type: i.props.chatInputType, content: t, stickers: r, ...}).then((function(isMessageValid)
|
||||
match: /(type:this\.props\.chatInputType.+?\.then\()(\i=>\{.+?let (\i)=\i\.\i\.parse\((\i),.+?let (\i)=\i\.\i\.getSendMessageOptionsForReply\(\i\);)(?<=\)\(({.+?})\)\.then.+?)/,
|
||||
match: /(type:this\.props\.chatInputType.+?\.then\()(\i=>\{.+?let (\i)=\i\.\i\.parse\((\i),.+?let (\i)=\i\.\i\.\i\(\i\);)(?<=\)\(({.+?})\)\.then.+?)/,
|
||||
// props.chatInputType...then((async function(isMessageValid)... var replyOptions = f.g.getSendMessageOptionsForReply(pendingReply); if(await Vencord.api...) return { shoudClear:true, shouldRefocus:true };
|
||||
replace: (_, rest1, rest2, parsedMessage, channel, replyOptions, extra) => "" +
|
||||
`${rest1}async ${rest2}` +
|
||||
|
|
|
@ -27,7 +27,7 @@ export default definePlugin({
|
|||
{
|
||||
find: "BAN_CONFIRM_TITLE.",
|
||||
replacement: {
|
||||
match: /src:\i\("\d+"\)/g,
|
||||
match: /src:\i\(\d+\)/g,
|
||||
replace: "src: Vencord.Settings.plugins.BANger.source"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByPropsLazy, findStoreLazy } from "@webpack";
|
||||
import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
|
||||
import { FluxDispatcher, i18n, useMemo } from "@webpack/common";
|
||||
|
||||
import FolderSideBar from "./FolderSideBar";
|
||||
|
@ -30,7 +30,7 @@ enum FolderIconDisplay {
|
|||
MoreThanOneFolderExpanded
|
||||
}
|
||||
|
||||
const { GuildsTree } = findByPropsLazy("GuildsTree");
|
||||
const GuildsTree = findLazy(m => m.prototype?.moveNextTo);
|
||||
const SortedGuildStore = findStoreLazy("SortedGuildStore");
|
||||
export const ExpandedGuildFolderStore = findStoreLazy("ExpandedGuildFolderStore");
|
||||
const FolderUtils = findByPropsLazy("move", "toggleGuildFolderExpand");
|
||||
|
@ -117,7 +117,7 @@ export default definePlugin({
|
|||
},
|
||||
// If we are rendering the Better Folders sidebar, we filter out guilds that are not in folders and unexpanded folders
|
||||
{
|
||||
match: /\[(\i)\]=(\(0,\i\.useStateFromStoresArray\).{0,40}getGuildsTree\(\).+?}\))(?=,)/,
|
||||
match: /\[(\i)\]=(\(0,\i\.\i\).{0,40}getGuildsTree\(\).+?}\))(?=,)/,
|
||||
replace: (_, originalTreeVar, rest) => `[betterFoldersOriginalTree]=${rest},${originalTreeVar}=$self.getGuildTree(!!arguments[0].isBetterFolders,betterFoldersOriginalTree,arguments[0].betterFoldersExpandedIds)`
|
||||
},
|
||||
// If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children
|
||||
|
@ -139,12 +139,12 @@ export default definePlugin({
|
|||
},
|
||||
{
|
||||
// This is the parent folder component
|
||||
find: ".MAX_GUILD_FOLDER_NAME_LENGTH,",
|
||||
find: ".toggleGuildFolderExpand(",
|
||||
predicate: () => settings.store.sidebar && settings.store.showFolderIcon !== FolderIconDisplay.Always,
|
||||
replacement: [
|
||||
{
|
||||
// Modify the expanded state to instead return the list of expanded folders
|
||||
match: /(useStateFromStores\).{0,20}=>)(\i\.\i)\.isFolderExpanded\(\i\)/,
|
||||
match: /(\i\).{0,20}=>)(\i\.\i)\.isFolderExpanded\(\i\)/,
|
||||
replace: (_, rest, ExpandedGuildFolderStore) => `${rest}${ExpandedGuildFolderStore}.getExpandedFolders()`,
|
||||
},
|
||||
{
|
||||
|
@ -196,7 +196,7 @@ export default definePlugin({
|
|||
]
|
||||
},
|
||||
{
|
||||
find: "APPLICATION_LIBRARY,render",
|
||||
find: "APPLICATION_LIBRARY,render:",
|
||||
predicate: () => settings.store.sidebar,
|
||||
replacement: {
|
||||
// Render the Better Folders sidebar
|
||||
|
|
|
@ -13,7 +13,7 @@ export default definePlugin({
|
|||
authors: [Devs.Samwich],
|
||||
patches: [
|
||||
{
|
||||
find: ".GIFPickerResultTypes.SEARCH",
|
||||
find: '"state",{resultType:',
|
||||
replacement: [{
|
||||
match: /(?<="state",{resultType:)null/,
|
||||
replace: '"Favorites"'
|
||||
|
|
|
@ -40,9 +40,9 @@ export default definePlugin({
|
|||
}),
|
||||
patches: [
|
||||
{
|
||||
find: "KeyboardKeys.ENTER&&(!",
|
||||
find: ".ENTER&&(!",
|
||||
replacement: {
|
||||
match: /(?<=(\i)\.which===\i\.KeyboardKeys.ENTER&&).{0,100}(\(0,\i\.hasOpenPlainTextCodeBlock\)\(\i\)).{0,100}(?=&&\(\i\.preventDefault)/,
|
||||
match: /(?<=(\i)\.which===\i\.\i.ENTER&&).{0,100}(\(0,\i\.\i\)\(\i\)).{0,100}(?=&&\(\i\.preventDefault)/,
|
||||
replace: "$self.shouldSubmit($1, $2)"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import "./ui/styles.css";
|
|||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { UserStore } from "@webpack/common";
|
||||
|
||||
import { CDN_URL, RAW_SKU_ID, SKU_ID } from "./lib/constants";
|
||||
|
@ -20,7 +19,6 @@ import { settings } from "./settings";
|
|||
import { setDecorationGridDecoration, setDecorationGridItem } from "./ui/components";
|
||||
import DecorSection from "./ui/components/DecorSection";
|
||||
|
||||
const { isAnimatedAvatarDecoration } = findByPropsLazy("isAnimatedAvatarDecoration");
|
||||
export interface AvatarDecoration {
|
||||
asset: string;
|
||||
skuId: string;
|
||||
|
@ -61,7 +59,7 @@ export default definePlugin({
|
|||
},
|
||||
// Remove NEW label from decor avatar decorations
|
||||
{
|
||||
match: /(?<=\.Section\.PREMIUM_PURCHASE&&\i)(?<=avatarDecoration:(\i).+?)/,
|
||||
match: /(?<=\.\i\.PREMIUM_PURCHASE&&\i)(?<=avatarDecoration:(\i).+?)/,
|
||||
replace: "||$1.skuId===$self.SKU_ID"
|
||||
}
|
||||
]
|
||||
|
@ -93,7 +91,7 @@ export default definePlugin({
|
|||
replacement: [
|
||||
// Use Decor avatar decoration hook
|
||||
{
|
||||
match: /(?<=getAvatarDecorationURL\)\({avatarDecoration:)(\i).avatarDecoration(?=,)/,
|
||||
match: /(?<=\i\)\({avatarDecoration:)(\i).avatarDecoration(?=,)/,
|
||||
replace: "$self.useUserDecorAvatarDecoration($1)??$&"
|
||||
}
|
||||
]
|
||||
|
@ -133,7 +131,7 @@ export default definePlugin({
|
|||
if (avatarDecoration?.skuId === SKU_ID) {
|
||||
const parts = avatarDecoration.asset.split("_");
|
||||
// Remove a_ prefix if it's animated and animation is disabled
|
||||
if (isAnimatedAvatarDecoration(avatarDecoration.asset) && !canAnimate) parts.shift();
|
||||
if (avatarDecoration.asset.startsWith("a_") && !canAnimate) parts.shift();
|
||||
return `${CDN_URL}/${parts.join("_")}.png`;
|
||||
} else if (avatarDecoration?.skuId === RAW_SKU_ID) {
|
||||
return avatarDecoration.asset;
|
||||
|
|
|
@ -29,7 +29,7 @@ export default definePlugin({
|
|||
{
|
||||
find: ".Messages.BOT_CALL_IDLE_DISCONNECT",
|
||||
replacement: {
|
||||
match: /,?(?=\i\(this,"idleTimeout",new \i\.Timeout\))/,
|
||||
match: /,?(?=\i\(this,"idleTimeout",new \i\.\i\))/,
|
||||
replace: ";return;"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -50,7 +50,7 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
{
|
||||
find: "MAX_AUTOCOMPLETE_RESULTS+",
|
||||
find: "numLockedEmojiResults:",
|
||||
replacement: [
|
||||
// set maxCount to Infinity so our sortEmojis callback gets the entire list, not just the first 10
|
||||
// and remove Discord's emojiResult slice, storing the endIndex on the array for us to use later
|
||||
|
|
|
@ -44,13 +44,8 @@ const pluginsValues = Object.values(Plugins);
|
|||
const settings = Settings.plugins;
|
||||
|
||||
const forceDisabled = new Set([
|
||||
"MessageLogger",
|
||||
"ShowHiddenChannels",
|
||||
"MoreUserTags",
|
||||
"Decor",
|
||||
"IgnoreActivities",
|
||||
"NoBlockedMessages",
|
||||
"BetterFolders"
|
||||
"MoreUserTags"
|
||||
]);
|
||||
export function isPluginEnabled(p: string) {
|
||||
return (
|
||||
|
|
|
@ -16,13 +16,15 @@ export default definePlugin({
|
|||
name: "MaskedLinkPaste",
|
||||
authors: [Devs.TheSun],
|
||||
description: "Pasting a link while having text selected will paste a hyperlink",
|
||||
patches: [{
|
||||
patches: [
|
||||
{
|
||||
find: ".selection,preventEmojiSurrogates:",
|
||||
replacement: {
|
||||
match: /(?<=SlateTransforms.delete.{0,50})(\i)\.insertText\((\i)\)/,
|
||||
match: /(?<=\i.delete.{0,50})(\i)\.insertText\((\i)\)/,
|
||||
replace: "$self.handlePaste($1, $2, () => $&)"
|
||||
}
|
||||
}],
|
||||
}
|
||||
],
|
||||
|
||||
handlePaste(editor, content: string, originalBehavior: () => void) {
|
||||
if (content && linkRegex.test(content) && editor.operations?.[0]?.type === "remove_text") {
|
||||
|
|
|
@ -18,8 +18,10 @@
|
|||
|
||||
import { Settings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { Message } from "discord-types/general";
|
||||
|
||||
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
|
||||
|
||||
|
@ -59,6 +61,12 @@ export default definePlugin({
|
|||
restartNeeded: true,
|
||||
},
|
||||
},
|
||||
isBlocked: message =>
|
||||
RelationshipStore.isBlocked(message.author.id)
|
||||
|
||||
isBlocked(message: Message) {
|
||||
try {
|
||||
return RelationshipStore.isBlocked(message.author.id);
|
||||
} catch (e) {
|
||||
new Logger("NoBlockedMessages").error("Failed to check if user is blocked:", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: "HangStatusTypes.CHILLING)",
|
||||
find: ".CHILLING)",
|
||||
replacement: {
|
||||
match: /{enableHangStatus:(\i),/,
|
||||
replace: "{_enableHangStatus:$1=false,"
|
||||
|
|
|
@ -27,7 +27,7 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: "isGroupableMedia:function()",
|
||||
find: '=>"IMAGE"===',
|
||||
replacement: {
|
||||
match: /=>"IMAGE"===\i\|\|"VIDEO"===\i;/,
|
||||
replace: "=>false;"
|
||||
|
|
|
@ -63,8 +63,8 @@ export default definePlugin({
|
|||
{
|
||||
find: "trackAnnouncementMessageLinkClicked({",
|
||||
replacement: {
|
||||
match: /(?<=handleClick:function\(\)\{return (\i)\}.+?)function \1\(.+?\)\{/,
|
||||
replace: "async $& if(await $self.handleLink(...arguments)) return;"
|
||||
match: /function (\i\(\i,\i\)\{)(?=.{0,100}trusted:)/,
|
||||
replace: "async function $1 if(await $self.handleLink(...arguments)) return;"
|
||||
}
|
||||
},
|
||||
// Make Spotify profile activity links open in app on web
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { findLazy } from "@webpack";
|
||||
import { Constants, GuildStore, i18n, RestAPI } from "@webpack/common";
|
||||
|
||||
const { InvitesDisabledExperiment } = findByPropsLazy("InvitesDisabledExperiment");
|
||||
const InvitesDisabledExperiment = findLazy(m => m.definition?.id === "2022-07_invites_disabled");
|
||||
|
||||
function showDisableInvites(guildId: string) {
|
||||
// Once the experiment is removed, this should keep working
|
||||
|
@ -56,7 +56,7 @@ export default definePlugin({
|
|||
replace: "children: $self.renderInvitesLabel({guildId:arguments[0].guildId,setChecked})",
|
||||
},
|
||||
{
|
||||
match: /(\i\.hasDMsDisabled\)\(\i\),\[\i,(\i)\]=\i\.useState\(\i\))/,
|
||||
match: /(\i\.\i\)\(\i\),\[\i,(\i)\]=\i\.useState\(\i\))/,
|
||||
replace: "$1,setChecked=$2"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -9,13 +9,16 @@ import "./style.css";
|
|||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { filters, findByPropsLazy, mapMangledModuleLazy } 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 { calendarFormat, dateFormat, isSameDay } = mapMangledModuleLazy("millisecondsInUnit:", {
|
||||
calendarFormat: filters.byCode("sameElse"),
|
||||
dateFormat: filters.byCode('":'),
|
||||
isSameDay: filters.byCode("Math.abs(+"),
|
||||
});
|
||||
const MessageClasses = findByPropsLazy("separator", "latin24CompactTimeStamp");
|
||||
|
||||
function Sep(props: HTMLAttributes<HTMLElement>) {
|
||||
|
@ -42,7 +45,6 @@ function ReplyTimestamp({
|
|||
const baseTimestamp = baseMessage.timestamp as any;
|
||||
return (
|
||||
<Timestamp
|
||||
id={getMessageTimestampId(referencedMessage.message)}
|
||||
className="vc-reply-timestamp"
|
||||
compact={isSameDay(refTimestamp, baseTimestamp)}
|
||||
timestamp={refTimestamp}
|
||||
|
@ -65,7 +67,7 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: "renderSingleLineMessage:function()",
|
||||
find: ".REPLY_QUOTE_MESSAGE_BLOCKED",
|
||||
replacement: {
|
||||
match: /(?<="aria-label":\i,children:\[)(?=\i,\i,\i\])/,
|
||||
replace: "$self.ReplyTimestamp(arguments[0]),"
|
||||
|
|
|
@ -110,7 +110,7 @@ export default definePlugin({
|
|||
{
|
||||
find: ".reactorDefault",
|
||||
replacement: {
|
||||
match: /\.openUserContextMenu\)\((\i),(\i),\i\).{0,250}tag:"strong"/,
|
||||
match: /,onContextMenu:e=>.{0,15}\((\i),(\i),(\i)\).{0,250}tag:"strong"/,
|
||||
replace: "$&,style:{color:$self.getColor($2?.id,$1)}"
|
||||
},
|
||||
predicate: () => settings.store.reactorsList,
|
||||
|
|
|
@ -48,7 +48,7 @@ export default definePlugin({
|
|||
authors: [Devs.Rini, Devs.TheKodeToad],
|
||||
patches: [
|
||||
{
|
||||
find: ".useCanSeeRemixBadge)",
|
||||
find: '?"@":"")',
|
||||
replacement: {
|
||||
match: /(?<=onContextMenu:\i,children:).*?\)}/,
|
||||
replace: "$self.renderUsername(arguments[0])}"
|
||||
|
|
|
@ -58,19 +58,13 @@ export default definePlugin({
|
|||
patches: [
|
||||
{
|
||||
find: ".NITRO_BANNER,",
|
||||
replacement: [
|
||||
{
|
||||
match: /(\i)\.premiumType/,
|
||||
replace: "$self.patchPremiumType($1)||$&"
|
||||
},
|
||||
{
|
||||
replacement: {
|
||||
match: /\?\(0,\i\.jsx\)\(\i,{type:\i,shown/,
|
||||
replace: "&&$self.shouldShowBadge(arguments[0])$&"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
find: "BannerLoadingStatus:function",
|
||||
find: ".banner)==null",
|
||||
replacement: {
|
||||
match: /(?<=void 0:)\i.getPreviewBanner\(\i,\i,\i\)/,
|
||||
replace: "$self.patchBannerUrl(arguments[0])||$&"
|
||||
|
@ -115,10 +109,6 @@ export default definePlugin({
|
|||
if (this.userHasBackground(displayProfile?.userId)) return this.getImageUrl(displayProfile?.userId);
|
||||
},
|
||||
|
||||
patchPremiumType({ userId }: any) {
|
||||
if (this.userHasBackground(userId)) return 2;
|
||||
},
|
||||
|
||||
shouldShowBadge({ displayProfile, user }: any) {
|
||||
return displayProfile?.banner && (!this.userHasBackground(user.id) || settings.store.nitroFirst);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue