From cdfc89b8192144bc7b58225655c1d52562a84e28 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Tue, 3 Dec 2024 22:39:36 -0300
Subject: [PATCH] NoScreensharePreview: Migrate to stock Discord feature
---
src/plugins/noScreensharePreview/index.ts | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/plugins/noScreensharePreview/index.ts b/src/plugins/noScreensharePreview/index.ts
index ca50ad28..6ad39a90 100644
--- a/src/plugins/noScreensharePreview/index.ts
+++ b/src/plugins/noScreensharePreview/index.ts
@@ -16,20 +16,23 @@
* along with this program. If not, see .
*/
+import { Settings } from "@api/Settings";
+import { getUserSettingLazy } from "@api/UserSettings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
+const DisableStreamPreviews = getUserSettingLazy("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;
+ }
});