Fix ViewIcons & plugins that use image modals

Co-Authored-By: sadan <117494111+sadan4@users.noreply.github.com>
This commit is contained in:
Vendicated 2024-10-23 03:57:46 +02:00
parent 58c3032bb2
commit a11ccde40f
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
9 changed files with 114 additions and 54 deletions

View file

@ -0,0 +1,24 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 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: "DynamicImageModalAPI",
authors: [Devs.sadan, Devs.Nuckyz],
description: "Allows you to omit either width or height when opening an image modal",
patches: [
{
find: "SCALE_DOWN:",
replacement: {
match: /!\(null==(\i)\|\|0===\i\|\|null==(\i)\|\|0===\i\)/,
replace: (_, width, height) => `!((null == ${width} || 0 === ${width}) && (null == ${height} || 0 === ${height}))`
}
}
]
});