@@ -49,6 +49,7 @@ docker run --rm -p 3000:3000 tbd
|
||||
| `GET` | `/auth/callback` | OAuth redirect target: completes the login, sets the session cookie, redirects to `/` |
|
||||
| `POST` | `/auth/logout` | Ends the session |
|
||||
| `GET` | `/auth/me` | The logged-in user, `{:login "alice" :id 7 :admin? true}` (401 if not logged in) |
|
||||
| `GET` | `/nrepl` | **Admin only.** Whether the nREPL debug server is on: `{:enabled false}`, or `{:enabled true :bind "127.0.0.1" :port 7888}` |
|
||||
| `POST` | `/nrepl` | **Admin only.** Body `{"enabled": true}` (JSON or EDN) starts the nREPL debug server, `false` stops it; returns `{:enabled true :bind "127.0.0.1" :port 7888}` |
|
||||
|
||||
```bash
|
||||
@@ -60,7 +61,7 @@ curl 'localhost:3000/api/add?x=2&y=3' # {:result 5}
|
||||
|
||||
Login is OAuth2 (authorization-code flow) against a [Gitea](https://about.gitea.com/) instance.
|
||||
Anyone with a Gitea account can log in, but routes marked `:admin? true` (currently
|
||||
`POST /nrepl`) also require the user to be on the `ADMIN_USERS` allowlist: **401** without a
|
||||
`GET` and `POST /nrepl`) also require the user to be on the `ADMIN_USERS` allowlist: **401** without a
|
||||
login, **403** for a logged-in non-admin. With no allowlist, nobody is an admin.
|
||||
|
||||
1. In Gitea (Settings > Applications) create an OAuth2 application, a confidential client, with
|
||||
@@ -154,7 +155,7 @@ src/tbd/
|
||||
<group>/routes.clj Each route group (health, math, ...) owns its route subtree
|
||||
<group>/core.clj Business logic for the group, with no HTTP concerns
|
||||
auth/ Gitea OAuth (core), session + admin middleware (middleware), /auth routes
|
||||
nrepl/ On-demand nREPL server (core) and the admin-only POST /nrepl route
|
||||
nrepl/ On-demand nREPL server (core) and the admin-only `/nrepl` routes
|
||||
ui/ ClojureScript re-frame app (shadow-cljs project); ui/src/tbd/ui/{db,events,subs,views,core}.cljs
|
||||
.env-template Settings the server reads from the environment; copy to .env (git-ignored)
|
||||
resources/public/ index.html (the shell served at /) and js/ (compiled UI output, git-ignored)
|
||||
|
||||
Reference in New Issue
Block a user