@ -16,31 +16,19 @@
* along with this program . If not , see < https : / / www.gnu.org / licenses / > .
* along with this program . If not , see < https : / / www.gnu.org / licenses / > .
* /
* /
import { definePluginSettings } from "@api/Settings" ;
import ErrorBoundary from "@components/ErrorBoundary" ;
import ErrorBoundary from "@components/ErrorBoundary" ;
import { ErrorCard } from "@components/ErrorCard" ;
import { ErrorCard } from "@components/ErrorCard" ;
import { Devs } from "@utils/constants" ;
import { Devs } from "@utils/constants" ;
import { Logger } from "@utils/Logger" ;
import { Margins } from "@utils/margins" ;
import { Margins } from "@utils/margins" ;
import definePlugin , { OptionType } from "@utils/types" ;
import definePlugin from "@utils/types" ;
import { findByPropsLazy } from "@webpack" ;
import { findByPropsLazy } from "@webpack" ;
import { Forms , React , UserStore } from "@webpack/common" ;
import { Forms , React } from "@webpack/common" ;
import { User } from "discord-types/general" ;
const KbdStyles = findByPropsLazy ( "key" , "removeBuildOverride" ) ;
const KbdStyles = findByPropsLazy ( "key" , "removeBuildOverride" ) ;
const settings = definePluginSettings ( {
enableIsStaff : {
description : "Enable isStaff" ,
type : OptionType . BOOLEAN ,
default : false ,
restartNeeded : true
}
} ) ;
export default definePlugin ( {
export default definePlugin ( {
name : "Experiments" ,
name : "Experiments" ,
description : "Enable Access to Experiments in Discord!",
description : "Enable Access to Experiments & other dev-only features in Discord!" ,
authors : [
authors : [
Devs . Megu ,
Devs . Megu ,
Devs . Ven ,
Devs . Ven ,
@ -48,7 +36,6 @@ export default definePlugin({
Devs . BanTheNons ,
Devs . BanTheNons ,
Devs . Nuckyz
Devs . Nuckyz
] ,
] ,
settings ,
patches : [
patches : [
{
{
@ -65,20 +52,6 @@ export default definePlugin({
replace : "$1=!0;"
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"' ,
find : 'H1,title:"Experiments"' ,
replacement : {
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 : ( ) = > {
settingsAboutComponent : ( ) = > {
const isMacOS = navigator . platform . includes ( "Mac" ) ;
const isMacOS = navigator . platform . includes ( "Mac" ) ;
const modKey = isMacOS ? "cmd" : "ctrl" ;
const modKey = isMacOS ? "cmd" : "ctrl" ;
@ -105,14 +69,10 @@ export default definePlugin({
< React.Fragment >
< React.Fragment >
< Forms.FormTitle tag = "h3" > More Information < / Forms.FormTitle >
< Forms.FormTitle tag = "h3" > More Information < / Forms.FormTitle >
< Forms.FormText variant = "text-md/normal" >
< 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 } > { modKey } < / kbd > + { " " }
< kbd className = { KbdStyles . key } > { altKey } < / kbd > + { " " }
< kbd className = { KbdStyles . key } > { altKey } < / kbd > + { " " }
< kbd className = { KbdStyles . key } > O < / 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 >
< / Forms.FormText >
< / React.Fragment >
< / React.Fragment >
) ;
) ;
@ -128,6 +88,12 @@ export default definePlugin({
< Forms.FormText className = { Margins . top8 } >
< 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 .
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 >
< / Forms.FormText >
< / ErrorCard >
< / ErrorCard >
) , { noop : true } )
) , { noop : true } )