Do A Proper Fix For FakeProfileThemesAndEffects

This commit is contained in:
thororen1234 2025-02-18 11:18:24 -05:00
parent af9a895a5e
commit bbdb4bb5bb
No known key found for this signature in database

View file

@ -24,7 +24,7 @@ function replaceHelper(
const beforeReplace = result;
result = result.replace(
canonicalizeMatch(searchRegExp),
canonicalizeReplace(replaceString, "FakeProfileThemesAndEffects")
canonicalizeReplace(replaceString, "Vencord.Plugins.plugins[\"FakeProfileThemesAndEffects\"]")
);
if (beforeReplace === result)
throw new Error("Replace had no effect: " + searchRegExp);
@ -58,7 +58,7 @@ export default definePlugin({
find: '"UserProfileStore"',
replacement: {
match: /([{}]getUserProfile\([^)]*\){return) ?([^}]+)/,
replace: "$1 Vencord.Plugins.plugins[\"FakeProfileThemesAndEffects\"].decodeAboutMeFPTEHook($2)"
replace: "$1 $self.decodeAboutMeFPTEHook($2)"
}
},
// Patches ProfileCustomizationPreview
@ -66,7 +66,7 @@ export default definePlugin({
find: ".EDIT_PROFILE_BANNER})",
replacement: {
match: /function \i\((\i)\){/,
replace: "$&Vencord.Plugins.plugins[\"FakeProfileThemesAndEffects\"].profilePreviewHook($1);"
replace: "$&$self.profilePreviewHook($1);"
}
},
// Adds the FPTE Builder to the User Profile settings page
@ -74,7 +74,7 @@ export default definePlugin({
find: '"DefaultCustomizationSections"',
replacement: {
match: /\.sectionsContainer,.*?children:\[/,
replace: "$&Vencord.Plugins.plugins[\"FakeProfileThemesAndEffects\"].addFPTEBuilder(),"
replace: "$&$self.addFPTEBuilder(),"
}
},
// Adds the FPTE Builder to the Server Profiles settings page
@ -82,7 +82,7 @@ export default definePlugin({
find: '"guild should not be null"',
replacement: {
match: /\.sectionsContainer,.*?children:\[(?=.+?[{,]guild:(\i))/,
replace: "$&Vencord.Plugins.plugins[\"FakeProfileThemesAndEffects\"].addFPTEBuilder($1),"
replace: "$&$self.addFPTEBuilder($1),"
}
},
// ProfileEffectModal
@ -93,12 +93,12 @@ export default definePlugin({
// Modal root
{
match: /(function (\i)\([^)]*\){(?:.(?!function |}$))*className:\i\.modal,(?:.(?!function |}$))*}).*(?=})/,
replace: (match, func, funcName) => `${match}(()=>{Vencord.Plugins.plugins["FakeProfileThemesAndEffects"].ProfileEffectModal=${funcName};`
replace: (match, func, funcName) => `${match}(()=>{$self.ProfileEffectModal=${funcName};`
+ replaceHelper(func, [
// Required for the profile preview to show profile effects
[
/(?<=[{,]purchases:.+?}=).+?(?=,\i=|,{\i:|;)/,
"{isFetching:!1,categories:new Map,purchases:Vencord.Plugins.plugins[\"FakeProfileThemesAndEffects\"].usePurchases()}"
"{isFetching:!1,categories:new Map,purchases:$self.usePurchases()}"
]
])
+ "})()"
@ -115,12 +115,12 @@ export default definePlugin({
// Replaces the profile effect list with the modified version
[
/(?<=\.jsxs?\)\()[^,]+(?=,{(?:(?:.(?!\.jsxs?\)))+,)?onSelect:)/,
"Vencord.Plugins.plugins[\"FakeProfileThemesAndEffects\"].ProfileEffectSelection"
"$self.ProfileEffectSelection"
],
// Replaces the apply profile effect function with the modified version
[
/(?<=[{,]onApply:).*?\)\((\i).*?(?=,\i:|}\))/,
"()=>Vencord.Plugins.plugins[\"FakeProfileThemesAndEffects\"].onApply($1)"
"()=>$self.onApply($1)"
],
// Required to show the apply button
[
@ -141,13 +141,13 @@ export default definePlugin({
find: ".presetEffectBackground",
replacement: {
match: /function\(\i,\i,.*?=>(\i).+[,;}]\1=([^=].+?})(?=;|}$).*(?=}$)/,
replace: (match, _, func) => `${match};Vencord.Plugins.plugins["FakeProfileThemesAndEffects"].ProfileEffectSelection=`
replace: (match, _, func) => `${match};$self.ProfileEffectSelection=`
+ replaceHelper(func, [
// Removes the "Exclusive to Nitro" and "Preview The Shop" sections
// Adds every profile effect to the "Your Decorations" section and removes the "Shop" button
[
/(?<=[ ,](\i)=).+?(?=(?:,\i=|,{\i:|;).+?:\1\.map\()/,
"Vencord.Plugins.plugins[\"FakeProfileThemesAndEffects\"].useProfileEffectSections($&)"
"$self.useProfileEffectSections($&)"
]
])
}