-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip * remove all canProxyReadc * finish cleanup * clean up tests * fix up tests * fix api tests * fix build * fix compression test * update image tests * fix dev envs * build branch * fix service file * re-enable getPopular * format * rm unused sharp code * dont build branch
- Loading branch information
Showing
131 changed files
with
414 additions
and
32,715 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,20 @@ describe('agent', () => { | |
await close() | ||
}) | ||
|
||
const getProfileDisplayName = async ( | ||
agent: BskyAgent, | ||
): Promise<string | undefined> => { | ||
try { | ||
const res = await agent.api.app.bsky.actor.profile.get({ | ||
repo: agent.session?.did || '', | ||
rkey: 'self', | ||
}) | ||
return res.value.displayName ?? '' | ||
} catch (err) { | ||
return undefined | ||
} | ||
} | ||
|
||
it('upsertProfile correctly creates and updates profiles.', async () => { | ||
const agent = new BskyAgent({ service: server.url }) | ||
|
||
|
@@ -28,9 +42,8 @@ describe('agent', () => { | |
email: '[email protected]', | ||
password: 'password', | ||
}) | ||
|
||
const profile1 = await agent.getProfile({ actor: agent.session?.did || '' }) | ||
expect(profile1.data.displayName).toBeFalsy() | ||
const displayName1 = await getProfileDisplayName(agent) | ||
expect(displayName1).toBeFalsy() | ||
|
||
await agent.upsertProfile((existing) => { | ||
expect(existing).toBeFalsy() | ||
|
@@ -39,8 +52,8 @@ describe('agent', () => { | |
} | ||
}) | ||
|
||
const profile2 = await agent.getProfile({ actor: agent.session?.did || '' }) | ||
expect(profile2.data.displayName).toBe('Bob') | ||
const displayName2 = await getProfileDisplayName(agent) | ||
expect(displayName2).toBe('Bob') | ||
|
||
await agent.upsertProfile((existing) => { | ||
expect(existing).toBeTruthy() | ||
|
@@ -49,8 +62,8 @@ describe('agent', () => { | |
} | ||
}) | ||
|
||
const profile3 = await agent.getProfile({ actor: agent.session?.did || '' }) | ||
expect(profile3.data.displayName).toBe('BOB') | ||
const displayName3 = await getProfileDisplayName(agent) | ||
expect(displayName3).toBe('BOB') | ||
}) | ||
|
||
it('upsertProfile correctly handles CAS failures.', async () => { | ||
|
@@ -62,8 +75,8 @@ describe('agent', () => { | |
password: 'password', | ||
}) | ||
|
||
const profile1 = await agent.getProfile({ actor: agent.session?.did || '' }) | ||
expect(profile1.data.displayName).toBeFalsy() | ||
const displayName1 = await getProfileDisplayName(agent) | ||
expect(displayName1).toBeFalsy() | ||
|
||
let hasConflicted = false | ||
let ranTwice = false | ||
|
@@ -88,8 +101,8 @@ describe('agent', () => { | |
}) | ||
expect(ranTwice).toBe(true) | ||
|
||
const profile2 = await agent.getProfile({ actor: agent.session?.did || '' }) | ||
expect(profile2.data.displayName).toBe('Bob') | ||
const displayName2 = await getProfileDisplayName(agent) | ||
expect(displayName2).toBe('Bob') | ||
}) | ||
|
||
it('upsertProfile wont endlessly retry CAS failures.', async () => { | ||
|
@@ -101,8 +114,8 @@ describe('agent', () => { | |
password: 'password', | ||
}) | ||
|
||
const profile1 = await agent.getProfile({ actor: agent.session?.did || '' }) | ||
expect(profile1.data.displayName).toBeFalsy() | ||
const displayName1 = await getProfileDisplayName(agent) | ||
expect(displayName1).toBeFalsy() | ||
|
||
const p = agent.upsertProfile(async (_existing) => { | ||
await agent.com.atproto.repo.putRecord({ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,9 +56,6 @@ export class TestPds { | |
appUrlPasswordReset: 'app://forgot-password', | ||
emailNoReplyAddress: '[email protected]', | ||
publicUrl: 'https://pds.public.url', | ||
imgUriSalt: '9dd04221f5755bce5f55f47464c27e1e', | ||
imgUriKey: | ||
'f23ecd142835025f42c3db2cf25dd813956c178392760256211f9d315f8ab4d8', | ||
dbPostgresUrl: cfg.dbPostgresUrl, | ||
maxSubscriptionBuffer: 200, | ||
repoBackfillLimitMs: 1000 * 60 * 60, // 1hr | ||
|
@@ -67,7 +64,8 @@ export class TestPds { | |
labelerKeywords: { label_me: 'test-label', label_me_2: 'test-label-2' }, | ||
feedGenDid: 'did:example:feedGen', | ||
dbTxLockNonce: await randomStr(32, 'base32'), | ||
bskyAppViewProxy: !!cfg.bskyAppViewEndpoint, | ||
bskyAppViewEndpoint: cfg.bskyAppViewEndpoint ?? 'http://fake_address', | ||
bskyAppViewDid: cfg.bskyAppViewDid ?? 'did:example:fake', | ||
bskyAppViewCdnUrlPattern: 'http://cdn.appview.com/%s/%s/%s', | ||
...cfg, | ||
}) | ||
|
@@ -82,11 +80,7 @@ export class TestPds { | |
: pds.Database.memory() | ||
await db.migrateToLatestOrThrow() | ||
|
||
if ( | ||
config.bskyAppViewEndpoint && | ||
config.bskyAppViewProxy && | ||
!cfg.enableInProcessAppView | ||
) { | ||
if (cfg.bskyAppViewEndpoint && !cfg.enableInProcessAppView) { | ||
// Disable communication to app view within pds | ||
MessageDispatcher.prototype.send = async () => {} | ||
} | ||
|
@@ -97,7 +91,6 @@ export class TestPds { | |
repoSigningKey, | ||
plcRotationKey, | ||
config, | ||
algos: cfg.algos, | ||
}) | ||
|
||
await server.start() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.