Radial Status: extend ring match to YouBar, profile, and DM list contexts
This commit is contained in:
parent
e599fb2afc
commit
2f4e5671d1
4 changed files with 36 additions and 17 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
|||
<SettingsScaffold>
|
||||
<NoteBox>
|
||||
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.
|
||||
</NoteBox>
|
||||
<FormSection title="Enable">
|
||||
<FormSwitchRow
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
"status": "revived",
|
||||
"accent": "#23A55A",
|
||||
"tagline": "A colored ring around the avatar instead of a presence dot - similar to Platform Indicator, but for status.",
|
||||
"note": "Fork of AngelW0lf's Radial Status (BSD-3-Clause, see LICENSE). Upstream had a phone-home mechanism - it fetched a remote blacklist on every load and could silently uninstall itself for specific user IDs the original author chose - dropped entirely here, no network requests at all. An early revision of this fork also generalized upstream's exact wrapper-size match to any fully-circular avatar wrapper, on the theory that avatar sizes differ across contexts - that broadened match turned out to false-positive on unrelated elements (confirmed on-device: corrupted member list rows and the profile status indicator), while upstream's own narrow, exact-size check was confirmed working live on Revenge as-is. Reverted to that exact match. Upstream's settings screen had commented-out, non-functional size/thickness inputs and an unfinished joke placeholder button - both removed, with real working size and thickness controls in their place.",
|
||||
"howItWorks": "Hides the small colored dot Discord shows on an avatar for online/idle/DND, and draws a colored ring around the whole avatar instead - similar in spirit to a platform indicator, but for presence status. Each status's color is configurable, along with the ring's size multiplier and thickness. A status left with no color configured just keeps showing the normal dot.",
|
||||
"note": "Fork of AngelW0lf's Radial Status (BSD-3-Clause, see LICENSE). Upstream had a phone-home mechanism - it fetched a remote blacklist on every load and could silently uninstall itself for specific user IDs the original author chose - dropped entirely here, no network requests at all. Upstream only ever matched one exact avatar size (member list-style rows), missing YouBar, the profile screen, and DM lists entirely. On-device capture across all of those contexts confirmed the real presence-carrying wrapper sizes (24, 32, 40, 50, 60, 80px) all share the same shape - square, half-width border radius, exactly 5 children - so this fork matches that confirmed whitelist instead of either upstream's single size or an earlier overly-broad generalization that briefly caused visible corruption elsewhere on-device. Upstream's settings screen had commented-out, non-functional size/thickness inputs and an unfinished joke placeholder button - both removed, with real working size and thickness controls in their place.",
|
||||
"howItWorks": "Hides the small colored dot Discord shows on an avatar for online/idle/DND/offline, and draws a colored ring around the whole avatar instead - similar in spirit to a platform indicator, but for presence status. Each status's color is independently configurable (including offline, which Discord doesn't normally show a dot for at all), along with the ring's size multiplier and thickness. A status left with no color configured just keeps showing the normal dot.",
|
||||
"features": [
|
||||
"Colored ring around the avatar instead of the small presence dot",
|
||||
"Independent color per status: online, idle, do not disturb",
|
||||
"Independent color per status: online, idle, do not disturb, offline",
|
||||
"Adjustable ring size multiplier and thickness",
|
||||
"No network requests - upstream's remote blacklist/kill-switch mechanism was removed entirely"
|
||||
],
|
||||
"commands": [],
|
||||
"limitations": "The wrapper-shape match this depends on hasn't been independently re-verified against a live decompiled build the way the rest of this repo's fixes are - it's a direct adaptation of upstream's own previously-working logic, generalized and guarded so a mismatch just means no ring is drawn rather than a crash."
|
||||
"limitations": "Matches a whitelist of avatar sizes confirmed on-device across YouBar, the profile screen, member lists, and DM lists - not a fully generic circular-wrapper match, since an earlier attempt at that briefly caused visible corruption on unrelated UI elements. A future Discord update introducing a new avatar size in one of these contexts (or elsewhere) wouldn't be picked up until re-confirmed and added to the whitelist."
|
||||
},
|
||||
"custom-user-tags": {
|
||||
"category": "Moderation & Appearance",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue