NoScreensharePreview: Migrate to stock Discord feature
This commit is contained in:
parent
8711dd9a4b
commit
cdfc89b819
1 changed files with 11 additions and 8 deletions
|
@ -16,20 +16,23 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* 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 { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
|
const DisableStreamPreviews = getUserSettingLazy<boolean>("voiceAndVideo", "disableStreamPreviews")!;
|
||||||
|
|
||||||
|
// @TODO: Delete this plugin in the future
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "NoScreensharePreview",
|
name: "NoScreensharePreview",
|
||||||
description: "Disables screenshare previews from being sent.",
|
description: "Disables screenshare previews from being sent.",
|
||||||
authors: [Devs.Nuckyz],
|
authors: [Devs.Nuckyz],
|
||||||
patches: [
|
start() {
|
||||||
{
|
if (!DisableStreamPreviews.getSetting()) {
|
||||||
find: '"ApplicationStreamPreviewUploadManager"',
|
DisableStreamPreviews.updateSetting(true);
|
||||||
replacement: {
|
|
||||||
match: /await \i\.\i\.(makeChunkedRequest\(|post\(\{url:)\i\.\i\.STREAM_PREVIEW.+?\}\)/g,
|
|
||||||
replace: "0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
Settings.plugins.NoScreensharePreview.enabled = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue