tangled
alpha
login
or
join now
teal.fm
/
teal
109
fork
atom
Your music, beautifully tracked. All yours. (coming soon)
teal.fm
teal-fm
atproto
109
fork
atom
overview
issues
pulls
pipelines
get aqua running on localhost
Kyle Loveless
1 year ago
6efbddfe
44b3e3c0
+20
-19
2 changed files
expand all
collapse all
unified
split
apps
aqua
src
auth
router.ts
index.ts
+4
-3
apps/aqua/src/auth/router.ts
···
28
28
}
29
29
};
30
30
31
31
-
export async function loginGet(handle: string) {
31
31
+
export async function loginGet(c: TealContext) {
32
32
+
const handle = c.req.param('handle');
32
33
// Initiate the OAuth flow
33
34
const auth = await createClient(db);
34
35
try {
35
35
-
const url = await auth.authorize("natalie.sh", {
36
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
74
-
app.get("/login", async (c) => loginGet("natalie.sh"));
75
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
1
-
import { serve as serveNode } from "@hono/node-server";
1
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
25
-
// const run = async () => {
26
26
-
// serve(
27
27
-
// {
28
28
-
// fetch: app.fetch,
29
29
-
// port: env.PORT,
30
30
-
// hostname: env.HOST,
31
31
-
// },
32
32
-
// (info) => {
33
33
-
// console.log(
34
34
-
// `Listening on ${info.address == "::1" ? "http://localhost" : info.address}:${info.port} (${info.family})`,
35
35
-
// );
36
36
-
// },
37
37
-
// );
38
38
-
// };
25
25
+
const run = async () => {
26
26
+
serve(
27
27
+
{
28
28
+
fetch: app.fetch,
29
29
+
port: env.PORT,
30
30
+
hostname: env.HOST,
31
31
+
},
32
32
+
(info) => {
33
33
+
console.log(
34
34
+
`Listening on ${info.address == "::1" ? "http://localhost" : info.address}:${info.port} (${info.family})`,
35
35
+
);
36
36
+
},
37
37
+
);
38
38
+
};
39
39
40
40
-
// run();
40
40
+
run();
41
41
42
42
export default app;