diff --git a/package.json b/package.json index 98072c18..22d4c25d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.9.1", + "version": "1.9.2", "description": "The other cutest Discord client mod", "homepage": "https://github.com/Equicord/Equicord#readme", "bugs": { @@ -118,4 +118,4 @@ "node": ">=18", "pnpm": ">=9" } -} +} \ No newline at end of file diff --git a/scripts/generateReport.ts b/scripts/generateReport.ts index ce65bc96..61613f3f 100644 --- a/scripts/generateReport.ts +++ b/scripts/generateReport.ts @@ -136,7 +136,6 @@ async function printReport() { body: JSON.stringify({ description: "Here's the latest Equicord Report!", username: "Equicord Reporter" + (CANARY ? " (Canary)" : ""), - avatar_url: "https://avatars.githubusercontent.com/u/150590884?s=48&v=4", embeds: [ { title: "Bad Patches", diff --git a/src/api/Settings.ts b/src/api/Settings.ts index 6579e783..b007d286 100644 --- a/src/api/Settings.ts +++ b/src/api/Settings.ts @@ -139,7 +139,7 @@ export const SettingsStore = new SettingsStoreClass(settings, { if (path === "plugins" && key in plugins) return target[key] = { - enabled: IS_REPORTER ?? plugins[key].required ?? plugins[key].enabledByDefault ?? false + enabled: IS_REPORTER || plugins[key].required || plugins[key].enabledByDefault || false }; // Since the property is not set, check if this is a plugin's setting and if so, try to resolve diff --git a/src/components/Icons.tsx b/src/components/Icons.tsx index 9f981f6f..9b6a2977 100644 --- a/src/components/Icons.tsx +++ b/src/components/Icons.tsx @@ -343,7 +343,7 @@ export function ResetIcon(props: IconProps) { > - + ); } diff --git a/src/equicordplugins/keywordNotify/index.tsx b/src/equicordplugins/keywordNotify/index.tsx index 6a9f4a34..1df6e98f 100644 --- a/src/equicordplugins/keywordNotify/index.tsx +++ b/src/equicordplugins/keywordNotify/index.tsx @@ -16,10 +16,12 @@ import { Margins } from "@utils/margins"; import { useForceUpdater } from "@utils/react"; import definePlugin, { OptionType } from "@utils/types"; import { findByCodeLazy, findByPropsLazy } from "@webpack"; -import { Button, ChannelStore, Forms, SearchableSelect, SelectedChannelStore, TabBar, TextInput, UserStore, useState } from "@webpack/common"; +import { Button, ChannelStore, Forms, Select, SelectedChannelStore, Switch, TabBar, TextInput, UserStore, useState } from "@webpack/common"; import { Message, User } from "discord-types/general/index.js"; -let keywordEntries: Array<{ regex: string, listIds: Array, listType: ListType; }> = []; +type KeywordEntry = { regex: string, listIds: Array, listType: ListType, ignoreCase: boolean; }; + +let keywordEntries: Array = []; let currentUser: User; let keywordLog: Array = []; @@ -33,7 +35,7 @@ const KEYWORD_LOG_KEY = "KeywordNotify_log"; const cl = classNameFactory("vc-keywordnotify-"); async function addKeywordEntry(forceUpdate: () => void) { - keywordEntries.push({ regex: "", listIds: [], listType: ListType.BlackList }); + keywordEntries.push({ regex: "", listIds: [], listType: ListType.BlackList, ignoreCase: false }); await DataStore.set(KEYWORD_ENTRIES_KEY, keywordEntries); forceUpdate(); } @@ -44,9 +46,9 @@ async function removeKeywordEntry(idx: number, forceUpdate: () => void) { forceUpdate(); } -function safeMatchesRegex(s: string, r: string) { +function safeMatchesRegex(str: string, regex: string, flags: string) { try { - return s.match(new RegExp(r)); + return str.match(new RegExp(regex, flags)); } catch { return false; } @@ -57,29 +59,26 @@ enum ListType { Whitelist = "Whitelist" } -function highlightKeywords(s: string, r: Array) { - let regex: RegExp; +function highlightKeywords(str: string, entries: Array) { + let regexes: Array; try { - regex = new RegExp(r.join("|"), "g"); - } catch { - return [s]; + regexes = entries.map(e => new RegExp(e.regex, "g" + (e.ignoreCase ? "i" : ""))); + } catch (err) { + return [str]; } - const matches = s.match(regex); - if (!matches) - return [s]; + const matches = regexes.map(r => str.match(r)).flat().filter(e => e != null); + if (matches.length === 0) { + return [str]; + } - const parts = [...matches.map(e => { - const idx = s.indexOf(e); - const before = s.substring(0, idx); - s = s.substring(idx + e.length); - return before; - }, s), s]; + const idx = str.indexOf(matches[0]!); - return parts.map(e => [ - ({e}), - matches!.length ? ({matches!.splice(0, 1)[0]}) : [] - ]); + return [ + {str.substring(0, idx)}, + {matches[0]}, + {str.substring(idx + matches[0]!.length)} + ]; } function Collapsible({ title, children }) { @@ -147,16 +146,17 @@ function ListedIds({ listIds, setListIds }) { function ListTypeSelector({ listType, setListType }) { return ( - v === listType} closeOnSelect={true} - value={listType} - onChange={setListType} + className={`${listType}`} + select={setListType} + serialize={v => v} /> ); } @@ -205,6 +205,16 @@ function KeywordEntries() { + { + values[i].ignoreCase = !values[i].ignoreCase; + update(); + }} + style={{ marginTop: "0.5em", marginRight: "40px" }} + > + Ignore Case + Whitelist/Blacklist @@ -304,7 +314,7 @@ export default definePlugin({ applyKeywordEntries(m: Message) { let matches = false; - keywordEntries.forEach(entry => { + for (const entry of keywordEntries) { if (entry.regex === "") { return; } @@ -318,6 +328,7 @@ export default definePlugin({ } const whitelistMode = entry.listType === ListType.Whitelist; + if (!whitelistMode && listed) { return; } @@ -325,28 +336,27 @@ export default definePlugin({ return; } - if (settings.store.ignoreBots && m.author.bot) { - if (!whitelistMode || !entry.listIds.includes(m.author.id)) { - return; - } + if (settings.store.ignoreBots && m.author.bot && (!whitelistMode || !entry.listIds.includes(m.author.id))) { + return; } - if (safeMatchesRegex(m.content, entry.regex)) { + const flags = entry.ignoreCase ? "i" : ""; + if (safeMatchesRegex(m.content, entry.regex, flags)) { matches = true; } for (const embed of m.embeds as any) { - if (safeMatchesRegex(embed.description, entry.regex) || safeMatchesRegex(embed.title, entry.regex)) { + if (safeMatchesRegex(embed.description, entry.regex, flags) || safeMatchesRegex(embed.title, entry.regex, flags)) { matches = true; } else if (embed.fields != null) { for (const field of embed.fields as Array<{ name: string, value: string; }>) { - if (safeMatchesRegex(field.value, entry.regex) || safeMatchesRegex(field.name, entry.regex)) { + if (safeMatchesRegex(field.value, entry.regex, flags) || safeMatchesRegex(field.name, entry.regex, flags)) { matches = true; } } } } - }); + } if (matches) { // @ts-ignore @@ -358,7 +368,7 @@ export default definePlugin({ }, addToLog(m: Message) { - if (m == null || keywordLog.some(e => e.id === m.id)) + if (m === null || keywordLog.some(e => e.id === m.id)) return; DataStore.get(KEYWORD_LOG_KEY).then(log => { @@ -405,7 +415,7 @@ export default definePlugin({ e._keyword = true; e.customRenderedContent = { - content: highlightKeywords(e.content, keywordEntries.map(e => e.regex)) + content: highlightKeywords(e.content, keywordEntries) }; const msg = this.renderMsg({ diff --git a/src/equicordplugins/keywordNotify/style.css b/src/equicordplugins/keywordNotify/style.css index 1668d1e3..5acddc67 100644 --- a/src/equicordplugins/keywordNotify/style.css +++ b/src/equicordplugins/keywordNotify/style.css @@ -1,17 +1,16 @@ -/* stylelint-disable no-descending-specificity */ -.keywordnotify-delete:hover { - color: var(--status-danger); -} - -.keywordnotify-delete { +.vc-keywordnotify-delete { padding: 0; color: var(--primary-400); transition: color 0.2s ease-in-out; } -.keywordnotify-collapsible { +.vc-keywordnotify-delete:hover { + color: var(--status-danger); +} + +.vc-keywordnotify-collapsible { display: flex; align-items: center; padding: 8px; cursor: pointer; -} +} \ No newline at end of file diff --git a/src/equicordplugins/themeLibrary/components/ThemeTab.tsx b/src/equicordplugins/themeLibrary/components/ThemeTab.tsx index 6bab6ad7..73b094d9 100644 --- a/src/equicordplugins/themeLibrary/components/ThemeTab.tsx +++ b/src/equicordplugins/themeLibrary/components/ThemeTab.tsx @@ -587,4 +587,4 @@ function ThemeLibrary() { ); } -export default wrapTab(ThemeLibrary, "Theme Library"); \ No newline at end of file +export default wrapTab(ThemeLibrary, "Theme Library"); diff --git a/src/plugins/fakeProfileThemes/index.tsx b/src/plugins/fakeProfileThemes/index.tsx index 032cba33..5d1035df 100644 --- a/src/plugins/fakeProfileThemes/index.tsx +++ b/src/plugins/fakeProfileThemes/index.tsx @@ -109,7 +109,7 @@ interface ProfileModalProps { } const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)"); -const ProfileModal = findComponentByCodeLazy("isTryItOutFlow:", "pendingThemeColors:", "avatarDecorationOverride:", ".CUSTOM_STATUS"); +const ProfileModal = findComponentByCodeLazy("isTryItOutFlow:", "pendingThemeColors:", "pendingAvatarDecoration:", "EDIT_PROFILE_BANNER"); const requireColorPicker = extractAndLoadChunksLazy(["USER_SETTINGS_PROFILE_COLOR_DEFAULT_BUTTON.format"], /createPromise:\(\)=>\i\.\i(\("?.+?"?\)).then\(\i\.bind\(\i,"?(.+?)"?\)\)/); diff --git a/src/plugins/userVoiceShow/index.tsx b/src/plugins/userVoiceShow/index.tsx index bdbf65e3..7d640171 100644 --- a/src/plugins/userVoiceShow/index.tsx +++ b/src/plugins/userVoiceShow/index.tsx @@ -98,8 +98,8 @@ export default definePlugin({ { find: ".popularApplicationCommandIds,", replacement: { - match: /applicationId:\i\.id}\),(?=.{0,50}setNote:\i)/, - replace: "$&$self.patchPopout(arguments[0]),", + match: /(?<=,)(?=!\i&&!\i&&.{0,50}setNote:)/, + replace: "$self.patchPopout(arguments[0]),", } }, // below username