tangled
alpha
login
or
join now
whey.party
/
red-dwarf
82
fork
atom
an independent Bluesky client using Constellation, PDS Queries, and other services
reddwarf.app
frontend
spa
bluesky
reddwarf
microcosm
client
app
82
fork
atom
overview
issues
25
pulls
pipelines
remove old tests
whey.party
1 month ago
511e5391
cde0d3df
+15
-8
2 changed files
expand all
collapse all
unified
split
src
components
ModerationInitializer.tsx
routes
moderation.tsx
+12
-5
src/components/ModerationInitializer.tsx
···
8
import { useQueryIdentity } from "~/utils/useQuery";
9
import { useQueryPreferences } from "~/utils/useQuery";
10
0
0
11
// Manual DID document resolution
12
const fetchDidDocument = async (did: string): Promise<any> => {
13
if (did.startsWith("did:plc:")) {
···
47
});
48
49
// 3. Identify Labeler DIDs from prefs
50
-
const labelerDids =
51
prefs?.preferences
52
?.find((pref: any) => pref.$type === "app.bsky.actor.defs#labelersPref")
53
?.labelers?.map((l: any) => l.did) ?? [];
0
0
0
0
0
54
55
// 4. Parallel fetch all Labeler DID Documents and Service Records
56
const labelerDidDocQueries = useQueries({
57
-
queries: labelerDids.map((did: string) => ({
58
queryKey: ["labelerDidDoc", did],
59
queryFn: () => fetchDidDocument(did),
60
staleTime: 5 * 60 * 1000, // 5 minutes
···
63
});
64
65
const labelerServiceQueries = useQueries({
66
-
queries: labelerDids.map((did: string) => ({
67
queryKey: ["labelerService", did],
68
queryFn: async () => {
69
if (!identity?.pds) throw new Error("No PDS URL");
···
99
globalPrefs[pref.label] = pref.visibility as LabelPreference;
100
});
101
102
-
const definitions: LabelerDefinition[] = labelerDids
103
.map((did: string, index: number) => {
104
const didDocQuery = labelerDidDocQueries[index];
105
const serviceQuery = labelerServiceQueries[index];
···
158
.filter(Boolean) as LabelerDefinition[];
159
160
setLabelerConfig(definitions);
161
-
}, [prefs, labelerDidDocQueries, labelerServiceQueries, setLabelerConfig, identity?.pds, labelerDids]);
162
163
return null; // Headless component
164
};
···
8
import { useQueryIdentity } from "~/utils/useQuery";
9
import { useQueryPreferences } from "~/utils/useQuery";
10
11
+
export const BSKY_LABELER_DID = "did:plc:ar7c4by46qjdydhdevvrndac";
12
+
13
// Manual DID document resolution
14
const fetchDidDocument = async (did: string): Promise<any> => {
15
if (did.startsWith("did:plc:")) {
···
49
});
50
51
// 3. Identify Labeler DIDs from prefs
52
+
const userPrefDids =
53
prefs?.preferences
54
?.find((pref: any) => pref.$type === "app.bsky.actor.defs#labelersPref")
55
?.labelers?.map((l: any) => l.did) ?? [];
56
+
57
+
// 2. MERGE: Force Bsky DID + User DIDs (Set removes duplicates)
58
+
const activeLabelerDids = Array.from(
59
+
new Set([BSKY_LABELER_DID, ...userPrefDids])
60
+
);
61
62
// 4. Parallel fetch all Labeler DID Documents and Service Records
63
const labelerDidDocQueries = useQueries({
64
+
queries: activeLabelerDids.map((did: string) => ({
65
queryKey: ["labelerDidDoc", did],
66
queryFn: () => fetchDidDocument(did),
67
staleTime: 5 * 60 * 1000, // 5 minutes
···
70
});
71
72
const labelerServiceQueries = useQueries({
73
+
queries: activeLabelerDids.map((did: string) => ({
74
queryKey: ["labelerService", did],
75
queryFn: async () => {
76
if (!identity?.pds) throw new Error("No PDS URL");
···
106
globalPrefs[pref.label] = pref.visibility as LabelPreference;
107
});
108
109
+
const definitions: LabelerDefinition[] = activeLabelerDids
110
.map((did: string, index: number) => {
111
const didDocQuery = labelerDidDocQueries[index];
112
const serviceQuery = labelerServiceQueries[index];
···
165
.filter(Boolean) as LabelerDefinition[];
166
167
setLabelerConfig(definitions);
168
+
}, [prefs, labelerDidDocQueries, labelerServiceQueries, setLabelerConfig, identity?.pds, activeLabelerDids]);
169
170
return null; // Headless component
171
};
+3
-3
src/routes/moderation.tsx
···
50
return (
51
<div>
52
<Header
53
-
title={`Moderation`}
54
backButtonCallback={() => {
55
if (window.history.length > 1) {
56
window.history.back();
···
108
</Switch.Root>
109
</div>
110
111
-
<TestModeration subject="did:plc:q7suwaz53ztc4mbiqyygbn43" />
112
<TestModeration subject="did:plc:fpruhuo22xkm5o7ttr2ktxdo" />
113
<TestModeration subject="did:plc:6ayddqghxhciedbaofoxkcbs" />
114
<TestModeration subject="did:plc:za2ezszbzyqer7eylvtgapd5" />
115
<TestModeration subject="did:plc:ia76kvnndjutgedggx2ibrem" />
116
-
<TestModeration subject="did:plc:w2wbinubagmo4hlxx2ik5rrp" />
117
<div className="">
118
{Object.entries(parsedPref?.contentLabelPrefs ?? {}).map(
119
([label, visibility]) => (
···
50
return (
51
<div>
52
<Header
53
+
title={`Moderation (WIP)`}
54
backButtonCallback={() => {
55
if (window.history.length > 1) {
56
window.history.back();
···
108
</Switch.Root>
109
</div>
110
111
+
{/* <TestModeration subject="did:plc:q7suwaz53ztc4mbiqyygbn43" />
112
<TestModeration subject="did:plc:fpruhuo22xkm5o7ttr2ktxdo" />
113
<TestModeration subject="did:plc:6ayddqghxhciedbaofoxkcbs" />
114
<TestModeration subject="did:plc:za2ezszbzyqer7eylvtgapd5" />
115
<TestModeration subject="did:plc:ia76kvnndjutgedggx2ibrem" />
116
+
<TestModeration subject="did:plc:w2wbinubagmo4hlxx2ik5rrp" /> */}
117
<div className="">
118
{Object.entries(parsedPref?.contentLabelPrefs ?? {}).map(
119
([label, visibility]) => (