NoScreensharePreview: Migrate to stock Discord feature

This commit is contained in:
Nuckyz 2024-12-03 22:39:36 -03:00
parent 8711dd9a4b
commit cdfc89b819
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -16,20 +16,23 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Settings } from "@api/Settings";
import { getUserSettingLazy } from "@api/UserSettings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
const DisableStreamPreviews = getUserSettingLazy<boolean>("voiceAndVideo", "disableStreamPreviews")!;
// @TODO: Delete this plugin in the future
export default definePlugin({
name: "NoScreensharePreview",
description: "Disables screenshare previews from being sent.",
authors: [Devs.Nuckyz],
patches: [
{
find: '"ApplicationStreamPreviewUploadManager"',
replacement: {
match: /await \i\.\i\.(makeChunkedRequest\(|post\(\{url:)\i\.\i\.STREAM_PREVIEW.+?\}\)/g,
replace: "0"
}
start() {
if (!DisableStreamPreviews.getSetting()) {
DisableStreamPreviews.updateSetting(true);
}
]
Settings.plugins.NoScreensharePreview.enabled = false;
}
});