Remove 'Run Snippet' functionality
This was really nice to have support, but having functionality like this is inherently unsafe. For security reasons, it's better to remove it.
This commit is contained in:
parent
0c3c9625a7
commit
b52ed365cf
1 changed files with 0 additions and 26 deletions
|
|
@ -43,8 +43,6 @@ import plugins, { PluginMeta } from "~plugins";
|
|||
|
||||
import SettingsPlugin from "./settings";
|
||||
|
||||
const CodeBlockRe = /```js\n(.+?)```/s;
|
||||
|
||||
const AdditionalAllowedChannelIds = [
|
||||
"1024286218801926184", // Vencord > #bot-commands
|
||||
];
|
||||
|
|
@ -55,8 +53,6 @@ const TrustedRolesIds = [
|
|||
DONOR_ROLE_ID, // donor
|
||||
];
|
||||
|
||||
const AsyncFunction = async function () { }.constructor;
|
||||
|
||||
const ShowCurrentGame = getUserSettingLazy<boolean>("status", "showCurrentGame")!;
|
||||
|
||||
const isSupportAllowedChannel = (channel: Channel) => channel.parent_id === SUPPORT_CATEGORY_ID || AdditionalAllowedChannelIds.includes(channel.id);
|
||||
|
|
@ -319,28 +315,6 @@ export default definePlugin({
|
|||
}
|
||||
}
|
||||
|
||||
if (props.channel.parent_id === KNOWN_ISSUES_CHANNEL_ID || (props.channel.parent_id === SUPPORT_CATEGORY_ID && props.message.author.id === VENBOT_USER_ID)) {
|
||||
const match = CodeBlockRe.exec(props.message.content || props.message.embeds[0]?.rawDescription || "");
|
||||
if (match) {
|
||||
buttons.push(
|
||||
<Button
|
||||
key="vc-run-snippet"
|
||||
onClick={async () => {
|
||||
try {
|
||||
await AsyncFunction(match[1])();
|
||||
showToast("Success!", "success");
|
||||
} catch (e) {
|
||||
new Logger(this.name).error("Error while running snippet:", e);
|
||||
showToast("Failed to run snippet :(", "failure");
|
||||
}
|
||||
}}
|
||||
>
|
||||
Run Snippet
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return buttons.length
|
||||
? <Flex>{buttons}</Flex>
|
||||
: null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue