Permission Check For InstantScreenshare

Permission Check For InstantScreenshare
This commit is contained in:
thororen1234 2025-04-07 13:55:48 -04:00
parent 10d4036a34
commit 3b3c508b0d
No known key found for this signature in database

View file

@ -8,7 +8,7 @@ import { definePluginSettings } from "@api/Settings";
import { Devs, EquicordDevs } from "@utils/constants"; import { Devs, EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByCode, findByProps } from "@webpack"; import { findByCode, findByProps } from "@webpack";
import { ChannelStore, SelectedChannelStore, UserStore } from "@webpack/common"; import { ChannelStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common";
import { VoiceState } from "@webpack/types"; import { VoiceState } from "@webpack/types";
const settings = definePluginSettings({ const settings = definePluginSettings({
@ -41,6 +41,8 @@ async function startStream() {
if (!selected) return; if (!selected) return;
const channel = ChannelStore.getChannel(selected); const channel = ChannelStore.getChannel(selected);
if (!PermissionStore.can(PermissionsBits.STREAM, channel)) return;
if (settings.store.streamType === "screen") { if (settings.store.streamType === "screen") {
sources = await getDesktopSources(mediaEngine, ["screen"], null); sources = await getDesktopSources(mediaEngine, ["screen"], null);
source = sources[0]; source = sources[0];