Your music, beautifully tracked. All yours. (coming soon) teal.fm
teal-fm atproto

get aqua running on localhost

+20 -19
+4 -3
apps/aqua/src/auth/router.ts
··· 28 28 } 29 29 }; 30 30 31 - export async function loginGet(handle: string) { 31 + export async function loginGet(c: TealContext) { 32 + const handle = c.req.param('handle'); 32 33 // Initiate the OAuth flow 33 34 const auth = await createClient(db); 34 35 try { 35 - const url = await auth.authorize("natalie.sh", { 36 + const url = await auth.authorize(handle, { 36 37 scope: "atproto transition:generic", 37 38 }); 38 39 return Response.redirect(url); ··· 71 72 72 73 const app = new Hono<EnvWithCtx>(); 73 74 74 - app.get("/login", async (c) => loginGet("natalie.sh")); 75 + app.get("/login/:handle", async (c) => loginGet(c)); 75 76 76 77 app.post("/login", async (c) => login(c)); 77 78
+16 -16
apps/aqua/src/index.ts
··· 1 - import { serve as serveNode } from "@hono/node-server"; 1 + import { serve } from "@hono/node-server"; 2 2 import { Hono } from "hono"; 3 3 import { db } from "@/db"; 4 4 import { getAuthRouter, loginGet } from "./auth/router"; ··· 22 22 23 23 app.route("/oauth", getAuthRouter()); 24 24 25 - // const run = async () => { 26 - // serve( 27 - // { 28 - // fetch: app.fetch, 29 - // port: env.PORT, 30 - // hostname: env.HOST, 31 - // }, 32 - // (info) => { 33 - // console.log( 34 - // `Listening on ${info.address == "::1" ? "http://localhost" : info.address}:${info.port} (${info.family})`, 35 - // ); 36 - // }, 37 - // ); 38 - // }; 25 + const run = async () => { 26 + serve( 27 + { 28 + fetch: app.fetch, 29 + port: env.PORT, 30 + hostname: env.HOST, 31 + }, 32 + (info) => { 33 + console.log( 34 + `Listening on ${info.address == "::1" ? "http://localhost" : info.address}:${info.port} (${info.family})`, 35 + ); 36 + }, 37 + ); 38 + }; 39 39 40 - // run(); 40 + run(); 41 41 42 42 export default app;