mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-16 09:57:08 -04:00
Fixes
This commit is contained in:
parent
2cb6975f95
commit
97e59d3869
21 changed files with 75 additions and 287 deletions
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a modification for Discord's desktop app
|
|
||||||
* Copyright (c) 2023 Vendicated and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Devs } from "@utils/constants";
|
|
||||||
|
|
||||||
import { types } from "../../philsPluginLibrary";
|
|
||||||
|
|
||||||
export const PluginInfo = {
|
|
||||||
PLUGIN_NAME: "BetterMicrophone",
|
|
||||||
DESCRIPTION: "This plugin allows you to further customize your microphone.",
|
|
||||||
AUTHOR: {
|
|
||||||
...Devs.philhk,
|
|
||||||
github: "https://github.com/philhk"
|
|
||||||
},
|
|
||||||
CONTRIBUTORS: {}
|
|
||||||
} as const satisfies types.PluginInfo;
|
|
|
@ -1,19 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a modification for Discord's desktop app
|
|
||||||
* Copyright (c) 2023 Vendicated and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export * from "./constants";
|
|
|
@ -16,42 +16,32 @@
|
||||||
* 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 { PluginAuthor, PluginDef } from "@utils/types";
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
import { addSettingsPanelButton, Emitter, MicrophoneSettingsIcon, removeSettingsPanelButton } from "../philsPluginLibrary";
|
import { addSettingsPanelButton, Emitter, MicrophoneSettingsIcon, removeSettingsPanelButton } from "../philsPluginLibrary";
|
||||||
import { PluginInfo } from "./constants";
|
|
||||||
import { openMicrophoneSettingsModal } from "./modals";
|
import { openMicrophoneSettingsModal } from "./modals";
|
||||||
import { MicrophonePatcher } from "./patchers";
|
import { MicrophonePatcher } from "./patchers";
|
||||||
import { initMicrophoneStore } from "./stores";
|
import { initMicrophoneStore } from "./stores";
|
||||||
|
|
||||||
export default new class Plugin implements PluginDef {
|
let microphonePatcher;
|
||||||
readonly name: string;
|
|
||||||
readonly description: string;
|
|
||||||
readonly authors: PluginAuthor[];
|
|
||||||
readonly dependencies: string[];
|
|
||||||
|
|
||||||
public microphonePatcher?: MicrophonePatcher;
|
export default definePlugin({
|
||||||
|
name: "BetterMicrophone",
|
||||||
constructor() {
|
description: "This plugin allows you to further customize your microphone.",
|
||||||
this.name = PluginInfo.PLUGIN_NAME;
|
authors: [Devs.philhk],
|
||||||
this.description = PluginInfo.DESCRIPTION;
|
dependencies: ["PhilsPluginLibrary"],
|
||||||
this.authors = [PluginInfo.AUTHOR, ...Object.values(PluginInfo.CONTRIBUTORS)] as PluginAuthor[];
|
microphonePatcher,
|
||||||
this.dependencies = ["PhilsPluginLibrary"];
|
start() {
|
||||||
}
|
|
||||||
|
|
||||||
start(): void {
|
|
||||||
initMicrophoneStore();
|
initMicrophoneStore();
|
||||||
|
|
||||||
this.microphonePatcher = new MicrophonePatcher().patch();
|
this.microphonePatcher = new MicrophonePatcher().patch();
|
||||||
|
addSettingsPanelButton({ name: "BetterMicrophone", icon: MicrophoneSettingsIcon, tooltipText: "Microphone Settings", onClick: openMicrophoneSettingsModal });
|
||||||
addSettingsPanelButton({ name: PluginInfo.PLUGIN_NAME, icon: MicrophoneSettingsIcon, tooltipText: "Microphone Settings", onClick: openMicrophoneSettingsModal });
|
},
|
||||||
}
|
stop() {
|
||||||
|
|
||||||
stop(): void {
|
|
||||||
this.microphonePatcher?.unpatch();
|
this.microphonePatcher?.unpatch();
|
||||||
|
|
||||||
Emitter.removeAllListeners(PluginInfo.PLUGIN_NAME);
|
Emitter.removeAllListeners("BetterMicrophone");
|
||||||
|
|
||||||
removeSettingsPanelButton(PluginInfo.PLUGIN_NAME);
|
removeSettingsPanelButton("BetterMicrophone");
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
|
@ -18,6 +18,4 @@
|
||||||
|
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
|
|
||||||
import { PluginInfo } from "../constants";
|
export const logger = new Logger("BetterMicrophone");
|
||||||
|
|
||||||
export const logger = new Logger(PluginInfo.PLUGIN_NAME);
|
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
* 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 { Devs } from "@utils/constants";
|
||||||
import { openModalLazy } from "@utils/modal";
|
import { openModalLazy } from "@utils/modal";
|
||||||
|
|
||||||
import { MicrophoneSettingsModal } from "../components";
|
import { MicrophoneSettingsModal } from "../components";
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
import Plugin from "../index";
|
import Plugin from "../index";
|
||||||
import { microphoneStore } from "../stores";
|
import { microphoneStore } from "../stores";
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ export const openMicrophoneSettingsModal =
|
||||||
onDone={onMicrophoneModalDone}
|
onDone={onMicrophoneModalDone}
|
||||||
showInfo
|
showInfo
|
||||||
microphoneStore={microphoneStore}
|
microphoneStore={microphoneStore}
|
||||||
author={PluginInfo.AUTHOR}
|
author={Devs.philhk}
|
||||||
contributors={Object.values(PluginInfo.CONTRIBUTORS)}
|
|
||||||
{...props} />;
|
{...props} />;
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
import { Emitter, MediaEngineStore, Patcher, types } from "../../philsPluginLibrary";
|
import { Emitter, MediaEngineStore, Patcher, types } from "../../philsPluginLibrary";
|
||||||
import { patchConnectionAudioTransportOptions } from "../../philsPluginLibrary/patches/audio";
|
import { patchConnectionAudioTransportOptions } from "../../philsPluginLibrary/patches/audio";
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
import { logger } from "../logger";
|
import { logger } from "../logger";
|
||||||
import { microphoneStore } from "../stores";
|
import { microphoneStore } from "../stores";
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ export class MicrophonePatcher extends Patcher {
|
||||||
"on",
|
"on",
|
||||||
"connection",
|
"connection",
|
||||||
connectionEventFunction,
|
connectionEventFunction,
|
||||||
PluginInfo.PLUGIN_NAME
|
"BetterMicrophone"
|
||||||
);
|
);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createPluginStore, ProfilableInitializer, ProfilableStore, profileable, ProfileableProfile } from "../../philsPluginLibrary";
|
import { createPluginStore, ProfilableInitializer, ProfilableStore, profileable, ProfileableProfile } from "../../philsPluginLibrary";
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
|
|
||||||
|
|
||||||
export interface MicrophoneProfile {
|
export interface MicrophoneProfile {
|
||||||
|
@ -84,7 +83,7 @@ export let microphoneStore: ProfilableStore<MicrophoneStore, MicrophoneProfile>;
|
||||||
|
|
||||||
export const initMicrophoneStore = () =>
|
export const initMicrophoneStore = () =>
|
||||||
microphoneStore = createPluginStore(
|
microphoneStore = createPluginStore(
|
||||||
PluginInfo.PLUGIN_NAME,
|
"BetterMicrophone",
|
||||||
"MicrophoneStore",
|
"MicrophoneStore",
|
||||||
profileable(
|
profileable(
|
||||||
microphoneStoreDefault,
|
microphoneStoreDefault,
|
||||||
|
|
|
@ -19,13 +19,12 @@
|
||||||
import { Flex } from "@components/Flex";
|
import { Flex } from "@components/Flex";
|
||||||
import { Switch } from "@components/Switch";
|
import { Switch } from "@components/Switch";
|
||||||
import { ModalSize, openModalLazy } from "@utils/modal";
|
import { ModalSize, openModalLazy } from "@utils/modal";
|
||||||
import { Button, Card, Forms, React, Select, Slider, TextInput, useEffect, useState } from "@webpack/common";
|
import { Button, Forms, React, Select, Slider, TextInput, useEffect, useState } from "@webpack/common";
|
||||||
import { SelectOption } from "@webpack/types";
|
import { SelectOption } from "@webpack/types";
|
||||||
|
|
||||||
import { MicrophoneSettingsModal } from "../../betterMicrophone.desktop/components";
|
import { MicrophoneSettingsModal } from "../../betterMicrophone.desktop/components";
|
||||||
import {
|
import {
|
||||||
MediaEngineStore,
|
MediaEngineStore,
|
||||||
openURL,
|
|
||||||
ProfilableStore,
|
ProfilableStore,
|
||||||
SettingsModal,
|
SettingsModal,
|
||||||
SettingsModalCard,
|
SettingsModalCard,
|
||||||
|
@ -36,8 +35,6 @@ import {
|
||||||
validateNumberInput,
|
validateNumberInput,
|
||||||
validateTextInputNumber
|
validateTextInputNumber
|
||||||
} from "../../philsPluginLibrary";
|
} from "../../philsPluginLibrary";
|
||||||
import { Styles } from "../../philsPluginLibrary/styles";
|
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
import { ScreenshareAudioProfile, ScreenshareAudioStore, ScreenshareProfile, ScreenshareStore } from "../stores";
|
import { ScreenshareAudioProfile, ScreenshareAudioStore, ScreenshareProfile, ScreenshareStore } from "../stores";
|
||||||
|
|
||||||
const simpleResolutions: readonly (SelectOption & { value: types.Resolution; })[] = [
|
const simpleResolutions: readonly (SelectOption & { value: types.Resolution; })[] = [
|
||||||
|
@ -403,12 +400,6 @@ export const ScreenshareSettingsModal = (props: ScreenshareSettingsModalProps) =
|
||||||
onChange: status => setHdrEnabled(status)
|
onChange: status => setHdrEnabled(status)
|
||||||
}} />;
|
}} />;
|
||||||
|
|
||||||
const guideCard =
|
|
||||||
<Card style={{ ...Styles.infoCard, flex: 0.4 }}>
|
|
||||||
<Forms.FormTitle tag="h5">How to use?</Forms.FormTitle>
|
|
||||||
<Forms.FormText>If you want to know more about the settings or possible issues, please read <a onClick={() => openURL(PluginInfo.README + "#better-screenshare-plugin")}>this</a>.</Forms.FormText>
|
|
||||||
</Card>;
|
|
||||||
|
|
||||||
const settingsCardProfiles =
|
const settingsCardProfiles =
|
||||||
<SettingsModalProfilesCard flex={0.5} onSaveStateChanged={state => setIsSaving(state)} profileableStore={screenshareStore} />;
|
<SettingsModalProfilesCard flex={0.5} onSaveStateChanged={state => setIsSaving(state)} profileableStore={screenshareStore} />;
|
||||||
|
|
||||||
|
@ -456,7 +447,6 @@ export const ScreenshareSettingsModal = (props: ScreenshareSettingsModalProps) =
|
||||||
{screenshareAudioStore && settingsCardAudio}
|
{screenshareAudioStore && settingsCardAudio}
|
||||||
</SettingsModalCardRow>
|
</SettingsModalCardRow>
|
||||||
<SettingsModalCardRow>
|
<SettingsModalCardRow>
|
||||||
{guideCard}
|
|
||||||
{settingsCardHdr}
|
{settingsCardHdr}
|
||||||
{settingsCardProfiles}
|
{settingsCardProfiles}
|
||||||
</SettingsModalCardRow>
|
</SettingsModalCardRow>
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a modification for Discord's desktop app
|
|
||||||
* Copyright (c) 2023 Vendicated and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Devs } from "@utils/constants";
|
|
||||||
|
|
||||||
import { types } from "../../philsPluginLibrary";
|
|
||||||
|
|
||||||
export const PluginInfo = {
|
|
||||||
PLUGIN_NAME: "BetterScreenshare",
|
|
||||||
DESCRIPTION: "This plugin allows you to further customize your screen sharing.",
|
|
||||||
AUTHOR: {
|
|
||||||
...Devs.philhk,
|
|
||||||
github: "https://github.com/philhk"
|
|
||||||
},
|
|
||||||
CONTRIBUTORS: {
|
|
||||||
walrus: {
|
|
||||||
github: "https://github.com/philhk",
|
|
||||||
id: 305317288775778306n,
|
|
||||||
name: "walrus"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
README: "https://github.com/Vendicated/Vencord/tree/main/src/plugins/betterScreenshare"
|
|
||||||
} as const satisfies types.PluginInfo;
|
|
|
@ -1,19 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a modification for Discord's desktop app
|
|
||||||
* Copyright (c) 2023 Vendicated and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export * from "./constants";
|
|
|
@ -17,32 +17,30 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { DefinedSettings, OptionType, Patch, PluginAuthor, PluginDef, SettingsDefinition } from "@utils/types";
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
|
||||||
import { addSettingsPanelButton, Emitter, removeSettingsPanelButton, ScreenshareSettingsIcon } from "../philsPluginLibrary";
|
import { addSettingsPanelButton, Emitter, removeSettingsPanelButton, ScreenshareSettingsIcon } from "../philsPluginLibrary";
|
||||||
import { PluginInfo } from "./constants";
|
|
||||||
import { openScreenshareModal } from "./modals";
|
import { openScreenshareModal } from "./modals";
|
||||||
import { ScreenshareAudioPatcher, ScreensharePatcher } from "./patchers";
|
import { ScreenshareAudioPatcher, ScreensharePatcher } from "./patchers";
|
||||||
import { replacedScreenshareModalComponent } from "./patches";
|
import { replacedScreenshareModalComponent } from "./patches";
|
||||||
import { initScreenshareAudioStore, initScreenshareStore } from "./stores";
|
import { initScreenshareAudioStore, initScreenshareStore } from "./stores";
|
||||||
|
|
||||||
export default new class Plugin implements PluginDef {
|
const settings = definePluginSettings({
|
||||||
readonly name: string;
|
hideDefaultSettings: {
|
||||||
readonly description: string;
|
type: OptionType.BOOLEAN,
|
||||||
readonly authors: PluginAuthor[];
|
description: "Hide Discord screen sharing settings",
|
||||||
readonly patches: Omit<Patch, "plugin">[];
|
default: true,
|
||||||
readonly settings: DefinedSettings<SettingsDefinition, {}>;
|
}
|
||||||
readonly dependencies: string[];
|
});
|
||||||
|
|
||||||
private readonly replacedScreenshareModalComponent: typeof replacedScreenshareModalComponent;
|
export default definePlugin({
|
||||||
public screensharePatcher?: ScreensharePatcher;
|
name: "BetterScreenshare",
|
||||||
public screenshareAudioPatcher?: ScreenshareAudioPatcher;
|
description: "This plugin allows you to further customize your screen sharing.",
|
||||||
|
authors: [Devs.philhk],
|
||||||
constructor() {
|
dependencies: ["PhilsPluginLibrary"],
|
||||||
this.name = PluginInfo.PLUGIN_NAME;
|
settings,
|
||||||
this.description = PluginInfo.DESCRIPTION;
|
patches: [
|
||||||
this.authors = [PluginInfo.AUTHOR, ...Object.values(PluginInfo.CONTRIBUTORS)] as PluginAuthor[];
|
|
||||||
this.patches = [
|
|
||||||
{
|
{
|
||||||
find: "Messages.SCREENSHARE_RELAUNCH",
|
find: "Messages.SCREENSHARE_RELAUNCH",
|
||||||
replacement: {
|
replacement: {
|
||||||
|
@ -50,37 +48,24 @@ export default new class Plugin implements PluginDef {
|
||||||
replace: "$1return $self.replacedScreenshareModalComponent(function(){$2}, this, arguments)$3"
|
replace: "$1return $self.replacedScreenshareModalComponent(function(){$2}, this, arguments)$3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
],
|
||||||
this.settings = definePluginSettings({
|
replacedScreenshareModalComponent: replacedScreenshareModalComponent,
|
||||||
hideDefaultSettings: {
|
|
||||||
type: OptionType.BOOLEAN,
|
|
||||||
description: "Hide Discord screen sharing settings",
|
|
||||||
default: true,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.dependencies = ["PhilsPluginLibrary"];
|
|
||||||
this.replacedScreenshareModalComponent = replacedScreenshareModalComponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
start(): void {
|
start(): void {
|
||||||
initScreenshareStore();
|
initScreenshareStore();
|
||||||
initScreenshareAudioStore();
|
initScreenshareAudioStore();
|
||||||
this.screensharePatcher = new ScreensharePatcher().patch();
|
this.screensharePatcher = new ScreensharePatcher().patch();
|
||||||
this.screenshareAudioPatcher = new ScreenshareAudioPatcher().patch();
|
this.screenshareAudioPatcher = new ScreenshareAudioPatcher().patch();
|
||||||
|
|
||||||
addSettingsPanelButton({
|
addSettingsPanelButton({
|
||||||
name: PluginInfo.PLUGIN_NAME,
|
name: "BetterScreenshare",
|
||||||
icon: ScreenshareSettingsIcon,
|
icon: ScreenshareSettingsIcon,
|
||||||
tooltipText: "Screenshare Settings",
|
tooltipText: "Screenshare Settings",
|
||||||
onClick: openScreenshareModal
|
onClick: openScreenshareModal
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
stop() {
|
||||||
stop(): void {
|
|
||||||
this.screensharePatcher?.unpatch();
|
this.screensharePatcher?.unpatch();
|
||||||
this.screenshareAudioPatcher?.unpatch();
|
this.screenshareAudioPatcher?.unpatch();
|
||||||
Emitter.removeAllListeners(PluginInfo.PLUGIN_NAME);
|
Emitter.removeAllListeners("BetterScreenshare");
|
||||||
|
removeSettingsPanelButton("BetterScreenshare");
|
||||||
removeSettingsPanelButton(PluginInfo.PLUGIN_NAME);
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
|
@ -18,6 +18,5 @@
|
||||||
|
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
|
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
|
|
||||||
export const logger = new Logger(PluginInfo.PLUGIN_NAME);
|
export const logger = new Logger("BetterScreenshare");
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
* 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 { Devs } from "@utils/constants";
|
||||||
import { openModalLazy } from "@utils/modal";
|
import { openModalLazy } from "@utils/modal";
|
||||||
|
|
||||||
import Plugin from "..";
|
import Plugin from "..";
|
||||||
import { ScreenshareSettingsModal } from "../components";
|
import { ScreenshareSettingsModal } from "../components";
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
import { screenshareAudioStore, screenshareStore } from "../stores";
|
import { screenshareAudioStore, screenshareStore } from "../stores";
|
||||||
|
|
||||||
const onScreenshareModalDone = () => {
|
const onScreenshareModalDone = () => {
|
||||||
|
@ -49,7 +49,6 @@ export const openScreenshareModal =
|
||||||
onDone={onScreenshareModalDone}
|
onDone={onScreenshareModalDone}
|
||||||
screenshareStore={screenshareStore}
|
screenshareStore={screenshareStore}
|
||||||
screenshareAudioStore={screenshareAudioStore}
|
screenshareAudioStore={screenshareAudioStore}
|
||||||
author={PluginInfo.AUTHOR}
|
author={Devs.philhk}
|
||||||
contributors={Object.values(PluginInfo.CONTRIBUTORS)}
|
|
||||||
{...props} />;
|
{...props} />;
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,7 +20,6 @@ import { UserStore } from "@webpack/common";
|
||||||
|
|
||||||
import { Emitter, MediaEngineStore, Patcher, types } from "../../philsPluginLibrary";
|
import { Emitter, MediaEngineStore, Patcher, types } from "../../philsPluginLibrary";
|
||||||
import { patchConnectionVideoSetDesktopSourceWithOptions, patchConnectionVideoTransportOptions } from "../../philsPluginLibrary/patches/video";
|
import { patchConnectionVideoSetDesktopSourceWithOptions, patchConnectionVideoTransportOptions } from "../../philsPluginLibrary/patches/video";
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
import { logger } from "../logger";
|
import { logger } from "../logger";
|
||||||
import { screenshareStore } from "../stores";
|
import { screenshareStore } from "../stores";
|
||||||
|
|
||||||
|
@ -87,7 +86,7 @@ export class ScreensharePatcher extends Patcher {
|
||||||
"on",
|
"on",
|
||||||
"connection",
|
"connection",
|
||||||
connectionEventFunction,
|
connectionEventFunction,
|
||||||
PluginInfo.PLUGIN_NAME
|
"BetterScreenshare"
|
||||||
);
|
);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
import { UserStore } from "@webpack/common";
|
import { UserStore } from "@webpack/common";
|
||||||
|
|
||||||
import { Emitter, MediaEngineStore, patchConnectionAudioTransportOptions, Patcher, types } from "../../philsPluginLibrary";
|
import { Emitter, MediaEngineStore, patchConnectionAudioTransportOptions, Patcher, types } from "../../philsPluginLibrary";
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
import { logger } from "../logger";
|
import { logger } from "../logger";
|
||||||
import { screenshareAudioStore } from "../stores/screenshareAudioStore";
|
import { screenshareAudioStore } from "../stores/screenshareAudioStore";
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ export class ScreenshareAudioPatcher extends Patcher {
|
||||||
"on",
|
"on",
|
||||||
"connection",
|
"connection",
|
||||||
connectionEventFunction,
|
connectionEventFunction,
|
||||||
PluginInfo.PLUGIN_NAME
|
"BetterScreenshare"
|
||||||
);
|
);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import { Settings } from "Vencord";
|
||||||
import { SettingsModalCard, SettingsModalCardItem } from "../../philsPluginLibrary";
|
import { SettingsModalCard, SettingsModalCardItem } from "../../philsPluginLibrary";
|
||||||
import Plugin from "..";
|
import Plugin from "..";
|
||||||
import { AudioSourceSelect, OpenScreenshareSettingsButton } from "../components";
|
import { AudioSourceSelect, OpenScreenshareSettingsButton } from "../components";
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
import { screenshareStore } from "../stores";
|
import { screenshareStore } from "../stores";
|
||||||
|
|
||||||
const ReplacedStreamSettings = () => {
|
const ReplacedStreamSettings = () => {
|
||||||
|
@ -59,7 +58,7 @@ const ReplacedStreamSettings = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export function replacedScreenshareModalSettingsContentType(oldType: (...args: any[]) => any, thisContext: any, functionArguments: any) {
|
export function replacedScreenshareModalSettingsContentType(oldType: (...args: any[]) => any, thisContext: any, functionArguments: any) {
|
||||||
const { hideDefaultSettings } = Settings.plugins[PluginInfo.PLUGIN_NAME];
|
const { hideDefaultSettings } = Settings.plugins.BetterScreenshare;
|
||||||
const oldTypeResult = Reflect.apply(oldType, thisContext, functionArguments);
|
const oldTypeResult = Reflect.apply(oldType, thisContext, functionArguments);
|
||||||
|
|
||||||
if (hideDefaultSettings)
|
if (hideDefaultSettings)
|
||||||
|
|
|
@ -23,13 +23,12 @@ import {
|
||||||
microphoneStoreDefault as screenshareAudioStoreDefault
|
microphoneStoreDefault as screenshareAudioStoreDefault
|
||||||
} from "../../betterMicrophone.desktop/stores";
|
} from "../../betterMicrophone.desktop/stores";
|
||||||
import { createPluginStore, ProfilableStore, profileable } from "../../philsPluginLibrary";
|
import { createPluginStore, ProfilableStore, profileable } from "../../philsPluginLibrary";
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
|
|
||||||
export let screenshareAudioStore: ProfilableStore<ScreenshareAudioStore, ScreenshareAudioProfile>;
|
export let screenshareAudioStore: ProfilableStore<ScreenshareAudioStore, ScreenshareAudioProfile>;
|
||||||
|
|
||||||
export const initScreenshareAudioStore = () =>
|
export const initScreenshareAudioStore = () =>
|
||||||
screenshareAudioStore = createPluginStore(
|
screenshareAudioStore = createPluginStore(
|
||||||
PluginInfo.PLUGIN_NAME,
|
"BetterScreenshare",
|
||||||
"ScreenshareAudioStore",
|
"ScreenshareAudioStore",
|
||||||
profileable(
|
profileable(
|
||||||
screenshareAudioStoreDefault,
|
screenshareAudioStoreDefault,
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createPluginStore, ProfilableInitializer, ProfilableStore, profileable, ProfileableProfile } from "../../philsPluginLibrary";
|
import { createPluginStore, ProfilableInitializer, ProfilableStore, profileable, ProfileableProfile } from "../../philsPluginLibrary";
|
||||||
import { PluginInfo } from "../constants";
|
|
||||||
|
|
||||||
|
|
||||||
export interface ScreenshareProfile {
|
export interface ScreenshareProfile {
|
||||||
|
@ -112,7 +111,7 @@ export let screenshareStore: ProfilableStore<ScreenshareStore, ScreenshareProfil
|
||||||
|
|
||||||
export const initScreenshareStore = () =>
|
export const initScreenshareStore = () =>
|
||||||
screenshareStore = createPluginStore(
|
screenshareStore = createPluginStore(
|
||||||
PluginInfo.PLUGIN_NAME,
|
"BetterScreenshare",
|
||||||
"ScreenshareStore",
|
"ScreenshareStore",
|
||||||
profileable(
|
profileable(
|
||||||
screenshareStoreDefault,
|
screenshareStoreDefault,
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a modification for Discord's desktop app
|
|
||||||
* Copyright (c) 2023 Vendicated and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Devs } from "@utils/constants";
|
|
||||||
|
|
||||||
import * as types from "../types/constants";
|
|
||||||
|
|
||||||
export const PluginInfo: types.PluginInfo = {
|
|
||||||
PLUGIN_NAME: "PhilsPluginLibrary",
|
|
||||||
DESCRIPTION: "A library for phil's plugins",
|
|
||||||
AUTHOR: {
|
|
||||||
...Devs.philhk,
|
|
||||||
github: "https://github.com/philhk"
|
|
||||||
},
|
|
||||||
} as const;
|
|
|
@ -1,19 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a modification for Discord's desktop app
|
|
||||||
* Copyright (c) 2023 Vendicated and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export * from "./constants";
|
|
|
@ -16,33 +16,24 @@
|
||||||
* 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 { Patch, PluginAuthor, PluginDef } from "@utils/types";
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
import { PluginInfo } from "./constants";
|
|
||||||
import { replacedUserPanelComponent } from "./patches";
|
import { replacedUserPanelComponent } from "./patches";
|
||||||
|
|
||||||
export default new class Plugin implements PluginDef {
|
export default definePlugin({
|
||||||
readonly name: string;
|
name: "PhilsPluginLibrary",
|
||||||
readonly description: string;
|
description: "A library for phil's plugins",
|
||||||
readonly authors: PluginAuthor[];
|
authors: [Devs.philhk],
|
||||||
readonly patches: Omit<Patch, "plugin">[];
|
patches: [{
|
||||||
|
|
||||||
readonly replacedUserPanelComponent: typeof replacedUserPanelComponent;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.name = PluginInfo.PLUGIN_NAME;
|
|
||||||
this.description = PluginInfo.DESCRIPTION;
|
|
||||||
this.authors = PluginInfo.AUTHORS as PluginAuthor[];
|
|
||||||
this.patches = [{
|
|
||||||
find: "Messages.ACCOUNT_A11Y_LABEL",
|
find: "Messages.ACCOUNT_A11Y_LABEL",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=function)( .{0,8}(?={).)(.{0,1000}isFullscreenInContext\(\).+?\)]}\))(})/,
|
match: /(?<=function)( .{0,8}(?={).)(.{0,1000}isFullscreenInContext\(\).+?\)]}\))(})/,
|
||||||
replace: "$1return $self.replacedUserPanelComponent(function(){$2}, this, arguments)$3"
|
replace: "$1return $self.replacedUserPanelComponent(function(){$2}, this, arguments)$3"
|
||||||
}
|
}
|
||||||
}];
|
}],
|
||||||
this.replacedUserPanelComponent = replacedUserPanelComponent;
|
replacedUserPanelComponent: replacedUserPanelComponent
|
||||||
}
|
});
|
||||||
};
|
|
||||||
|
|
||||||
export * from "./components";
|
export * from "./components";
|
||||||
export * from "./discordModules";
|
export * from "./discordModules";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue