mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-16 18:07:02 -04:00
experiments: remove obsolete isStaff patch; rename ServerProfile -> ServerInfo
This commit is contained in:
parent
23584393a9
commit
9ab7b8b9c9
6 changed files with 28 additions and 60 deletions
|
@ -16,31 +16,19 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { ErrorCard } from "@components/ErrorCard";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { Margins } from "@utils/margins";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { Forms, React, UserStore } from "@webpack/common";
|
||||
import { User } from "discord-types/general";
|
||||
import { Forms, React } from "@webpack/common";
|
||||
|
||||
const KbdStyles = findByPropsLazy("key", "removeBuildOverride");
|
||||
|
||||
const settings = definePluginSettings({
|
||||
enableIsStaff: {
|
||||
description: "Enable isStaff",
|
||||
type: OptionType.BOOLEAN,
|
||||
default: false,
|
||||
restartNeeded: true
|
||||
}
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "Experiments",
|
||||
description: "Enable Access to Experiments in Discord!",
|
||||
description: "Enable Access to Experiments & other dev-only features in Discord!",
|
||||
authors: [
|
||||
Devs.Megu,
|
||||
Devs.Ven,
|
||||
|
@ -48,7 +36,6 @@ export default definePlugin({
|
|||
Devs.BanTheNons,
|
||||
Devs.Nuckyz
|
||||
],
|
||||
settings,
|
||||
|
||||
patches: [
|
||||
{
|
||||
|
@ -65,20 +52,6 @@ export default definePlugin({
|
|||
replace: "$1=!0;"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: '"isStaff",',
|
||||
predicate: () => settings.store.enableIsStaff,
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<=>)(\i)\.hasFlag\((\i\.\i)\.STAFF\)(?=})/,
|
||||
replace: (_, user, flags) => `$self.isStaff(${user},${flags})`
|
||||
},
|
||||
{
|
||||
match: /hasFreePremium\(\){return this.isStaff\(\)\s*?\|\|/,
|
||||
replace: "hasFreePremium(){return ",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
find: 'H1,title:"Experiments"',
|
||||
replacement: {
|
||||
|
@ -88,15 +61,6 @@ export default definePlugin({
|
|||
}
|
||||
],
|
||||
|
||||
isStaff(user: User, flags: any) {
|
||||
try {
|
||||
return UserStore.getCurrentUser()?.id === user.id || user.hasFlag(flags.STAFF);
|
||||
} catch (err) {
|
||||
new Logger("Experiments").error(err);
|
||||
return user.hasFlag(flags.STAFF);
|
||||
}
|
||||
},
|
||||
|
||||
settingsAboutComponent: () => {
|
||||
const isMacOS = navigator.platform.includes("Mac");
|
||||
const modKey = isMacOS ? "cmd" : "ctrl";
|
||||
|
@ -105,14 +69,10 @@ export default definePlugin({
|
|||
<React.Fragment>
|
||||
<Forms.FormTitle tag="h3">More Information</Forms.FormTitle>
|
||||
<Forms.FormText variant="text-md/normal">
|
||||
You can enable client DevTools{" "}
|
||||
You can open Discord's DevTools via {" "}
|
||||
<kbd className={KbdStyles.key}>{modKey}</kbd> +{" "}
|
||||
<kbd className={KbdStyles.key}>{altKey}</kbd> +{" "}
|
||||
<kbd className={KbdStyles.key}>O</kbd>{" "}
|
||||
after enabling <code>isStaff</code> below
|
||||
</Forms.FormText>
|
||||
<Forms.FormText>
|
||||
and then toggling <code>Enable DevTools</code> in the <code>Developer Options</code> tab in settings.
|
||||
</Forms.FormText>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
@ -128,6 +88,12 @@ export default definePlugin({
|
|||
|
||||
<Forms.FormText className={Margins.top8}>
|
||||
Only use experiments if you know what you're doing. Vencord is not responsible for any damage caused by enabling experiments.
|
||||
|
||||
If you don't know what an experiment does, ignore it. Do not ask us what experiments do either, we probably don't know.
|
||||
</Forms.FormText>
|
||||
|
||||
<Forms.FormText className={Margins.top8}>
|
||||
No, you cannot use server-side features like checking the "Send to Client" box.
|
||||
</Forms.FormText>
|
||||
</ErrorCard>
|
||||
), { noop: true })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue