/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
import { migratePluginSettings } from "@api/Settings";
import { CodeBlock } from "@components/CodeBlock";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import { Margins } from "@utils/margins";
import {
closeModal,
ModalCloseButton,
ModalContent,
ModalHeader,
ModalRoot,
ModalSize,
openModal,
} from "@utils/modal";
import definePlugin from "@utils/types";
import { Forms, Menu, Text } from "@webpack/common";
import { Message } from "discord-types/general";
migratePluginSettings("ViewRawVariant", "ViewRaw2");
type CustomMessage = Message & {
editHistory?: any;
deleted?: any;
firstEditTimestamp?: any;
};
const CopyIcon = () => {
return (
);
};
function cleanMessage(msg: CustomMessage) {
const author = { ...msg.author } as any;
delete author.email;
delete author.phone;
delete author.mfaEnabled;
delete author.personalConnectionId;
delete msg.editHistory;
delete msg.deleted;
delete msg.firstEditTimestamp;
return { ...msg, author };
}
function openViewRawModal(obj: any, type: string, isMessage?: boolean) {
const key = openModal(props => (