Fix multiple plugins for latest Discord update (#2911)

Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
sadan4 2024-09-25 21:25:48 -04:00 committed by GitHub
parent 1abfb5f0cf
commit bc59fc41b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 68 additions and 67 deletions

View file

@ -254,11 +254,11 @@ export default definePlugin({
},
// Allow stickers to be sent everywhere
{
find: "canUseCustomStickersEverywhere:function",
find: "canUseCustomStickersEverywhere:",
predicate: () => settings.store.enableStickerBypass,
replacement: {
match: /canUseCustomStickersEverywhere:function\(\i\){/,
replace: "$&return true;"
match: /(?<=canUseCustomStickersEverywhere:)\i/,
replace: "()=>true"
},
},
// Make stickers always available
@ -272,15 +272,15 @@ export default definePlugin({
},
// Allow streaming with high quality
{
find: "canUseHighVideoUploadQuality:function",
find: "canUseHighVideoUploadQuality:",
predicate: () => settings.store.enableStreamQualityBypass,
replacement: [
"canUseHighVideoUploadQuality",
"canStreamQuality",
].map(func => {
return {
match: new RegExp(`${func}:function\\(\\i(?:,\\i)?\\){`, "g"),
replace: "$&return true;"
match: new RegExp(`(?<=${func}:)\\i`, "g"),
replace: "()=>true"
};
})
},
@ -295,10 +295,10 @@ export default definePlugin({
},
// Allow client themes to be changeable
{
find: "canUseClientThemes:function",
find: "canUseClientThemes:",
replacement: {
match: /canUseClientThemes:function\(\i\){/,
replace: "$&return true;"
match: /(?<=canUseClientThemes:)\i/,
replace: "()=>true"
}
},
{
@ -306,8 +306,8 @@ export default definePlugin({
replacement: [
{
// Overwrite incoming connection settings proto with our local settings
match: /CONNECTION_OPEN:function\((\i)\){/,
replace: (m, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`
match: /function (\i)\((\i)\){(?=.*CONNECTION_OPEN:\1)/,
replace: (m, funcName, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`
},
{
// Overwrite non local proto changes with our local settings
@ -400,10 +400,10 @@ export default definePlugin({
},
// Allow using custom app icons
{
find: "canUsePremiumAppIcons:function",
find: "canUsePremiumAppIcons:",
replacement: {
match: /canUsePremiumAppIcons:function\(\i\){/,
replace: "$&return true;"
match: /(?<=canUsePremiumAppIcons:)\i/,
replace: "()=>true"
}
},
// Separate patch for allowing using custom app icons
@ -424,10 +424,10 @@ export default definePlugin({
},
// Allow using custom notification sounds
{
find: "canUseCustomNotificationSounds:function",
find: "canUseCustomNotificationSounds:",
replacement: {
match: /canUseCustomNotificationSounds:function\(\i\){/,
replace: "$&return true;"
match: /(?<=canUseCustomNotificationSounds:)\i/,
replace: "()=>true"
}
}
],