Graphical PDS migrator for AT Protocol

fixes

auth/client.ts oauth/client.ts
+1
auth/session.ts oauth/session.ts
···
}
const cookieSecret = Deno.env.get("COOKIE_SECRET");
+
console.log("COOKIE_SECRET", cookieSecret);
const sessionOptions: SessionOptions = {
cookieName: "sid",
auth/storage.ts oauth/storage.ts
+1 -1
deno.json
···
{
"tasks": {
"check": "deno fmt --check . && deno lint . && deno check **/*.ts && deno check **/*.tsx",
-
"dev": "deno run -A --watch=static/,routes/ dev.ts",
+
"dev": "deno run -A --env --watch=static/,routes/ dev.ts",
"build": "deno run -A dev.ts build",
"start": "deno run -A main.ts",
"update": "deno run -A -r jsr:@fresh/update ."
plugins/id-resolver.ts tools/id-resolver.ts
+2 -2
routes/api/me.ts
···
-
import { getSessionAgent } from "../../auth/session.ts";
+
import { getSessionAgent } from "../../oauth/session.ts";
import { define } from "../../utils.ts";
-
import { resolver } from "../../plugins/id-resolver.ts";
+
import { resolver } from "../../tools/id-resolver.ts";
export const handler = define.handlers({
async GET(ctx) {
+7 -6
routes/api/oauth/callback.ts
···
-
import { oauthClient } from "../../../auth/client.ts";
-
import { getSession } from "../../../auth/session.ts";
-
import { Handlers } from "fresh/compat";
+
import { oauthClient } from "../../../oauth/client.ts";
+
import { getSession } from "../../../oauth/session.ts";
+
import { define } from "../../../utils.ts";
-
export const handler: Handlers = {
+
export const handler = define.handlers({
async GET(ctx) {
const req = ctx.req;
const url = new URL(req.url);
const params = url.searchParams;
+
const baseUrl = `${url.protocol}//${url.host}`;
// Log incoming parameters for debugging
console.log("OAuth callback received params:", {
···
params: Object.fromEntries(params.entries()),
}, "OAuth callback failed");
-
return Response.redirect("/login/callback?error=auth");
+
return Response.redirect(`${baseUrl}/login/callback?error=auth`);
}
},
-
};
+
});
+1 -1
routes/api/oauth/initiate.ts
···
import { isValidHandle } from 'npm:@atproto/syntax'
-
import { oauthClient } from "../../../auth/client.ts";
+
import { oauthClient } from "../../../oauth/client.ts";
import { define } from "../../../utils.ts";
function isValidUrl(url: string): boolean {
+2 -2
routes/api/oauth/logout.ts
···
-
import { getSession } from "../../../auth/session.ts";
-
import { oauthClient } from "../../../auth/client.ts";
+
import { getSession } from "../../../oauth/session.ts";
+
import { oauthClient } from "../../../oauth/client.ts";
import { define } from "../../../utils.ts";
export const handler = define.handlers({
+1 -1
routes/api/server/describe.ts
···
import { Agent } from "@atproto/api";
-
import { getSessionAgent } from "../../../auth/session.ts";
+
import { getSessionAgent } from "../../../oauth/session.ts";
import { define } from "../../../utils.ts";
/**
* Describe the server configuration and capabilities
+1 -1
routes/api/server/migrate/create.ts
···
import {
getSessionAgent,
setMigrationSession,
-
} from "../../../../auth/session.ts";
+
} from "../../../../oauth/session.ts";
import { Agent } from "@atproto/api";
import { define } from "../../../../utils.ts";
+1 -1
routes/api/server/migrate/data.ts
···
import {
getMigrationSessionAgent,
getSessionAgent,
-
} from "../../../../auth/session.ts";
+
} from "../../../../oauth/session.ts";
export const handler = define.handlers({
async POST(ctx) {
+1 -1
routes/api/server/migrate/finalize.ts
···
import {
getMigrationSessionAgent,
getSessionAgent,
-
} from "../../../../auth/session.ts";
+
} from "../../../../oauth/session.ts";
import { define } from "../../../../utils.ts";
export const handler = define.handlers({
+1 -1
routes/api/server/migrate/identity/request.ts
···
getMigrationSession,
getMigrationSessionAgent,
getSessionAgent,
-
} from "../../../../../auth/session.ts";
+
} from "../../../../../oauth/session.ts";
import { Secp256k1Keypair } from "npm:@atproto/crypto";
import * as ui8 from "npm:uint8arrays";
import { define } from "../../../../../utils.ts";
+1 -1
routes/api/server/migrate/identity/sign.ts
···
getMigrationSession,
getMigrationSessionAgent,
getSessionAgent,
-
} from "../../../../../auth/session.ts";
+
} from "../../../../../oauth/session.ts";
import { define } from "../../../../../utils.ts";
export const handler = define.handlers({