Merge branch 'dev' into translation
This commit is contained in:
commit
567cfdd4bd
9 changed files with 31 additions and 40 deletions
|
|
@ -32,7 +32,7 @@ import { EquicordDevs } from "@utils/constants";
|
|||
|
||||
export default definePlugin({
|
||||
name: "PluginName", // PascalCase, matches directory name
|
||||
description: "Does something.", // Capital first, period at end
|
||||
description: "Does something", // Capital first
|
||||
authors: [EquicordDevs.Name], // EquicordDevs for new, Devs for upstream
|
||||
});
|
||||
```
|
||||
|
|
@ -76,8 +76,7 @@ Flag these and suggest the fix:
|
|||
| `value \|\| defaultValue` | `value ?? defaultValue` | `\|\|` falsifies `0`, `""`, `false` |
|
||||
| `` `${classA} ${classB}` `` | `classes(classA, classB)` | Handles null/false gracefully |
|
||||
| `"vc-plugin-class"` hardcoded | `cl("class")` via `classNameFactory` | Consistent, typo-proof |
|
||||
| `console.log/warn/error` | Remove it | No logging in plugin code |
|
||||
| `new Logger(...)` / `logger.log(...)` | Remove it | No logging in plugin code |
|
||||
| `console.log/warn` | Remove it | No logging in plugin code |
|
||||
| `cdn.discordapp.com/avatars/...` | `IconUtils.getUserAvatarURL(user)` | Handles animated, sizing, CDN |
|
||||
| `cdn.discordapp.com/icons/...` | `IconUtils.getGuildIconURL(...)` | Same |
|
||||
| `cdn.discordapp.com/banners/...` | `IconUtils.getUserBannerURL(...)` | Same |
|
||||
|
|
@ -246,7 +245,7 @@ Vencord.Plugins.plugins["OtherPlugin"].someFunction();
|
|||
|
||||
## Text and Descriptions
|
||||
|
||||
- Plugin and setting descriptions: capital first letter, end with period.
|
||||
- Plugin and setting descriptions: capital first letter.
|
||||
- Error messages and toasts: natural human text, no dashes or robotic formatting.
|
||||
|
||||
```typescript
|
||||
|
|
@ -317,8 +316,7 @@ stop() {}
|
|||
- **No overengineering.** No premature abstractions, no "just in case" handling, no features not requested. Three similar lines beats a one-use helper. If code can be half the size and do the same thing, it should be.
|
||||
- **No bloat.** Flag unnecessary wrapper functions, redundant type annotations, excessive error handling for things that can't fail, useless try/catch around synchronous code, or 50 lines doing what 10 could do. Code should be lean.
|
||||
- **No unused imports.** Every import must be referenced.
|
||||
- **No logging in plugin code.** No `console.log/warn/error`, no `Logger`. Remove all logging statements.
|
||||
- **No empty catch blocks.** Handle every error (show toast, return fallback, rethrow, etc.).
|
||||
- **No logging in plugin code besides for errors.** No `console.log/warn`.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -378,6 +376,6 @@ If a PR reimplements any of these, flag it. They already exist:
|
|||
## Review Severity
|
||||
|
||||
1. **CRITICAL** — `any` types, hardcoded CDN/API URLs, direct DOM manipulation, security issues, massive overengineering/bloat, suspected AI slop (note it, but still review everything)
|
||||
2. **HIGH** — Missing useEffect cleanup, forbidden React APIs, hardcoded class names, logging statements (console or Logger), missing definePluginSettings, unnecessary abstractions
|
||||
2. **HIGH** — Missing useEffect cleanup, forbidden React APIs, hardcoded class names, console logging statements, missing definePluginSettings, unnecessary abstractions
|
||||
3. **MEDIUM** — Anti-patterns (`||` instead of `??`), utility reimplementations, commented-out code, bad description format, excessive comments
|
||||
4. **LOW** — Style preferences, minor performance wins, organization
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export default definePlugin({
|
|||
// regardless of if the "discodo" effect is enabled or not. This is due to the volume setter
|
||||
// internally calling the ensureAudio function which is where the internal sounds module is loaded
|
||||
// by default. To account for this, the module is force loaded in the first patch in the above group.
|
||||
find: "UPDATE_OPEN_ON_STARTUP",
|
||||
find: '"UPDATE_OPEN_ON_STARTUP"',
|
||||
group: true,
|
||||
replacement: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export default definePlugin({
|
|||
{
|
||||
find: '?"BACK_FORWARD_NAVIGATION":',
|
||||
replacement: {
|
||||
match: /(?<="HELP".{0,150}className:\i\}\))(?=\])/,
|
||||
match: /(?<="HELP"===.{0,150}className:\i\.\i\}\))(?=\])/,
|
||||
replace: ",...Vencord.Api.HeaderBar._addHeaderBarButtons()"
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -104,13 +104,6 @@ export default definePlugin({
|
|||
match: /defaultConfig:\{enableClips:!\d,ignorePlatformRestriction:!\d,showClipsHeaderEntrypoint:!\d,enableScreenshotKeybind:!\d,enableVoiceOnlyClips:!\d,enableAdvancedSignals:!\d\}/,
|
||||
replace: "defaultConfig:{enableClips:!0,ignorePlatformRestriction:$self.settings.store.ignorePlatformRestriction,showClipsHeaderEntrypoint:!0,enableScreenshotKeybind:$self.settings.store.enableScreenshotKeybind,enableVoiceOnlyClips:$self.settings.store.enableVoiceOnlyClips,enableAdvancedSignals:$self.settings.store.enableAdvancedSignals}"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: "2023-10_viewer_clipping",
|
||||
replacement: {
|
||||
match: /defaultConfig:\{enableViewerClipping:!\d,ignoreSenderPreference:!\d\}/,
|
||||
replace: "defaultConfig:{enableViewerClipping:!0,ignoreSenderPreference:!0}"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ import { FluxDispatcher, Menu, React, Tooltip, UserStore } from "@webpack/common
|
|||
|
||||
interface CallUpdate {
|
||||
ringing: string[];
|
||||
ongoingRings: Record<number, string>;
|
||||
ongoingRings: string[];
|
||||
messageId: string;
|
||||
region: string;
|
||||
}
|
||||
|
||||
const args: CallUpdate = {
|
||||
ringing: [],
|
||||
ongoingRings: {},
|
||||
ongoingRings: [],
|
||||
messageId: "",
|
||||
region: "",
|
||||
};
|
||||
|
|
@ -35,6 +35,8 @@ const args: CallUpdate = {
|
|||
const ignoredChannelIds = new Set<string>();
|
||||
const cl = classNameFactory("vc-ignore-calls-");
|
||||
const Deafen = findComponentByCodeLazy("0-1.02-.1H3.05a9");
|
||||
const filterOngoingRings = (currentUserId: string): CallUpdate["ongoingRings"] =>
|
||||
args.ongoingRings.filter((id: string) => id !== currentUserId);
|
||||
|
||||
const ContextMenuPatch: NavContextMenuPatchCallback = (children, { channel }: { channel: Channel; }) => {
|
||||
if (!channel || (!channel.isDM() && !channel.isGroupDM())) return;
|
||||
|
|
@ -110,7 +112,7 @@ export default definePlugin({
|
|||
flux: {
|
||||
async CALL_UPDATE({ ringing, ongoingRings, messageId, region }) {
|
||||
args.ringing = ringing || [];
|
||||
args.ongoingRings = ongoingRings || {};
|
||||
args.ongoingRings = Array.isArray(ongoingRings) ? ongoingRings : [];
|
||||
args.messageId = messageId;
|
||||
args.region = region;
|
||||
}
|
||||
|
|
@ -123,7 +125,7 @@ export default definePlugin({
|
|||
type: "CALL_UPDATE",
|
||||
channelId: channel.id,
|
||||
ringing: args.ringing.filter((id: string) => id !== currentUserId),
|
||||
ongoingRings: args.ongoingRings,
|
||||
ongoingRings: filterOngoingRings(currentUserId),
|
||||
messageId: args.messageId,
|
||||
region: args.region
|
||||
});
|
||||
|
|
@ -144,7 +146,7 @@ export default definePlugin({
|
|||
type: "CALL_UPDATE",
|
||||
channelId: channel.id,
|
||||
ringing: args.ringing.filter((id: string) => id !== currentUserId),
|
||||
ongoingRings: args.ongoingRings,
|
||||
ongoingRings: filterOngoingRings(currentUserId),
|
||||
messageId: args.messageId,
|
||||
region: args.region
|
||||
});
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ function LogsContent({ visibleMessages, canLoadMore, sortNewest, tab, reset, han
|
|||
);
|
||||
}
|
||||
|
||||
const LogsContentMemo = LazyComponent(() => React.memo(LogsContent));
|
||||
const LogsContentMemo = LazyComponent(() => LogsContent);
|
||||
|
||||
function NoResults({ tab }: { tab: LogTabs; }) {
|
||||
const generateSuggestedTabs = (tab: LogTabs) => {
|
||||
|
|
|
|||
|
|
@ -1230,7 +1230,7 @@ export default definePlugin({
|
|||
},
|
||||
{
|
||||
// Hides Quests tab in the DMs tab list.
|
||||
find: "QUEST_HOME_V2):",
|
||||
find: ".QUEST_HOME):",
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<="family-center"\):null,)/,
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ function makeContextCallback(
|
|||
children.push(
|
||||
<Menu.MenuItem
|
||||
id={`c98-view-${name}-raw`}
|
||||
label="View Raw"
|
||||
label="View Raw Variant"
|
||||
action={() => action(value)}
|
||||
icon={CopyIcon}
|
||||
/>,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { t } from "@utils/translation";
|
|||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { GuildMember, Message, User } from "@vencord/discord-types";
|
||||
import { findByCodeLazy, findStoreLazy } from "@webpack";
|
||||
import { ChannelStore, GuildMemberStore, GuildRoleStore, GuildStore, Menu, MessageStore, RelationshipStore, StreamerModeStore, TextInput, useEffect, useState } from "@webpack/common";
|
||||
import { ChannelStore, GuildMemberStore, GuildStore, Menu, MessageStore, RelationshipStore, StreamerModeStore, TextInput, useEffect, useState } from "@webpack/common";
|
||||
import { JSX } from "react";
|
||||
|
||||
const SMYNC = classNameFactory();
|
||||
|
|
@ -481,9 +481,7 @@ function renderUsername(
|
|||
|
||||
const ircColorsEnabled = isPluginEnabled(ircColors.name);
|
||||
|
||||
const authorTopRole = (author as GuildMember)?.guildId && (author as any)?.highestRoleId;
|
||||
const authorTopRoleColor = authorTopRole && GuildRoleStore.getRole((author as GuildMember).guildId, authorTopRole)?.colorStrings;
|
||||
const authorColorStrings = colorStrings || (author as any)?.colorStrings || authorTopRoleColor || null;
|
||||
const authorColorStrings = colorStrings || (author as any)?.colorStrings || null;
|
||||
const authorDisplayNameStyles = (!inGuild && !ircColorsEnabled && (author as any)?.displayNameStyles) || null;
|
||||
const effectType = authorDisplayNameStyles ? getEffectType(authorDisplayNameStyles.effectId) : null;
|
||||
const effectCSSVars = authorDisplayNameStyles ? computeEffectCSSVars(authorDisplayNameStyles) : {};
|
||||
|
|
@ -493,9 +491,9 @@ function renderUsername(
|
|||
const shouldAnimateEffect = shouldShowEffect && !AccessibilityStore.useReducedMotion;
|
||||
|
||||
const canUseGradient = ((author as GuildMember)?.guildId ? (GuildStore.getGuild((author as GuildMember).guildId) ?? {}).premiumFeatures?.features.includes("ENHANCED_ROLE_COLORS") : !inGuild);
|
||||
const useTopStyle = isMention || isReactionsPopout || channel?.isDM() || channel?.isGroupDM();
|
||||
const topStyle = author ? resolveColor(authorColorStrings, authorDisplayNameStyles, "Role", canUseGradient, inGuild, ircColorsEnabled, isHovering) : null;
|
||||
const hasGradient = !!topStyle?.gradient && Object.keys(topStyle.gradient).length > 0;
|
||||
const useTopRoleStyle = isMention || isReactionsPopout || channel?.isDM() || channel?.isGroupDM();
|
||||
const topRoleStyle = author ? resolveColor(authorColorStrings, authorDisplayNameStyles, "Role", canUseGradient, inGuild, ircColorsEnabled, isHovering) : null;
|
||||
const hasGradient = !!topRoleStyle?.gradient && Object.keys(topRoleStyle.gradient).length > 0;
|
||||
|
||||
const textMutedValue = getComputedStyle(document.documentElement)?.getPropertyValue("--text-muted")?.trim() || "#72767d";
|
||||
const options = splitTemplate(includedNames);
|
||||
|
|
@ -650,7 +648,7 @@ function renderUsername(
|
|||
|
||||
// Only mentions and reactions popouts should patch in the gradient glow or else a double glow will appear on messages.
|
||||
const hoveringClass = (isHovering ? " smyn-gradient-hovered" : "");
|
||||
const gradientClasses = useTopStyle
|
||||
const gradientClasses = useTopRoleStyle
|
||||
? "smyn-gradient smyn-gradient-inherit-bg" + hoveringClass
|
||||
: "smyn-gradient smyn-gradient-unset-bg" + hoveringClass;
|
||||
|
||||
|
|
@ -682,7 +680,7 @@ function renderUsername(
|
|||
<span
|
||||
style={{
|
||||
...topLevelStyle,
|
||||
...(topStyle?.normal.original || {})
|
||||
...(topRoleStyle?.normal.original || {})
|
||||
}}
|
||||
className="smyn-container"
|
||||
>
|
||||
|
|
@ -691,7 +689,7 @@ function renderUsername(
|
|||
<span
|
||||
className={SMYNC(firstGroupClasses, { [gradientClasses]: shouldGradientGlow })}
|
||||
data-text={shouldGradientGlow ? firstDataText : undefined}
|
||||
style={(shouldGradientGlow && useTopStyle && topStyle ? topStyle.gradient.animated : undefined) as React.CSSProperties}
|
||||
style={(shouldGradientGlow && useTopRoleStyle && topRoleStyle ? topRoleStyle.gradient.animated : undefined) as React.CSSProperties}
|
||||
>
|
||||
<span
|
||||
className={SMYNC(firstNameClasses, {
|
||||
|
|
@ -702,12 +700,12 @@ function renderUsername(
|
|||
data-username-with-effects={needsEffectDataAttr && shouldShowEffect ? first.name : undefined}
|
||||
style={shouldShowEffect
|
||||
? undefined
|
||||
: topStyle ?
|
||||
shouldAnimateGradients && topStyle.gradient
|
||||
? topStyle.gradient.animated
|
||||
: topStyle.gradient
|
||||
? topStyle.gradient.static.original
|
||||
: topStyle.normal.original
|
||||
: topRoleStyle ?
|
||||
shouldAnimateGradients && topRoleStyle.gradient
|
||||
? topRoleStyle.gradient.animated
|
||||
: topRoleStyle.gradient
|
||||
? topRoleStyle.gradient.static.original
|
||||
: topRoleStyle.normal.original
|
||||
: undefined
|
||||
}>
|
||||
{first.wrapped}</span>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue