Merge branch 'dev'

This commit is contained in:
thororen1234 2024-11-07 10:08:19 -05:00
commit f27a38009a
13 changed files with 55 additions and 43 deletions

View file

@ -244,7 +244,7 @@ function FullPatchInput({ setFind, setParsedFind, setMatch, setReplacement }: Fu
} }
try { try {
const parsed = (0, eval)(`(${fullPatch})`) as Patch; const parsed = (0, eval)(`([${fullPatch}][0])`) as Patch;
if (!parsed.find) throw new Error("No 'find' field"); if (!parsed.find) throw new Error("No 'find' field");
if (!parsed.replacement) throw new Error("No 'replacement' field"); if (!parsed.replacement) throw new Error("No 'replacement' field");

View file

@ -111,21 +111,6 @@ function Updatable(props: CommonProps) {
return ( return (
<> <>
{!updates && updateError ? (
<>
<Forms.FormText>Failed to check updates. Check the console for more info</Forms.FormText>
<ErrorCard style={{ padding: "1em" }}>
<p>{updateError.stderr || updateError.stdout || "An unknown error occurred"}</p>
</ErrorCard>
</>
) : (
<Forms.FormText className={Margins.bottom8}>
{isOutdated ? (updates.length === 1 ? "There is 1 Update" : `There are ${updates.length} Updates`) : "Up to Date!"}
</Forms.FormText>
)}
{isOutdated && <Changes updates={updates} {...props} />}
<Flex className={classes(Margins.bottom8, Margins.top8)}> <Flex className={classes(Margins.bottom8, Margins.top8)}>
{isOutdated && <Button {isOutdated && <Button
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
@ -174,6 +159,20 @@ function Updatable(props: CommonProps) {
Check for Updates Check for Updates
</Button> </Button>
</Flex> </Flex>
{!updates && updateError ? (
<>
<Forms.FormText>Failed to check updates. Check the console for more info</Forms.FormText>
<ErrorCard style={{ padding: "1em" }}>
<p>{updateError.stderr || updateError.stdout || "An unknown error occurred"}</p>
</ErrorCard>
</>
) : (
<Forms.FormText className={Margins.bottom8}>
{isOutdated ? (updates.length === 1 ? "There is 1 Update" : `There are ${updates.length} Updates`) : "Up to Date!"}
</Forms.FormText>
)}
{isOutdated && <Changes updates={updates} {...props} />}
</> </>
); );
} }

View file

@ -366,8 +366,13 @@ export default definePlugin({
); );
data.storageAutoSaveProtocol(); data.storageAutoSaveProtocol();
// @ts-ignore const customSettingsSections = (
Vencord.Plugins.plugins.Settings.customSections.push(ID => ({ Vencord.Plugins.plugins.Settings as any as {
customSections: ((ID: Record<string, unknown>) => any)[];
}
).customSections;
customSettingsSections.push(_ => ({
section: "iremeberyou.display-data", section: "iremeberyou.display-data",
label: "IRememberYou", label: "IRememberYou",
element: () => ui.toElement(data.usersCollection), element: () => ui.toElement(data.usersCollection),

View file

@ -59,7 +59,7 @@ export default definePlugin({
replacement: { replacement: {
// Find the Edit User Profile button and insert our custom button. // Find the Edit User Profile button and insert our custom button.
// A bit jank, but whatever // A bit jank, but whatever
match: /,(.{0,20}\.Button,.{0,100}#{intl::USER_SETTINGS_EDIT_USER_PROFILE}\)}\))/, match: /,(\(.{1,90}#{intl::USER_SETTINGS_EDIT_USER_PROFILE}\)}\))/,
replace: ",$self.insertScanQrButton($1)", replace: ",$self.insertScanQrButton($1)",
}, },
}, },

View file

@ -14,10 +14,10 @@ export default definePlugin({
patches: [ patches: [
{ {
find: "#{intl::APP_TAG})", find: "#{intl::APP_TAG::hash}\":",
replacement: { replacement: {
match: /\i\.\i\.string\(\i\.\i#{intl::APP_TAG}\)/, match: /(#{intl::APP_TAG::hash}"):".*?"/,
replace: '"BOT"' replace: '$1:"BOT"'
} }
} }
], ],

View file

@ -28,15 +28,13 @@ export default definePlugin({
} }
).customSections; ).customSections;
const ThemeSection = () => ({ customSettingsSections.push(_ => ({
section: "ThemeLibrary", section: "ThemeLibrary",
label: "Theme Library", label: "Theme Library",
searchableTitles: ["Theme Library"], searchableTitles: ["Theme Library"],
element: require("./components/ThemeTab").default, element: require("./components/ThemeTab").default,
id: "ThemeSection", id: "ThemeSection",
}); }));
customSettingsSections.push(ThemeSection);
}, },
stop() { stop() {

View file

@ -103,42 +103,49 @@ export default definePlugin({
{ {
section: "EquicordSettings", section: "EquicordSettings",
label: "Equicord", label: "Equicord",
searchableTitles: ["Equicord", "Settings", "Equicord Settings"],
element: VencordTab, element: VencordTab,
className: "vc-settings" className: "vc-settings"
}, },
{ {
section: "EquicordPlugins", section: "EquicordPlugins",
label: "Plugins", label: "Plugins",
searchableTitles: ["Plugins"],
element: PluginsTab, element: PluginsTab,
className: "vc-plugins" className: "vc-plugins"
}, },
{ {
section: "EquicordThemes", section: "EquicordThemes",
label: "Themes", label: "Themes",
searchableTitles: ["Themes"],
element: require("@components/ThemeSettings/ThemesTab").default, element: require("@components/ThemeSettings/ThemesTab").default,
className: "vc-themes" className: "vc-themes"
}, },
!IS_UPDATER_DISABLED && { !IS_UPDATER_DISABLED && {
section: "EquicordUpdater", section: "EquicordUpdater",
label: "Updater", label: "Updater",
searchableTitles: ["Updater"],
element: UpdaterTab, element: UpdaterTab,
className: "vc-updater" className: "vc-updater"
}, },
{ {
section: "EquicordCloud", section: "EquicordCloud",
label: "Cloud", label: "Cloud",
searchableTitles: ["Cloud"],
element: CloudTab, element: CloudTab,
className: "vc-cloud" className: "vc-cloud"
}, },
{ {
section: "EquicordSettingsSync", section: "EquicordSettingsSync",
label: "Backup & Restore", label: "Backup & Restore",
searchableTitles: ["Backup & Restore"],
element: BackupAndRestoreTab, element: BackupAndRestoreTab,
className: "vc-backup-restore" className: "vc-backup-restore"
}, },
{ {
section: "EquicordPatchHelper", section: "EquicordPatchHelper",
label: "Patch Helper", label: "Patch Helper",
searchableTitles: ["Patch Helper"],
element: PatchHelperTab, element: PatchHelperTab,
className: "vc-patch-helper" className: "vc-patch-helper"
}, },

View file

@ -275,16 +275,16 @@ export default definePlugin({
}, },
makeGuildsBarGuildListFilter(isBetterFolders: boolean) { makeGuildsBarGuildListFilter(isBetterFolders: boolean) {
try {
return child => { return child => {
if (isBetterFolders) { if (isBetterFolders) {
try {
return child?.props?.["aria-label"] === getIntlMessage("SERVERS"); return child?.props?.["aria-label"] === getIntlMessage("SERVERS");
} catch (e) {
console.error(e);
}
} }
return true; return true;
}; };
} catch {
return true;
}
}, },
makeGuildsBarTreeFilter(isBetterFolders: boolean) { makeGuildsBarTreeFilter(isBetterFolders: boolean) {

View file

@ -282,11 +282,11 @@ export function initWs(isManual = false) {
const { find, replacement } = data as PatchData; const { find, replacement } = data as PatchData;
let candidates; let candidates;
if (data.findType === FindType.STRING) if (data.findType === FindType.REGEX)
candidates = search(find.toString()); candidates = search(...mkRegexFind(find));
else else
candidates = search(...mkRegexFind(find)); candidates = search(find.toString());
// const candidates = search(find); // const candidates = search(find);
const keys = Object.keys(candidates); const keys = Object.keys(candidates);

View file

@ -928,6 +928,9 @@ export default definePlugin({
const url = new URL(IconUtils.getEmojiURL({ id: emoji.id, animated: emoji.animated, size: s.emojiSize })); const url = new URL(IconUtils.getEmojiURL({ id: emoji.id, animated: emoji.animated, size: s.emojiSize }));
url.searchParams.set("size", s.emojiSize.toString()); url.searchParams.set("size", s.emojiSize.toString());
url.searchParams.set("name", emoji.name); url.searchParams.set("name", emoji.name);
if (emoji.animated) {
url.pathname = url.pathname.replace(".webp", ".gif");
}
const linkText = s.hyperLinkText.replaceAll("{{NAME}}", emoji.name); const linkText = s.hyperLinkText.replaceAll("{{NAME}}", emoji.name);

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { definePluginSettings, Settings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Flex } from "@components/Flex"; import { Flex } from "@components/Flex";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord"; import { getIntlMessage } from "@utils/discord";
@ -301,7 +301,6 @@ export default definePlugin({
const [tagName, variant] = passedTagName.split("-"); const [tagName, variant] = passedTagName.split("-");
if (!passedTagName) return getIntlMessage("APP_TAG"); if (!passedTagName) return getIntlMessage("APP_TAG");
const tag = tags.find(({ name }) => tagName === name); const tag = tags.find(({ name }) => tagName === name);
if (!tag && Settings.plugins.NoAppsAllowed.enabled) return "BOT";
if (!tag) return getIntlMessage("APP_TAG"); if (!tag) return getIntlMessage("APP_TAG");
if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG"); if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG");
@ -310,7 +309,6 @@ export default definePlugin({
case "OP": case "OP":
return `${getIntlMessage("BOT_TAG_FORUM_ORIGINAL_POSTER")}${tagText}`; return `${getIntlMessage("BOT_TAG_FORUM_ORIGINAL_POSTER")}${tagText}`;
case "BOT": case "BOT":
if (Settings.plugins.NoAppsAllowed.enabled) return `BOT • ${tagText}`;
return `${getIntlMessage("APP_TAG")}${tagText}`; return `${getIntlMessage("APP_TAG")}${tagText}`;
default: default:
return tagText; return tagText;

View file

@ -134,7 +134,7 @@ export default definePlugin({
let element = 0; let element = 0;
return children.map(c => return children.map(c =>
c.type === "strong" c.type === "strong" || (typeof c !== "string" && !React.isValidElement(c))
? <TypingUser {...props} user={users[element++]} /> ? <TypingUser {...props} user={users[element++]} />
: c : c
); );

View file

@ -21,12 +21,14 @@ import { Patch, PatchReplacement, ReplaceFn } from "./types";
export function canonicalizeMatch<T extends RegExp | string>(match: T): T { export function canonicalizeMatch<T extends RegExp | string>(match: T): T {
let partialCanon = typeof match === "string" ? match : match.source; let partialCanon = typeof match === "string" ? match : match.source;
partialCanon = partialCanon.replaceAll(/#{intl::([A-Za-z_$][\w$]*)}/g, (_, key) => { partialCanon = partialCanon.replaceAll(/#{intl::([\w$+/]*)(?:::(\w+))?}/g, (_, key, modifier) => {
const hashed = runtimeHashMessageKey(key); const hashed = modifier === "raw" ? key : runtimeHashMessageKey(key);
const isString = typeof match === "string"; const isString = typeof match === "string";
const hasSpecialChars = !Number.isNaN(Number(hashed[0])) || hashed.includes("+") || hashed.includes("/"); const hasSpecialChars = !Number.isNaN(Number(hashed[0])) || hashed.includes("+") || hashed.includes("/");
if (modifier === "hash") return hashed;
if (hasSpecialChars) { if (hasSpecialChars) {
return isString return isString
? `["${hashed}"]` ? `["${hashed}"]`
@ -40,7 +42,7 @@ export function canonicalizeMatch<T extends RegExp | string>(match: T): T {
return partialCanon as T; return partialCanon as T;
} }
const canonSource = partialCanon.replaceAll(String.raw`\i`, String.raw`(?:[A-Za-z_$][\w$]*)`); const canonSource = partialCanon.replaceAll("\\i", String.raw`(?:[A-Za-z_$][\w$]*)`);
return new RegExp(canonSource, match.flags) as T; return new RegExp(canonSource, match.flags) as T;
} }