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"',
replacement: {
// 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}` +
`vcCustomUserColorsDummy=[${colorString},${hasGradientColors}]=$self.getMessageColorsVariables(arguments[0],${hasGradientColors}),`
},

View file

@ -50,6 +50,7 @@ export default definePlugin({
settings,
required: true,
patches: [
// Fixes Unknown Resolution/FPS Crashing
{
find: "Unknown resolution:",
replacement: [
@ -62,6 +63,14 @@ export default definePlugin({
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() {

View file

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

View file

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

View file

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

View file

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

View file

@ -68,7 +68,7 @@ export default definePlugin({
find: '="SYSTEM_TAG"',
replacement: {
// 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}` +
`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 { Message } from "discord-types/general";
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
const RelationshipStore = findByPropsLazy("getFriendIDs", "isBlocked");
interface MessageDeleteProps {
// Internal intl message for BLOCKED_MESSAGE_COUNT

View file

@ -19,14 +19,11 @@
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
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 { Message } from "discord-types/general";
import NoBlockedMessagesPlugin from "plugins/noBlockedMessages";
import NoReplyMentionPlugin from "plugins/noReplyMention";
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
const isMac = navigator.platform.includes("Mac"); // bruh
let currentlyReplyingId: 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 RelationshipStore: Stores.RelationshipStore & t.FluxStore & {
/** Get the date (as a string) that the relationship was created */
getFriendCount(): number;
getSince(userId: string): string;
isIgnored(userId: string): boolean;
};