This commit is contained in:
thororen1234 2024-07-18 23:54:25 -04:00
commit a64eae919a
20 changed files with 251 additions and 441 deletions

View file

@ -1,44 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "ModViewBypass",
description: "Open the mod view sidebar in guilds you don't have moderator permissions in, or where the experiment is disabled.",
authors: [Devs.Sqaaakoi],
patches: [
{
find: "canAccessGuildMemberModViewWithExperiment:",
replacement: {
match: /canAccessGuildMemberModViewWithExperiment:function\(\){return\s\i/,
replace: "canAccessGuildMemberModViewWithExperiment:function(){return ()=>true;",
},
},
{
find: "useCanAccessGuildMemberModView:",
replacement: {
match: /\i.default.hasAny\(/,
replace: "true; (",
},
},
{
find: "isInGuildMemberModViewExperiment:",
replacement: {
match: /isInGuildMemberModViewExperiment:function\(\){return\s\i/,
replace: "isInGuildMemberModViewExperiment:function(){return ()=>true;",
},
},
{
find: "useGuildMemberModViewExperiment:",
replacement: {
match: /useGuildMemberModViewExperiment:function\(\){return\s\i/,
replace: "useGuildMemberModViewExperiment:function(){return ()=>true;",
},
},
],
});

View file

@ -13,13 +13,6 @@ export default definePlugin({
authors: [EquicordDevs.kvba],
patches: [
{
find: "\"APP_TAG\"",
replacement: {
match: /"APP_TAG":".*?"/,
replace: "\"APP_TAG\":\"BOT\""
}
},
{
find: ",APP_TAG:\"",
replacement: {

View file

@ -29,7 +29,7 @@ export default definePlugin({
patches: [
{
find: "Messages.ACCOUNT_A11Y_LABEL",
find: "isFullscreenInContext());",
replacement: {
match: /(?<=function)( \i\i\(\i\)(?={).)(.{0,1000}\i\.\i\.isFullscreenInContext\(\).+?\)]}\))\}/,
replace: "$1 return $self.replacedUserPanelComponent(function(){$2}, this, arguments)}"

View file

@ -62,13 +62,12 @@ export default definePlugin({
name: "TextToSpeech",
description: "Reads out chat messages with openai tts",
authors: [Devs.Samwich],
flux:
{
flux: {
async MESSAGE_CREATE({ optimistic, type, message, channelId }) {
if (optimistic || type !== "MESSAGE_CREATE") return;
if (message.state === "SENDING") return;
if (!message.content) return;
if (message.channel_id !== getCurrentChannel().id) return;
if (message.channel_id !== getCurrentChannel()?.id ?? 0) return;
readOutText(message.content);
}

View file

@ -1,70 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { definePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
const settings = definePluginSettings({
spoilerFilenames: {
description: "Strings in filenames that should be spoilered. Comma separated.",
type: OptionType.STRING,
default: "",
},
spoilerLinks: {
description: "Strings in link attachments that should be spoilered. Comma separated.",
type: OptionType.STRING,
default: ""
},
gifSpoilersOnly: {
description: "Should the links only be gifs?",
type: OptionType.BOOLEAN,
default: true
},
});
export default definePlugin({
name: "TriggerWarning",
authors: [EquicordDevs.Joona],
description: "Spoiler attachments based on filenames and links.",
patches: [
{
find: "SimpleMessageAccessories:",
replacement: [
{
match: /function \i\((\i),\i\){return/,
replace: "$& $self.shouldSpoiler($1.originalItem.filename) || "
},
{
match: /(\i)=\(0,\i\.getOb.{27,35}\);(?=if\((\i).type)/,
replace: "$&$1=$self.spoilerLink($1,$2.url,$2.type);"
}
]
}
],
settings,
shouldSpoiler(filename: string): string | null {
const { spoilerFilenames } = settings.store;
if (!filename || !spoilerFilenames) return null;
const strings = spoilerFilenames.split(",").map(s => s.trim());
return strings.some(s => filename.includes(s)) ? "spoiler" : null;
},
spoilerLink(alreadySpoilered: string, link: string, type: string): string | null {
if (alreadySpoilered) return alreadySpoilered;
const { spoilerLinks, gifSpoilersOnly } = settings.store;
if (!link || !spoilerLinks) return null;
const strings = spoilerLinks.split(",").map(s => s.trim());
const isLinkSpoiler = strings.some(s => link.includes(s));
if (gifSpoilersOnly) {
return type === "gifv" && isLinkSpoiler ? "spoiler" : null;
} else {
return isLinkSpoiler ? "spoiler" : null;
}
}
});

View file

@ -1,147 +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 { Settings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { findExportedComponentLazy } from "@webpack";
import { Menu, Popout, useState } from "@webpack/common";
import type { ReactNode } from "react";
function toggle(name: string, onClose: () => void) {
Settings.plugins.TextModifiers[name] = !Settings.plugins.TextModifiers[name];
onClose();
}
function isEnabled(name: string) {
return Settings.plugins.TextModifiers[name];
}
const HeaderBarIcon = findExportedComponentLazy("Icon", "Divider");
function utilityDockPopout(onClose: () => void) {
return (
<Menu.Menu
navId="utilityDock"
onClose={onClose}
>
<Menu.MenuCheckboxItem
id="utilityDock-quickcss-toggle"
checked={Settings.useQuickCss}
label={"QuickCSS"}
action={() => {
Settings.useQuickCss = !Settings.useQuickCss;
onClose();
}}
/>
<Menu.MenuItem
id="utilityDock-quickcss"
label="Edit QuickCSS"
action={() => VencordNative.quickCss.openEditor()}
/>
</Menu.Menu>
);
}
function utilityDockIcon(isShown: boolean) {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width={24} height={24}>
<path fill="currentColor" d={isShown ?
"M20 8H17V6C17 4.9 16.1 4 15 4H9C7.9 4 7 4.9 7 6V8H4C2.9 8 2 8.9 2 10V20H22V10C22 8.9 21.1 8 20 8M9 6H15V8H9V6M20 18H4V15H6V16H8V15H16V16H18V15H20V18M18 13V12H16V13H8V12H6V13H4V10H20V13H18Z"
:
"M18 16H16V15H8V16H6V15H2V20H22V15H18V16M20 8H17V6C17 4.9 16.1 4 15 4H9C7.9 4 7 4.9 7 6V8H4C2.9 8 2 8.9 2 10V14H6V12H8V14H16V12H18V14H22V10C22 8.9 21.1 8 20 8M15 8H9V6H15V8Z"} />
</svg>
);
}
function VencordPopoutButton() {
const [show, setShow] = useState(false);
return (
<Popout
position="bottom"
align="right"
animation={Popout.Animation.NONE}
shouldShow={show}
onRequestClose={() => setShow(false)}
renderPopout={() => utilityDockPopout(() => setShow(false))}
>
{(_, { isShown }) => (
<HeaderBarIcon
className="vc-toolbox-btn"
onClick={() => setShow(v => !v)}
tooltip={isShown ? null : "Utility Dock"}
icon={() => utilityDockIcon(isShown)}
selected={isShown}
/>
)}
</Popout>
);
}
function utilityDock({ children }: { children: ReactNode[]; }) {
children.splice(
children.length - 1, 0,
<ErrorBoundary noop={true}>
<VencordPopoutButton />
</ErrorBoundary>
);
return <>{children}</>;
}
export default definePlugin({
name: "UtilityDock",
description: "Adds a button on your titlebar with multiple useful features",
authors: [Devs.Samwich],
patches: [
{
find: "toolbar:function",
replacement: {
match: /(?<=toolbar:function.{0,100}\()\i.Fragment,/,
replace: "$self.utilityDock,"
}
}
],
utilityDock: ErrorBoundary.wrap(utilityDock, {
fallback: () => <p style={{ color: "red" }}>Failed to render :(</p>
})
});
export function TextPlugin({ pluginName, onClose }) {
return (
<Menu.MenuCheckboxItem
id={`vc-toolbox-${pluginName}-toggle`}
checked={Settings.plugins[pluginName].enabled}
label={pluginName}
action={() => {
Settings.plugins[pluginName].isEnabled = !Settings.plugins[pluginName].isEnabled;
onClose();
}}
/>
);
}