Graphical PDS migrator for AT Protocol

fix: ci and devenv (#10)

* fix: allow dids

* fix: allow custom PLC_URL

* fix(devenv): use bsky app view

* refactor: move is dev to variable

* fix: update migration flow to finalizeMigration instead of continueToNextStep

authored by turtlepaw.pds.witchcraft.syste… and committed by GitHub a7837ede 18853a42

Changed files
+9 -3
lib
oauth
routes
api
oauth
tests
+3
lib/oauth/client.ts
··· 1 import { AtprotoOAuthClient } from "@bigmoves/atproto-oauth-client"; 2 import { SessionStore, StateStore } from "../storage.ts"; 3 4 export const scope = [ 5 "atproto", 6 "account:email", ··· 44 stateStore: new StateStore(db), 45 sessionStore: new SessionStore(db), 46 didCache: undefined, 47 }); 48 }; 49
··· 1 import { AtprotoOAuthClient } from "@bigmoves/atproto-oauth-client"; 2 import { SessionStore, StateStore } from "../storage.ts"; 3 4 + const isDev = Deno.env.get("NODE_ENV") !== "production"; 5 export const scope = [ 6 "atproto", 7 "account:email", ··· 45 stateStore: new StateStore(db), 46 sessionStore: new SessionStore(db), 47 didCache: undefined, 48 + allowHttp: isDev, 49 + plcDirectoryUrl: Deno.env.get("PLC_URL") ?? "https://plc.directory", 50 }); 51 }; 52
+2 -1
routes/api/oauth/initiate.ts
··· 18 const handle = data.handle; 19 if ( 20 typeof handle !== "string" || 21 - !(isValidHandle(handle) || isValidUrl(handle)) 22 ) { 23 return new Response("Invalid Handle", { status: 400 }); 24 }
··· 18 const handle = data.handle; 19 if ( 20 typeof handle !== "string" || 21 + !(isValidHandle(handle) || isValidUrl(handle) || 22 + handle.startsWith("did:")) 23 ) { 24 return new Response("Invalid Handle", { status: 400 }); 25 }
tests/.yarn/install-state.gz

This is a binary file and will not be displayed.

+1 -1
tests/e2e/migration.test.ts
··· 138 139 await migrationClient.handleIdentityMigration(verificationCode); 140 // If successful, continue to next step 141 - migrationClient.continueToNextStep(3); 142 } 143 }, 144 },
··· 138 139 await migrationClient.handleIdentityMigration(verificationCode); 140 // If successful, continue to next step 141 + await migrationClient.finalizeMigration(); 142 } 143 }, 144 },
+3 -1
tests/utils/test-env.ts
··· 3 */ 4 5 import { Agent } from "@atproto/api"; 6 - import { TestPds, TestPlc } from "@atproto/dev-env"; 7 import { ComAtprotoServerCreateAccount } from "@atproto/api"; 8 import { SMTPServer, SMTPServerAddress } from "smtp-server"; 9 import * as cheerio from "cheerio"; ··· 171 devMode: true, 172 emailSmtpUrl: `smtp://localhost:${SMTP_PORT}`, 173 emailFromAddress: `noreply@localhost:${SMTP_PORT}`, 174 }); 175 176 const targetPds = await TestPds.create({ ··· 181 devMode: true, 182 emailSmtpUrl: `smtp://localhost:${SMTP_PORT}`, 183 emailFromAddress: `noreply@localhost:${SMTP_PORT}`, 184 }); 185 186 return {
··· 3 */ 4 5 import { Agent } from "@atproto/api"; 6 + import { TestBsky, TestPds, TestPlc } from "@atproto/dev-env"; 7 import { ComAtprotoServerCreateAccount } from "@atproto/api"; 8 import { SMTPServer, SMTPServerAddress } from "smtp-server"; 9 import * as cheerio from "cheerio"; ··· 171 devMode: true, 172 emailSmtpUrl: `smtp://localhost:${SMTP_PORT}`, 173 emailFromAddress: `noreply@localhost:${SMTP_PORT}`, 174 + bskyAppViewDid: "did:web:api.bsky.app", 175 }); 176 177 const targetPds = await TestPds.create({ ··· 182 devMode: true, 183 emailSmtpUrl: `smtp://localhost:${SMTP_PORT}`, 184 emailFromAddress: `noreply@localhost:${SMTP_PORT}`, 185 + bskyAppViewDid: "did:web:api.bsky.app", 186 }); 187 188 return {