Plugin
DoNotLeak
Hide all message contents and attachments when you're streaming or sharing your screen.
1
/*2
* FiveCord — a Discord client mod3
* Copyright (c) 2025 FiveCord4
* SPDX-License-Identifier: GPL-3.0-or-later5
*/6
7
import { definePluginSettings, migratePluginSettings } from "@api/Settings";8
import { disableStyle, enableStyle } from "@api/Styles";9
import { Devs } from "@utils/constants";10
import definePlugin, { OptionType } from "@utils/types";11
12
import styles from "./style.css?managed";13
14
const settings = definePluginSettings({15
hoverToView: {16
type: OptionType.BOOLEAN,17
description: "When hovering over a message, show the contents.",18
default: false,19
restartNeeded: false,20
onChange: () => {21
updateClassList("hoverToView", settings.store.hoverToView);22
},23
},24
keybind: {25
type: OptionType.STRING,26
description: "The keybind to show the contents of a message.",27
default: "Insert",28
restartNeeded: false,29
},30
enableForStream: {31
type: OptionType.BOOLEAN,32
description: "Blur all messages in streamer mode.",33
default: false,34
restartNeeded: false,35
onChange: () => {36
updateClassList("hideinstreamermode", settings.store.enableForStream);37
},38
},39
});40
41
migratePluginSettings("DoNotLeak", "Do Not Leak!");42
export default definePlugin({43
name: "DoNotLeak",44
description: "Hide all message contents and attachments when you039;re streaming or sharing your screen.",45
authors: [Devs.FiveCord],46
settings,47
start() {48
document.addEventListener("keyup", keyUpHandler);49
document.addEventListener("keydown", keyDownHandler);50
updateClassList("hoverToView", settings.store.hoverToView);51
updateClassList("hideinstreamermode", settings.store.enableForStream);52
enableStyle(styles);53
},54
stop() {55
document.removeEventListener("keyup", keyUpHandler);56
document.removeEventListener("keydown", keyDownHandler);57
disableStyle(styles);58
},59
});60
61
function updateClassList(className, condition) {62
if (condition) {63
document.body.classList.add(className);64
return;65
}66
document.body.classList.remove(className);67
}68
69
function keyUpHandler(e: KeyboardEvent) {70
if (e.key !== settings.store.keybind) return;71
document.body.classList.remove("youcanleaknow");72
}73
74
function keyDownHandler(e: KeyboardEvent) {75
if (e.key !== settings.store.keybind) return;76
document.body.classList.add("youcanleaknow");77
}78