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

Changed files
+9 -3
lib
oauth
routes
api
oauth
tests
+3
lib/oauth/client.ts
···
import { AtprotoOAuthClient } from "@bigmoves/atproto-oauth-client";
import { SessionStore, StateStore } from "../storage.ts";
+
const isDev = Deno.env.get("NODE_ENV") !== "production";
export const scope = [
"atproto",
"account:email",
···
stateStore: new StateStore(db),
sessionStore: new SessionStore(db),
didCache: undefined,
+
allowHttp: isDev,
+
plcDirectoryUrl: Deno.env.get("PLC_URL") ?? "https://plc.directory",
});
};
+2 -1
routes/api/oauth/initiate.ts
···
const handle = data.handle;
if (
typeof handle !== "string" ||
-
!(isValidHandle(handle) || isValidUrl(handle))
+
!(isValidHandle(handle) || isValidUrl(handle) ||
+
handle.startsWith("did:"))
) {
return new Response("Invalid Handle", { status: 400 });
}
tests/.yarn/install-state.gz

This is a binary file and will not be displayed.

+1 -1
tests/e2e/migration.test.ts
···
await migrationClient.handleIdentityMigration(verificationCode);
// If successful, continue to next step
-
migrationClient.continueToNextStep(3);
+
await migrationClient.finalizeMigration();
}
},
},
+3 -1
tests/utils/test-env.ts
···
*/
import { Agent } from "@atproto/api";
-
import { TestPds, TestPlc } from "@atproto/dev-env";
+
import { TestBsky, TestPds, TestPlc } from "@atproto/dev-env";
import { ComAtprotoServerCreateAccount } from "@atproto/api";
import { SMTPServer, SMTPServerAddress } from "smtp-server";
import * as cheerio from "cheerio";
···
devMode: true,
emailSmtpUrl: `smtp://localhost:${SMTP_PORT}`,
emailFromAddress: `noreply@localhost:${SMTP_PORT}`,
+
bskyAppViewDid: "did:web:api.bsky.app",
});
const targetPds = await TestPds.create({
···
devMode: true,
emailSmtpUrl: `smtp://localhost:${SMTP_PORT}`,
emailFromAddress: `noreply@localhost:${SMTP_PORT}`,
+
bskyAppViewDid: "did:web:api.bsky.app",
});
return {