Equicord/src/equicordplugins/platformSpoofer/index.tsx
KrystalSkull f9c12779c8
chore(pluginCards): warning to few plugins, change restart modal style & more (#88)
* add warning to plugins

* update wording and restart button

* update warning gif
2024-10-31 19:11:11 -06:00

73 lines
2 KiB
TypeScript

/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./style.css";
import { definePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { Forms } from "@webpack/common";
const settings = definePluginSettings({
platform: {
type: OptionType.SELECT,
description: "What platform to show up as on",
restartNeeded: true,
options: [
{
label: "Desktop",
value: "desktop",
default: true,
},
{
label: "Web",
value: "web",
},
{
label: "Mobile",
value: "mobile",
},
{
label: "Embedded (Console)",
value: "embedded",
},
]
}
});
export default definePlugin({
name: "PlatformSpoofer",
description: "Spoof what platform or device you're on",
authors: [EquicordDevs.Drag],
settingsAboutComponent: () => <>
<Forms.FormText className="platform-warning">
We can't guarantee this plugin won't get you warned or banned.
</Forms.FormText>
</>,
settings: settings,
patches: [
{
find: "_doIdentify(){",
replacement: {
match: /(\[IDENTIFY\].*let.{0,5}=\{.*properties:)(.*),presence/,
replace: "$1{...$2,...$self.getPlatform()},presence"
}
}
],
getPlatform: () => {
switch (settings.store.platform ?? "desktop") {
case "desktop":
return { browser: "Discord Client" };
case "web":
return { browser: "Chrome" };
case "mobile":
return { browser: "Discord iOS" };
case "embedded":
return { browser: "Discord Embedded" };
}
}
});