repoint the last AtpAgent statics and drop the dead conversions
Five sites read `AtpAgent.appLabelers`, which the previous commit stopped populating - a silent regression, since an empty static reads as "no authorities" rather than failing. All now read `Client.appLabelers`, the static that is actually configured: - `lib/moderation.ts`'s `isAppLabeler`, which decides whether a labeler is non-removable in the UI; - `preferences/moderation.ts`'s `useMyLabelersQuery`, which seeds the labeler list with the app authorities; - `feed/custom.ts`'s hand-rolled logged-out `getFeed`, which reproduces the header lex would have emitted because the request bypasses the client. `sessionAccountToSession` (the `AtpSessionData` conversion) had no callers left once the bridge agent went, and the age assurance config read - the one standalone `new AtpAgent` the age assurance slice deliberately left behind - moves to the public appview client, which is what it was approximating. That is the last `AtpAgent` in src. What remains of `@atproto/api` in the session layer is types and `BSKY_LABELER_DID`, which S4d owns. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {type AppBskyFeedDefs, AtpAgent, jsonStringToLex} from '@atproto/api'
|
||||
import {type Client, type XrpcRequestParams} from '@atproto/lex'
|
||||
import {type AppBskyFeedDefs, jsonStringToLex} from '@atproto/api'
|
||||
import {Client, type XrpcRequestParams} from '@atproto/lex'
|
||||
|
||||
import {
|
||||
getAppLanguageAsContentLanguage,
|
||||
@@ -115,12 +115,12 @@ async function loggedOutFetch({
|
||||
}): Promise<app.bsky.feed.getFeed.$OutputBody | null> {
|
||||
let contentLangs = getAppLanguageAsContentLanguage()
|
||||
|
||||
/**
|
||||
* Copied from our root `Agent` class
|
||||
* @see https://github.com/bluesky-social/atproto/blob/60df3fc652b00cdff71dd9235d98a7a4bb828f05/packages/api/src/agent.ts#L120
|
||||
/*
|
||||
* This request is hand-rolled rather than issued through a client, so it has
|
||||
* to reproduce the header lex would have emitted from the global static.
|
||||
*/
|
||||
const labelersHeader = {
|
||||
'atproto-accept-labelers': AtpAgent.appLabelers
|
||||
'atproto-accept-labelers': Client.appLabelers
|
||||
.map(l => `${l};redact`)
|
||||
.join(', '),
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import {useMemo} from 'react'
|
||||
import {AtpAgent, type ComAtprotoLabelDefs} from '@atproto/api'
|
||||
import {type ComAtprotoLabelDefs} from '@atproto/api'
|
||||
import {Client} from '@atproto/lex'
|
||||
import {type DidString} from '@atproto/syntax'
|
||||
import {
|
||||
type InterpretedLabelValueDefinition,
|
||||
LABELS,
|
||||
@@ -105,9 +107,9 @@ export function isAppLabeler(
|
||||
| app.bsky.labeler.defs.LabelerViewDetailed,
|
||||
): boolean {
|
||||
if (typeof labeler === 'string') {
|
||||
return AtpAgent.appLabelers.includes(labeler)
|
||||
return Client.appLabelers.includes(labeler as DidString)
|
||||
}
|
||||
return AtpAgent.appLabelers.includes(labeler.creator.did)
|
||||
return Client.appLabelers.includes(labeler.creator.did)
|
||||
}
|
||||
|
||||
export function isLabelerSubscribed(
|
||||
|
||||
Reference in New Issue
Block a user