Commit0dbb13fremoved the whole feature: the apikeys tab, the /ui/apikeys routes, requireApiKey, the /api/v1 router, the ApiKey type, the better-sqlite3 dependency and UI_DB_FILE in the CLI and the installer. Only the untracked awg-ui/API.md survived, so the README went on to claim there was no key-based API at all. Restores all of it: ui.db with the api_keys table, awgk_ key generation storing only the SHA-256 and a display prefix, the JWT-guarded CRUD, and the /api/v1 router mounted before the JWT proxy on /api so the key auth is not swallowed. The tab comes back as its own folder and the registry picks it up on its own. UI_DB_FILE points at /etc/amnezia/amneziawg/ui.db, outside the install tree, so reinstalling keeps the keys; a fresh install moves the old one aside with its WAL sidecars. better-sqlite3 takes the slot of jsonwebtoken, which arrived with the MA7 integration and has been unused since068cab4removed it. One defect is not reproduced: the /api/v1 handlers called ctrl() without a try/catch, and Express 4 does not catch async rejections, so a single request with awg-ctrl down killed the panel process. They now answer 502 like proxy() already did. The API contract is documented in the README rather than linked: .gitignore excludes every markdown but README.md, so awg-ui/API.md is not in the repo and the link would break on a clone. Checked against a running server: login, key create/list/delete, 400 on a bad label, 401 without a JWT, "API key required" rather than "Unauthorized" on /api/v1, "Invalid API key" for a deleted key, last_used updating, and all three /api/v1 routes returning 502 with the process still alive.
34 lines
866 B
JSON
34 lines
866 B
JSON
{
|
|
"name": "awg-ui",
|
|
"version": "0.2.0",
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "vite build",
|
|
"preview": "vite preview",
|
|
"server": "tsx server.ts",
|
|
"mock": "tsx mock-server.ts",
|
|
"dev:mock": "concurrently -n mock,vite -c magenta,cyan \"tsx mock-server.ts\" \"vite\""
|
|
},
|
|
"dependencies": {
|
|
"axios": "^1.7.0",
|
|
"better-sqlite3": "^12.10.0",
|
|
"qrcode": "^1.5.0",
|
|
"react": "^18.3.0",
|
|
"react-dom": "^18.3.0"
|
|
},
|
|
"devDependencies": {
|
|
"concurrently": "^9.0.0",
|
|
"@types/better-sqlite3": "^7.6.13",
|
|
"@types/qrcode": "^1.5.0",
|
|
"@types/express": "^4.17.0",
|
|
"@types/node": "^22.0.0",
|
|
"@types/react": "^18.3.0",
|
|
"@types/react-dom": "^18.3.0",
|
|
"@vitejs/plugin-react": "^4.3.0",
|
|
"express": "^4.19.0",
|
|
"tsx": "^4.7.0",
|
|
"typescript": "^5.4.0",
|
|
"vite": "^5.4.0"
|
|
}
|
|
} |