mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-20 15:18:50 -05:00
Merge branch 'dev'
This commit is contained in:
commit
f27a38009a
13 changed files with 55 additions and 43 deletions
|
@ -244,7 +244,7 @@ function FullPatchInput({ setFind, setParsedFind, setMatch, setReplacement }: Fu
|
|||
}
|
||||
|
||||
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.replacement) throw new Error("No 'replacement' field");
|
||||
|
|
|
@ -111,21 +111,6 @@ function Updatable(props: CommonProps) {
|
|||
|
||||
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)}>
|
||||
{isOutdated && <Button
|
||||
size={Button.Sizes.SMALL}
|
||||
|
@ -174,6 +159,20 @@ function Updatable(props: CommonProps) {
|
|||
Check for Updates
|
||||
</Button>
|
||||
</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} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -366,8 +366,13 @@ export default definePlugin({
|
|||
);
|
||||
data.storageAutoSaveProtocol();
|
||||
|
||||
// @ts-ignore
|
||||
Vencord.Plugins.plugins.Settings.customSections.push(ID => ({
|
||||
const customSettingsSections = (
|
||||
Vencord.Plugins.plugins.Settings as any as {
|
||||
customSections: ((ID: Record<string, unknown>) => any)[];
|
||||
}
|
||||
).customSections;
|
||||
|
||||
customSettingsSections.push(_ => ({
|
||||
section: "iremeberyou.display-data",
|
||||
label: "IRememberYou",
|
||||
element: () => ui.toElement(data.usersCollection),
|
||||
|
|
|
@ -59,7 +59,7 @@ export default definePlugin({
|
|||
replacement: {
|
||||
// Find the Edit User Profile button and insert our custom button.
|
||||
// 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)",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -14,10 +14,10 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: "#{intl::APP_TAG})",
|
||||
find: "#{intl::APP_TAG::hash}\":",
|
||||
replacement: {
|
||||
match: /\i\.\i\.string\(\i\.\i#{intl::APP_TAG}\)/,
|
||||
replace: '"BOT"'
|
||||
match: /(#{intl::APP_TAG::hash}"):".*?"/,
|
||||
replace: '$1:"BOT"'
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
@ -28,15 +28,13 @@ export default definePlugin({
|
|||
}
|
||||
).customSections;
|
||||
|
||||
const ThemeSection = () => ({
|
||||
customSettingsSections.push(_ => ({
|
||||
section: "ThemeLibrary",
|
||||
label: "Theme Library",
|
||||
searchableTitles: ["Theme Library"],
|
||||
element: require("./components/ThemeTab").default,
|
||||
id: "ThemeSection",
|
||||
});
|
||||
|
||||
customSettingsSections.push(ThemeSection);
|
||||
}));
|
||||
},
|
||||
|
||||
stop() {
|
||||
|
|
|
@ -103,42 +103,49 @@ export default definePlugin({
|
|||
{
|
||||
section: "EquicordSettings",
|
||||
label: "Equicord",
|
||||
searchableTitles: ["Equicord", "Settings", "Equicord Settings"],
|
||||
element: VencordTab,
|
||||
className: "vc-settings"
|
||||
},
|
||||
{
|
||||
section: "EquicordPlugins",
|
||||
label: "Plugins",
|
||||
searchableTitles: ["Plugins"],
|
||||
element: PluginsTab,
|
||||
className: "vc-plugins"
|
||||
},
|
||||
{
|
||||
section: "EquicordThemes",
|
||||
label: "Themes",
|
||||
searchableTitles: ["Themes"],
|
||||
element: require("@components/ThemeSettings/ThemesTab").default,
|
||||
className: "vc-themes"
|
||||
},
|
||||
!IS_UPDATER_DISABLED && {
|
||||
section: "EquicordUpdater",
|
||||
label: "Updater",
|
||||
searchableTitles: ["Updater"],
|
||||
element: UpdaterTab,
|
||||
className: "vc-updater"
|
||||
},
|
||||
{
|
||||
section: "EquicordCloud",
|
||||
label: "Cloud",
|
||||
searchableTitles: ["Cloud"],
|
||||
element: CloudTab,
|
||||
className: "vc-cloud"
|
||||
},
|
||||
{
|
||||
section: "EquicordSettingsSync",
|
||||
label: "Backup & Restore",
|
||||
searchableTitles: ["Backup & Restore"],
|
||||
element: BackupAndRestoreTab,
|
||||
className: "vc-backup-restore"
|
||||
},
|
||||
{
|
||||
section: "EquicordPatchHelper",
|
||||
label: "Patch Helper",
|
||||
searchableTitles: ["Patch Helper"],
|
||||
element: PatchHelperTab,
|
||||
className: "vc-patch-helper"
|
||||
},
|
||||
|
|
|
@ -275,16 +275,16 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
makeGuildsBarGuildListFilter(isBetterFolders: boolean) {
|
||||
try {
|
||||
return child => {
|
||||
if (isBetterFolders) {
|
||||
return child => {
|
||||
if (isBetterFolders) {
|
||||
try {
|
||||
return child?.props?.["aria-label"] === getIntlMessage("SERVERS");
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
} catch {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
makeGuildsBarTreeFilter(isBetterFolders: boolean) {
|
||||
|
|
|
@ -282,11 +282,11 @@ export function initWs(isManual = false) {
|
|||
const { find, replacement } = data as PatchData;
|
||||
|
||||
let candidates;
|
||||
if (data.findType === FindType.STRING)
|
||||
candidates = search(find.toString());
|
||||
if (data.findType === FindType.REGEX)
|
||||
candidates = search(...mkRegexFind(find));
|
||||
|
||||
else
|
||||
candidates = search(...mkRegexFind(find));
|
||||
candidates = search(find.toString());
|
||||
|
||||
// const candidates = search(find);
|
||||
const keys = Object.keys(candidates);
|
||||
|
|
|
@ -928,6 +928,9 @@ export default definePlugin({
|
|||
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("name", emoji.name);
|
||||
if (emoji.animated) {
|
||||
url.pathname = url.pathname.replace(".webp", ".gif");
|
||||
}
|
||||
|
||||
const linkText = s.hyperLinkText.replaceAll("{{NAME}}", emoji.name);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* 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 { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
|
@ -301,7 +301,6 @@ export default definePlugin({
|
|||
const [tagName, variant] = passedTagName.split("-");
|
||||
if (!passedTagName) return getIntlMessage("APP_TAG");
|
||||
const tag = tags.find(({ name }) => tagName === name);
|
||||
if (!tag && Settings.plugins.NoAppsAllowed.enabled) return "BOT";
|
||||
if (!tag) 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":
|
||||
return `${getIntlMessage("BOT_TAG_FORUM_ORIGINAL_POSTER")} • ${tagText}`;
|
||||
case "BOT":
|
||||
if (Settings.plugins.NoAppsAllowed.enabled) return `BOT • ${tagText}`;
|
||||
return `${getIntlMessage("APP_TAG")} • ${tagText}`;
|
||||
default:
|
||||
return tagText;
|
||||
|
|
|
@ -134,7 +134,7 @@ export default definePlugin({
|
|||
let element = 0;
|
||||
|
||||
return children.map(c =>
|
||||
c.type === "strong"
|
||||
c.type === "strong" || (typeof c !== "string" && !React.isValidElement(c))
|
||||
? <TypingUser {...props} user={users[element++]} />
|
||||
: c
|
||||
);
|
||||
|
|
|
@ -21,12 +21,14 @@ import { Patch, PatchReplacement, ReplaceFn } from "./types";
|
|||
|
||||
export function canonicalizeMatch<T extends RegExp | string>(match: T): T {
|
||||
let partialCanon = typeof match === "string" ? match : match.source;
|
||||
partialCanon = partialCanon.replaceAll(/#{intl::([A-Za-z_$][\w$]*)}/g, (_, key) => {
|
||||
const hashed = runtimeHashMessageKey(key);
|
||||
partialCanon = partialCanon.replaceAll(/#{intl::([\w$+/]*)(?:::(\w+))?}/g, (_, key, modifier) => {
|
||||
const hashed = modifier === "raw" ? key : runtimeHashMessageKey(key);
|
||||
|
||||
const isString = typeof match === "string";
|
||||
const hasSpecialChars = !Number.isNaN(Number(hashed[0])) || hashed.includes("+") || hashed.includes("/");
|
||||
|
||||
if (modifier === "hash") return hashed;
|
||||
|
||||
if (hasSpecialChars) {
|
||||
return isString
|
||||
? `["${hashed}"]`
|
||||
|
@ -40,7 +42,7 @@ export function canonicalizeMatch<T extends RegExp | string>(match: T): 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue