From 3a42b0ebb852df25585672f25b4e0dfed2d65900 Mon Sep 17 00:00:00 2001 From: Crxaw <48805031+sitescript@users.noreply.github.com> Date: Thu, 3 Apr 2025 00:54:47 +0100 Subject: [PATCH 01/24] Completed Merge StatsFM> LastFM + Streaming status added. (#201) * Update index.tsx * Add Back AlwaysHideArt --------- Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com> --- src/plugins/lastfm/index.tsx | 206 +++++++++++++++++++++++++++++++---- 1 file changed, 187 insertions(+), 19 deletions(-) diff --git a/src/plugins/lastfm/index.tsx b/src/plugins/lastfm/index.tsx index 75d9c7c3..c9ac96d1 100644 --- a/src/plugins/lastfm/index.tsx +++ b/src/plugins/lastfm/index.tsx @@ -19,7 +19,7 @@ import { definePluginSettings } from "@api/Settings"; import { getUserSettingLazy } from "@api/UserSettings"; import { Link } from "@components/Link"; -import { Devs } from "@utils/constants"; +import { Devs, EquicordDevs } from "@utils/constants"; import { Logger } from "@utils/Logger"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; @@ -44,10 +44,12 @@ interface Activity { timestamps?: { start?: number; }; - assets?: ActivityAssets; + assets?: ActivityAssets; // LastFM + assets2?: ActivityAssets; // StatsFM buttons?: Array; name: string; - application_id: string; + application_id: string; // LastFM + application_id2: string; // StatsFM metadata?: { button_urls?: Array; }; @@ -67,39 +69,91 @@ interface TrackData { const enum ActivityType { PLAYING = 0, LISTENING = 2, + STREAMING = 1, // Added Streaming ig as a alt to listening } const enum ActivityFlag { INSTANCE = 1 << 0, } -const enum NameFormat { +const enum NameFormat { // (2) = Statsfm config StatusName = "status-name", ArtistFirst = "artist-first", SongFirst = "song-first", ArtistOnly = "artist", SongOnly = "song", - AlbumName = "album" + AlbumName = "album", + AlbumName2 = "album2", // ^ + ArtistOnly2 = "artist2", // ^ + ArtistFirst2 = "ArtistFirst2", // ^ + SongFirst2 = "SongFirst2", // ^ + SongOnly2 = "SongOnly2", // ^ +} + +interface Albums { + id: number; + name: string; + image: string; +} + +interface Artists { + id: number; + name: string; + image: string; +} +interface ExternalIds { + spotify: string[]; + appleMusic: string[]; +} + + +interface Track { + albums: Albums[]; + artists: Artists[]; + durationMs: number; + explicit: boolean; + externalIds: ExternalIds; + id: number; + name: string; + spotifyPopularity: number; + spotifyPreview: string; + appleMusicPreview: string; +} + +interface Item { + date: string; + isPlaying: boolean; + progressMs: number; + deviceName: string; + track: Track; + platform: string; +} + +interface SFMR { + item: Item; } const ShowCurrentGame = getUserSettingLazy("status", "showCurrentGame")!; -const applicationId = "1108588077900898414"; +const applicationId = "1108588077900898414"; // LastFM Appid +const applicationId2 = "1325126169179197500"; // StatsFM Appid const placeholderId = "2a96cbd8b46e442fc41c2b86b821562f"; -const logger = new Logger("LastFMRichPresence"); +const logger = new Logger("LastFMRichPresence + StatsfmFMRichPresence"); const PresenceStore = findByPropsLazy("getLocalPresence"); async function getApplicationAsset(key: string): Promise { return (await ApplicationAssetUtils.fetchAssetIds(applicationId, [key]))[0]; } - +async function getApplicationAsset2(key: string): Promise { + return (await ApplicationAssetUtils.fetchAssetIds(applicationId2, [key]))[0]; +} function setActivity(activity: Activity | null) { FluxDispatcher.dispatch({ type: "LOCAL_ACTIVITY_UPDATE", activity, - socketId: "LastFM", + socketId: "LastFM + Statsfm", }); } @@ -108,6 +162,10 @@ const settings = definePluginSettings({ description: "last.fm username", type: OptionType.STRING, }, + statsfmusername: { + description: "stats.fm username", + type: OptionType.STRING, + }, apiKey: { description: "last.fm api key", type: OptionType.STRING, @@ -117,26 +175,51 @@ const settings = definePluginSettings({ type: OptionType.BOOLEAN, default: false, }, + shareUsernameStatsfm: { + description: "show link to stats.fm profile", + type: OptionType.BOOLEAN, + default: false, + }, shareSong: { description: "show link to song on last.fm", type: OptionType.BOOLEAN, default: true, }, + StatsfmSong: { + description: "show link to song on stats.fm", + type: OptionType.BOOLEAN, + default: true, + }, hideWithSpotify: { description: "hide last.fm presence if spotify is running", type: OptionType.BOOLEAN, default: true, }, + hidewithSpotifySFM: { + description: "hide stats.fm presence if spotify is running", + type: OptionType.BOOLEAN, + default: true, + }, hideWithActivity: { description: "Hide Last.fm presence if you have any other presence", type: OptionType.BOOLEAN, default: false, }, + hideStatsfmWithExternalRPC: { + description: "Hide Stats.fm presence if you have any other presence", + type: OptionType.BOOLEAN, + default: false, + }, enableGameActivity: { description: "Enable game activity for last.fm", type: OptionType.BOOLEAN, default: false, }, + enableGameActivitySFM: { + description: "Enable game activity for stats.fm", + type: OptionType.BOOLEAN, + default: false, + }, statusName: { description: "custom status text", type: OptionType.STRING, @@ -178,6 +261,11 @@ const settings = definePluginSettings({ type: OptionType.BOOLEAN, default: false, }, + useStreamingStatus: { + description: 'show "Streaming" status instead of "Playing"', + type: OptionType.BOOLEAN, + default: false, + }, missingArt: { description: "When album or album art is missing", type: OptionType.SELECT, @@ -187,6 +275,11 @@ const settings = definePluginSettings({ value: "lastfmLogo", default: true }, + { + label: "Use Large Stats.fm logo", + value: "StatsFMLogo", + default: false + }, { label: "Use generic placeholder", value: "placeholder" @@ -198,6 +291,11 @@ const settings = definePluginSettings({ type: OptionType.BOOLEAN, default: true, }, + showStatsFMLogo: { + description: "show the Stats.fm logo by the album cover", + type: OptionType.BOOLEAN, + default: false, + }, alwaysHideArt: { description: "Disable downloading album art", type: OptionType.BOOLEAN, @@ -207,8 +305,8 @@ const settings = definePluginSettings({ export default definePlugin({ name: "LastFMRichPresence", - description: "Little plugin for Last.fm rich presence", - authors: [Devs.dzshn, Devs.RuiNtD, Devs.blahajZip, Devs.archeruwu], + description: "Little plugin for Last.fm rich presence + Stats.fm rich presence", + authors: [Devs.dzshn, Devs.RuiNtD, Devs.blahajZip, Devs.archeruwu, EquicordDevs.Crxa], settingsAboutComponent: () => ( <> @@ -223,6 +321,12 @@ export default definePlugin({ And copy the API key (not the shared secret!) + + How to get Stats.fm Presence! + + STATSFM ONLY: + If you want to use stats.fm, you will need an account linked @ and have your listening history public. + ), @@ -236,7 +340,7 @@ export default definePlugin({ stop() { clearInterval(this.updateInterval); }, - + // Last.fm Fetching async fetchTrackData(): Promise { if (!settings.store.username || !settings.store.apiKey) return null; @@ -278,6 +382,33 @@ export default definePlugin({ return null; } }, + // Stats.fm Fetching + async fetchTrackDataStatsfm(): Promise { + if (!settings.store.statsfmusername) + return null; + try { + const res2 = await fetch(`https://api.stats.fm/api/v1/user/${settings.store.statsfmusername}/recent`); + if (!res2.ok) throw `${res2.status} ${res2.statusText}`; + + const json = await res2.json() as SFMR; + if (!json.item) { + logger.error("Error from Stats.fm API"), json; + return null; + } + const trackData2 = json.item.track; + if (!trackData2) return null; + return { + name: trackData2.name || "Unknown", + album: trackData2.albums.map(a => a.name).join(", ") || "Unknown", + artist: trackData2.artists[0].name ?? "Unknown", + url: `https://stats.fm/track/${trackData2.id}`, + imageUrl: trackData2.albums[0].image + }; + } catch (e) { + logger.error("Failed to query Stats.fm API, Report to Equicord Discord. https://discord.gg/equicord", e); + return null; + } + }, async updatePresence() { setActivity(await this.getActivity()); @@ -293,13 +424,14 @@ export default definePlugin({ async getActivity(): Promise { if (settings.store.hideWithActivity) { - if (PresenceStore.getActivities().some(a => a.application_id !== applicationId)) { + if (PresenceStore.getActivities().some(a => a.application_id !== applicationId && (!a.application_id2 || a.application_id2 !== applicationId2))) return null; + { } } if (settings.store.hideWithSpotify) { - if (PresenceStore.getActivities().some(a => a.type === ActivityType.LISTENING && a.application_id !== applicationId)) { + if (PresenceStore.getActivities().some(a => (a.type === ActivityType.LISTENING || a.type === ActivityType.STREAMING) && a.application_id !== applicationId)) { // there is already music status because of Spotify or richerCider (probably more) return null; } @@ -326,7 +458,21 @@ export default definePlugin({ large_image: await getApplicationAsset("lastfm-large"), large_text: trackData.album || undefined, }; - + // Stats.fm image stuff + const largeImage2 = this.getLargeImage(trackData); + const assets2: ActivityAssets = largeImage2 ? + { + large_image: await getApplicationAsset2(largeImage2), + large_text: trackData.album || undefined, + ...(settings.store.showStatsFMLogo && { + small_image: await getApplicationAsset2("statsfm-large"), + small_text: "Stats.fm" + }), + } : { + large_image: await getApplicationAsset2("statsfm-large"), + large_text: trackData.album || undefined, + }; + const trackData2 = await this.fetchTrackDataStatsfm(); const buttons: ActivityButton[] = []; if (settings.store.shareUsername) @@ -334,14 +480,24 @@ export default definePlugin({ label: "Last.fm Profile", url: `https://www.last.fm/user/${settings.store.username}`, }); - + // Stats.fm settings + if (settings.store.shareUsernameStatsfm) + buttons.push({ + label: "Stats.fm Profile", + url: `https://stats.fm/user/${settings.store.statsfmusername}`, + }); + if (settings.store.StatsfmSong) + buttons.push({ + label: "View Song", + url: trackData.url, + }); if (settings.store.shareSong) buttons.push({ label: "View Song", url: trackData.url, }); - const statusName = (() => { + const statusName = (() => { // Last.FM satus stuff dont touch switch (settings.store.nameFormat) { case NameFormat.ArtistFirst: return trackData.artist + " - " + trackData.name; @@ -353,6 +509,17 @@ export default definePlugin({ return trackData.name; case NameFormat.AlbumName: return trackData.album || settings.store.statusName; + // Stats.fm Status stuff + case NameFormat.ArtistFirst2: // hoping my code works + return trackData2?.artist ? `${trackData2.artist} - ${trackData2.name}` : settings.store.statusName; + case NameFormat.SongFirst2: + return trackData2?.name ? `${trackData2.name} - ${trackData2.artist}` : settings.store.statusName; + case NameFormat.ArtistOnly2: + return trackData2?.artist ?? settings.store.statusName; + case NameFormat.SongOnly2: + return trackData2?.name ?? settings.store.statusName; + case NameFormat.AlbumName2: + return trackData2?.album ?? settings.store.statusName; default: return settings.store.statusName; } @@ -360,18 +527,19 @@ export default definePlugin({ return { application_id: applicationId, + application_id2: applicationId2, // StatsFM Appid name: statusName, details: trackData.name, state: trackData.artist, assets, + assets2, // StatsFM assets buttons: buttons.length ? buttons.map(v => v.label) : undefined, metadata: { button_urls: buttons.map(v => v.url), }, - - type: settings.store.useListeningStatus ? ActivityType.LISTENING : ActivityType.PLAYING, + type: settings.store.useStreamingStatus ? ActivityType.STREAMING : settings.store.useListeningStatus ? ActivityType.LISTENING : ActivityType.PLAYING, flags: ActivityFlag.INSTANCE, }; } From 3d8bf9f13c89474216e38d4a123d9bebbadb11ed Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 2 Apr 2025 22:10:19 -0400 Subject: [PATCH 02/24] Fix NeverPausePreviews --- src/equicordplugins/neverPausePreviews/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equicordplugins/neverPausePreviews/index.tsx b/src/equicordplugins/neverPausePreviews/index.tsx index fde17a66..1efbab32 100644 --- a/src/equicordplugins/neverPausePreviews/index.tsx +++ b/src/equicordplugins/neverPausePreviews/index.tsx @@ -40,7 +40,7 @@ export default definePlugin({ } }, { - find: "onSpinnerStarted():null", + find: "emptyPreviewWrapper,children", replacement: { match: /paused:\i([^=])/, replace: "paused:false$1" From 0ce98c2ca1420ddcb7ac0e8803e5b80435da134a Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 00:53:44 -0400 Subject: [PATCH 03/24] Add BetterBlockedContext to BetterBlockedUsers --- README.md | 2 +- .../betterBlockedUsers/index.tsx | 72 +++++++++++++------ .../betterBlockedUsers/styles.css | 3 - 3 files changed, 50 insertions(+), 27 deletions(-) delete mode 100644 src/equicordplugins/betterBlockedUsers/styles.css diff --git a/README.md b/README.md index 9968cacc..93c618af 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch - BetterActivities by D3SOX, Arjix, AutumnVN - BetterAudioPlayer by Creations - BetterBanReasons by Inbestigator -- BetterBlockedUsers by TheArmagan +- BetterBlockedUsers by TheArmagan & Elvyra - BetterInvites by iamme - BetterPlusReacts by Joona - BetterQuickReact by Ven & Sqaaakoi diff --git a/src/equicordplugins/betterBlockedUsers/index.tsx b/src/equicordplugins/betterBlockedUsers/index.tsx index 61a1dd63..03d2d911 100644 --- a/src/equicordplugins/betterBlockedUsers/index.tsx +++ b/src/equicordplugins/betterBlockedUsers/index.tsx @@ -6,18 +6,30 @@ import "./styles.css"; -import { EquicordDevs } from "@utils/constants"; -import { getIntlMessage, openUserProfile } from "@utils/discord"; -import definePlugin from "@utils/types"; -import { Button, React, RelationshipStore, TextInput, UserStore } from "@webpack/common"; +import { definePluginSettings } from "@api/Settings"; +import { Devs, EquicordDevs } from "@utils/constants"; +import { openUserProfile } from "@utils/discord"; +import definePlugin, { OptionType } from "@utils/types"; +import { FluxDispatcher, React, RelationshipStore, TextInput, UserStore } from "@webpack/common"; +import { User } from "discord-types/general"; let lastSearch = ""; let updateFunc = (v: any) => { }; +const settings = definePluginSettings({ + hideBlockedWarning: { + default: true, + type: OptionType.BOOLEAN, + description: "Skip the warning about blocked/ignored users when opening the profile through the blocklist.", + restartNeeded: true, + }, +}); + export default definePlugin({ name: "BetterBlockedUsers", - description: "Allows you to search in blocked users list and makes names selectable in settings.", - authors: [EquicordDevs.TheArmagan], + description: "Allows you to search in blocked users list and makes names clickable in settings.", + authors: [EquicordDevs.TheArmagan, Devs.Elvyra], + settings, patches: [ { find: '"],{numberOfBlockedUsers:', @@ -27,8 +39,8 @@ export default definePlugin({ replace: ",$1.listType==='blocked'?$self.renderSearchInput():null" }, { - match: /(?<=userId:(\i).*?\}\)\]\}\),)(\(.*?\)\}\))/, - replace: "$self.renderUser($1,$2),", + match: /(?<=className:\i.userInfo,)(?=children:.{0,20}user:(\i))/, + replace: "style:{cursor:'pointer'},onClick:()=>$self.openUserProfile($1)," }, { match: /(?<=\}=(\i).{0,10}(\i).useState\(.{0,1}\);)/, @@ -39,7 +51,28 @@ export default definePlugin({ replace: "$1(searchResults.length?searchResults:$2)" }, ] - } + }, + { + find: "UserProfileModalHeaderActionButtons", + replacement: [ + { + match: /(?<=return \i)\|\|(\i)===.*?.FRIEND/, + replace: (_, type) => `?null:${type} === 1|| ${type} === 2`, + }, + { + match: /(?<=\i.bot.{0,50}children:.*?onClose:)(\i)/, + replace: "() => {$1();$self.closeSettingsWindow()}", + } + ], + }, + { + find: ',["user"])', + replacement: { + match: /(?<=isIgnored:.*?,\[\i,\i]=\i.useState\()\i\|\|\i\|\|\i.*?]\);/, + replace: "false);" + }, + predicate: () => settings.store.hideBlockedWarning, + }, ], renderSearchInput() { const [value, setValue] = React.useState(lastSearch); @@ -61,19 +94,6 @@ export default definePlugin({ }} value={value} >; }, - renderUser(userId: string, rest: any) { - return ( -
- - {rest} -
- ); - }, - getSearchResults() { - return !!lastSearch; - }, setUpdateFunc(e, setResults) { if (e.listType !== "blocked") return; updateFunc = setResults; @@ -86,5 +106,11 @@ export default definePlugin({ if (!user) return id === search; return id === search || user?.username?.toLowerCase()?.includes(search) || user?.globalName?.toLowerCase()?.includes(search); }) as string[]; - } + }, + closeSettingsWindow: () => { + FluxDispatcher.dispatch({ type: "LAYER_POP" }); + }, + openUserProfile: (user: User) => { + openUserProfile(user.id); + }, }); diff --git a/src/equicordplugins/betterBlockedUsers/styles.css b/src/equicordplugins/betterBlockedUsers/styles.css deleted file mode 100644 index 810c6772..00000000 --- a/src/equicordplugins/betterBlockedUsers/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -[class*="usersList_"] [class*="text_"] { - user-select: text !important; -} From 6c4a9d4cc8481ec05e28d3c1297ccacbc9075161 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 07:04:42 -0400 Subject: [PATCH 04/24] Fix Lint --- src/equicordplugins/betterBlockedUsers/index.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/equicordplugins/betterBlockedUsers/index.tsx b/src/equicordplugins/betterBlockedUsers/index.tsx index 03d2d911..085d68c9 100644 --- a/src/equicordplugins/betterBlockedUsers/index.tsx +++ b/src/equicordplugins/betterBlockedUsers/index.tsx @@ -4,8 +4,6 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -import "./styles.css"; - import { definePluginSettings } from "@api/Settings"; import { Devs, EquicordDevs } from "@utils/constants"; import { openUserProfile } from "@utils/discord"; From 2a4c3c119ba012e3c3357d7adcc059131b52cec8 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 15:55:06 -0400 Subject: [PATCH 05/24] Fix Canary Patches --- src/equicordplugins/clientSideBlock/index.tsx | 2 +- src/equicordplugins/customUserColors/index.tsx | 2 +- src/equicordplugins/messageLoggerEnhanced/index.tsx | 2 +- src/equicordplugins/moreStickers/index.tsx | 2 +- src/equicordplugins/searchFix/index.tsx | 2 +- src/equicordplugins/videoSpeed/index.tsx | 2 +- src/plugins/consoleJanitor/index.tsx | 4 ++-- src/plugins/customidle/index.ts | 2 +- src/plugins/ircColors/index.ts | 2 +- src/plugins/messageLogger/index.tsx | 2 +- src/plugins/newGuildSettings/index.tsx | 2 +- src/plugins/nsfwGateBypass/index.ts | 4 ++-- src/webpack/common/components.ts | 4 ++-- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/equicordplugins/clientSideBlock/index.tsx b/src/equicordplugins/clientSideBlock/index.tsx index 837d34da..3ce827ff 100644 --- a/src/equicordplugins/clientSideBlock/index.tsx +++ b/src/equicordplugins/clientSideBlock/index.tsx @@ -179,7 +179,7 @@ export default definePlugin({ find: ".GUILD_APPLICATION_PREMIUM_SUBSCRIPTION||", replacement: [ { - match: /let \i;let\{repliedAuthor:/, + match: /let \i,\{repliedAuthor:/, replace: "if(arguments[0] != null && arguments[0].referencedMessage.message != null) { if($self.shouldHideUser(arguments[0].referencedMessage.message.author.id, arguments[0].baseMessage.messageReference.channel_id)) { return $self.hiddenReplyComponent(); } }$&" } ] diff --git a/src/equicordplugins/customUserColors/index.tsx b/src/equicordplugins/customUserColors/index.tsx index 57134557..9e825152 100644 --- a/src/equicordplugins/customUserColors/index.tsx +++ b/src/equicordplugins/customUserColors/index.tsx @@ -83,7 +83,7 @@ export default definePlugin({ // this also affects name headers in chats outside of servers find: '="SYSTEM_TAG"', replacement: { - match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0,)/, + match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0\}\)\(\),)/, replace: "style:{color:$self.colorIfServer(arguments[0])}," }, predicate: () => !Settings.plugins.IrcColors.enabled diff --git a/src/equicordplugins/messageLoggerEnhanced/index.tsx b/src/equicordplugins/messageLoggerEnhanced/index.tsx index d22f04d2..bbf4df3a 100644 --- a/src/equicordplugins/messageLoggerEnhanced/index.tsx +++ b/src/equicordplugins/messageLoggerEnhanced/index.tsx @@ -254,7 +254,7 @@ export default definePlugin({ ] }, { - find: "THREAD_STARTER_MESSAGE?null===", + find: "THREAD_STARTER_MESSAGE?null==", replacement: { match: /deleted:\i\.deleted, editHistory:\i\.editHistory,/, replace: "deleted:$self.getDeleted(...arguments), editHistory:$self.getEdited(...arguments)," diff --git a/src/equicordplugins/moreStickers/index.tsx b/src/equicordplugins/moreStickers/index.tsx index 6ee8628d..2388329f 100644 --- a/src/equicordplugins/moreStickers/index.tsx +++ b/src/equicordplugins/moreStickers/index.tsx @@ -56,7 +56,7 @@ export default definePlugin({ { find: ".gifts)", replacement: { - match: /,.{0,5}\(null===\(\w=\w\.stickers\)\|\|void 0.*?(\w)\.push\((\(0,\w\.jsx\))\((.+?),{disabled:\w,type:(\w)},"sticker"\)\)\)/, + match: /,.{0,5}\(null==\(\i=\i\.stickers\)\?void 0.*?(\i)\.push\((\(0,\w\.jsx\))\((.+?),{disabled:\i,type:(\i)},"sticker"\)\)\)/, replace: (m, _, jsx, compo, type) => { const c = "arguments[0].type"; return `${m},${c}?.submit?.button&&${_}.push(${jsx}(${compo},{disabled:!${c}?.submit?.button,type:${type},stickersType:"stickers+"},"stickers+"))`; diff --git a/src/equicordplugins/searchFix/index.tsx b/src/equicordplugins/searchFix/index.tsx index cb7f9f5e..5234537e 100644 --- a/src/equicordplugins/searchFix/index.tsx +++ b/src/equicordplugins/searchFix/index.tsx @@ -28,7 +28,7 @@ export default definePlugin({ { find: '"SearchStore",', replacement: { - match: /(\i)\.offset=null!==\((\i)=(\i)\.offset\)&&void 0!==(\i)\?(\i):0/i, + match: /(\i)\.offset=null!=\((\i)=(\i)\.offset\)\?(\i):0/i, replace: (_, v, v1, query, v3, v4) => `$self.main(${query}), ${v}.offset = null !== (${v1} = ${query}.offset) && void 0 !== ${v3} ? ${v4} : 0` } } diff --git a/src/equicordplugins/videoSpeed/index.tsx b/src/equicordplugins/videoSpeed/index.tsx index f066da2a..448d9ae7 100644 --- a/src/equicordplugins/videoSpeed/index.tsx +++ b/src/equicordplugins/videoSpeed/index.tsx @@ -27,7 +27,7 @@ export default definePlugin({ settings, patches: [ { - find: ".videoControls:", + find: /\.VIDEO\?\i\.videoControls:/, replacement: { match: /children:\[this\.renderPlayIcon\(\),.{0,200}\.setDurationRef}\),/, replace: "$&$self.SpeedButton()," diff --git a/src/plugins/consoleJanitor/index.tsx b/src/plugins/consoleJanitor/index.tsx index 5a3b3cd1..ab0ac9bb 100644 --- a/src/plugins/consoleJanitor/index.tsx +++ b/src/plugins/consoleJanitor/index.tsx @@ -148,14 +148,14 @@ export default definePlugin({ { find: "is not a valid locale.", replacement: { - match: /\i\.error\(""\.concat\(\i," is not a valid locale."\)\);/, + match: /void \i\.error\(""\.concat\(\i," is not a valid locale."\)\)/, replace: "" } }, { find: '"AppCrashedFatalReport: getLastCrash not supported."', replacement: { - match: /console\.log\("AppCrashedFatalReport: getLastCrash not supported\."\);/, + match: /void console\.log\("AppCrashedFatalReport: getLastCrash not supported\."\)/, replace: "" } }, diff --git a/src/plugins/customidle/index.ts b/src/plugins/customidle/index.ts index 97a77973..5ff0c81a 100644 --- a/src/plugins/customidle/index.ts +++ b/src/plugins/customidle/index.ts @@ -49,7 +49,7 @@ export default definePlugin({ replace: "$self.handleOnline()" }, { - match: /(setInterval\(\i,\.25\*)\i\.\i/, + match: /(setInterval\(\i,30\*)\i\.\i/, replace: "$1$self.getIntervalDelay()" // For web installs } ] diff --git a/src/plugins/ircColors/index.ts b/src/plugins/ircColors/index.ts index 5363acc0..237286e7 100644 --- a/src/plugins/ircColors/index.ts +++ b/src/plugins/ircColors/index.ts @@ -67,7 +67,7 @@ export default definePlugin({ { find: '="SYSTEM_TAG"', replacement: { - match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0,)/, + match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0\}\)\(\),)/, replace: "style:{color:$self.calculateNameColorForMessageContext(arguments[0])}," } }, diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index ad974126..a2d205cd 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -433,7 +433,7 @@ export default definePlugin({ { // Updated message transformer(?) - find: "THREAD_STARTER_MESSAGE?null===", + find: "THREAD_STARTER_MESSAGE?null==", replacement: [ { // Pass through editHistory & deleted & original attachments to the "edited message" transformer diff --git a/src/plugins/newGuildSettings/index.tsx b/src/plugins/newGuildSettings/index.tsx index edddb968..49fc5f05 100644 --- a/src/plugins/newGuildSettings/index.tsx +++ b/src/plugins/newGuildSettings/index.tsx @@ -134,7 +134,7 @@ export default definePlugin({ { find: ",acceptInvite(", replacement: { - match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!==.+?;/, + match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!=.+?;/, replace: (m, guildId) => `${m}$self.applyDefaultSettings(${guildId});` } }, diff --git a/src/plugins/nsfwGateBypass/index.ts b/src/plugins/nsfwGateBypass/index.ts index e6f3ee40..6d0cb702 100644 --- a/src/plugins/nsfwGateBypass/index.ts +++ b/src/plugins/nsfwGateBypass/index.ts @@ -28,11 +28,11 @@ export default definePlugin({ find: ".nsfwAllowed=null", replacement: [ { - match: /(?<=\.nsfwAllowed=)null!==.+?(?=[,;])/, + match: /(?<=\.nsfwAllowed=)null!=.+?(?=[,;])/, replace: "true", }, { - match: /(?<=\.ageVerificationStatus=)null!==.+?(?=[,;])/, + match: /(?<=\.ageVerificationStatus=)null!=.+?(?=[,;])/, replace: "3", // VERIFIED_ADULT } ], diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index d5249f2f..ebc3f383 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -25,7 +25,7 @@ import * as t from "./types/components"; const FormTitle = waitForComponent("FormTitle", filters.componentByCode('["defaultMargin".concat', '="h5"')); const FormText = waitForComponent("FormText", filters.componentByCode(".SELECTABLE),", ".DISABLED:")); -const FormSection = waitForComponent("FormSection", filters.componentByCode(".titleId)&&")); +const FormSection = waitForComponent("FormSection", filters.componentByCode(".titleId)?")); const FormDivider = waitForComponent("FormDivider", filters.componentByCode(".divider,", ",style:", '"div"', /\.divider,\i\),style:/)); export const Forms = { @@ -74,7 +74,7 @@ export const ScrollerNone = LazyComponent(() => createScroller(scrollerClasses.n export const ScrollerThin = LazyComponent(() => createScroller(scrollerClasses.thin, scrollerClasses.fade, scrollerClasses.customTheme)); export const ScrollerAuto = LazyComponent(() => createScroller(scrollerClasses.auto, scrollerClasses.fade, scrollerClasses.customTheme)); -const { FocusLock_ } = mapMangledModuleLazy("attachTo:null!==", { +const { FocusLock_ } = mapMangledModuleLazy("attachTo:null!=", { FocusLock_: filters.componentByCode(".containerRef") }) as { FocusLock_: t.FocusLock; From 9e3dfed22fcc4df56250e8701dc06d5b6dc98e5c Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 15:55:47 -0400 Subject: [PATCH 06/24] Fixes For customizationSectionBackground --- .../fakeProfileThemesAndEffects/components/index.tsx | 2 +- src/equicordplugins/identity/index.tsx | 4 ++-- src/plugins/decor/ui/components/DecorSection.tsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/equicordplugins/fakeProfileThemesAndEffects/components/index.tsx b/src/equicordplugins/fakeProfileThemesAndEffects/components/index.tsx index eb09a44c..d8d074b8 100644 --- a/src/equicordplugins/fakeProfileThemesAndEffects/components/index.tsx +++ b/src/equicordplugins/fakeProfileThemesAndEffects/components/index.tsx @@ -40,7 +40,7 @@ export const enum FeatureBorderType { } export const CustomizationSection: ComponentType - = findByCodeLazy(".customizationSectionBackground"); + = findComponentByCodeLazy(".customizationSectionBackground"); export const tokens: { unsafe_rawColors: Record[0]>; diff --git a/src/equicordplugins/identity/index.tsx b/src/equicordplugins/identity/index.tsx index 9f1c2853..ac301ce3 100644 --- a/src/equicordplugins/identity/index.tsx +++ b/src/equicordplugins/identity/index.tsx @@ -8,11 +8,11 @@ import { DataStore } from "@api/index"; import { Flex } from "@components/Flex"; import { Devs, EquicordDevs } from "@utils/constants"; import definePlugin, { PluginNative } from "@utils/types"; -import { findByCodeLazy } from "@webpack"; +import { findComponentByCodeLazy } from "@webpack"; import { Alerts, Button, FluxDispatcher, Forms, Toasts, UserProfileStore, UserStore } from "@webpack/common"; const native = VencordNative.pluginHelpers.Identity as PluginNative; -const CustomizationSection = findByCodeLazy(".customizationSectionBackground"); +const CustomizationSection = findComponentByCodeLazy(".customizationSectionBackground"); async function SetNewData() { const PersonData = JSON.parse(await native.RequestRandomUser()); diff --git a/src/plugins/decor/ui/components/DecorSection.tsx b/src/plugins/decor/ui/components/DecorSection.tsx index ff044f8c..4648ef8d 100644 --- a/src/plugins/decor/ui/components/DecorSection.tsx +++ b/src/plugins/decor/ui/components/DecorSection.tsx @@ -5,7 +5,7 @@ */ import { Flex } from "@components/Flex"; -import { findByCodeLazy } from "@webpack"; +import { findComponentByCodeLazy } from "@webpack"; import { Button, useEffect } from "@webpack/common"; import { useAuthorizationStore } from "../../lib/stores/AuthorizationStore"; @@ -13,7 +13,7 @@ import { useCurrentUserDecorationsStore } from "../../lib/stores/CurrentUserDeco import { cl } from "../"; import { openChangeDecorationModal } from "../modals/ChangeDecorationModal"; -const CustomizationSection = findByCodeLazy(".customizationSectionBackground"); +const CustomizationSection = findComponentByCodeLazy(".customizationSectionBackground"); export interface DecorSectionProps { hideTitle?: boolean; From b075f7b6a4fa72939f5a1ce094128809f3e2f693 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:09:18 -0400 Subject: [PATCH 07/24] Revert "Fix Canary Patches" This reverts commit 2a4c3c119ba012e3c3357d7adcc059131b52cec8. --- src/equicordplugins/clientSideBlock/index.tsx | 2 +- src/equicordplugins/customUserColors/index.tsx | 2 +- src/equicordplugins/messageLoggerEnhanced/index.tsx | 2 +- src/equicordplugins/moreStickers/index.tsx | 2 +- src/equicordplugins/searchFix/index.tsx | 2 +- src/equicordplugins/videoSpeed/index.tsx | 2 +- src/plugins/consoleJanitor/index.tsx | 4 ++-- src/plugins/customidle/index.ts | 2 +- src/plugins/ircColors/index.ts | 2 +- src/plugins/messageLogger/index.tsx | 2 +- src/plugins/newGuildSettings/index.tsx | 2 +- src/plugins/nsfwGateBypass/index.ts | 4 ++-- src/webpack/common/components.ts | 4 ++-- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/equicordplugins/clientSideBlock/index.tsx b/src/equicordplugins/clientSideBlock/index.tsx index 3ce827ff..837d34da 100644 --- a/src/equicordplugins/clientSideBlock/index.tsx +++ b/src/equicordplugins/clientSideBlock/index.tsx @@ -179,7 +179,7 @@ export default definePlugin({ find: ".GUILD_APPLICATION_PREMIUM_SUBSCRIPTION||", replacement: [ { - match: /let \i,\{repliedAuthor:/, + match: /let \i;let\{repliedAuthor:/, replace: "if(arguments[0] != null && arguments[0].referencedMessage.message != null) { if($self.shouldHideUser(arguments[0].referencedMessage.message.author.id, arguments[0].baseMessage.messageReference.channel_id)) { return $self.hiddenReplyComponent(); } }$&" } ] diff --git a/src/equicordplugins/customUserColors/index.tsx b/src/equicordplugins/customUserColors/index.tsx index 9e825152..57134557 100644 --- a/src/equicordplugins/customUserColors/index.tsx +++ b/src/equicordplugins/customUserColors/index.tsx @@ -83,7 +83,7 @@ export default definePlugin({ // this also affects name headers in chats outside of servers find: '="SYSTEM_TAG"', replacement: { - match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0\}\)\(\),)/, + match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0,)/, replace: "style:{color:$self.colorIfServer(arguments[0])}," }, predicate: () => !Settings.plugins.IrcColors.enabled diff --git a/src/equicordplugins/messageLoggerEnhanced/index.tsx b/src/equicordplugins/messageLoggerEnhanced/index.tsx index bbf4df3a..d22f04d2 100644 --- a/src/equicordplugins/messageLoggerEnhanced/index.tsx +++ b/src/equicordplugins/messageLoggerEnhanced/index.tsx @@ -254,7 +254,7 @@ export default definePlugin({ ] }, { - find: "THREAD_STARTER_MESSAGE?null==", + find: "THREAD_STARTER_MESSAGE?null===", replacement: { match: /deleted:\i\.deleted, editHistory:\i\.editHistory,/, replace: "deleted:$self.getDeleted(...arguments), editHistory:$self.getEdited(...arguments)," diff --git a/src/equicordplugins/moreStickers/index.tsx b/src/equicordplugins/moreStickers/index.tsx index 2388329f..6ee8628d 100644 --- a/src/equicordplugins/moreStickers/index.tsx +++ b/src/equicordplugins/moreStickers/index.tsx @@ -56,7 +56,7 @@ export default definePlugin({ { find: ".gifts)", replacement: { - match: /,.{0,5}\(null==\(\i=\i\.stickers\)\?void 0.*?(\i)\.push\((\(0,\w\.jsx\))\((.+?),{disabled:\i,type:(\i)},"sticker"\)\)\)/, + match: /,.{0,5}\(null===\(\w=\w\.stickers\)\|\|void 0.*?(\w)\.push\((\(0,\w\.jsx\))\((.+?),{disabled:\w,type:(\w)},"sticker"\)\)\)/, replace: (m, _, jsx, compo, type) => { const c = "arguments[0].type"; return `${m},${c}?.submit?.button&&${_}.push(${jsx}(${compo},{disabled:!${c}?.submit?.button,type:${type},stickersType:"stickers+"},"stickers+"))`; diff --git a/src/equicordplugins/searchFix/index.tsx b/src/equicordplugins/searchFix/index.tsx index 5234537e..cb7f9f5e 100644 --- a/src/equicordplugins/searchFix/index.tsx +++ b/src/equicordplugins/searchFix/index.tsx @@ -28,7 +28,7 @@ export default definePlugin({ { find: '"SearchStore",', replacement: { - match: /(\i)\.offset=null!=\((\i)=(\i)\.offset\)\?(\i):0/i, + match: /(\i)\.offset=null!==\((\i)=(\i)\.offset\)&&void 0!==(\i)\?(\i):0/i, replace: (_, v, v1, query, v3, v4) => `$self.main(${query}), ${v}.offset = null !== (${v1} = ${query}.offset) && void 0 !== ${v3} ? ${v4} : 0` } } diff --git a/src/equicordplugins/videoSpeed/index.tsx b/src/equicordplugins/videoSpeed/index.tsx index 448d9ae7..f066da2a 100644 --- a/src/equicordplugins/videoSpeed/index.tsx +++ b/src/equicordplugins/videoSpeed/index.tsx @@ -27,7 +27,7 @@ export default definePlugin({ settings, patches: [ { - find: /\.VIDEO\?\i\.videoControls:/, + find: ".videoControls:", replacement: { match: /children:\[this\.renderPlayIcon\(\),.{0,200}\.setDurationRef}\),/, replace: "$&$self.SpeedButton()," diff --git a/src/plugins/consoleJanitor/index.tsx b/src/plugins/consoleJanitor/index.tsx index ab0ac9bb..5a3b3cd1 100644 --- a/src/plugins/consoleJanitor/index.tsx +++ b/src/plugins/consoleJanitor/index.tsx @@ -148,14 +148,14 @@ export default definePlugin({ { find: "is not a valid locale.", replacement: { - match: /void \i\.error\(""\.concat\(\i," is not a valid locale."\)\)/, + match: /\i\.error\(""\.concat\(\i," is not a valid locale."\)\);/, replace: "" } }, { find: '"AppCrashedFatalReport: getLastCrash not supported."', replacement: { - match: /void console\.log\("AppCrashedFatalReport: getLastCrash not supported\."\)/, + match: /console\.log\("AppCrashedFatalReport: getLastCrash not supported\."\);/, replace: "" } }, diff --git a/src/plugins/customidle/index.ts b/src/plugins/customidle/index.ts index 5ff0c81a..97a77973 100644 --- a/src/plugins/customidle/index.ts +++ b/src/plugins/customidle/index.ts @@ -49,7 +49,7 @@ export default definePlugin({ replace: "$self.handleOnline()" }, { - match: /(setInterval\(\i,30\*)\i\.\i/, + match: /(setInterval\(\i,\.25\*)\i\.\i/, replace: "$1$self.getIntervalDelay()" // For web installs } ] diff --git a/src/plugins/ircColors/index.ts b/src/plugins/ircColors/index.ts index 237286e7..5363acc0 100644 --- a/src/plugins/ircColors/index.ts +++ b/src/plugins/ircColors/index.ts @@ -67,7 +67,7 @@ export default definePlugin({ { find: '="SYSTEM_TAG"', replacement: { - match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0\}\)\(\),)/, + match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0,)/, replace: "style:{color:$self.calculateNameColorForMessageContext(arguments[0])}," } }, diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index a2d205cd..ad974126 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -433,7 +433,7 @@ export default definePlugin({ { // Updated message transformer(?) - find: "THREAD_STARTER_MESSAGE?null==", + find: "THREAD_STARTER_MESSAGE?null===", replacement: [ { // Pass through editHistory & deleted & original attachments to the "edited message" transformer diff --git a/src/plugins/newGuildSettings/index.tsx b/src/plugins/newGuildSettings/index.tsx index 49fc5f05..edddb968 100644 --- a/src/plugins/newGuildSettings/index.tsx +++ b/src/plugins/newGuildSettings/index.tsx @@ -134,7 +134,7 @@ export default definePlugin({ { find: ",acceptInvite(", replacement: { - match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!=.+?;/, + match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!==.+?;/, replace: (m, guildId) => `${m}$self.applyDefaultSettings(${guildId});` } }, diff --git a/src/plugins/nsfwGateBypass/index.ts b/src/plugins/nsfwGateBypass/index.ts index 6d0cb702..e6f3ee40 100644 --- a/src/plugins/nsfwGateBypass/index.ts +++ b/src/plugins/nsfwGateBypass/index.ts @@ -28,11 +28,11 @@ export default definePlugin({ find: ".nsfwAllowed=null", replacement: [ { - match: /(?<=\.nsfwAllowed=)null!=.+?(?=[,;])/, + match: /(?<=\.nsfwAllowed=)null!==.+?(?=[,;])/, replace: "true", }, { - match: /(?<=\.ageVerificationStatus=)null!=.+?(?=[,;])/, + match: /(?<=\.ageVerificationStatus=)null!==.+?(?=[,;])/, replace: "3", // VERIFIED_ADULT } ], diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index ebc3f383..d5249f2f 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -25,7 +25,7 @@ import * as t from "./types/components"; const FormTitle = waitForComponent("FormTitle", filters.componentByCode('["defaultMargin".concat', '="h5"')); const FormText = waitForComponent("FormText", filters.componentByCode(".SELECTABLE),", ".DISABLED:")); -const FormSection = waitForComponent("FormSection", filters.componentByCode(".titleId)?")); +const FormSection = waitForComponent("FormSection", filters.componentByCode(".titleId)&&")); const FormDivider = waitForComponent("FormDivider", filters.componentByCode(".divider,", ",style:", '"div"', /\.divider,\i\),style:/)); export const Forms = { @@ -74,7 +74,7 @@ export const ScrollerNone = LazyComponent(() => createScroller(scrollerClasses.n export const ScrollerThin = LazyComponent(() => createScroller(scrollerClasses.thin, scrollerClasses.fade, scrollerClasses.customTheme)); export const ScrollerAuto = LazyComponent(() => createScroller(scrollerClasses.auto, scrollerClasses.fade, scrollerClasses.customTheme)); -const { FocusLock_ } = mapMangledModuleLazy("attachTo:null!=", { +const { FocusLock_ } = mapMangledModuleLazy("attachTo:null!==", { FocusLock_: filters.componentByCode(".containerRef") }) as { FocusLock_: t.FocusLock; From c8b5337d186149bffab5d2b9a2e0ac24ff5748eb Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:11:06 -0400 Subject: [PATCH 08/24] Reapply "Fix Canary Patches" This reverts commit b075f7b6a4fa72939f5a1ce094128809f3e2f693. --- src/equicordplugins/clientSideBlock/index.tsx | 2 +- src/equicordplugins/customUserColors/index.tsx | 2 +- src/equicordplugins/messageLoggerEnhanced/index.tsx | 2 +- src/equicordplugins/moreStickers/index.tsx | 2 +- src/equicordplugins/searchFix/index.tsx | 2 +- src/equicordplugins/videoSpeed/index.tsx | 2 +- src/plugins/consoleJanitor/index.tsx | 4 ++-- src/plugins/customidle/index.ts | 2 +- src/plugins/ircColors/index.ts | 2 +- src/plugins/messageLogger/index.tsx | 2 +- src/plugins/newGuildSettings/index.tsx | 2 +- src/plugins/nsfwGateBypass/index.ts | 4 ++-- src/webpack/common/components.ts | 4 ++-- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/equicordplugins/clientSideBlock/index.tsx b/src/equicordplugins/clientSideBlock/index.tsx index 837d34da..3ce827ff 100644 --- a/src/equicordplugins/clientSideBlock/index.tsx +++ b/src/equicordplugins/clientSideBlock/index.tsx @@ -179,7 +179,7 @@ export default definePlugin({ find: ".GUILD_APPLICATION_PREMIUM_SUBSCRIPTION||", replacement: [ { - match: /let \i;let\{repliedAuthor:/, + match: /let \i,\{repliedAuthor:/, replace: "if(arguments[0] != null && arguments[0].referencedMessage.message != null) { if($self.shouldHideUser(arguments[0].referencedMessage.message.author.id, arguments[0].baseMessage.messageReference.channel_id)) { return $self.hiddenReplyComponent(); } }$&" } ] diff --git a/src/equicordplugins/customUserColors/index.tsx b/src/equicordplugins/customUserColors/index.tsx index 57134557..9e825152 100644 --- a/src/equicordplugins/customUserColors/index.tsx +++ b/src/equicordplugins/customUserColors/index.tsx @@ -83,7 +83,7 @@ export default definePlugin({ // this also affects name headers in chats outside of servers find: '="SYSTEM_TAG"', replacement: { - match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0,)/, + match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0\}\)\(\),)/, replace: "style:{color:$self.colorIfServer(arguments[0])}," }, predicate: () => !Settings.plugins.IrcColors.enabled diff --git a/src/equicordplugins/messageLoggerEnhanced/index.tsx b/src/equicordplugins/messageLoggerEnhanced/index.tsx index d22f04d2..bbf4df3a 100644 --- a/src/equicordplugins/messageLoggerEnhanced/index.tsx +++ b/src/equicordplugins/messageLoggerEnhanced/index.tsx @@ -254,7 +254,7 @@ export default definePlugin({ ] }, { - find: "THREAD_STARTER_MESSAGE?null===", + find: "THREAD_STARTER_MESSAGE?null==", replacement: { match: /deleted:\i\.deleted, editHistory:\i\.editHistory,/, replace: "deleted:$self.getDeleted(...arguments), editHistory:$self.getEdited(...arguments)," diff --git a/src/equicordplugins/moreStickers/index.tsx b/src/equicordplugins/moreStickers/index.tsx index 6ee8628d..2388329f 100644 --- a/src/equicordplugins/moreStickers/index.tsx +++ b/src/equicordplugins/moreStickers/index.tsx @@ -56,7 +56,7 @@ export default definePlugin({ { find: ".gifts)", replacement: { - match: /,.{0,5}\(null===\(\w=\w\.stickers\)\|\|void 0.*?(\w)\.push\((\(0,\w\.jsx\))\((.+?),{disabled:\w,type:(\w)},"sticker"\)\)\)/, + match: /,.{0,5}\(null==\(\i=\i\.stickers\)\?void 0.*?(\i)\.push\((\(0,\w\.jsx\))\((.+?),{disabled:\i,type:(\i)},"sticker"\)\)\)/, replace: (m, _, jsx, compo, type) => { const c = "arguments[0].type"; return `${m},${c}?.submit?.button&&${_}.push(${jsx}(${compo},{disabled:!${c}?.submit?.button,type:${type},stickersType:"stickers+"},"stickers+"))`; diff --git a/src/equicordplugins/searchFix/index.tsx b/src/equicordplugins/searchFix/index.tsx index cb7f9f5e..5234537e 100644 --- a/src/equicordplugins/searchFix/index.tsx +++ b/src/equicordplugins/searchFix/index.tsx @@ -28,7 +28,7 @@ export default definePlugin({ { find: '"SearchStore",', replacement: { - match: /(\i)\.offset=null!==\((\i)=(\i)\.offset\)&&void 0!==(\i)\?(\i):0/i, + match: /(\i)\.offset=null!=\((\i)=(\i)\.offset\)\?(\i):0/i, replace: (_, v, v1, query, v3, v4) => `$self.main(${query}), ${v}.offset = null !== (${v1} = ${query}.offset) && void 0 !== ${v3} ? ${v4} : 0` } } diff --git a/src/equicordplugins/videoSpeed/index.tsx b/src/equicordplugins/videoSpeed/index.tsx index f066da2a..448d9ae7 100644 --- a/src/equicordplugins/videoSpeed/index.tsx +++ b/src/equicordplugins/videoSpeed/index.tsx @@ -27,7 +27,7 @@ export default definePlugin({ settings, patches: [ { - find: ".videoControls:", + find: /\.VIDEO\?\i\.videoControls:/, replacement: { match: /children:\[this\.renderPlayIcon\(\),.{0,200}\.setDurationRef}\),/, replace: "$&$self.SpeedButton()," diff --git a/src/plugins/consoleJanitor/index.tsx b/src/plugins/consoleJanitor/index.tsx index 5a3b3cd1..ab0ac9bb 100644 --- a/src/plugins/consoleJanitor/index.tsx +++ b/src/plugins/consoleJanitor/index.tsx @@ -148,14 +148,14 @@ export default definePlugin({ { find: "is not a valid locale.", replacement: { - match: /\i\.error\(""\.concat\(\i," is not a valid locale."\)\);/, + match: /void \i\.error\(""\.concat\(\i," is not a valid locale."\)\)/, replace: "" } }, { find: '"AppCrashedFatalReport: getLastCrash not supported."', replacement: { - match: /console\.log\("AppCrashedFatalReport: getLastCrash not supported\."\);/, + match: /void console\.log\("AppCrashedFatalReport: getLastCrash not supported\."\)/, replace: "" } }, diff --git a/src/plugins/customidle/index.ts b/src/plugins/customidle/index.ts index 97a77973..5ff0c81a 100644 --- a/src/plugins/customidle/index.ts +++ b/src/plugins/customidle/index.ts @@ -49,7 +49,7 @@ export default definePlugin({ replace: "$self.handleOnline()" }, { - match: /(setInterval\(\i,\.25\*)\i\.\i/, + match: /(setInterval\(\i,30\*)\i\.\i/, replace: "$1$self.getIntervalDelay()" // For web installs } ] diff --git a/src/plugins/ircColors/index.ts b/src/plugins/ircColors/index.ts index 5363acc0..237286e7 100644 --- a/src/plugins/ircColors/index.ts +++ b/src/plugins/ircColors/index.ts @@ -67,7 +67,7 @@ export default definePlugin({ { find: '="SYSTEM_TAG"', replacement: { - match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0,)/, + match: /(?<=\i.gradientClassName]\),style:.{0,80}:void 0\}\)\(\),)/, replace: "style:{color:$self.calculateNameColorForMessageContext(arguments[0])}," } }, diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index ad974126..a2d205cd 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -433,7 +433,7 @@ export default definePlugin({ { // Updated message transformer(?) - find: "THREAD_STARTER_MESSAGE?null===", + find: "THREAD_STARTER_MESSAGE?null==", replacement: [ { // Pass through editHistory & deleted & original attachments to the "edited message" transformer diff --git a/src/plugins/newGuildSettings/index.tsx b/src/plugins/newGuildSettings/index.tsx index edddb968..49fc5f05 100644 --- a/src/plugins/newGuildSettings/index.tsx +++ b/src/plugins/newGuildSettings/index.tsx @@ -134,7 +134,7 @@ export default definePlugin({ { find: ",acceptInvite(", replacement: { - match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!==.+?;/, + match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!=.+?;/, replace: (m, guildId) => `${m}$self.applyDefaultSettings(${guildId});` } }, diff --git a/src/plugins/nsfwGateBypass/index.ts b/src/plugins/nsfwGateBypass/index.ts index e6f3ee40..6d0cb702 100644 --- a/src/plugins/nsfwGateBypass/index.ts +++ b/src/plugins/nsfwGateBypass/index.ts @@ -28,11 +28,11 @@ export default definePlugin({ find: ".nsfwAllowed=null", replacement: [ { - match: /(?<=\.nsfwAllowed=)null!==.+?(?=[,;])/, + match: /(?<=\.nsfwAllowed=)null!=.+?(?=[,;])/, replace: "true", }, { - match: /(?<=\.ageVerificationStatus=)null!==.+?(?=[,;])/, + match: /(?<=\.ageVerificationStatus=)null!=.+?(?=[,;])/, replace: "3", // VERIFIED_ADULT } ], diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index d5249f2f..ebc3f383 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -25,7 +25,7 @@ import * as t from "./types/components"; const FormTitle = waitForComponent("FormTitle", filters.componentByCode('["defaultMargin".concat', '="h5"')); const FormText = waitForComponent("FormText", filters.componentByCode(".SELECTABLE),", ".DISABLED:")); -const FormSection = waitForComponent("FormSection", filters.componentByCode(".titleId)&&")); +const FormSection = waitForComponent("FormSection", filters.componentByCode(".titleId)?")); const FormDivider = waitForComponent("FormDivider", filters.componentByCode(".divider,", ",style:", '"div"', /\.divider,\i\),style:/)); export const Forms = { @@ -74,7 +74,7 @@ export const ScrollerNone = LazyComponent(() => createScroller(scrollerClasses.n export const ScrollerThin = LazyComponent(() => createScroller(scrollerClasses.thin, scrollerClasses.fade, scrollerClasses.customTheme)); export const ScrollerAuto = LazyComponent(() => createScroller(scrollerClasses.auto, scrollerClasses.fade, scrollerClasses.customTheme)); -const { FocusLock_ } = mapMangledModuleLazy("attachTo:null!==", { +const { FocusLock_ } = mapMangledModuleLazy("attachTo:null!=", { FocusLock_: filters.componentByCode(".containerRef") }) as { FocusLock_: t.FocusLock; From d1d8ca5791c4cf1938ca0b223bcb5e3326a5657a Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:11:36 -0400 Subject: [PATCH 09/24] Tests Tests Tests --- src/plugins/consoleJanitor/index.tsx | 8 ++++---- src/plugins/customidle/index.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/consoleJanitor/index.tsx b/src/plugins/consoleJanitor/index.tsx index ab0ac9bb..1dbc3b07 100644 --- a/src/plugins/consoleJanitor/index.tsx +++ b/src/plugins/consoleJanitor/index.tsx @@ -148,15 +148,15 @@ export default definePlugin({ { find: "is not a valid locale.", replacement: { - match: /void \i\.error\(""\.concat\(\i," is not a valid locale."\)\)/, - replace: "" + match: /\i\.error\(""\.concat\(\i," is not a valid locale."\)\)/, + replace: '""' } }, { find: '"AppCrashedFatalReport: getLastCrash not supported."', replacement: { - match: /void console\.log\("AppCrashedFatalReport: getLastCrash not supported\."\)/, - replace: "" + match: /console\.log\("AppCrashedFatalReport: getLastCrash not supported\."\)/, + replace: '""' } }, { diff --git a/src/plugins/customidle/index.ts b/src/plugins/customidle/index.ts index 5ff0c81a..97a77973 100644 --- a/src/plugins/customidle/index.ts +++ b/src/plugins/customidle/index.ts @@ -49,7 +49,7 @@ export default definePlugin({ replace: "$self.handleOnline()" }, { - match: /(setInterval\(\i,30\*)\i\.\i/, + match: /(setInterval\(\i,\.25\*)\i\.\i/, replace: "$1$self.getIntervalDelay()" // For web installs } ] From e1e49248feb9c0e63d59d7894a8ddcdbbc17805a Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:44:05 -0400 Subject: [PATCH 10/24] All Fixes --- src/plugins/_api/serverList.ts | 2 +- src/plugins/customidle/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts index 00bf3054..37ed626a 100644 --- a/src/plugins/_api/serverList.ts +++ b/src/plugins/_api/serverList.ts @@ -39,7 +39,7 @@ export default definePlugin({ replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)" }, { - match: /discoveryIcon\}\)\}\)\]/, + match: /children:\i\}\)\]/, replace: "$&.concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Below))" } ] diff --git a/src/plugins/customidle/index.ts b/src/plugins/customidle/index.ts index 97a77973..77e7d4e9 100644 --- a/src/plugins/customidle/index.ts +++ b/src/plugins/customidle/index.ts @@ -49,7 +49,7 @@ export default definePlugin({ replace: "$self.handleOnline()" }, { - match: /(setInterval\(\i,\.25\*)\i\.\i/, + match: /(setInterval\(\i,30\*)\i\.\i\.Millis\.SECOND/, replace: "$1$self.getIntervalDelay()" // For web installs } ] From 75f56263ed25c94f4664042825bb595f0dc039d5 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 17:03:27 -0400 Subject: [PATCH 11/24] Fix ConsoleJan --- src/plugins/consoleJanitor/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/consoleJanitor/index.tsx b/src/plugins/consoleJanitor/index.tsx index 1dbc3b07..12fe231c 100644 --- a/src/plugins/consoleJanitor/index.tsx +++ b/src/plugins/consoleJanitor/index.tsx @@ -148,15 +148,15 @@ export default definePlugin({ { find: "is not a valid locale.", replacement: { - match: /\i\.error\(""\.concat\(\i," is not a valid locale."\)\)/, - replace: '""' + match: /\i\.error(?=\(""\.concat\(\i," is not a valid locale."\)\))/, + replace: "$self.NoopLogger" } }, { find: '"AppCrashedFatalReport: getLastCrash not supported."', replacement: { - match: /console\.log\("AppCrashedFatalReport: getLastCrash not supported\."\)/, - replace: '""' + match: /console\.log(?=\("AppCrashedFatalReport: getLastCrash not supported\."\))/, + replace: "$self.NoopLogger" } }, { From 9f4a0c43a138fde2e11354496d8d9db4840f4c8e Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 17:24:20 -0400 Subject: [PATCH 12/24] Revert FocusLock --- src/webpack/common/components.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index ebc3f383..152b921f 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -74,7 +74,7 @@ export const ScrollerNone = LazyComponent(() => createScroller(scrollerClasses.n export const ScrollerThin = LazyComponent(() => createScroller(scrollerClasses.thin, scrollerClasses.fade, scrollerClasses.customTheme)); export const ScrollerAuto = LazyComponent(() => createScroller(scrollerClasses.auto, scrollerClasses.fade, scrollerClasses.customTheme)); -const { FocusLock_ } = mapMangledModuleLazy("attachTo:null!=", { +const { FocusLock_ } = mapMangledModuleLazy('document.getElementById("app-mount"))', { FocusLock_: filters.componentByCode(".containerRef") }) as { FocusLock_: t.FocusLock; From d10cb89c5c9b9c182f76f08ec573658b6f620946 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 17:32:19 -0400 Subject: [PATCH 13/24] Update BetterBlockedUsers --- .../betterBlockedUsers/index.tsx | 85 ++++++++++++++++++- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/src/equicordplugins/betterBlockedUsers/index.tsx b/src/equicordplugins/betterBlockedUsers/index.tsx index 085d68c9..bd8cde39 100644 --- a/src/equicordplugins/betterBlockedUsers/index.tsx +++ b/src/equicordplugins/betterBlockedUsers/index.tsx @@ -7,13 +7,20 @@ import { definePluginSettings } from "@api/Settings"; import { Devs, EquicordDevs } from "@utils/constants"; import { openUserProfile } from "@utils/discord"; +import { openModal } from "@utils/modal"; import definePlugin, { OptionType } from "@utils/types"; -import { FluxDispatcher, React, RelationshipStore, TextInput, UserStore } from "@webpack/common"; +import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack"; +import { Button, FluxDispatcher, React, RelationshipStore, Text, TextInput, UserStore } from "@webpack/common"; +import { ButtonProps } from "@webpack/types"; import { User } from "discord-types/general"; let lastSearch = ""; let updateFunc = (v: any) => { }; +const ChannelActions = findByPropsLazy("openPrivateChannel"); +const ButtonComponent = findComponentByCodeLazy('submittingStartedLabel","submittingFinishedLabel"]);'); +const ConfirmationModal = findByCodeLazy('"ConfirmModal")', "useLayoutEffect"); + const settings = definePluginSettings({ hideBlockedWarning: { default: true, @@ -21,6 +28,21 @@ const settings = definePluginSettings({ description: "Skip the warning about blocked/ignored users when opening the profile through the blocklist.", restartNeeded: true, }, + addDmsButton: { + default: true, + type: OptionType.BOOLEAN, + description: "Adds a 'View DMs' button to the users in the blocked list.", + }, + unblockButtonDanger: { + default: false, + type: OptionType.BOOLEAN, + description: "Changes the 'Unblock' button to a red color to make it's 'danger' more obvious.", + }, + showUnblockConfirmation: { + default: true, + type: OptionType.BOOLEAN, + description: "Show a confirmation dialog when clicking the 'Unblock' button.", + } }); export default definePlugin({ @@ -40,6 +62,10 @@ export default definePlugin({ match: /(?<=className:\i.userInfo,)(?=children:.{0,20}user:(\i))/, replace: "style:{cursor:'pointer'},onClick:()=>$self.openUserProfile($1)," }, + { + match: /(?<=children:null!=(\i).globalName\?\i.username:null.*?}\),).*?(\{color:.{0,50}?children:\i.\i.string\((\i)\?.*?"8wXU9P"]\)})\)/, + replace: "$self.generateButtons({user:$1, originalProps:$2, isBlocked:$3})", + }, { match: /(?<=\}=(\i).{0,10}(\i).useState\(.{0,1}\);)/, replace: "let [searchResults,setSearchResults]=$2.useState([]);$self.setUpdateFunc($1,setSearchResults);" @@ -105,10 +131,63 @@ export default definePlugin({ return id === search || user?.username?.toLowerCase()?.includes(search) || user?.globalName?.toLowerCase()?.includes(search); }) as string[]; }, - closeSettingsWindow: () => { + closeSettingsWindow() { FluxDispatcher.dispatch({ type: "LAYER_POP" }); }, - openUserProfile: (user: User) => { + openUserProfile(user: User) { openUserProfile(user.id); }, + generateButtons(props: { user: User, originalProps: ButtonProps, isBlocked: boolean; }) { + const { user, originalProps, isBlocked } = props; + + if (settings.store.unblockButtonDanger) originalProps.color = Button.Colors.RED; + + // TODO add extra unblock confirmation after the click + setting. + + if (settings.store.showUnblockConfirmation) { + const originalOnClick = originalProps.onClick!; + originalProps.onClick = e => { + if (e.shiftKey) return originalOnClick(e); + + openModal(m => { + originalOnClick(e); + }}> +
+
+ {`Are you sure you want to ${isBlocked ? "unblock" : "unignore"} this user?`} + {isBlocked ? {`This will allow ${user.username} to see your profile and message you again.`} : null} +
+ {`You can always ${isBlocked ? "block" : "ignore"} them again later.`} +
+ {"If you just want to read the chat logs instead, you can just click on their profile."} + {"Alternatively, you can enable a button to show DMs in the blocklist through the plugin settings."} +
+
+
); + }; + } + + const originalButton = ; + + if (!settings.store.addDmsButton) return originalButton; + + const dmButton = this.openDMChannel(user)}>Show DMs; + + return
+ {dmButton} + {originalButton} +
; + }, + + openDMChannel(user: User) { + ChannelActions.openPrivateChannel(user.id); + this.closeSettingsWindow(); + return null; + }, }); From 50cb219d3a8c22a393d8f05fbd36e3f35788fa71 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 20:03:50 -0400 Subject: [PATCH 14/24] Fix Decor --- src/plugins/decor/ui/modals/CreateDecorationModal.tsx | 2 +- src/webpack/patchWebpack.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx index eb39c16d..4afb7464 100644 --- a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx +++ b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx @@ -19,7 +19,7 @@ import { AvatarDecorationModalPreview } from "../components"; const FileUpload = findComponentByCodeLazy("fileUploadInput,"); -const { HelpMessage, HelpMessageTypes } = mapMangledModuleLazy('POSITIVE=3]="POSITIVE', { +const { HelpMessage, HelpMessageTypes } = mapMangledModuleLazy('POSITIVE="positive', { HelpMessageTypes: filters.byProps("POSITIVE", "WARNING", "INFO"), HelpMessage: filters.byCode(".iconDiv") }); diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index 802f9da9..2c212a9a 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -8,7 +8,6 @@ import { Settings } from "@api/Settings"; import { makeLazy } from "@utils/lazy"; import { Logger } from "@utils/Logger"; import { interpolateIfDefined } from "@utils/misc"; -import { canonicalizeReplacement } from "@utils/patches"; import { Patch, PatchReplacement } from "@utils/types"; import { reporterData } from "debug/reporterData"; From 87554065373d1c1a28a93ba2a161a2377c07fc64 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 20:15:39 -0400 Subject: [PATCH 15/24] Fix CustomTimestamps --- src/equicordplugins/customTimestamps/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equicordplugins/customTimestamps/index.tsx b/src/equicordplugins/customTimestamps/index.tsx index 26078f2c..87930f6a 100644 --- a/src/equicordplugins/customTimestamps/index.tsx +++ b/src/equicordplugins/customTimestamps/index.tsx @@ -71,7 +71,7 @@ export default definePlugin({ find: "#{intl::MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL}", replacement: [ { - match: /(?<=\i=\i\?)\(0,\i\.\i\)\((\i),"LT"\):\(0,\i\.\i\)\(\i,!0\)/, + match: /(?<=\i=null!=\i\?).{0,25}\((\i),"LT"\):\(0,\i\.\i\)\(\i,!0\)/, replace: '$self.format($1,"compactFormat","[calendar]"):$self.format($1,"cozyFormat","LT")', }, { From c8f5cf3fb1659e0ae167a1e885c3d74a6e391a2a Mon Sep 17 00:00:00 2001 From: Crxaw <48805031+sitescript@users.noreply.github.com> Date: Fri, 4 Apr 2025 01:16:51 +0100 Subject: [PATCH 16/24] PingNotifications [BetterDiscord plugin port] (#214) * pushing sumki code that is using git * Added Smuki to const * Update index.tsx * Update index.tsx --------- Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com> --- .../PingNotifications/index.tsx | 109 ++++++++++++++++++ src/utils/constants.ts | 4 + 2 files changed, 113 insertions(+) create mode 100644 src/equicordplugins/PingNotifications/index.tsx diff --git a/src/equicordplugins/PingNotifications/index.tsx b/src/equicordplugins/PingNotifications/index.tsx new file mode 100644 index 00000000..a733f900 --- /dev/null +++ b/src/equicordplugins/PingNotifications/index.tsx @@ -0,0 +1,109 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { showNotification } from "@api/Notifications"; +import { definePluginSettings } from "@api/Settings"; +import { EquicordDevs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { + ChannelStore, + FluxDispatcher, + GuildStore, + MessageStore, + NavigationRouter, + PresenceStore, + RelationshipStore, + SelectedChannelStore, + UserStore +} from "@webpack/common"; + +const settings = definePluginSettings({ + friends: { + type: OptionType.BOOLEAN, + default: true, + description: "Notify when friends message you (non-@ mentions)" + }, + mentions: { + type: OptionType.BOOLEAN, + default: true, + description: "Notify when someone @mentions you directly" + }, + replies: { + type: OptionType.BOOLEAN, + default: true, + description: "Notify when someone replies to your messages" + }, + dms: { + type: OptionType.BOOLEAN, + default: true, + description: "Notify for direct messages (DMs)" + }, + showInActive: { + type: OptionType.BOOLEAN, + default: false, + description: "Show notifications even for current active channel" + } +}); + +function formatContent(message: any) { + let content = message.content || ""; + message.mentions?.forEach(user => { + content = content.replace(new RegExp(`<@!?${user.id}>`, "g"), `@${user.username}`); + }); + return content.slice(0, 200) + (content.length > 200 ? "..." : ""); +} + +export default definePlugin({ + name: "PingNotifications", + description: "Customizable notifications with improved mention formatting", + authors: [EquicordDevs.smuki], + settings, + flux: { + async MESSAGE_CREATE({ message }) { + try { + if (!message?.channel_id || message.state === "SENDING") return; + + const channel = ChannelStore.getChannel(message.channel_id); + const currentUser = UserStore.getCurrentUser(); + + if (!channel || !currentUser || message.author?.id === currentUser.id) return; + if ((channel as any).isMuted?.() || (channel.guild_id && (GuildStore.getGuild(channel.guild_id) as any)?.isMuted?.())) return; + if (!settings.store.showInActive && channel.id === SelectedChannelStore.getChannelId()) return; + if (PresenceStore.getStatus(currentUser.id) === "dnd") return; + + const author = UserStore.getUser(message.author.id) || { username: "Unknown" }; + const isDM = [1, 3].includes(channel.type); + const channelName = channel.name || (isDM ? "DM" : "Group"); + const body = formatContent(message); + + const shouldNotify = ( + (settings.store.mentions && message.mentions?.some(u => u.id === currentUser.id)) || + (settings.store.friends && RelationshipStore.isFriend(message.author.id)) || + (settings.store.replies && message.message_reference?.message_id && + MessageStore.getMessage( + message.message_reference.channel_id || channel.id, + message.message_reference.message_id + )?.author.id === currentUser.id + ) || + (isDM && settings.store.dms) + ); + + if (shouldNotify) { + showNotification({ + title: `${author.username} in ${channelName}`, + body, + icon: author.getAvatarURL?.(undefined, 128), + onClick: () => NavigationRouter.transitionTo( + `/channels/${channel.guild_id || "@me"}/${channel.id}/${message.id}` + ) + }); + } + } catch (err) { + console.error("[PingNotifications] Error:", err); + } + } + } +}); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 7f1cf9ce..7b19908f 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1038,6 +1038,10 @@ export const EquicordDevs = Object.freeze({ name: "WKoA", id: 724416180097384498n }, + smuki: { + name: "sumki", + id: 691517398523576331n + }, } satisfies Record); // iife so #__PURE__ works correctly From 57cfb09d6c9334f55dd68011ea7c9b8821e2ce2a Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 3 Apr 2025 20:17:45 -0400 Subject: [PATCH 17/24] Add PingNotifications To Readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 93c618af..d2e150bf 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch - NoRoleHeaders by Samwich - NotificationTitle by Kyuuhachi - OnePingPerDM by ProffDea +- PingNotifications by smuki - PinIcon by iamme - PlatformSpoofer by Drag - PolishWording by Samwich From b03e6dbb40f2899b5dfb4ef048b5eafd653b36c2 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 4 Apr 2025 01:57:33 -0400 Subject: [PATCH 18/24] Update BetterBlockedUsers --- .../betterBlockedUsers/index.tsx | 131 ++++++++++++------ 1 file changed, 91 insertions(+), 40 deletions(-) diff --git a/src/equicordplugins/betterBlockedUsers/index.tsx b/src/equicordplugins/betterBlockedUsers/index.tsx index bd8cde39..4ea600b5 100644 --- a/src/equicordplugins/betterBlockedUsers/index.tsx +++ b/src/equicordplugins/betterBlockedUsers/index.tsx @@ -22,27 +22,33 @@ const ButtonComponent = findComponentByCodeLazy('submittingStartedLabel","submit const ConfirmationModal = findByCodeLazy('"ConfirmModal")', "useLayoutEffect"); const settings = definePluginSettings({ - hideBlockedWarning: { - default: true, - type: OptionType.BOOLEAN, - description: "Skip the warning about blocked/ignored users when opening the profile through the blocklist.", - restartNeeded: true, - }, addDmsButton: { default: true, type: OptionType.BOOLEAN, - description: "Adds a 'View DMs' button to the users in the blocked list.", + description: "Adds a 'View DMs' button to the users in the blocked/ignored list.", }, - unblockButtonDanger: { + hideBlockedWarning: { default: false, type: OptionType.BOOLEAN, - description: "Changes the 'Unblock' button to a red color to make it's 'danger' more obvious.", + description: "Skip the warning about blocked/ignored users when opening any profile anywhere on discord outside of the blocklist.", + restartNeeded: true, }, showUnblockConfirmation: { default: true, type: OptionType.BOOLEAN, - description: "Show a confirmation dialog when clicking the 'Unblock' button.", - } + description: "Show a warning before unblocking a user from the blocklist.", + }, + showUnblockConfirmationEverywhere: { + default: false, + type: OptionType.BOOLEAN, + description: "Show a warning before unblocking a user anywhere on discord.", + restartNeeded: true, + }, + unblockButtonDanger: { + default: false, + type: OptionType.BOOLEAN, + description: "Color the unblock button in the blocklist red instead of gray.", + }, }); export default definePlugin({ @@ -63,7 +69,7 @@ export default definePlugin({ replace: "style:{cursor:'pointer'},onClick:()=>$self.openUserProfile($1)," }, { - match: /(?<=children:null!=(\i).globalName\?\i.username:null.*?}\),).*?(\{color:.{0,50}?children:\i.\i.string\((\i)\?.*?"8wXU9P"]\)})\)/, + match: /(?<=children:null!=(\i).globalName\?.+?}\),).*?(\{color:.{0,65}?string\((\i).+?"8wXU9P"]\)})\)/, replace: "$self.generateButtons({user:$1, originalProps:$2, isBlocked:$3})", }, { @@ -95,8 +101,45 @@ export default definePlugin({ match: /(?<=isIgnored:.*?,\[\i,\i]=\i.useState\()\i\|\|\i\|\|\i.*?]\);/, replace: "false);" }, - predicate: () => settings.store.hideBlockedWarning, }, + + // If the users wishes to, they can disable the warning in all other places as well. + ...[ + "UserProfilePanelWrapper: currentUser cannot be undefined", + "UserProfilePopoutWrapper: currentUser cannot be undefined", + ].map(x => ({ + find: x, + replacement: { + match: /(?<=isIgnored:.*?,\[\i,\i]=\i.useState\()\i\|\|\i\|\|\i\)(?:;\i.useEffect.*?]\))?/, + replace: "false)", + }, + predicate: () => settings.store.hideBlockedWarning, + })), + + { + find: ".BLOCKED:return", + replacement: { + match: /(?<=\i.BLOCKED:return.{0,65}onClick:)\(\)=>\{(\i.\i.unblockUser\((\i).+?}\))/, + replace: "(event) => {$self.openConfirmationModal(event,()=>{$1}, $2)", + }, + predicate: () => settings.store.showUnblockConfirmationEverywhere, + }, + { + find: "#{intl::UNBLOCK}),", + replacement: { + match: /(?<=#{intl::UNBLOCK}.+?Click=)\(\)=>(\{.+?(\i.getRecipientId\(\))\)})/, + replace: "event => $self.openConfirmationModal(event, ()=>$1, $2)", + }, + predicate: () => settings.store.showUnblockConfirmationEverywhere, + }, + { + find: "#{intl::BLOCK}),action", + replacement: { + match: /(?<=id:"block".{0,100}action:\i\?)\(\)=>(\{.{0,25}unblockUser\((\i).{0,60}:void 0\)})/, + replace: "event => {$self.openConfirmationModal(event, ()=>$1,$2)}", + }, + predicate: () => settings.store.showUnblockConfirmationEverywhere, + } ], renderSearchInput() { const [value, setValue] = React.useState(lastSearch); @@ -144,44 +187,23 @@ export default definePlugin({ // TODO add extra unblock confirmation after the click + setting. - if (settings.store.showUnblockConfirmation) { + if (settings.store.showUnblockConfirmation || settings.store.showUnblockConfirmationEverywhere) { const originalOnClick = originalProps.onClick!; originalProps.onClick = e => { - if (e.shiftKey) return originalOnClick(e); - - openModal(m => { - originalOnClick(e); - }}> -
-
- {`Are you sure you want to ${isBlocked ? "unblock" : "unignore"} this user?`} - {isBlocked ? {`This will allow ${user.username} to see your profile and message you again.`} : null} -
- {`You can always ${isBlocked ? "block" : "ignore"} them again later.`} -
- {"If you just want to read the chat logs instead, you can just click on their profile."} - {"Alternatively, you can enable a button to show DMs in the blocklist through the plugin settings."} -
-
-
); + if (!isBlocked) return originalOnClick(e); + this.openConfirmationModal(e, () => originalOnClick(e), user, true); }; } - const originalButton = ; + const unblockButton = ; - if (!settings.store.addDmsButton) return originalButton; + if (!settings.store.addDmsButton) return unblockButton; const dmButton = this.openDMChannel(user)}>Show DMs; return
{dmButton} - {originalButton} + {unblockButton}
; }, @@ -190,4 +212,33 @@ export default definePlugin({ this.closeSettingsWindow(); return null; }, + openConfirmationModal(event: MouseEvent, callback: () => any, user: User | string, isSettingsOrigin: boolean = false) { + if (event.shiftKey) return callback(); + + if (typeof user === "string") { + user = UserStore.getUser(user); + } + + return openModal(m => { + callback(); + }}> +
+
+ {`Are you sure you want to unblock ${user?.username ?? "this user"}?`} + {`This will allow ${user?.username ?? "them"} to see your profile and message you again.`} +
+ {"You can always block them again later."} + {isSettingsOrigin ?
+ {"If you just want to read the chat logs instead, you can just click on their profile."} + {"Alternatively, you can enable a button to jump to DMs in the blocklist through the plugin settings."} +
: {"If you just want to read the chat logs, you can do this without unblocking them."}} +
+
); + }, }); From 4f35e58a13574cd48a8eee958ec348ef09062573 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 4 Apr 2025 02:29:36 -0400 Subject: [PATCH 19/24] Fix Lint --- src/equicordplugins/betterBlockedUsers/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equicordplugins/betterBlockedUsers/index.tsx b/src/equicordplugins/betterBlockedUsers/index.tsx index 4ea600b5..258933d2 100644 --- a/src/equicordplugins/betterBlockedUsers/index.tsx +++ b/src/equicordplugins/betterBlockedUsers/index.tsx @@ -191,7 +191,7 @@ export default definePlugin({ const originalOnClick = originalProps.onClick!; originalProps.onClick = e => { if (!isBlocked) return originalOnClick(e); - this.openConfirmationModal(e, () => originalOnClick(e), user, true); + this.openConfirmationModal(e as unknown as MouseEvent, () => originalOnClick(e), user, true); }; } From f2247a3e2b0d0aff6742c09c885eb413e0709cea Mon Sep 17 00:00:00 2001 From: panbread <93918332+Panniku@users.noreply.github.com> Date: Fri, 4 Apr 2025 11:44:05 +0400 Subject: [PATCH 20/24] fix(serverListIndicators): desktop refresh (#215) * Fixes For customizationSectionBackground * fix(serverListIndicators): desktop refresh --------- Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com> --- src/plugins/serverListIndicators/index.tsx | 20 ++++----- src/plugins/serverListIndicators/styles.css | 46 ++++++++++++++------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/plugins/serverListIndicators/index.tsx b/src/plugins/serverListIndicators/index.tsx index 2f103251..e761c84b 100644 --- a/src/plugins/serverListIndicators/index.tsx +++ b/src/plugins/serverListIndicators/index.tsx @@ -74,10 +74,9 @@ function FriendsIndicator() { } - {onlineFriendsCount} - {!!settings.store.useCompact && - Friends - } + {onlineFriendsCount} + {!!settings.store.useCompact && Friends} + ); } @@ -109,10 +108,9 @@ function ServersIndicator() { } - {guildCount} - {!!settings.store.useCompact && - Servers - } + {guildCount} + {!!settings.store.useCompact && Servers} + ); } @@ -155,13 +153,11 @@ export default definePlugin({ text = `${onlineFriendsCount} Friends`; break; case IndicatorType.SERVER: - text = `${onlineFriendsCount} Friends, ${guildCount} Servers`; + text = `${guildCount} Servers`; break; } - let cl; - if (useCompact) cl = classNameFactory("vc-indicators-compact"); - else cl = classNameFactory("vc-indicators"); + const cl = useCompact ? classNameFactory("vc-indicators-compact") : classNameFactory("vc-indicators"); return
diff --git a/src/plugins/serverListIndicators/styles.css b/src/plugins/serverListIndicators/styles.css index d6fb68a5..8ae03ad1 100644 --- a/src/plugins/serverListIndicators/styles.css +++ b/src/plugins/serverListIndicators/styles.css @@ -4,7 +4,7 @@ display: flex; align-items: center; justify-content: center; - margin-bottom: 8px; + margin-bottom: -1px; } #vc-indicators-indicator-items { @@ -12,13 +12,35 @@ flex-direction: column; align-items: center; justify-content: center; - background-color: var(--background-primary); - height: 48px; - width: 48px; - border-radius: 100%; + border-radius: 24%; + height: var(--guildbar-avatar-size); + width: var(--guildbar-avatar-size); + background-color: var(--background-surface-higher); transition: border-radius 0.15s ease-out, background-color 0.15s ease-out; } +#vc-indicators-indicator-items::before { + position: absolute; + content: ""; + display: block; + /* stylelint-disable-next-line length-zero-no-unit */ + width: 0px; + /* stylelint-disable-next-line length-zero-no-unit */ + height: 0px; + opacity: 0; + border-radius: 0 4px 4px 0; + left: -4px; + background-color: var(--header-primary); + transition: height 0.15s ease-out, width 0.15s ease-out, + opacity 0.15s ease-out; +} + +#vc-indicators-indicator-items:hover::before { + width: 8px; + height: 20px; + opacity: 1; +} + #vc-indicators-compact-indicator-items { display: flex; flex-direction: column; @@ -27,7 +49,6 @@ } #vc-indicators-indicator-items:hover { - border-radius: 34%; background-color: var(--brand-500); } @@ -35,7 +56,7 @@ #vc-guildcount { display: flex; align-items: center; - justify-content: center; + justify-content: space-evenly; font-size: 12px; font-weight: 600; width: 100%; @@ -44,13 +65,6 @@ #vc-friendcount-icon, #vc-guildcount-icon { - padding-right: 2px; - width: 14px; - height: 14px; -} - -#vc-indicators-compact-container #vc-friendcount-text-compact, -#vc-indicators-compact-container #vc-guildcount-text-compact { - display: block; - padding-left: 4px; + width: var(--size-12); + height: var(--size-12); } From ccb029b83924197053ae161a7a2202a37465e44e Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 4 Apr 2025 09:19:21 -0400 Subject: [PATCH 21/24] BetterFolder Fixes --- src/utils/quickCss.ts | 90 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 15 deletions(-) diff --git a/src/utils/quickCss.ts b/src/utils/quickCss.ts index 94c7a5e0..25626981 100644 --- a/src/utils/quickCss.ts +++ b/src/utils/quickCss.ts @@ -44,27 +44,80 @@ export async function toggle(isEnabled: boolean) { if (!style) { if (isEnabled) { style = createStyle("vencord-custom-css"); + VencordNative.quickCss.addChangeListener(css => { + css = patchSidebar(css); style.textContent = css; - // At the time of writing this, changing textContent resets the disabled state style.disabled = !Settings.useQuickCss; }); - style.textContent = await VencordNative.quickCss.get(); + + const css = await VencordNative.quickCss.get(); + style.textContent = patchSidebar(css); } - } else + } else { style.disabled = !isEnabled; + } +} + +function patchSidebar(css: string): string { + if ( + css.includes("grid-template-columns") && Settings.plugins.BetterFolders.enabled || + css.includes("grid-template-areas") && Settings.plugins.BetterFolders.enabled + ) { + css = css.replace( + /\btitleBar\b/, + "titleBar titleBar" + ); + css = css.replace( + /\buserPanel\b/, + "userPanel userPanel" + ); + css = css.replace( + /guildsList/g, + "guildsList sidebar" + ); + css = css.replace( + /guildsEnd\]/g, + "guildsEnd] min-content [sidebarEnd]" + ); + } + return css; +} + +async function fetchAndPatchCSS(url: string): Promise { + try { + const res = await fetch(url); + const css = await res.text(); + + const importLinks = extractImportLinks(css); + const patchedCSS = await Promise.all(importLinks.map(fetchAndPatchCSS)); + + const combinedCSS = patchedCSS.join("\n") + "\n" + patchSidebar(css); + return combinedCSS; + } catch (e) { + console.warn(`Failed to fetch and patch CSS from ${url}`, e); + return ""; + } +} + +function extractImportLinks(css: string): string[] { + const importRegex = /@import url\(([^)]+)\)/g; + const links: string[] = []; + let match; + while ((match = importRegex.exec(css)) !== null) { + links.push(match[1].trim().replace(/['"]/g, "")); + } + return links; } async function initThemes() { themesStyle ??= createStyle("vencord-themes"); const { enabledThemeLinks, enabledThemes } = Settings; - const enabledlinks: string[] = [...enabledThemeLinks]; - // "darker" and "midnight" both count as dark const activeTheme = ThemeStore.theme === "light" ? "light" : "dark"; - const links = enabledlinks + const rawLinks = enabledlinks .map(rawLink => { const match = /^@(light|dark) (.*)/.exec(rawLink); if (!match) return rawLink; @@ -72,18 +125,25 @@ async function initThemes() { const [, mode, link] = match; return mode === activeTheme ? link : null; }) - .filter(link => link !== null); + .filter((link): link is string => link !== null); - if (IS_WEB) { - for (const theme of enabledThemes) { - const themeData = await VencordNative.themes.getThemeData(theme); - if (!themeData) continue; - const blob = new Blob([themeData], { type: "text/css" }); + const links: string[] = []; + + for (const url of rawLinks) { + const css = await fetchAndPatchCSS(url); + if (css) { + const blob = new Blob([css], { type: "text/css" }); links.push(URL.createObjectURL(blob)); } - } else { - const localThemes = enabledThemes.map(theme => `vencord:///themes/${theme}?v=${Date.now()}`); - links.push(...localThemes); + } + + for (const theme of enabledThemes) { + const themeData = await VencordNative.themes.getThemeData(theme); + if (!themeData) continue; + + const patchedTheme = patchSidebar(themeData); + const blob = new Blob([patchedTheme], { type: "text/css" }); + links.push(URL.createObjectURL(blob)); } themesStyle.textContent = links.map(link => `@import url("${link.trim()}");`).join("\n"); From cb66f6e18f3d14268efca9fc06c80b728e422b13 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 4 Apr 2025 12:20:53 -0400 Subject: [PATCH 22/24] Banners Everywhere Nameplate Setting --- .../bannersEverywhere/index.tsx | 42 +++++++++++++++---- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/equicordplugins/bannersEverywhere/index.tsx b/src/equicordplugins/bannersEverywhere/index.tsx index b9686a7a..ad804c89 100644 --- a/src/equicordplugins/bannersEverywhere/index.tsx +++ b/src/equicordplugins/bannersEverywhere/index.tsx @@ -19,12 +19,27 @@ interface iUSRBG extends Plugin { getImageUrl(userId: string): string | null; } +interface Nameplate { + imgAlt: string; + palette: { + darkBackground: string; + lightBackground: string; + name: string; + }; + src: string; +} + const settings = definePluginSettings({ animate: { description: "Animate banners", type: OptionType.BOOLEAN, default: false }, + preferNameplate: { + description: "prefer nameplate over banner", + type: OptionType.BOOLEAN, + default: false + }, }); const DATASTORE_KEY = "bannersEverywhere"; @@ -40,17 +55,21 @@ export default definePlugin({ patches: [ { find: "#{intl::GUILD_OWNER}),", - replacement: - { - // We add the banner as a property while we can still access the user id - match: /verified:(\i).isVerifiedBot.*?name:null.*?(?=avatar:)/, - replace: "$&banner:$self.memberListBannerHook($1),", - }, + replacement: [ + { + // We add the banner as a property while we can still access the user id + match: /(?<=nameplate:(\i).*?)verified:(\i).isVerifiedBot.*?name:null.*?(?=avatar:)/, + replace: "$&banner:$self.memberListBannerHook($2, $1),", + }, + { + match: /(?<=\),nameplate:)(\i)/, + replace: "$self.nameplate($1)" + } + ] }, { find: "role:\"listitem\",innerRef", - replacement: - { + replacement: { // We cant access the user id here, so we take the banner property we set earlier match: /focusProps.\i\}=(\i).*?children:\[/, replace: "$&$1.banner," @@ -70,9 +89,14 @@ export default definePlugin({ DataStore.set(DATASTORE_KEY, this.data); }, - memberListBannerHook(user: User) { + nameplate(nameplate: Nameplate | undefined) { + if (settings.store.preferNameplate) return nameplate; + }, + + memberListBannerHook(user: User, nameplate: Nameplate | undefined) { let url = this.getBanner(user.id); if (!url) return; + if (settings.store.preferNameplate && nameplate) return; if (!settings.store.animate) { // Discord Banners url = url.replace(".gif", ".png"); From 4b6b4c67b39fdd3afc56f01f5e3ae57010505ec9 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 4 Apr 2025 12:55:32 -0400 Subject: [PATCH 23/24] Revert "BetterFolder Fixes" This reverts commit ccb029b83924197053ae161a7a2202a37465e44e. --- src/utils/quickCss.ts | 90 ++++++++----------------------------------- 1 file changed, 15 insertions(+), 75 deletions(-) diff --git a/src/utils/quickCss.ts b/src/utils/quickCss.ts index 25626981..94c7a5e0 100644 --- a/src/utils/quickCss.ts +++ b/src/utils/quickCss.ts @@ -44,80 +44,27 @@ export async function toggle(isEnabled: boolean) { if (!style) { if (isEnabled) { style = createStyle("vencord-custom-css"); - VencordNative.quickCss.addChangeListener(css => { - css = patchSidebar(css); style.textContent = css; + // At the time of writing this, changing textContent resets the disabled state style.disabled = !Settings.useQuickCss; }); - - const css = await VencordNative.quickCss.get(); - style.textContent = patchSidebar(css); + style.textContent = await VencordNative.quickCss.get(); } - } else { + } else style.disabled = !isEnabled; - } -} - -function patchSidebar(css: string): string { - if ( - css.includes("grid-template-columns") && Settings.plugins.BetterFolders.enabled || - css.includes("grid-template-areas") && Settings.plugins.BetterFolders.enabled - ) { - css = css.replace( - /\btitleBar\b/, - "titleBar titleBar" - ); - css = css.replace( - /\buserPanel\b/, - "userPanel userPanel" - ); - css = css.replace( - /guildsList/g, - "guildsList sidebar" - ); - css = css.replace( - /guildsEnd\]/g, - "guildsEnd] min-content [sidebarEnd]" - ); - } - return css; -} - -async function fetchAndPatchCSS(url: string): Promise { - try { - const res = await fetch(url); - const css = await res.text(); - - const importLinks = extractImportLinks(css); - const patchedCSS = await Promise.all(importLinks.map(fetchAndPatchCSS)); - - const combinedCSS = patchedCSS.join("\n") + "\n" + patchSidebar(css); - return combinedCSS; - } catch (e) { - console.warn(`Failed to fetch and patch CSS from ${url}`, e); - return ""; - } -} - -function extractImportLinks(css: string): string[] { - const importRegex = /@import url\(([^)]+)\)/g; - const links: string[] = []; - let match; - while ((match = importRegex.exec(css)) !== null) { - links.push(match[1].trim().replace(/['"]/g, "")); - } - return links; } async function initThemes() { themesStyle ??= createStyle("vencord-themes"); const { enabledThemeLinks, enabledThemes } = Settings; + const enabledlinks: string[] = [...enabledThemeLinks]; + // "darker" and "midnight" both count as dark const activeTheme = ThemeStore.theme === "light" ? "light" : "dark"; - const rawLinks = enabledlinks + const links = enabledlinks .map(rawLink => { const match = /^@(light|dark) (.*)/.exec(rawLink); if (!match) return rawLink; @@ -125,25 +72,18 @@ async function initThemes() { const [, mode, link] = match; return mode === activeTheme ? link : null; }) - .filter((link): link is string => link !== null); + .filter(link => link !== null); - const links: string[] = []; - - for (const url of rawLinks) { - const css = await fetchAndPatchCSS(url); - if (css) { - const blob = new Blob([css], { type: "text/css" }); + if (IS_WEB) { + for (const theme of enabledThemes) { + const themeData = await VencordNative.themes.getThemeData(theme); + if (!themeData) continue; + const blob = new Blob([themeData], { type: "text/css" }); links.push(URL.createObjectURL(blob)); } - } - - for (const theme of enabledThemes) { - const themeData = await VencordNative.themes.getThemeData(theme); - if (!themeData) continue; - - const patchedTheme = patchSidebar(themeData); - const blob = new Blob([patchedTheme], { type: "text/css" }); - links.push(URL.createObjectURL(blob)); + } else { + const localThemes = enabledThemes.map(theme => `vencord:///themes/${theme}?v=${Date.now()}`); + links.push(...localThemes); } themesStyle.textContent = links.map(link => `@import url("${link.trim()}");`).join("\n"); From 3461da81e679cab6fc3ae826441c1ec553237422 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 4 Apr 2025 12:58:53 -0400 Subject: [PATCH 24/24] Fix PingNotif Folder --- .../{PingNotifications => pingNotifications}/index.tsx | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/equicordplugins/{PingNotifications => pingNotifications}/index.tsx (100%) diff --git a/src/equicordplugins/PingNotifications/index.tsx b/src/equicordplugins/pingNotifications/index.tsx similarity index 100% rename from src/equicordplugins/PingNotifications/index.tsx rename to src/equicordplugins/pingNotifications/index.tsx