From cf93a3e7ec650cf0c2c457ec8a799b395fc463f6 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 19 Oct 2022 13:56:13 -0300 Subject: [PATCH 1/5] initial --- src/plugins/ify.ts | 47 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/src/plugins/ify.ts b/src/plugins/ify.ts index 743560da4a5..9731a6d4437 100644 --- a/src/plugins/ify.ts +++ b/src/plugins/ify.ts @@ -1,18 +1,47 @@ import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import definePlugin, { OptionType } from "../utils/types"; +import { Settings } from "../Vencord"; export default definePlugin({ name: "Ify", - description: "Disables Spotify auto-pausing and Premium checks, allowing you to listen along with others.", - authors: [Devs.Cyn], + description: "Disables Spotify auto-pausing, allows activity to continue playing when idling and bypasses premium checks, allowing you to listen along with others.", + authors: [ + Devs.Cyn, + { name: "Nuckyz", id: 235834946571337729n } + ], patches: [{ - find: '.displayName="SpotifyStore"', + find: 'dispatch({type:"SPOTIFY_PROFILE_UPDATE"', replacement: [{ - match: /\.isPremium=.;/, - replace: ".isPremium=true;" - }, { + match: /(function\((.{1,2})\){)(.{1,6}dispatch\({type:"SPOTIFY_PROFILE_UPDATE")/, + replace: '$1$2.body.product=\"premium\";$3' + }], + }, { + find: '.displayName="SpotifyStore"', + predicate: () => Settings.plugins["Ify"].noSpotifyAutoPause === true, + replacement: { match: /function (.{1,2})\(\).{0,200}SPOTIFY_AUTO_PAUSED\);.{0,}}}}/, replace: "function $1(){}" - }] - }] + } + }, { + find: '.displayName="SpotifyStore"', + predicate: () => Settings.plugins["Ify"].keepSpotifyActivityOnIdle === true, + replacement: { + match: /(shouldShowActivity=function\(\){.{1,50})&&!.{1,6}\.isIdle\(\)(.{0,}?})/, + replace: "$1$2" + } + }], + options: { + noSpotifyAutoPause: { + description: "Disable Spotify auto-pause", + type: OptionType.BOOLEAN, + default: true, + restartNeeded: true, + }, + keepSpotifyActivityOnIdle: { + description: "Keep Spotify activity playing when idling", + type: OptionType.BOOLEAN, + default: false, + restartNeeded: true, + } + } }); From dccafd0f87791386ed3f3dd03211bcaa7248c36e Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 19 Oct 2022 15:08:56 -0300 Subject: [PATCH 2/5] changes --- src/plugins/ify.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/ify.ts b/src/plugins/ify.ts index 9731a6d4437..c23bccded15 100644 --- a/src/plugins/ify.ts +++ b/src/plugins/ify.ts @@ -17,14 +17,14 @@ export default definePlugin({ }], }, { find: '.displayName="SpotifyStore"', - predicate: () => Settings.plugins["Ify"].noSpotifyAutoPause === true, + predicate: () => Settings.plugins.Ify.noSpotifyAutoPause, replacement: { match: /function (.{1,2})\(\).{0,200}SPOTIFY_AUTO_PAUSED\);.{0,}}}}/, replace: "function $1(){}" } }, { find: '.displayName="SpotifyStore"', - predicate: () => Settings.plugins["Ify"].keepSpotifyActivityOnIdle === true, + predicate: () => Settings.plugins.Ify.keepSpotifyActivityOnIdle, replacement: { match: /(shouldShowActivity=function\(\){.{1,50})&&!.{1,6}\.isIdle\(\)(.{0,}?})/, replace: "$1$2" From eb22dc6519bc6f1a04de1f3002239b61806b7b43 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 19 Oct 2022 15:16:57 -0300 Subject: [PATCH 3/5] cleanup --- src/plugins/ify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/ify.ts b/src/plugins/ify.ts index c23bccded15..832d09c9fef 100644 --- a/src/plugins/ify.ts +++ b/src/plugins/ify.ts @@ -13,7 +13,7 @@ export default definePlugin({ find: 'dispatch({type:"SPOTIFY_PROFILE_UPDATE"', replacement: [{ match: /(function\((.{1,2})\){)(.{1,6}dispatch\({type:"SPOTIFY_PROFILE_UPDATE")/, - replace: '$1$2.body.product=\"premium\";$3' + replace: (_, functionStart, data, functionBody) => `${functionStart}${data}.body.product="premium";${functionBody}` }], }, { find: '.displayName="SpotifyStore"', From 60e450a6ebd80cf9c90fe23d1d780d46313c034e Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 19 Oct 2022 15:20:33 -0300 Subject: [PATCH 4/5] forgot this one --- src/plugins/ify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/ify.ts b/src/plugins/ify.ts index 832d09c9fef..af349fd3bb9 100644 --- a/src/plugins/ify.ts +++ b/src/plugins/ify.ts @@ -27,7 +27,7 @@ export default definePlugin({ predicate: () => Settings.plugins.Ify.keepSpotifyActivityOnIdle, replacement: { match: /(shouldShowActivity=function\(\){.{1,50})&&!.{1,6}\.isIdle\(\)(.{0,}?})/, - replace: "$1$2" + replace: (_, functionDeclarationAndExpression, restOfFunction) => `${functionDeclarationAndExpression}${restOfFunction}` } }], options: { From 77f3f19033835dc807c2955a08d2f6b7720ecea8 Mon Sep 17 00:00:00 2001 From: Ven Date: Wed, 19 Oct 2022 21:09:09 +0200 Subject: [PATCH 5/5] Update ify.ts --- src/plugins/ify.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/ify.ts b/src/plugins/ify.ts index af349fd3bb9..0e6b58d0a65 100644 --- a/src/plugins/ify.ts +++ b/src/plugins/ify.ts @@ -9,6 +9,7 @@ export default definePlugin({ Devs.Cyn, { name: "Nuckyz", id: 235834946571337729n } ], + patches: [{ find: 'dispatch({type:"SPOTIFY_PROFILE_UPDATE"', replacement: [{ @@ -30,6 +31,7 @@ export default definePlugin({ replace: (_, functionDeclarationAndExpression, restOfFunction) => `${functionDeclarationAndExpression}${restOfFunction}` } }], + options: { noSpotifyAutoPause: { description: "Disable Spotify auto-pause",