Patch Fixes

This commit is contained in:
thororen1234 2025-06-17 00:04:19 -04:00
parent e2be554848
commit 522e2b5b8f
No known key found for this signature in database
10 changed files with 24 additions and 43 deletions

View file

@ -96,7 +96,7 @@ export default definePlugin({
find: '="SYSTEM_TAG"', find: '="SYSTEM_TAG"',
replacement: { replacement: {
// Override colorString with our custom color and disable gradients if applying the custom color. // Override colorString with our custom color and disable gradients if applying the custom color.
match: /&&null!=\i\.secondaryColor,(?<=colorString:(\i).+?(\i)=.+?)/, match: /useContext\(\i\.\i\),(?<=colorString:(\i).+?(\i)=.+?)/,
replace: (m, colorString, hasGradientColors) => `${m}` + replace: (m, colorString, hasGradientColors) => `${m}` +
`vcCustomUserColorsDummy=[${colorString},${hasGradientColors}]=$self.getMessageColorsVariables(arguments[0],${hasGradientColors}),` `vcCustomUserColorsDummy=[${colorString},${hasGradientColors}]=$self.getMessageColorsVariables(arguments[0],${hasGradientColors}),`
}, },

View file

@ -50,6 +50,7 @@ export default definePlugin({
settings, settings,
required: true, required: true,
patches: [ patches: [
// Fixes Unknown Resolution/FPS Crashing
{ {
find: "Unknown resolution:", find: "Unknown resolution:",
replacement: [ replacement: [
@ -62,6 +63,14 @@ export default definePlugin({
replace: "return $1;" replace: "return $1;"
} }
] ]
},
// Adds getRelationships Back To The RelationshipStore
{
find: "getRelationshipCount(){",
replacement: {
match: /(?<=getRelationshipCount\(\)\{.{0,25}\})(?=.*?getFriendIDs\(\)\{.{0,25}.keys\((\i)\))/,
replace: "getRelationships(){return $1}"
}
} }
], ],
start() { start() {

View file

@ -32,12 +32,8 @@ export default definePlugin({
patches: [ patches: [
// Taken from AnonymiseFileNames // Taken from AnonymiseFileNames
{ {
find: "async uploadFiles(", find: "async uploadFilesSimple(",
replacement: [ replacement: [
{
match: /async uploadFiles\((\i),\i\){/,
replace: "$&$1.forEach($self.fixExt);"
},
{ {
match: /async uploadFilesSimple\((\i)\){/, match: /async uploadFilesSimple\((\i)\){/,
replace: "$&$1.forEach($self.fixExt);" replace: "$&$1.forEach($self.fixExt);"

View file

@ -6,13 +6,11 @@
import { FFmpeg } from "@ffmpeg/ffmpeg"; import { FFmpeg } from "@ffmpeg/ffmpeg";
import { fetchFile } from "@ffmpeg/util"; import { fetchFile } from "@ffmpeg/util";
import { findByPropsLazy, findLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
import { ChannelStore, UploadHandler } from "@webpack/common"; import { ChannelStore, UploadHandler } from "@webpack/common";
import { FFmpegState, Sticker } from "./types"; import { FFmpegState, Sticker } from "./types";
const MessageUpload = findByPropsLazy("uploadFiles");
const CloudUpload = findLazy(m => m.prototype?.trackUploadFinished);
const PendingReplyStore = findByPropsLazy("getPendingReply"); const PendingReplyStore = findByPropsLazy("getPendingReply");
const MessageUtils = findByPropsLazy("sendMessage"); const MessageUtils = findByPropsLazy("sendMessage");
const DraftStore = findByPropsLazy("getDraft", "getState"); const DraftStore = findByPropsLazy("getDraft", "getState");
@ -159,26 +157,8 @@ export async function sendSticker({
file = new File([processedImage], filename!, { type: mimeType }); file = new File([processedImage], filename!, { type: mimeType });
} }
if (ctrlKey) {
UploadHandler.promptToUpload([file], ChannelStore.getChannel(channelId), 0); UploadHandler.promptToUpload([file], ChannelStore.getChannel(channelId), 0);
return; return;
}
MessageUpload.uploadFiles({
channelId,
draftType: 0,
hasSpoiler: false,
options: messageOptions || {},
parsedMessage: {
content: messageContent
},
uploads: [
new CloudUpload({
file,
platform: 1
}, channelId, false, 0)
]
});
} else if (shiftKey) { } else if (shiftKey) {
if (!messageContent.endsWith(" ") || !messageContent.endsWith("\n")) messageContent += " "; if (!messageContent.endsWith(" ") || !messageContent.endsWith("\n")) messageContent += " ";
messageContent += sticker.image; messageContent += sticker.image;

View file

@ -192,15 +192,17 @@ function isTimestampDisabled() {
function onlineFriendCount(): number { function onlineFriendCount(): number {
let onlineFriends = 0; let onlineFriends = 0;
const relationships = RelationshipStore.getRelationships(); const relationships = RelationshipStore.getFriendIDs();
for (const id in relationships) { for (const id of relationships) {
if (relationships[id] === 1 && PresenceStore.getStatus(id) !== "offline") onlineFriends++; if (PresenceStore.getStatus(id) !== "offline") {
onlineFriends++;
}
} }
return onlineFriends; return onlineFriends;
} }
function totalFriendCount(): number { function totalFriendCount(): number {
return Object.values(RelationshipStore.getRelationships()).filter(r => r === 1).length; return RelationshipStore.getFriendCount();
} }
function memberCount(): string { function memberCount(): string {

View file

@ -79,12 +79,8 @@ export default definePlugin({
patches: [ patches: [
{ {
find: "async uploadFiles(", find: "async uploadFilesSimple(",
replacement: [ replacement: [
{
match: /async uploadFiles\((\i),\i\){/,
replace: "$&$1.forEach($self.anonymise);"
},
{ {
match: /async uploadFilesSimple\((\i)\){/, match: /async uploadFilesSimple\((\i)\){/,
replace: "$&$1.forEach($self.anonymise);" replace: "$&$1.forEach($self.anonymise);"

View file

@ -68,7 +68,7 @@ export default definePlugin({
find: '="SYSTEM_TAG"', find: '="SYSTEM_TAG"',
replacement: { replacement: {
// Override colorString with our custom color and disable gradients if applying the custom color. // Override colorString with our custom color and disable gradients if applying the custom color.
match: /&&null!=\i\.secondaryColor,(?<=colorString:(\i).+?(\i)=.+?)/, match: /useContext\(\i\.\i\),(?<=colorString:(\i).+?(\i)=.+?)/,
replace: (m, colorString, hasGradientColors) => `${m}` + replace: (m, colorString, hasGradientColors) => `${m}` +
`vcIrcColorsDummy=[${colorString},${hasGradientColors}]=$self.getMessageColorsVariables(arguments[0],${hasGradientColors}),` `vcIrcColorsDummy=[${colorString},${hasGradientColors}]=$self.getMessageColorsVariables(arguments[0],${hasGradientColors}),`
} }

View file

@ -25,7 +25,7 @@ import { findByPropsLazy } from "@webpack";
import { i18n, MessageStore } from "@webpack/common"; import { i18n, MessageStore } from "@webpack/common";
import { Message } from "discord-types/general"; import { Message } from "discord-types/general";
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked"); const RelationshipStore = findByPropsLazy("getFriendIDs", "isBlocked");
interface MessageDeleteProps { interface MessageDeleteProps {
// Internal intl message for BLOCKED_MESSAGE_COUNT // Internal intl message for BLOCKED_MESSAGE_COUNT

View file

@ -19,14 +19,11 @@
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { ChannelStore, ComponentDispatch, FluxDispatcher as Dispatcher, MessageActions, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common"; import { ChannelStore, ComponentDispatch, FluxDispatcher as Dispatcher, MessageActions, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common";
import { Message } from "discord-types/general"; import { Message } from "discord-types/general";
import NoBlockedMessagesPlugin from "plugins/noBlockedMessages"; import NoBlockedMessagesPlugin from "plugins/noBlockedMessages";
import NoReplyMentionPlugin from "plugins/noReplyMention"; import NoReplyMentionPlugin from "plugins/noReplyMention";
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
const isMac = navigator.platform.includes("Mac"); // bruh const isMac = navigator.platform.includes("Mac"); // bruh
let currentlyReplyingId: string | null = null; let currentlyReplyingId: string | null = null;
let currentlyEditingId: string | null = null; let currentlyEditingId: string | null = null;

View file

@ -49,6 +49,7 @@ export let TypingStore: GenericStore;
export let GuildMemberStore: Stores.GuildMemberStore & t.FluxStore; export let GuildMemberStore: Stores.GuildMemberStore & t.FluxStore;
export let RelationshipStore: Stores.RelationshipStore & t.FluxStore & { export let RelationshipStore: Stores.RelationshipStore & t.FluxStore & {
/** Get the date (as a string) that the relationship was created */ /** Get the date (as a string) that the relationship was created */
getFriendCount(): number;
getSince(userId: string): string; getSince(userId: string): string;
isIgnored(userId: string): boolean; isIgnored(userId: string): boolean;
}; };