about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/state/persisted/schema.ts1
-rw-r--r--src/state/session/__tests__/session-test.ts31
-rw-r--r--src/state/session/agent.ts2
3 files changed, 34 insertions, 0 deletions
diff --git a/src/state/persisted/schema.ts b/src/state/persisted/schema.ts
index 804017949..f70d77463 100644
--- a/src/state/persisted/schema.ts
+++ b/src/state/persisted/schema.ts
@@ -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>
 
diff --git a/src/state/session/__tests__/session-test.ts b/src/state/session/__tests__/session-test.ts
index 44c5cf934..4c58c6323 100644
--- a/src/state/session/__tests__/session-test.ts
+++ b/src/state/session/__tests__/session-test.ts
@@ -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/",
diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts
index 8a48cf95e..84c816d44 100644
--- a/src/state/session/agent.ts
+++ b/src/state/session/agent.ts
@@ -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),
   }
 }