chore(plugins): Fix IgnoreActivities & clean up other plugins (#384)
This commit is contained in:
parent
15aa2299c3
commit
f0240ec345
3 changed files with 18 additions and 18 deletions
|
@ -35,7 +35,7 @@ interface IgnoredActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
const RegisteredGamesClasses = findByPropsLazy("overlayToggleIconOff", "overlayToggleIconOn");
|
const RegisteredGamesClasses = findByPropsLazy("overlayToggleIconOff", "overlayToggleIconOn");
|
||||||
const PreviewBadgeClasses = findByPropsLazy("previewBadge", "previewBadgeIcon");
|
const TryItOutClasses = findByPropsLazy("tryItOutBadge", "tryItOutBadgeIcon");
|
||||||
const BaseShapeRoundClasses = findByPropsLazy("baseShapeRound", "baseShapeRoundLeft", "baseShapeRoundRight");
|
const BaseShapeRoundClasses = findByPropsLazy("baseShapeRound", "baseShapeRoundLeft", "baseShapeRoundRight");
|
||||||
const RunningGameStore = findByPropsLazy("getRunningGames", "getGamesSeen");
|
const RunningGameStore = findByPropsLazy("getRunningGames", "getGamesSeen");
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ function ToggleActivityComponent({ activity }: { activity: IgnoredActivity; }) {
|
||||||
function ToggleActivityComponentWithBackground({ activity }: { activity: IgnoredActivity; }) {
|
function ToggleActivityComponentWithBackground({ activity }: { activity: IgnoredActivity; }) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`${PreviewBadgeClasses.previewBadge} ${BaseShapeRoundClasses.baseShapeRound}`}
|
className={`${TryItOutClasses.tryItOutBadge} ${BaseShapeRoundClasses.baseShapeRound}`}
|
||||||
style={{ padding: "0 2px" }}
|
style={{ padding: "0 2px" }}
|
||||||
>
|
>
|
||||||
<ToggleActivityComponent activity={activity} />
|
<ToggleActivityComponent activity={activity} />
|
||||||
|
@ -145,11 +145,11 @@ export default definePlugin({
|
||||||
patches: [{
|
patches: [{
|
||||||
find: ".Messages.SETTINGS_GAMES_OVERLAY_ON",
|
find: ".Messages.SETTINGS_GAMES_OVERLAY_ON",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(this.renderLastPlayed\(\)]}\),this.renderOverlayToggle\(\))/,
|
match: /this.renderLastPlayed\(\)]}\),this.renderOverlayToggle\(\)/,
|
||||||
replace: "$1,Vencord.Plugins.plugins.IgnoreActivities.renderToggleGameActivityButton(this.props)"
|
replace: "$&,Vencord.Plugins.plugins.IgnoreActivities.renderToggleGameActivityButton(this.props)"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
find: ".Messages.NEW,name",
|
find: ".overlayBadge",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /.badgeContainer.+?.\?\(0,.\.jsx\)\(.{1,2},{name:(?<props>.)\.name}\):null/,
|
match: /.badgeContainer.+?.\?\(0,.\.jsx\)\(.{1,2},{name:(?<props>.)\.name}\):null/,
|
||||||
replace: "$&,Vencord.Plugins.plugins.IgnoreActivities.renderToggleActivityButton($<props>)"
|
replace: "$&,Vencord.Plugins.plugins.IgnoreActivities.renderToggleActivityButton($<props>)"
|
||||||
|
@ -157,8 +157,8 @@ export default definePlugin({
|
||||||
}, {
|
}, {
|
||||||
find: '.displayName="LocalActivityStore"',
|
find: '.displayName="LocalActivityStore"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /((.)\.push\(.\({type:.\..{1,3}\.LISTENING.+?;)/,
|
match: /(?<activities>.)\.push\(.\({type:.\..{1,3}\.LISTENING.+?\)\)/,
|
||||||
replace: "$1$2=$2.filter(Vencord.Plugins.plugins.IgnoreActivities.isActivityEnabled);"
|
replace: "$&;$<activities>=$<activities>.filter(Vencord.Plugins.plugins.IgnoreActivities.isActivityIgnored);"
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ export default definePlugin({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
isActivityEnabled(props: { type: number; application_id?: string; name?: string; }) {
|
isActivityIgnored(props: { type: number; application_id?: string; name?: string; }) {
|
||||||
if (props.type === 0) {
|
if (props.type === 0) {
|
||||||
if (props.application_id !== undefined) return !ignoredActivitiesCache.has(props.application_id);
|
if (props.application_id !== undefined) return !ignoredActivitiesCache.has(props.application_id);
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -29,21 +29,21 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".Messages.USER_VOLUME",
|
find: ".Messages.USER_VOLUME",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /maxValue:(.{1,2}\..{1,2})\?(\d+?):(\d+?),/,
|
match: /maxValue:(?<defaultMaxVolumePredicate>.{1,2}\..{1,2})\?(?<higherMaxVolume>\d+?):(?<minorMaxVolume>\d+?),/,
|
||||||
replace: (_, defaultMaxVolumePredicate, higherMaxVolume, minorMaxVolume) => ""
|
replace: ""
|
||||||
+ `maxValue:${defaultMaxVolumePredicate}`
|
+ "maxValue:$<defaultMaxVolumePredicate>"
|
||||||
+ `?${higherMaxVolume}*Vencord.Settings.plugins.VolumeBooster.multiplier`
|
+ "?$<higherMaxVolume>*Vencord.Settings.plugins.VolumeBooster.multiplier"
|
||||||
+ `:${minorMaxVolume}*Vencord.Settings.plugins.VolumeBooster.multiplier,`
|
+ ":$<minorMaxVolume>*Vencord.Settings.plugins.VolumeBooster.multiplier,"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "currentVolume:",
|
find: "currentVolume:",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /maxValue:(.{1,2}\..{1,2})\?(\d+?):(\d+?),/,
|
match: /maxValue:(?<defaultMaxVolumePredicate>.{1,2}\..{1,2})\?(?<higherMaxVolume>\d+?):(?<minorMaxVolume>\d+?),/,
|
||||||
replace: (_, defaultMaxVolumePredicate, higherMaxVolume, minorMaxVolume) => ""
|
replace: ""
|
||||||
+ `maxValue:${defaultMaxVolumePredicate}`
|
+ "maxValue:$<defaultMaxVolumePredicate>"
|
||||||
+ `?${higherMaxVolume}*Vencord.Settings.plugins.VolumeBooster.multiplier`
|
+ "?$<higherMaxVolume>*Vencord.Settings.plugins.VolumeBooster.multiplier"
|
||||||
+ `:${minorMaxVolume}*Vencord.Settings.plugins.VolumeBooster.multiplier,`
|
+ ":$<minorMaxVolume>*Vencord.Settings.plugins.VolumeBooster.multiplier,"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue