diff --git a/plugins/radial-status/src/index.ts b/plugins/radial-status/src/index.ts index 37f68f3..408fe9d 100644 --- a/plugins/radial-status/src/index.ts +++ b/plugins/radial-status/src/index.ts @@ -8,9 +8,8 @@ let unpatchAll: () => void = () => {}; export default { onLoad: () => { - // Re-enabled by default - see the note in patches/ringPatch.ts. The earlier corruption came - // from this repo's own broadened wrapper-size match, not upstream's original narrow one, - // which is confirmed working live on Revenge as-is. + // Enabled by default - see patches/ringPatch.ts for the confirmed-sizes whitelist this + // matches against (covers YouBar, profile, member list, and DM list contexts). storage.enabled ??= true; storage.colors ??= { online: "#23A55A", diff --git a/plugins/radial-status/src/patches/ringPatch.ts b/plugins/radial-status/src/patches/ringPatch.ts index 0e9cbf4..9b35377 100644 --- a/plugins/radial-status/src/patches/ringPatch.ts +++ b/plugins/radial-status/src/patches/ringPatch.ts @@ -4,14 +4,20 @@ import { storage } from "@vendetta/plugin"; /** * Forked from AngelW0lf's Radial Status (BSD-3-Clause, see LICENSE). This repo's own first attempt - * "generalized" upstream's exact wrapper-size check (32x32, borderRadius 16) to any square, + * "generalized" upstream's exact wrapper-size check (32x32, borderRadius 16 only) to any square, * fully-circular wrapper, on the theory that avatar sizes differ across contexts - that broadened - * match turned out to false-positive on unrelated Views (confirmed on-device: it visibly corrupted - * member list rows and the profile status indicator, and never matched YouBar's own indicator at - * all). The user was separately running upstream's own unmodified build live on Revenge with none - * of those problems, which means the narrow exact-size check was never the issue - reverted to it - * here instead of the broadened guess. + * match visibly corrupted member list rows and the profile status indicator on-device, and still + * never matched YouBar's own indicator at all. + * + * Confirmed live via Key Inspector's Eval console (a capture across YouBar, the profile screen, + * member lists, and DM lists) exactly which sizes are real presence-carrying wrappers: 24, 32, 40, + * 50, 60, and 80 (all square, all borderRadius === width/2, all with a `user.id` string + a + * `status` string on children[1]/[3], and every single one with exactly 5 children) - so this now + * matches that confirmed set specifically, plus the same child-count check every real one shared, + * rather than either the overly narrow single-size check or the overly broad any-circle one. */ +const CONFIRMED_SIZES = new Set([24, 32, 40, 50, 60, 80]); + export default function patchRing(): () => void { if (!General?.View) return () => {}; @@ -19,9 +25,15 @@ export default function patchRing(): () => void { try { const [wrapper] = args; if (!wrapper || !Array.isArray(wrapper.style)) return; + if (!Array.isArray(wrapper.children) || wrapper.children.length !== 5) return; const circleIdx = wrapper.style.findIndex( - (s: any) => s && s.width === 32 && s.height === 32 && s.borderRadius === 16 + (s: any) => + s && + typeof s.width === "number" && + s.width === s.height && + s.borderRadius === s.width / 2 && + CONFIRMED_SIZES.has(s.width) ); if (circleIdx === -1) return; diff --git a/plugins/radial-status/src/ui/Settings.tsx b/plugins/radial-status/src/ui/Settings.tsx index 545f05b..168a226 100644 --- a/plugins/radial-status/src/ui/Settings.tsx +++ b/plugins/radial-status/src/ui/Settings.tsx @@ -8,10 +8,15 @@ import NoteBox from "@shared/ui/NoteBox"; const { FormSection, FormInput, FormSwitchRow } = Forms; -const STATUSES: { key: string; label: string; defaultColor: string }[] = [ +// The ring patch itself does a generic colors[status] lookup, not one hardcoded to three statuses - +// offline just needed its own configurable entry here to work the same way the other three already +// do. Discord doesn't show a colored dot for offline at all normally, so this is opt-in (blank by +// default) rather than given a default color like the other three. +const STATUSES: { key: string; label: string; defaultColor?: string }[] = [ { key: "online", label: "Online", defaultColor: "#23A55A" }, { key: "idle", label: "Idle", defaultColor: "#F0B232" }, - { key: "dnd", label: "Do Not Disturb", defaultColor: "#F23F42" } + { key: "dnd", label: "Do Not Disturb", defaultColor: "#F23F42" }, + { key: "offline", label: "Offline", defaultColor: "#80848E" } ]; function numberInput(title: string, key: "ringMult" | "ringThickness", placeholder: string) { @@ -37,7 +42,10 @@ export default function Settings() { Replaces the small presence dot on an avatar with a colored ring instead, per status - below. Leave a status blank to keep showing the normal dot for it. + below. Leave a status blank to keep showing the normal dot for it. Confirmed on-device + across YouBar, the profile screen, member lists, and DM lists - matches the specific + avatar sizes seen in each of those contexts, so other unrelated circular UI elements are + left alone.