From 8c998b9330af7e7db089709ba05170e2a3c45cfc Mon Sep 17 00:00:00 2001 From: AutumnVN Date: Wed, 25 Oct 2023 20:34:00 +0700 Subject: [PATCH] experiments: fix (#1855) --- src/plugins/experiments/index.tsx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx index 149c436c..89fcf33e 100644 --- a/src/plugins/experiments/index.tsx +++ b/src/plugins/experiments/index.tsx @@ -52,7 +52,7 @@ export default definePlugin({ { find: "Object.defineProperties(this,{isDeveloper", replacement: { - match: /(?<={isDeveloper:\{[^}]+?,get:function\(\)\{return )\w/, + match: /(?<={isDeveloper:\{[^}]+?,get:\(\)=>)\i/, replace: "true" } }, @@ -64,19 +64,28 @@ export default definePlugin({ } }, { - find: ".isStaff=function(){", + find: ".isStaff=()", predicate: () => settings.store.enableIsStaff, replacement: [ { - match: /return\s*?(\i)\.hasFlag\((\i\.\i)\.STAFF\)}/, - replace: (_, user, flags) => `return Vencord.Webpack.Common.UserStore.getCurrentUser()?.id===${user}.id||${user}.hasFlag(${flags}.STAFF)}` + match: /=>*?(\i)\.hasFlag\((\i\.\i)\.STAFF\)}/, + replace: (_, user, flags) => `=>Vencord.Webpack.Common.UserStore.getCurrentUser()?.id===${user}.id||${user}.hasFlag(${flags}.STAFF)}` }, { - match: /hasFreePremium=function\(\){return this.isStaff\(\)\s*?\|\|/, - replace: "hasFreePremium=function(){return ", + match: /hasFreePremium\(\){return this.isStaff\(\)\s*?\|\|/, + replace: "hasFreePremium(){return ", } ] }, + // Fix search history being disabled / broken with isStaff + { + find: '("showNewSearch")', + predicate: () => settings.store.enableIsStaff, + replacement: { + match: /(?<=showNewSearch"\);return)\s?/, + replace: "!1&&" + } + }, { find: 'H1,title:"Experiments"', replacement: {