import { classNameFactory } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
import { PluginCard } from "@components/PluginSettings";
import { ModalCloseButton, ModalContent, ModalHeader, ModalRoot, ModalSize, openModal, closeModal } from "@utils/modal";
import { Alerts, Button, Card, Parser, Text, Toasts } from "@webpack/common";
import { Native } from ".";
const cl = classNameFactory("vc-userplugininstaller-");
export function showInstallModal(meta: any, pluginPath: string) {
console.log(meta);
Alerts.show({
title: <>
Review userplugin
>,
body: <>
Plugin info
{meta.name}
{meta.description}
Notes & warnings
{
meta.usesPreSend &&
Has pre-send listeners
This plugin is able to intercept and edit messages before sending them.
}
Refresh and enable required
After the install is completed, Discord will be reloaded and you will need to enable the plugin yourself.
Make sure that the plugin author is trustworthy before installing {meta.name}.
>,
cancelText: "Cancel install",
confirmText: `Install plugin`,
onCancel() {
Native.deleteFolder(pluginPath);
},
onCloseCallback() {
setTimeout(() => {
Native.deleteFolder(pluginPath);
}, 20000);
},
async onConfirm() {
Toasts.pop();
Toasts.show({
message: "Rebuilding Vencord, please wait...",
id: Toasts.genId(),
type: Toasts.Type.MESSAGE
});
try {
await Native.build(pluginPath);
window.location.reload();
}
catch {
Toasts.pop();
return Toasts.show({
message: "Something bad has happened while building Vencord.",
id: Toasts.genId(),
type: Toasts.Type.FAILURE
});
}
},
});
}