Add isSelfHosted to SessionAccount (#7028)

* Add isSelfHosted to SessionAccount

* Update snaps
This commit is contained in:
Eric Bailey
2024-12-09 13:43:16 -06:00
committed by GitHub
parent 63c0c7e621
commit bc4b4a3cfe
3 changed files with 34 additions and 0 deletions
+1
View File
@@ -28,6 +28,7 @@ const accountSchema = z.object({
*/
status: z.string().optional(),
pdsUrl: z.string().optional(),
isSelfHosted: z.boolean().optional(),
})
export type PersistedAccount = z.infer<typeof accountSchema>
@@ -61,6 +61,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-1",
"service": "https://alice.com/",
@@ -100,6 +101,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": undefined,
"service": "https://alice.com/",
@@ -152,6 +154,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-1",
"service": "https://alice.com/",
@@ -202,6 +205,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "bob.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "bob-refresh-jwt-1",
"service": "https://bob.com/",
@@ -216,6 +220,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-1",
"service": "https://alice.com/",
@@ -266,6 +271,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice-updated.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-2",
"service": "https://alice.com/",
@@ -280,6 +286,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "bob.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "bob-refresh-jwt-1",
"service": "https://bob.com/",
@@ -328,6 +335,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "jay.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "jay-refresh-jwt-1",
"service": "https://jay.com/",
@@ -342,6 +350,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice-updated.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-2",
"service": "https://alice.com/",
@@ -356,6 +365,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "bob.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "bob-refresh-jwt-1",
"service": "https://bob.com/",
@@ -399,6 +409,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "jay.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": undefined,
"service": "https://jay.com/",
@@ -413,6 +424,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice-updated.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": undefined,
"service": "https://alice.com/",
@@ -427,6 +439,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "bob.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": undefined,
"service": "https://bob.com/",
@@ -488,6 +501,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": undefined,
"service": "https://alice.com/",
@@ -535,6 +549,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-2",
"service": "https://alice.com/",
@@ -651,6 +666,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "bob.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "bob-refresh-jwt-1",
"service": "https://bob.com/",
@@ -743,6 +759,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "bob.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": undefined,
"service": "https://bob.com/",
@@ -757,6 +774,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-1",
"service": "https://alice.com/",
@@ -832,6 +850,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice-updated.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-2",
"service": "https://alice.com/",
@@ -885,6 +904,7 @@ describe('session', () => {
"emailAuthFactor": true,
"emailConfirmed": true,
"handle": "alice-updated.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-3",
"service": "https://alice.com/",
@@ -938,6 +958,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice-updated.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-4",
"service": "https://alice.com/",
@@ -1102,6 +1123,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "bob.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "bob-refresh-jwt-1",
"service": "https://bob.com/",
@@ -1116,6 +1138,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice-updated.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-2",
"service": "https://alice.com/",
@@ -1167,6 +1190,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "bob-updated.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "bob-refresh-jwt-2",
"service": "https://bob.com/",
@@ -1181,6 +1205,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice-updated.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-2",
"service": "https://alice.com/",
@@ -1332,6 +1357,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "alice-refresh-jwt-1",
"service": "https://alice.com/",
@@ -1397,6 +1423,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": undefined,
"service": "https://alice.com/",
@@ -1462,6 +1489,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "alice.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": undefined,
"service": "https://alice.com/",
@@ -1559,6 +1587,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "jay.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "jay-refresh-jwt-1",
"service": "https://jay.com/",
@@ -1573,6 +1602,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "bob.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "bob-refresh-jwt-2",
"service": "https://alice.com/",
@@ -1622,6 +1652,7 @@ describe('session', () => {
"emailAuthFactor": false,
"emailConfirmed": false,
"handle": "clarence.test",
"isSelfHosted": true,
"pdsUrl": undefined,
"refreshJwt": "clarence-refresh-jwt-2",
"service": "https://clarence.com/",
+2
View File
@@ -3,6 +3,7 @@ import {TID} from '@atproto/common-web'
import {networkRetry} from '#/lib/async/retry'
import {
BSKY_SERVICE,
DISCOVER_SAVED_FEED,
IS_PROD_SERVICE,
PUBLIC_BSKY_SERVICE,
@@ -204,6 +205,7 @@ export function agentToSessionAccount(
active: agent.session.active,
status: agent.session.status as SessionAccount['status'],
pdsUrl: agent.pdsUrl?.toString(),
isSelfHosted: !agent.serviceUrl.toString().startsWith(BSKY_SERVICE),
}
}