betterNAS/apps
Harivansh Rathi c499e46a4d Add SQLite store and user auth for production deployment
Replace the in-memory JSON-backed store with a SQLite option using
modernc.org/sqlite (pure Go, no CGo). Add user authentication with
bcrypt password hashing and random session tokens.

SQLite store:
- Schema covers nodes, exports, tokens, ordinals, users, sessions
- WAL mode and foreign keys enabled
- Set BETTERNAS_CONTROL_PLANE_DB_PATH to activate (falls back to
  memory store when empty)

User auth:
- POST /api/v1/auth/register, login, logout, GET /me
- bcrypt (cost 10) for passwords, 32-byte hex session tokens
- Sessions stored in SQLite with configurable TTL
- Client endpoints accept session tokens or static client token
- CORS middleware via BETTERNAS_CORS_ORIGIN env var

New env vars: BETTERNAS_CONTROL_PLANE_DB_PATH, BETTERNAS_SESSION_TTL,
BETTERNAS_REGISTRATION_ENABLED, BETTERNAS_CORS_ORIGIN

24 tests pass including 7 SQLite store tests and 7 auth tests.
Builds clean with CGO_ENABLED=0.
2026-04-01 18:47:59 -04:00
..
control-plane Add SQLite store and user auth for production deployment 2026-04-01 18:47:59 -04:00
nextcloud-app Secure first-loop control-plane auth and mount routing. 2026-04-01 14:13:14 +00:00
node-agent Allow OPTIONS to bypass WebDAV auth for Finder discovery 2026-04-01 16:57:55 -04:00
web Migrate apps/web to shadcn/ui with preset b2D1F1IZv 2026-04-01 18:11:52 +00:00