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

This is a binary file and will not be displayed.

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