Experiments: Support new experiment link embeds & fix toolbar patch (#3372)

This commit is contained in:
Mufaro 2025-05-03 03:46:34 +02:00 committed by GitHub
parent 59974a162e
commit 3b53ad0c91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 12 deletions

View file

@ -31,6 +31,10 @@ import hideBugReport from "./hideBugReport.css?managed";
const KbdStyles = findByPropsLazy("key", "combo");
const BugReporterExperiment = findLazy(m => m?.definition?.id === "2024-09_bug_reporter");
const isMacOS = navigator.platform.includes("Mac");
const modKey = isMacOS ? "cmd" : "ctrl";
const altKey = isMacOS ? "opt" : "alt";
const settings = definePluginSettings({
toolbarDevMenu: {
type: OptionType.BOOLEAN,
@ -48,7 +52,7 @@ export default definePlugin({
Devs.Ven,
Devs.Nickyux,
Devs.BanTheNons,
Devs.Nuckyz
Devs.Nuckyz,
],
settings,
@ -75,9 +79,9 @@ export default definePlugin({
replace: "$&$self.WarningCard(),"
}
},
// change top right chat toolbar button from the help one to the dev one
// Change top right chat toolbar button from the help one to the dev one
{
find: "toolbar:function",
find: ".CONTEXTLESS,isActivityPanelMode:",
replacement: {
match: /hasBugReporterAccess:(\i)/,
replace: "_hasBugReporterAccess:$1=true"
@ -85,7 +89,7 @@ export default definePlugin({
predicate: () => settings.store.toolbarDevMenu
},
// makes the Favourites Server experiment allow favouriting DMs and threads
// Make the Favourites Server experiment allow favouriting DMs and threads
{
find: "useCanFavoriteChannel",
replacement: {
@ -93,23 +97,29 @@ export default definePlugin({
replace: "false",
}
},
// enable option to always record clips even if you are not streaming
// Enable option to always record clips even if you are not streaming
{
find: "isDecoupledGameClippingEnabled(){",
replacement: {
match: /\i\.isStaff\(\)/,
replace: "true"
}
}
},
// Enable experiment embed on sent experiment links
{
find: "dev://experiment/",
replacement: {
match: /\i\.isStaff\(\)/,
replace: "true"
}
},
],
start: () => !BugReporterExperiment.getCurrentConfig().hasBugReporterAccess && enableStyle(hideBugReport),
stop: () => disableStyle(hideBugReport),
settingsAboutComponent: () => {
const isMacOS = navigator.platform.includes("Mac");
const modKey = isMacOS ? "cmd" : "ctrl";
const altKey = isMacOS ? "opt" : "alt";
return (
<React.Fragment>
<Forms.FormTitle tag="h3">More Information</Forms.FormTitle>