Run codemod for replacing BskyAgent with AtpAgent (#10862)
This commit is contained in:
@@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* Codemod to replace BskyAgent with AtpAgent
|
||||||
|
*
|
||||||
|
* Before:
|
||||||
|
* import {BskyAgent} from '@atproto/api`
|
||||||
|
* BskyAgent.appLabelers.includes(labeler)
|
||||||
|
*
|
||||||
|
* After:
|
||||||
|
* import {AtpAgent} from '@atproto/api`
|
||||||
|
* AtpAgent.appLabelers.includes(labeler)
|
||||||
|
*
|
||||||
|
* Handles import specifiers, type annotations, static member access
|
||||||
|
* (BskyAgent.configure), `extends BskyAgent`, and `new BskyAgent()`. Whole
|
||||||
|
* identifiers only, so names like `OpaqueBskyAgent` are left untouched.
|
||||||
|
*
|
||||||
|
* Usage: jscodeshift -t .jscodeshift/repo/bsky-agent.js <file-path>
|
||||||
|
* Example: jscodeshift -t .jscodeshift/repo/bsky-agent.js src/lib/moderation.ts
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
export const parser = 'tsx'
|
||||||
|
|
||||||
|
export default function transformer(file, api) {
|
||||||
|
const j = api.jscodeshift
|
||||||
|
const root = j(file.source)
|
||||||
|
|
||||||
|
// Replace every standalone `BskyAgent` identifier with `AtpAgent`. This
|
||||||
|
// covers imports, type references, member expressions, `extends`, and `new`.
|
||||||
|
root
|
||||||
|
.find(j.Identifier, {name: 'BskyAgent'})
|
||||||
|
.replaceWith(() => j.identifier('AtpAgent'))
|
||||||
|
|
||||||
|
// Renaming can leave a duplicate `AtpAgent` specifier on the @atproto/api
|
||||||
|
// import if the file already imported it. Dedupe by imported name, keeping
|
||||||
|
// the type-only modifier only if every duplicate was type-only.
|
||||||
|
root
|
||||||
|
.find(j.ImportDeclaration, {source: {value: '@atproto/api'}})
|
||||||
|
.forEach(path => {
|
||||||
|
const seen = new Map()
|
||||||
|
for (const spec of path.value.specifiers) {
|
||||||
|
if (spec.type !== 'ImportSpecifier') {
|
||||||
|
seen.set(Symbol(), spec)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const name = spec.imported.name
|
||||||
|
const existing = seen.get(name)
|
||||||
|
if (!existing) {
|
||||||
|
seen.set(name, spec)
|
||||||
|
} else if (
|
||||||
|
existing.importKind === 'type' &&
|
||||||
|
spec.importKind !== 'type'
|
||||||
|
) {
|
||||||
|
// Prefer the value (non-type) import if either usage needs it.
|
||||||
|
seen.set(name, spec)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
path.value.specifiers = Array.from(seen.values())
|
||||||
|
})
|
||||||
|
|
||||||
|
return root.toSource()
|
||||||
|
}
|
||||||
@@ -67,7 +67,6 @@ export function DateField({
|
|||||||
isInvalid={isInvalid}
|
isInvalid={isInvalid}
|
||||||
accessibilityHint={accessibilityHint}
|
accessibilityHint={accessibilityHint}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{open && (
|
{open && (
|
||||||
// Android implementation of DatePicker currently does not change default button colors according to theme and only takes hex values for buttonColor
|
// Android implementation of DatePicker currently does not change default button colors according to theme and only takes hex values for buttonColor
|
||||||
// Can remove the buttonColor setting if/when this PR is merged: https://github.com/henninghall/react-native-date-picker/pull/871
|
// Can remove the buttonColor setting if/when this PR is merged: https://github.com/henninghall/react-native-date-picker/pull/871
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import {
|
import {
|
||||||
AppBskyFeedDefs,
|
AppBskyFeedDefs,
|
||||||
type AppBskyFeedGetAuthorFeed as GetAuthorFeed,
|
type AppBskyFeedGetAuthorFeed as GetAuthorFeed,
|
||||||
type BskyAgent,
|
type AtpAgent,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
|
|
||||||
import {type FeedAPI, type FeedAPIResponse} from './types'
|
import {type FeedAPI, type FeedAPIResponse} from './types'
|
||||||
|
|
||||||
export class AuthorFeedAPI implements FeedAPI {
|
export class AuthorFeedAPI implements FeedAPI {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
_params: GetAuthorFeed.QueryParams
|
_params: GetAuthorFeed.QueryParams
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
agent,
|
agent,
|
||||||
feedParams,
|
feedParams,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
feedParams: GetAuthorFeed.QueryParams
|
feedParams: GetAuthorFeed.QueryParams
|
||||||
}) {
|
}) {
|
||||||
this.agent = agent
|
this.agent = agent
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
type AppBskyFeedDefs,
|
type AppBskyFeedDefs,
|
||||||
type AppBskyFeedGetFeed as GetCustomFeed,
|
type AppBskyFeedGetFeed as GetCustomFeed,
|
||||||
BskyAgent,
|
AtpAgent,
|
||||||
jsonStringToLex,
|
jsonStringToLex,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ import {type FeedAPI, type FeedAPIResponse} from './types'
|
|||||||
import {createBskyTopicsHeader, isBlueskyOwnedFeed} from './utils'
|
import {createBskyTopicsHeader, isBlueskyOwnedFeed} from './utils'
|
||||||
|
|
||||||
export class CustomFeedAPI implements FeedAPI {
|
export class CustomFeedAPI implements FeedAPI {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
params: GetCustomFeed.QueryParams
|
params: GetCustomFeed.QueryParams
|
||||||
userInterests?: string
|
userInterests?: string
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ export class CustomFeedAPI implements FeedAPI {
|
|||||||
feedParams,
|
feedParams,
|
||||||
userInterests,
|
userInterests,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
feedParams: GetCustomFeed.QueryParams
|
feedParams: GetCustomFeed.QueryParams
|
||||||
userInterests?: string
|
userInterests?: string
|
||||||
}) {
|
}) {
|
||||||
@@ -113,7 +113,7 @@ async function loggedOutFetch({
|
|||||||
* @see https://github.com/bluesky-social/atproto/blob/60df3fc652b00cdff71dd9235d98a7a4bb828f05/packages/api/src/agent.ts#L120
|
* @see https://github.com/bluesky-social/atproto/blob/60df3fc652b00cdff71dd9235d98a7a4bb828f05/packages/api/src/agent.ts#L120
|
||||||
*/
|
*/
|
||||||
const labelersHeader = {
|
const labelersHeader = {
|
||||||
'atproto-accept-labelers': BskyAgent.appLabelers
|
'atproto-accept-labelers': AtpAgent.appLabelers
|
||||||
.map(l => `${l};redact`)
|
.map(l => `${l};redact`)
|
||||||
.join(', '),
|
.join(', '),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import {type AppBskyFeedDefs, type BskyAgent} from '@atproto/api'
|
import {type AppBskyFeedDefs, type AtpAgent} from '@atproto/api'
|
||||||
|
|
||||||
import {DEMO_FEED} from '#/lib/demo'
|
import {DEMO_FEED} from '#/lib/demo'
|
||||||
import {type FeedAPI, type FeedAPIResponse} from './types'
|
import {type FeedAPI, type FeedAPIResponse} from './types'
|
||||||
|
|
||||||
export class DemoFeedAPI implements FeedAPI {
|
export class DemoFeedAPI implements FeedAPI {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
|
|
||||||
constructor({agent}: {agent: BskyAgent}) {
|
constructor({agent}: {agent: AtpAgent}) {
|
||||||
this.agent = agent
|
this.agent = agent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import {type AppBskyFeedDefs, type BskyAgent} from '@atproto/api'
|
import {type AppBskyFeedDefs, type AtpAgent} from '@atproto/api'
|
||||||
|
|
||||||
import {type FeedAPI, type FeedAPIResponse} from './types'
|
import {type FeedAPI, type FeedAPIResponse} from './types'
|
||||||
|
|
||||||
export class FollowingFeedAPI implements FeedAPI {
|
export class FollowingFeedAPI implements FeedAPI {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
|
|
||||||
constructor({agent}: {agent: BskyAgent}) {
|
constructor({agent}: {agent: AtpAgent}) {
|
||||||
this.agent = agent
|
this.agent = agent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {type AppBskyFeedDefs, type BskyAgent} from '@atproto/api'
|
import {type AppBskyFeedDefs, type AtpAgent} from '@atproto/api'
|
||||||
|
|
||||||
import {PROD_DEFAULT_FEED} from '#/lib/constants'
|
import {PROD_DEFAULT_FEED} from '#/lib/constants'
|
||||||
import {CustomFeedAPI} from './custom'
|
import {CustomFeedAPI} from './custom'
|
||||||
@@ -27,7 +27,7 @@ export const FALLBACK_MARKER_POST: AppBskyFeedDefs.FeedViewPost = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class HomeFeedAPI implements FeedAPI {
|
export class HomeFeedAPI implements FeedAPI {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
following: FollowingFeedAPI
|
following: FollowingFeedAPI
|
||||||
discover: CustomFeedAPI
|
discover: CustomFeedAPI
|
||||||
usingDiscover = false
|
usingDiscover = false
|
||||||
@@ -39,7 +39,7 @@ export class HomeFeedAPI implements FeedAPI {
|
|||||||
agent,
|
agent,
|
||||||
}: {
|
}: {
|
||||||
userInterests?: string
|
userInterests?: string
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
}) {
|
}) {
|
||||||
this.agent = agent
|
this.agent = agent
|
||||||
this.following = new FollowingFeedAPI({agent})
|
this.following = new FollowingFeedAPI({agent})
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import {
|
import {
|
||||||
type AppBskyFeedDefs,
|
type AppBskyFeedDefs,
|
||||||
type AppBskyFeedGetActorLikes as GetActorLikes,
|
type AppBskyFeedGetActorLikes as GetActorLikes,
|
||||||
type BskyAgent,
|
type AtpAgent,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
|
|
||||||
import {type FeedAPI, type FeedAPIResponse} from './types'
|
import {type FeedAPI, type FeedAPIResponse} from './types'
|
||||||
|
|
||||||
export class LikesFeedAPI implements FeedAPI {
|
export class LikesFeedAPI implements FeedAPI {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
params: GetActorLikes.QueryParams
|
params: GetActorLikes.QueryParams
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
agent,
|
agent,
|
||||||
feedParams,
|
feedParams,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
feedParams: GetActorLikes.QueryParams
|
feedParams: GetActorLikes.QueryParams
|
||||||
}) {
|
}) {
|
||||||
this.agent = agent
|
this.agent = agent
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
type AppBskyFeedDefs,
|
type AppBskyFeedDefs,
|
||||||
type AppBskyFeedGetTimeline,
|
type AppBskyFeedGetTimeline,
|
||||||
type BskyAgent,
|
type AtpAgent,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import shuffle from 'lodash.shuffle'
|
import shuffle from 'lodash.shuffle'
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ const POST_AGE_CUTOFF = 60e3 * 60 * 24 // 24hours
|
|||||||
|
|
||||||
export class MergeFeedAPI implements FeedAPI {
|
export class MergeFeedAPI implements FeedAPI {
|
||||||
userInterests?: string
|
userInterests?: string
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
params: FeedParams
|
params: FeedParams
|
||||||
feedTuners: FeedTunerFn[]
|
feedTuners: FeedTunerFn[]
|
||||||
following: MergeFeedSource_Following
|
following: MergeFeedSource_Following
|
||||||
@@ -39,7 +39,7 @@ export class MergeFeedAPI implements FeedAPI {
|
|||||||
feedTuners,
|
feedTuners,
|
||||||
userInterests,
|
userInterests,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
feedParams: FeedParams
|
feedParams: FeedParams
|
||||||
feedTuners: FeedTunerFn[]
|
feedTuners: FeedTunerFn[]
|
||||||
userInterests?: string
|
userInterests?: string
|
||||||
@@ -175,7 +175,7 @@ export class MergeFeedAPI implements FeedAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MergeFeedSource {
|
class MergeFeedSource {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
feedTuners: FeedTunerFn[]
|
feedTuners: FeedTunerFn[]
|
||||||
sourceInfo: ReasonFeedSource | undefined
|
sourceInfo: ReasonFeedSource | undefined
|
||||||
cursor: string | undefined = undefined
|
cursor: string | undefined = undefined
|
||||||
@@ -186,7 +186,7 @@ class MergeFeedSource {
|
|||||||
agent,
|
agent,
|
||||||
feedTuners,
|
feedTuners,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
feedTuners: FeedTunerFn[]
|
feedTuners: FeedTunerFn[]
|
||||||
}) {
|
}) {
|
||||||
this.agent = agent
|
this.agent = agent
|
||||||
@@ -253,7 +253,7 @@ class MergeFeedSource_Following extends MergeFeedSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MergeFeedSource_Custom extends MergeFeedSource {
|
class MergeFeedSource_Custom extends MergeFeedSource {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
minDate: Date
|
minDate: Date
|
||||||
feedUri: string
|
feedUri: string
|
||||||
userInterests?: string
|
userInterests?: string
|
||||||
@@ -264,7 +264,7 @@ class MergeFeedSource_Custom extends MergeFeedSource {
|
|||||||
feedTuners,
|
feedTuners,
|
||||||
userInterests,
|
userInterests,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
feedUri: string
|
feedUri: string
|
||||||
feedTuners: FeedTunerFn[]
|
feedTuners: FeedTunerFn[]
|
||||||
userInterests?: string
|
userInterests?: string
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import {
|
|||||||
type AppBskyEmbedRecordWithMedia,
|
type AppBskyEmbedRecordWithMedia,
|
||||||
type AppBskyEmbedVideo,
|
type AppBskyEmbedVideo,
|
||||||
AppBskyFeedPost,
|
AppBskyFeedPost,
|
||||||
|
type AtpAgent,
|
||||||
BlobRef,
|
BlobRef,
|
||||||
type BskyAgent,
|
|
||||||
ChatBskyGroupDefs,
|
ChatBskyGroupDefs,
|
||||||
type ComAtprotoLabelDefs,
|
type ComAtprotoLabelDefs,
|
||||||
type ComAtprotoRepoApplyWrites,
|
type ComAtprotoRepoApplyWrites,
|
||||||
@@ -55,7 +55,7 @@ interface PostOpts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function post(
|
export async function post(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
queryClient: QueryClient,
|
queryClient: QueryClient,
|
||||||
opts: PostOpts,
|
opts: PostOpts,
|
||||||
) {
|
) {
|
||||||
@@ -197,7 +197,7 @@ export async function post(
|
|||||||
return {uris}
|
return {uris}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resolveRT(agent: BskyAgent, richtext: RichText) {
|
async function resolveRT(agent: AtpAgent, richtext: RichText) {
|
||||||
const trimmedText = richtext.text
|
const trimmedText = richtext.text
|
||||||
// Trim leading whitespace-only lines (but don't break ASCII art).
|
// Trim leading whitespace-only lines (but don't break ASCII art).
|
||||||
.replace(/^(\s*\n)+/, '')
|
.replace(/^(\s*\n)+/, '')
|
||||||
@@ -217,7 +217,7 @@ export class ReplyDeletedError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resolveReply(agent: BskyAgent, replyTo: string) {
|
async function resolveReply(agent: AtpAgent, replyTo: string) {
|
||||||
const {data} = await agent.app.bsky.feed.getPosts({
|
const {data} = await agent.app.bsky.feed.getPosts({
|
||||||
uris: [replyTo],
|
uris: [replyTo],
|
||||||
})
|
})
|
||||||
@@ -250,7 +250,7 @@ async function resolveReply(agent: BskyAgent, replyTo: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function resolveEmbed(
|
async function resolveEmbed(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
queryClient: QueryClient,
|
queryClient: QueryClient,
|
||||||
draft: PostDraft,
|
draft: PostDraft,
|
||||||
onStateChange: ((state: string) => void) | undefined,
|
onStateChange: ((state: string) => void) | undefined,
|
||||||
@@ -309,7 +309,7 @@ async function resolveEmbed(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function resolveMedia(
|
async function resolveMedia(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
queryClient: QueryClient,
|
queryClient: QueryClient,
|
||||||
embedDraft: EmbedDraft,
|
embedDraft: EmbedDraft,
|
||||||
onStateChange: ((state: string) => void) | undefined,
|
onStateChange: ((state: string) => void) | undefined,
|
||||||
@@ -482,7 +482,7 @@ async function resolveMedia(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function resolveRecord(
|
async function resolveRecord(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
queryClient: QueryClient,
|
queryClient: QueryClient,
|
||||||
uri: string,
|
uri: string,
|
||||||
): Promise<ComAtprotoRepoStrongRef.Main> {
|
): Promise<ComAtprotoRepoStrongRef.Main> {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {copyAsync} from 'expo-file-system/legacy'
|
import {copyAsync} from 'expo-file-system/legacy'
|
||||||
import {type BskyAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
import {type AtpAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
||||||
|
|
||||||
import {safeDeleteAsync} from '#/lib/media/manip'
|
import {safeDeleteAsync} from '#/lib/media/manip'
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ import {safeDeleteAsync} from '#/lib/media/manip'
|
|||||||
* @param encoding Allows overriding the blob's type
|
* @param encoding Allows overriding the blob's type
|
||||||
*/
|
*/
|
||||||
export async function uploadBlob(
|
export async function uploadBlob(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
input: string | Blob,
|
input: string | Blob,
|
||||||
encoding?: string,
|
encoding?: string,
|
||||||
): Promise<ComAtprotoRepoUploadBlob.Response> {
|
): Promise<ComAtprotoRepoUploadBlob.Response> {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {type BskyAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
import {type AtpAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note It is recommended, on web, to use the `file` instance of the file
|
* @note It is recommended, on web, to use the `file` instance of the file
|
||||||
@@ -7,7 +7,7 @@ import {type BskyAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api'
|
|||||||
* be passed directly to this function.
|
* be passed directly to this function.
|
||||||
*/
|
*/
|
||||||
export async function uploadBlob(
|
export async function uploadBlob(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
input: string | Blob,
|
input: string | Blob,
|
||||||
encoding?: string,
|
encoding?: string,
|
||||||
): Promise<ComAtprotoRepoUploadBlob.Response> {
|
): Promise<ComAtprotoRepoUploadBlob.Response> {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
type $Typed,
|
type $Typed,
|
||||||
type AppBskyActorDefs,
|
type AppBskyActorDefs,
|
||||||
type AppBskyGraphGetStarterPack,
|
type AppBskyGraphGetStarterPack,
|
||||||
type BskyAgent,
|
type AtpAgent,
|
||||||
type ComAtprotoRepoApplyWrites,
|
type ComAtprotoRepoApplyWrites,
|
||||||
type Facet,
|
type Facet,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
@@ -28,7 +28,7 @@ export const createStarterPackList = async ({
|
|||||||
description?: string
|
description?: string
|
||||||
descriptionFacets?: Facet[]
|
descriptionFacets?: Facet[]
|
||||||
profiles: bsky.profile.AnyProfileView[]
|
profiles: bsky.profile.AnyProfileView[]
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
}): Promise<{uri: string; cid: string}> => {
|
}): Promise<{uri: string; cid: string}> => {
|
||||||
if (profiles.length === 0) throw new Error('No profiles given')
|
if (profiles.length === 0) throw new Error('No profiles given')
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ function createListItem({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function whenAppViewReady(
|
async function whenAppViewReady(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
uri: string,
|
uri: string,
|
||||||
fn: (res?: AppBskyGraphGetStarterPack.Response) => boolean,
|
fn: (res?: AppBskyGraphGetStarterPack.Response) => boolean,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {type AppBskyEmbedExternal, type BskyAgent} from '@atproto/api'
|
import {type AppBskyEmbedExternal, type AtpAgent} from '@atproto/api'
|
||||||
|
|
||||||
import {LINK_META_PROXY} from '#/lib/constants'
|
import {LINK_META_PROXY} from '#/lib/constants'
|
||||||
import {getGiphyMetaUri} from '#/lib/strings/embed-player'
|
import {getGiphyMetaUri} from '#/lib/strings/embed-player'
|
||||||
@@ -31,7 +31,7 @@ export interface LinkMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getLinkMeta(
|
export async function getLinkMeta(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
url: string,
|
url: string,
|
||||||
timeout = 15e3,
|
timeout = 15e3,
|
||||||
): Promise<LinkMeta> {
|
): Promise<LinkMeta> {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {type BskyAgent} from '@atproto/api'
|
import {type AtpAgent} from '@atproto/api'
|
||||||
import {type I18n} from '@lingui/core'
|
import {type I18n} from '@lingui/core'
|
||||||
import {msg} from '@lingui/core/macro'
|
import {msg} from '@lingui/core/macro'
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ export async function getServiceAuthToken({
|
|||||||
lxm,
|
lxm,
|
||||||
exp,
|
exp,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
aud?: string
|
aud?: string
|
||||||
lxm: string
|
lxm: string
|
||||||
exp?: number
|
exp?: number
|
||||||
@@ -30,7 +30,7 @@ export async function getServiceAuthToken({
|
|||||||
return serviceAuth.token
|
return serviceAuth.token
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getVideoUploadLimits(agent: BskyAgent, i18n: I18n) {
|
export async function getVideoUploadLimits(agent: AtpAgent, i18n: I18n) {
|
||||||
const token = await getServiceAuthToken({
|
const token = await getServiceAuthToken({
|
||||||
agent,
|
agent,
|
||||||
lxm: 'app.bsky.video.getUploadLimits',
|
lxm: 'app.bsky.video.getUploadLimits',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {createUploadTask, FileSystemUploadType} from 'expo-file-system/legacy'
|
import {createUploadTask, FileSystemUploadType} from 'expo-file-system/legacy'
|
||||||
import {type AppBskyVideoDefs, type BskyAgent} from '@atproto/api'
|
import {type AppBskyVideoDefs, type AtpAgent} from '@atproto/api'
|
||||||
import {type I18n} from '@lingui/core'
|
import {type I18n} from '@lingui/core'
|
||||||
import {msg} from '@lingui/core/macro'
|
import {msg} from '@lingui/core/macro'
|
||||||
import {nanoid} from 'nanoid/non-secure'
|
import {nanoid} from 'nanoid/non-secure'
|
||||||
@@ -19,7 +19,7 @@ export async function uploadVideo({
|
|||||||
i18n,
|
i18n,
|
||||||
}: {
|
}: {
|
||||||
video: CompressedVideo
|
video: CompressedVideo
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
did: string
|
did: string
|
||||||
setProgress: (progress: number) => void
|
setProgress: (progress: number) => void
|
||||||
signal: AbortSignal
|
signal: AbortSignal
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {type AppBskyVideoDefs, type BskyAgent} from '@atproto/api'
|
import {type AppBskyVideoDefs, type AtpAgent} from '@atproto/api'
|
||||||
import {type I18n} from '@lingui/core'
|
import {type I18n} from '@lingui/core'
|
||||||
import {msg} from '@lingui/core/macro'
|
import {msg} from '@lingui/core/macro'
|
||||||
import {nanoid} from 'nanoid/non-secure'
|
import {nanoid} from 'nanoid/non-secure'
|
||||||
@@ -18,7 +18,7 @@ export async function uploadVideo({
|
|||||||
i18n,
|
i18n,
|
||||||
}: {
|
}: {
|
||||||
video: CompressedVideo
|
video: CompressedVideo
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
did: string
|
did: string
|
||||||
setProgress: (progress: number) => void
|
setProgress: (progress: number) => void
|
||||||
signal: AbortSignal
|
signal: AbortSignal
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {useMemo} from 'react'
|
import {useMemo} from 'react'
|
||||||
import {
|
import {
|
||||||
type AppBskyLabelerDefs,
|
type AppBskyLabelerDefs,
|
||||||
BskyAgent,
|
AtpAgent,
|
||||||
type ComAtprotoLabelDefs,
|
type ComAtprotoLabelDefs,
|
||||||
type InterpretedLabelValueDefinition,
|
type InterpretedLabelValueDefinition,
|
||||||
LABELS,
|
LABELS,
|
||||||
@@ -91,9 +91,9 @@ export function isAppLabeler(
|
|||||||
| AppBskyLabelerDefs.LabelerViewDetailed,
|
| AppBskyLabelerDefs.LabelerViewDetailed,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (typeof labeler === 'string') {
|
if (typeof labeler === 'string') {
|
||||||
return BskyAgent.appLabelers.includes(labeler)
|
return AtpAgent.appLabelers.includes(labeler)
|
||||||
}
|
}
|
||||||
return BskyAgent.appLabelers.includes(labeler.creator.did)
|
return AtpAgent.appLabelers.includes(labeler.creator.did)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isLabelerSubscribed(
|
export function isLabelerSubscribed(
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
type $Typed,
|
type $Typed,
|
||||||
type AppBskyGraphFollow,
|
type AppBskyGraphFollow,
|
||||||
type AppBskyGraphGetFollows,
|
type AppBskyGraphGetFollows,
|
||||||
type BskyAgent,
|
type AtpAgent,
|
||||||
type ComAtprotoRepoApplyWrites,
|
type ComAtprotoRepoApplyWrites,
|
||||||
type ComAtprotoRepoStrongRef,
|
type ComAtprotoRepoStrongRef,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
@@ -12,7 +12,7 @@ import chunk from 'lodash.chunk'
|
|||||||
import {until} from '#/lib/async/until'
|
import {until} from '#/lib/async/until'
|
||||||
|
|
||||||
export async function bulkWriteFollows(
|
export async function bulkWriteFollows(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
dids: string[],
|
dids: string[],
|
||||||
via?: ComAtprotoRepoStrongRef.Main,
|
via?: ComAtprotoRepoStrongRef.Main,
|
||||||
) {
|
) {
|
||||||
@@ -59,7 +59,7 @@ export async function bulkWriteFollows(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function whenFollowsIndexed(
|
async function whenFollowsIndexed(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
actor: string,
|
actor: string,
|
||||||
fn: (res: AppBskyGraphGetFollows.Response) => boolean,
|
fn: (res: AppBskyGraphGetFollows.Response) => boolean,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
type $Typed,
|
type $Typed,
|
||||||
type AppBskyEmbedRecord,
|
type AppBskyEmbedRecord,
|
||||||
type BskyAgent,
|
type AtpAgent,
|
||||||
type ChatBskyActorDefs,
|
type ChatBskyActorDefs,
|
||||||
type ChatBskyConvoDefs,
|
type ChatBskyConvoDefs,
|
||||||
type ChatBskyConvoSendMessage,
|
type ChatBskyConvoSendMessage,
|
||||||
@@ -13,7 +13,7 @@ import {type ConvoWithDetails} from '#/components/dms/util'
|
|||||||
|
|
||||||
export type ConvoParams = {
|
export type ConvoParams = {
|
||||||
convoId: string
|
convoId: string
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
events: MessagesEventBus
|
events: MessagesEventBus
|
||||||
placeholderData?: {
|
placeholderData?: {
|
||||||
convo: ChatBskyConvoDefs.ConvoView
|
convo: ChatBskyConvoDefs.ConvoView
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {type BskyAgent, type ChatBskyConvoGetLog} from '@atproto/api'
|
import {type AtpAgent, type ChatBskyConvoGetLog} from '@atproto/api'
|
||||||
import {EventEmitter} from 'eventemitter3'
|
import {EventEmitter} from 'eventemitter3'
|
||||||
import {nanoid} from 'nanoid/non-secure'
|
import {nanoid} from 'nanoid/non-secure'
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ const logger = Logger.create(Logger.Context.DMsAgent)
|
|||||||
export class MessagesEventBus {
|
export class MessagesEventBus {
|
||||||
private id: string
|
private id: string
|
||||||
|
|
||||||
private agent: BskyAgent
|
private agent: AtpAgent
|
||||||
private emitter = new EventEmitter<{event: [MessagesEventBusEvent]}>()
|
private emitter = new EventEmitter<{event: [MessagesEventBusEvent]}>()
|
||||||
|
|
||||||
private status: MessagesEventBusStatus = MessagesEventBusStatus.Initializing
|
private status: MessagesEventBusStatus = MessagesEventBusStatus.Initializing
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {type BskyAgent, type ChatBskyConvoGetLog} from '@atproto/api'
|
import {type AtpAgent, type ChatBskyConvoGetLog} from '@atproto/api'
|
||||||
|
|
||||||
export type MessagesEventBusParams = {
|
export type MessagesEventBusParams = {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum MessagesEventBusStatus {
|
export enum MessagesEventBusStatus {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
type AppBskyActorDefs,
|
type AppBskyActorDefs,
|
||||||
type AppBskyGraphDefs,
|
type AppBskyGraphDefs,
|
||||||
type AppBskyGraphGetList,
|
type AppBskyGraphGetList,
|
||||||
type BskyAgent,
|
type AtpAgent,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {
|
import {
|
||||||
type InfiniteData,
|
type InfiniteData,
|
||||||
@@ -60,7 +60,7 @@ export function useAllListMembersQuery(uri?: string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getAllListMembers(agent: BskyAgent, uri: string) {
|
export async function getAllListMembers(agent: AtpAgent, uri: string) {
|
||||||
let hasMore = true
|
let hasMore = true
|
||||||
let cursor: string | undefined
|
let cursor: string | undefined
|
||||||
const listItems: AppBskyGraphDefs.ListItemView[] = []
|
const listItems: AppBskyGraphDefs.ListItemView[] = []
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import {
|
|||||||
type AppBskyGraphDefs,
|
type AppBskyGraphDefs,
|
||||||
type AppBskyGraphGetList,
|
type AppBskyGraphGetList,
|
||||||
type AppBskyGraphList,
|
type AppBskyGraphList,
|
||||||
|
type AtpAgent,
|
||||||
AtUri,
|
AtUri,
|
||||||
type BskyAgent,
|
|
||||||
type ComAtprotoRepoApplyWrites,
|
type ComAtprotoRepoApplyWrites,
|
||||||
type Facet,
|
type Facet,
|
||||||
type Un$Typed,
|
type Un$Typed,
|
||||||
@@ -305,7 +305,7 @@ export function useListBlockMutation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function whenAppViewReady(
|
async function whenAppViewReady(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
uri: string,
|
uri: string,
|
||||||
fn: (res: AppBskyGraphGetList.Response) => boolean,
|
fn: (res: AppBskyGraphGetList.Response) => boolean,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
type AppBskyGraphDefs,
|
type AppBskyGraphDefs,
|
||||||
AppBskyGraphStarterpack,
|
AppBskyGraphStarterpack,
|
||||||
type AppBskyNotificationListNotifications,
|
type AppBskyNotificationListNotifications,
|
||||||
type BskyAgent,
|
type AtpAgent,
|
||||||
hasMutedWord,
|
hasMutedWord,
|
||||||
moderateNotification,
|
moderateNotification,
|
||||||
type ModerationOpts,
|
type ModerationOpts,
|
||||||
@@ -46,7 +46,7 @@ export async function fetchPage({
|
|||||||
fetchAdditionalData,
|
fetchAdditionalData,
|
||||||
reasons,
|
reasons,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
cursor: string | undefined
|
cursor: string | undefined
|
||||||
limit: number
|
limit: number
|
||||||
queryClient: QueryClient
|
queryClient: QueryClient
|
||||||
@@ -204,7 +204,7 @@ export function groupNotifications(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function fetchSubjects(
|
async function fetchSubjects(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
groupedNotifs: FeedNotification[],
|
groupedNotifs: FeedNotification[],
|
||||||
): Promise<{
|
): Promise<{
|
||||||
posts: Map<string, AppBskyFeedDefs.PostView>
|
posts: Map<string, AppBskyFeedDefs.PostView>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import {
|
|||||||
type AppBskyActorDefs,
|
type AppBskyActorDefs,
|
||||||
AppBskyFeedDefs,
|
AppBskyFeedDefs,
|
||||||
type AppBskyFeedPost,
|
type AppBskyFeedPost,
|
||||||
|
type AtpAgent,
|
||||||
AtUri,
|
AtUri,
|
||||||
type BskyAgent,
|
|
||||||
moderatePost,
|
moderatePost,
|
||||||
type ModerationDecision,
|
type ModerationDecision,
|
||||||
type ModerationPrefs,
|
type ModerationPrefs,
|
||||||
@@ -450,7 +450,7 @@ function createApi({
|
|||||||
feedParams: FeedParams
|
feedParams: FeedParams
|
||||||
feedTuners: FeedTunerFn[]
|
feedTuners: FeedTunerFn[]
|
||||||
userInterests?: string
|
userInterests?: string
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
enableFollowingToDiscoverFallback: boolean
|
enableFollowingToDiscoverFallback: boolean
|
||||||
}) {
|
}) {
|
||||||
if (feedDesc === 'following') {
|
if (feedDesc === 'following') {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import {
|
|||||||
AppBskyEmbedRecordWithMedia,
|
AppBskyEmbedRecordWithMedia,
|
||||||
type AppBskyFeedDefs,
|
type AppBskyFeedDefs,
|
||||||
AppBskyFeedPostgate,
|
AppBskyFeedPostgate,
|
||||||
|
type AtpAgent,
|
||||||
AtUri,
|
AtUri,
|
||||||
type BskyAgent,
|
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ export async function getPostgateRecord({
|
|||||||
agent,
|
agent,
|
||||||
postUri,
|
postUri,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
postUri: string
|
postUri: string
|
||||||
}): Promise<AppBskyFeedPostgate.Record | undefined> {
|
}): Promise<AppBskyFeedPostgate.Record | undefined> {
|
||||||
const urip = new AtUri(postUri)
|
const urip = new AtUri(postUri)
|
||||||
@@ -89,7 +89,7 @@ export async function writePostgateRecord({
|
|||||||
postUri,
|
postUri,
|
||||||
postgate,
|
postgate,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
postUri: string
|
postUri: string
|
||||||
postgate: AppBskyFeedPostgate.Record
|
postgate: AppBskyFeedPostgate.Record
|
||||||
}) {
|
}) {
|
||||||
@@ -110,7 +110,7 @@ export async function upsertPostgate(
|
|||||||
agent,
|
agent,
|
||||||
postUri,
|
postUri,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
postUri: string
|
postUri: string
|
||||||
},
|
},
|
||||||
callback: (
|
callback: (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {useMemo} from 'react'
|
import {useMemo} from 'react'
|
||||||
import {BskyAgent, interpretLabelValueDefinitions} from '@atproto/api'
|
import {AtpAgent, interpretLabelValueDefinitions} from '@atproto/api'
|
||||||
|
|
||||||
import {isNonConfigurableModerationAuthority} from '#/state/session/additional-moderation-authorities'
|
import {isNonConfigurableModerationAuthority} from '#/state/session/additional-moderation-authorities'
|
||||||
import {useLabelersDetailedInfoQuery} from '../labeler'
|
import {useLabelersDetailedInfoQuery} from '../labeler'
|
||||||
@@ -13,7 +13,7 @@ export function useMyLabelersQuery({
|
|||||||
const prefs = usePreferencesQuery()
|
const prefs = usePreferencesQuery()
|
||||||
let dids = Array.from(
|
let dids = Array.from(
|
||||||
new Set(
|
new Set(
|
||||||
BskyAgent.appLabelers.concat(
|
AtpAgent.appLabelers.concat(
|
||||||
prefs.data?.moderationPrefs.labelers.map(l => l.did) || [],
|
prefs.data?.moderationPrefs.labelers.map(l => l.did) || [],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {AtUri, type BskyAgent} from '@atproto/api'
|
import {type AtpAgent, AtUri} from '@atproto/api'
|
||||||
import {type QueryClient, queryOptions, useQuery} from '@tanstack/react-query'
|
import {type QueryClient, queryOptions, useQuery} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {STALE} from '#/state/queries'
|
import {STALE} from '#/state/queries'
|
||||||
@@ -9,7 +9,7 @@ const RQKEY_ROOT = 'resolved-did'
|
|||||||
export const RQKEY = (didOrHandle: string) => [RQKEY_ROOT, didOrHandle]
|
export const RQKEY = (didOrHandle: string) => [RQKEY_ROOT, didOrHandle]
|
||||||
|
|
||||||
const resolvedDidQueryOptions = (
|
const resolvedDidQueryOptions = (
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
getUnstableProfile: (did: string) => {did: string} | undefined,
|
getUnstableProfile: (did: string) => {did: string} | undefined,
|
||||||
didOrHandle: string | undefined,
|
didOrHandle: string | undefined,
|
||||||
) =>
|
) =>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import {
|
|||||||
type AppBskyGraphGetStarterPack,
|
type AppBskyGraphGetStarterPack,
|
||||||
AppBskyGraphStarterpack,
|
AppBskyGraphStarterpack,
|
||||||
type AppBskyRichtextFacet,
|
type AppBskyRichtextFacet,
|
||||||
|
type AtpAgent,
|
||||||
AtUri,
|
AtUri,
|
||||||
type BskyAgent,
|
|
||||||
RichText,
|
RichText,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {
|
import {
|
||||||
@@ -340,7 +340,7 @@ export function useDeleteStarterPackMutation({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function whenAppViewReady(
|
async function whenAppViewReady(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
uri: string,
|
uri: string,
|
||||||
fn: (res?: AppBskyGraphGetStarterPack.Response) => boolean,
|
fn: (res?: AppBskyGraphGetStarterPack.Response) => boolean,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
type AppBskyFeedDefs,
|
type AppBskyFeedDefs,
|
||||||
AppBskyFeedThreadgate,
|
AppBskyFeedThreadgate,
|
||||||
|
type AtpAgent,
|
||||||
AtUri,
|
AtUri,
|
||||||
type BskyAgent,
|
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ export async function getThreadgateRecord({
|
|||||||
agent,
|
agent,
|
||||||
postUri,
|
postUri,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
postUri: string
|
postUri: string
|
||||||
}): Promise<AppBskyFeedThreadgate.Record | null> {
|
}): Promise<AppBskyFeedThreadgate.Record | null> {
|
||||||
const urip = new AtUri(postUri)
|
const urip = new AtUri(postUri)
|
||||||
@@ -150,7 +150,7 @@ export async function writeThreadgateRecord({
|
|||||||
postUri,
|
postUri,
|
||||||
threadgate,
|
threadgate,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
postUri: string
|
postUri: string
|
||||||
threadgate: AppBskyFeedThreadgate.Record
|
threadgate: AppBskyFeedThreadgate.Record
|
||||||
}) {
|
}) {
|
||||||
@@ -176,7 +176,7 @@ export async function upsertThreadgate(
|
|||||||
agent,
|
agent,
|
||||||
postUri,
|
postUri,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
postUri: string
|
postUri: string
|
||||||
},
|
},
|
||||||
callback: (
|
callback: (
|
||||||
@@ -205,7 +205,7 @@ export async function updateThreadgateAllow({
|
|||||||
postUri,
|
postUri,
|
||||||
allow,
|
allow,
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: AtpAgent
|
||||||
postUri: string
|
postUri: string
|
||||||
allow: ThreadgateAllowUISetting[]
|
allow: ThreadgateAllowUISetting[]
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {BskyAgent} from '@atproto/api'
|
import {AtpAgent} from '@atproto/api'
|
||||||
import {describe, expect, it, jest} from '@jest/globals'
|
import {describe, expect, it, jest} from '@jest/globals'
|
||||||
|
|
||||||
import {agentToSessionAccountOrThrow} from '../agent'
|
import {agentToSessionAccountOrThrow} from '../agent'
|
||||||
@@ -16,7 +16,7 @@ jest.mock('../../../ageAssurance/state', () => ({
|
|||||||
unsafeGetAndComputeAgeAssurance: () => ({state: {}}),
|
unsafeGetAndComputeAgeAssurance: () => ({state: {}}),
|
||||||
}))
|
}))
|
||||||
jest.mock('#/lib/notifications/notifications', () => ({
|
jest.mock('#/lib/notifications/notifications', () => ({
|
||||||
unregisterPushToken(_agents: BskyAgent[]) {
|
unregisterPushToken(_agents: AtpAgent[]) {
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
@@ -37,7 +37,7 @@ describe('session', () => {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
const agent = new BskyAgent({service: 'https://alice.com'})
|
const agent = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent.sessionManager.session = {
|
agent.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -130,7 +130,7 @@ describe('session', () => {
|
|||||||
it('switches to the latest account, stores all of them', () => {
|
it('switches to the latest account, stores all of them', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -179,7 +179,7 @@ describe('session', () => {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||||
agent2.sessionManager.session = {
|
agent2.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'bob-did',
|
did: 'bob-did',
|
||||||
@@ -245,7 +245,7 @@ describe('session', () => {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
const agent3 = new BskyAgent({service: 'https://alice.com'})
|
const agent3 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent3.sessionManager.session = {
|
agent3.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -311,7 +311,7 @@ describe('session', () => {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
const agent4 = new BskyAgent({service: 'https://jay.com'})
|
const agent4 = new AtpAgent({service: 'https://jay.com'})
|
||||||
agent4.sessionManager.session = {
|
agent4.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'jay-did',
|
did: 'jay-did',
|
||||||
@@ -468,7 +468,7 @@ describe('session', () => {
|
|||||||
it('can log back in after logging out', () => {
|
it('can log back in after logging out', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -526,7 +526,7 @@ describe('session', () => {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
const agent2 = new BskyAgent({service: 'https://alice.com'})
|
const agent2 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent2.sessionManager.session = {
|
agent2.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -578,7 +578,7 @@ describe('session', () => {
|
|||||||
it('can remove active account', () => {
|
it('can remove active account', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -623,7 +623,7 @@ describe('session', () => {
|
|||||||
it('can remove inactive account', () => {
|
it('can remove inactive account', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -631,7 +631,7 @@ describe('session', () => {
|
|||||||
accessJwt: 'alice-access-jwt-1',
|
accessJwt: 'alice-access-jwt-1',
|
||||||
refreshJwt: 'alice-refresh-jwt-1',
|
refreshJwt: 'alice-refresh-jwt-1',
|
||||||
}
|
}
|
||||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||||
agent2.sessionManager.session = {
|
agent2.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'bob-did',
|
did: 'bob-did',
|
||||||
@@ -704,7 +704,7 @@ describe('session', () => {
|
|||||||
it('can log out of the current account', () => {
|
it('can log out of the current account', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -724,7 +724,7 @@ describe('session', () => {
|
|||||||
expect(state.accounts[0].refreshJwt).toBe('alice-refresh-jwt-1')
|
expect(state.accounts[0].refreshJwt).toBe('alice-refresh-jwt-1')
|
||||||
expect(state.currentAgentState.did).toBe('alice-did')
|
expect(state.currentAgentState.did).toBe('alice-did')
|
||||||
|
|
||||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||||
agent2.sessionManager.session = {
|
agent2.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'bob-did',
|
did: 'bob-did',
|
||||||
@@ -803,7 +803,7 @@ describe('session', () => {
|
|||||||
it('updates stored account with refreshed tokens', () => {
|
it('updates stored account with refreshed tokens', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -987,7 +987,7 @@ describe('session', () => {
|
|||||||
it('bails out of update on identical objects', () => {
|
it('bails out of update on identical objects', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -1059,7 +1059,7 @@ describe('session', () => {
|
|||||||
it('accepts updates from a stale agent', () => {
|
it('accepts updates from a stale agent', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -1068,7 +1068,7 @@ describe('session', () => {
|
|||||||
refreshJwt: 'alice-refresh-jwt-1',
|
refreshJwt: 'alice-refresh-jwt-1',
|
||||||
}
|
}
|
||||||
|
|
||||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||||
agent2.sessionManager.session = {
|
agent2.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'bob-did',
|
did: 'bob-did',
|
||||||
@@ -1258,7 +1258,7 @@ describe('session', () => {
|
|||||||
it('ignores updates from a removed agent', () => {
|
it('ignores updates from a removed agent', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -1267,7 +1267,7 @@ describe('session', () => {
|
|||||||
refreshJwt: 'alice-refresh-jwt-1',
|
refreshJwt: 'alice-refresh-jwt-1',
|
||||||
}
|
}
|
||||||
|
|
||||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||||
agent2.sessionManager.session = {
|
agent2.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'bob-did',
|
did: 'bob-did',
|
||||||
@@ -1320,7 +1320,7 @@ describe('session', () => {
|
|||||||
it('ignores network errors', () => {
|
it('ignores network errors', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -1386,7 +1386,7 @@ describe('session', () => {
|
|||||||
it('resets tokens on expired event', () => {
|
it('resets tokens on expired event', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -1452,7 +1452,7 @@ describe('session', () => {
|
|||||||
it('resets tokens on created-failed event', () => {
|
it('resets tokens on created-failed event', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -1518,7 +1518,7 @@ describe('session', () => {
|
|||||||
it('replaces local accounts with synced accounts', () => {
|
it('replaces local accounts with synced accounts', () => {
|
||||||
let state = getInitialState([])
|
let state = getInitialState([])
|
||||||
|
|
||||||
const agent1 = new BskyAgent({service: 'https://alice.com'})
|
const agent1 = new AtpAgent({service: 'https://alice.com'})
|
||||||
agent1.sessionManager.session = {
|
agent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'alice-did',
|
did: 'alice-did',
|
||||||
@@ -1526,7 +1526,7 @@ describe('session', () => {
|
|||||||
accessJwt: 'alice-access-jwt-1',
|
accessJwt: 'alice-access-jwt-1',
|
||||||
refreshJwt: 'alice-refresh-jwt-1',
|
refreshJwt: 'alice-refresh-jwt-1',
|
||||||
}
|
}
|
||||||
const agent2 = new BskyAgent({service: 'https://bob.com'})
|
const agent2 = new AtpAgent({service: 'https://bob.com'})
|
||||||
agent2.sessionManager.session = {
|
agent2.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'bob-did',
|
did: 'bob-did',
|
||||||
@@ -1549,7 +1549,7 @@ describe('session', () => {
|
|||||||
expect(state.accounts.length).toBe(2)
|
expect(state.accounts.length).toBe(2)
|
||||||
expect(state.currentAgentState.did).toBe('bob-did')
|
expect(state.currentAgentState.did).toBe('bob-did')
|
||||||
|
|
||||||
const anotherTabAgent1 = new BskyAgent({service: 'https://jay.com'})
|
const anotherTabAgent1 = new AtpAgent({service: 'https://jay.com'})
|
||||||
anotherTabAgent1.sessionManager.session = {
|
anotherTabAgent1.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'jay-did',
|
did: 'jay-did',
|
||||||
@@ -1557,7 +1557,7 @@ describe('session', () => {
|
|||||||
accessJwt: 'jay-access-jwt-1',
|
accessJwt: 'jay-access-jwt-1',
|
||||||
refreshJwt: 'jay-refresh-jwt-1',
|
refreshJwt: 'jay-refresh-jwt-1',
|
||||||
}
|
}
|
||||||
const anotherTabAgent2 = new BskyAgent({service: 'https://alice.com'})
|
const anotherTabAgent2 = new AtpAgent({service: 'https://alice.com'})
|
||||||
anotherTabAgent2.sessionManager.session = {
|
anotherTabAgent2.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'bob-did',
|
did: 'bob-did',
|
||||||
@@ -1627,7 +1627,7 @@ describe('session', () => {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
const anotherTabAgent3 = new BskyAgent({service: 'https://clarence.com'})
|
const anotherTabAgent3 = new AtpAgent({service: 'https://clarence.com'})
|
||||||
anotherTabAgent3.sessionManager.session = {
|
anotherTabAgent3.sessionManager.session = {
|
||||||
active: true,
|
active: true,
|
||||||
did: 'clarence-did',
|
did: 'clarence-did',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {BskyAgent} from '@atproto/api'
|
import {AtpAgent} from '@atproto/api'
|
||||||
|
|
||||||
import {device} from '#/storage'
|
import {device} from '#/storage'
|
||||||
|
|
||||||
@@ -83,8 +83,8 @@ export function configureAdditionalModerationAuthorities() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const appLabelers = Array.from(
|
const appLabelers = Array.from(
|
||||||
new Set([...BskyAgent.appLabelers, ...additionalLabelers]),
|
new Set([...AtpAgent.appLabelers, ...additionalLabelers]),
|
||||||
)
|
)
|
||||||
|
|
||||||
BskyAgent.configure({appLabelers})
|
AtpAgent.configure({appLabelers})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
Agent as BaseAgent,
|
Agent as BaseAgent,
|
||||||
type AppBskyActorProfile,
|
type AppBskyActorProfile,
|
||||||
|
AtpAgent,
|
||||||
type AtprotoServiceType,
|
type AtprotoServiceType,
|
||||||
type AtpSessionData,
|
type AtpSessionData,
|
||||||
type AtpSessionEvent,
|
type AtpSessionEvent,
|
||||||
BskyAgent,
|
|
||||||
type Did,
|
type Did,
|
||||||
type Un$Typed,
|
type Un$Typed,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
@@ -52,7 +52,7 @@ export function createPublicAgent() {
|
|||||||
export async function createAgentAndResume(
|
export async function createAgentAndResume(
|
||||||
storedAccount: SessionAccount,
|
storedAccount: SessionAccount,
|
||||||
onSessionChange: (
|
onSessionChange: (
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
did: string,
|
did: string,
|
||||||
event: AtpSessionEvent,
|
event: AtpSessionEvent,
|
||||||
) => void,
|
) => void,
|
||||||
@@ -96,7 +96,7 @@ export async function createAgentAndLogin(
|
|||||||
authFactorToken?: string
|
authFactorToken?: string
|
||||||
},
|
},
|
||||||
onSessionChange: (
|
onSessionChange: (
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
did: string,
|
did: string,
|
||||||
event: AtpSessionEvent,
|
event: AtpSessionEvent,
|
||||||
) => void,
|
) => void,
|
||||||
@@ -143,7 +143,7 @@ export async function createAgentAndCreateAccount(
|
|||||||
verificationCode?: string
|
verificationCode?: string
|
||||||
},
|
},
|
||||||
onSessionChange: (
|
onSessionChange: (
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
did: string,
|
did: string,
|
||||||
event: AtpSessionEvent,
|
event: AtpSessionEvent,
|
||||||
) => void,
|
) => void,
|
||||||
@@ -282,7 +282,7 @@ export async function createAgentAndCreateAccount(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function agentToSessionAccountOrThrow(agent: BskyAgent): SessionAccount {
|
export function agentToSessionAccountOrThrow(agent: AtpAgent): SessionAccount {
|
||||||
const account = agentToSessionAccount(agent)
|
const account = agentToSessionAccount(agent)
|
||||||
if (!account) {
|
if (!account) {
|
||||||
throw Error('Expected an active session')
|
throw Error('Expected an active session')
|
||||||
@@ -291,7 +291,7 @@ export function agentToSessionAccountOrThrow(agent: BskyAgent): SessionAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function agentToSessionAccount(
|
export function agentToSessionAccount(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
): SessionAccount | undefined {
|
): SessionAccount | undefined {
|
||||||
if (!agent.session) {
|
if (!agent.session) {
|
||||||
return undefined
|
return undefined
|
||||||
@@ -350,7 +350,7 @@ export class Agent extends BaseAgent {
|
|||||||
// Ideally, we wouldn't be doing this. However, since there is so much logic that requires making calls to the PDS right now, it
|
// Ideally, we wouldn't be doing this. However, since there is so much logic that requires making calls to the PDS right now, it
|
||||||
// feels safer to just let those run as-is and set the header afterward.
|
// feels safer to just let those run as-is and set the header afterward.
|
||||||
let realFetch = globalThis.fetch
|
let realFetch = globalThis.fetch
|
||||||
class BskyAppAgent extends BskyAgent {
|
class BskyAppAgent extends AtpAgent {
|
||||||
persistSessionHandler: ((event: AtpSessionEvent) => void) | undefined =
|
persistSessionHandler: ((event: AtpSessionEvent) => void) | undefined =
|
||||||
undefined
|
undefined
|
||||||
|
|
||||||
@@ -389,7 +389,7 @@ class BskyAppAgent extends BskyAgent {
|
|||||||
// Not awaited in the calling code so we can delay blocking on them.
|
// Not awaited in the calling code so we can delay blocking on them.
|
||||||
resolvers: Promise<unknown>[]
|
resolvers: Promise<unknown>[]
|
||||||
onSessionChange: (
|
onSessionChange: (
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
did: string,
|
did: string,
|
||||||
event: AtpSessionEvent,
|
event: AtpSessionEvent,
|
||||||
) => void
|
) => void
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {BSKY_LABELER_DID, BskyAgent} from '@atproto/api'
|
import {AtpAgent, BSKY_LABELER_DID} from '@atproto/api'
|
||||||
|
|
||||||
import {IS_TEST_USER} from '#/lib/constants'
|
import {IS_TEST_USER} from '#/lib/constants'
|
||||||
import {configureAdditionalModerationAuthorities} from './additional-moderation-authorities'
|
import {configureAdditionalModerationAuthorities} from './additional-moderation-authorities'
|
||||||
@@ -13,7 +13,7 @@ export function configureModerationForGuest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function configureModerationForAccount(
|
export async function configureModerationForAccount(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
account: SessionAccount,
|
account: SessionAccount,
|
||||||
) {
|
) {
|
||||||
// This global mutation is *only* OK because this code is only relevant for testing.
|
// This global mutation is *only* OK because this code is only relevant for testing.
|
||||||
@@ -38,10 +38,10 @@ export async function configureModerationForAccount(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function switchToBskyAppLabeler() {
|
function switchToBskyAppLabeler() {
|
||||||
BskyAgent.configure({appLabelers: [BSKY_LABELER_DID]})
|
AtpAgent.configure({appLabelers: [BSKY_LABELER_DID]})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function trySwitchToTestAppLabeler(agent: BskyAgent) {
|
async function trySwitchToTestAppLabeler(agent: AtpAgent) {
|
||||||
const did = (
|
const did = (
|
||||||
await agent
|
await agent
|
||||||
.resolveHandle({handle: 'mod-authority.test'})
|
.resolveHandle({handle: 'mod-authority.test'})
|
||||||
@@ -49,6 +49,6 @@ async function trySwitchToTestAppLabeler(agent: BskyAgent) {
|
|||||||
)?.data.did
|
)?.data.did
|
||||||
if (did) {
|
if (did) {
|
||||||
console.warn('USING TEST ENV MODERATION')
|
console.warn('USING TEST ENV MODERATION')
|
||||||
BskyAgent.configure({appLabelers: [did]})
|
AtpAgent.configure({appLabelers: [did]})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ import {
|
|||||||
AppBskyDraftCreateDraft,
|
AppBskyDraftCreateDraft,
|
||||||
AppBskyUnspeccedDefs,
|
AppBskyUnspeccedDefs,
|
||||||
type AppBskyUnspeccedGetPostThreadV2,
|
type AppBskyUnspeccedGetPostThreadV2,
|
||||||
|
type AtpAgent,
|
||||||
AtUri,
|
AtUri,
|
||||||
type BskyAgent,
|
|
||||||
ChatBskyGroupDefs,
|
ChatBskyGroupDefs,
|
||||||
type RichText,
|
type RichText,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
@@ -2358,7 +2358,7 @@ function useKeyboardVerticalOffset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function whenAppViewReady(
|
async function whenAppViewReady(
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
uri: string,
|
uri: string,
|
||||||
fn: (res: AppBskyUnspeccedGetPostThreadV2.Response) => boolean,
|
fn: (res: AppBskyUnspeccedGetPostThreadV2.Response) => boolean,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {type ImagePickerAsset} from 'expo-image-picker'
|
import {type ImagePickerAsset} from 'expo-image-picker'
|
||||||
import {type AppBskyVideoDefs, type BlobRef, type BskyAgent} from '@atproto/api'
|
import {type AppBskyVideoDefs, type AtpAgent, type BlobRef} from '@atproto/api'
|
||||||
import {type I18n} from '@lingui/core'
|
import {type I18n} from '@lingui/core'
|
||||||
import {msg} from '@lingui/core/macro'
|
import {msg} from '@lingui/core/macro'
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ function trunc2dp(num: number) {
|
|||||||
export async function processVideo(
|
export async function processVideo(
|
||||||
asset: ImagePickerAsset,
|
asset: ImagePickerAsset,
|
||||||
dispatch: (action: VideoAction) => void,
|
dispatch: (action: VideoAction) => void,
|
||||||
agent: BskyAgent,
|
agent: AtpAgent,
|
||||||
did: string,
|
did: string,
|
||||||
signal: AbortSignal,
|
signal: AbortSignal,
|
||||||
i18n: I18n,
|
i18n: I18n,
|
||||||
|
|||||||
Reference in New Issue
Block a user