aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSammy <sammy@sammcheese.net>2023-05-16 19:38:01 -0700
committerGitHub <noreply@github.com>2023-05-17 04:38:01 +0200
commit341151a71811ddf2a7a36af3dc037135d2b9f7dd (patch)
tree9f69090ff93c74d5f54edd8041fa6b312573a7fd
parentf6fd7cf37a177aed043addeaddd11b6aaad06419 (diff)
downloadVencord-341151a71811ddf2a7a36af3dc037135d2b9f7dd.tar.gz
Vencord-341151a71811ddf2a7a36af3dc037135d2b9f7dd.tar.bz2
Vencord-341151a71811ddf2a7a36af3dc037135d2b9f7dd.zip
feat(InvisibleChat): use discords embed api (#1162)
-rw-r--r--src/plugins/invisibleChat/index.tsx30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/plugins/invisibleChat/index.tsx b/src/plugins/invisibleChat/index.tsx
index fb173ee..6f21628 100644
--- a/src/plugins/invisibleChat/index.tsx
+++ b/src/plugins/invisibleChat/index.tsx
@@ -22,7 +22,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getStegCloak } from "@utils/dependencies";
import definePlugin, { OptionType } from "@utils/types";
-import { Button, ButtonLooks, ButtonWrapperClasses, ChannelStore, FluxDispatcher, Tooltip } from "@webpack/common";
+import { Button, ButtonLooks, ButtonWrapperClasses, ChannelStore, FluxDispatcher, RestAPI, Tooltip } from "@webpack/common";
import { Message } from "discord-types/general";
import { buildDecModal } from "./components/DecryptionModal";
@@ -123,7 +123,7 @@ const settings = definePluginSettings({
export default definePlugin({
name: "InvisibleChat",
- description: "Encrypt your Messages in a non-suspicious way! This plugin makes requests to >>https://embed.sammcheese.net<< to provide embeds to decrypted links!",
+ description: "Encrypt your Messages in a non-suspicious way!",
authors: [Devs.SammCheese],
dependencies: ["MessagePopoverAPI"],
patches: [
@@ -178,25 +178,13 @@ export default definePlugin({
// Gets the Embed of a Link
async getEmbed(url: URL): Promise<Object | {}> {
- const controller = new AbortController();
- const timeout = setTimeout(() => controller.abort(), 5000);
-
- const options: RequestInit = {
- signal: controller.signal,
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- url,
- }),
- };
-
- // AWS hosted url to discord embed object
- const rawRes = await fetch(this.EMBED_API_URL, options);
- clearTimeout(timeout);
-
- return await rawRes.json();
+ const { body } = await RestAPI.post({
+ url: "/unfurler/embed-urls",
+ body: {
+ urls: [url]
+ }
+ });
+ return await body.embeds[0];
},
async buildEmbed(message: any, revealed: string): Promise<void> {