Files
MicroNAS/CLAUDE.md
T
marcandClaude Sonnet 4.6 96055e6375 Codebase cleanup: remove dead code, fix docker, update docs
app.py:
- Remove 'raw' field from export dict entries (only comment/blank
  kinds need raw; export entries are always reconstructed from
  path/rest/enabled when writing back)
- Remove extra blank line

shares.js:
- Remove unused pathJson variable in SMB row (was only needed for
  the quota button, which was removed)

docker-compose.yml:
- Deleted entirely: was missing templates/ and static/ mounts so the
  Flask app couldn't serve pages; SYS_ADMIN cap_add was only needed
  for quotas; deployment is systemd, not Docker

README.md:
- Remove quota package from apt install command
- Remove quota setup section (feature removed)
- Remove docker-compose from Dev section

CLAUDE.md / PLANNING.md:
- Remove docker-compose.yml references and quotas.js from file tree

.gitignore:
- Remove redundant micronas.env entry (already covered by *.env)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 23:11:41 +02:00

54 lines
2.5 KiB
Markdown

# CLAUDE.md
Project context for Claude Code. See `PLANNING.md` for the full roadmap.
## What this is
A lightweight web GUI to manage file shares on a single home server (Proxmox
LXC/VM) — a minimal NAS control panel. Manages **SMB shares**, **NFS exports**,
**quotas**, and **system users** by editing host config files and reloading
daemons. Home/LAN use only.
## File layout
- `app.py` — Flask backend: all API routes, auth, business logic.
- `templates/index.html` — main SPA shell (Jinja2); no inline JS or CSS.
- `templates/login.html` — login form.
- `static/css/app.css` — custom dark theme (GitHub-palette CSS variables).
- `static/js/utils.js` — shared helpers: `esc()`, `showToast()`, `apiFetch()`.
- `static/js/dashboard.js` — dashboard data loading.
- `static/js/shares.js` — SMB/NFS CRUD (create, edit, delete, toggle).
- `static/js/quotas.js` — quota modal logic.
- `static/js/users.js` — user CRUD + password modal.
- `static/js/main.js` — page init and 30 s auto-refresh.
- `micronas.service` — systemd unit (gunicorn, reads `/etc/micronas.env`).
## How it runs
Directly on the LXC/VM as a `systemd` service, Flask behind `gunicorn`.
**Not** in Docker for production — the app manipulates host services
(`smbd`, `nfsd`, `/etc/exports`, `exportfs`, `setquota`).
Auth uses **Flask sessions** with a secret key derived from `MICRONAS_PASS`.
Credentials come from `/etc/micronas.env` (`MICRONAS_USER`, `MICRONAS_PASS`).
## Conventions & constraints
- **Keep it simple.** No database, no auth framework, dependency-light.
Config files (`/etc/samba/smb.conf`, `/etc/exports`) are the source of truth.
- **Security basics are non-negotiable even for home use:**
- Never use `subprocess.run(..., shell=True)` with user input. Use argument
lists.
- Validate all input: names `^[A-Za-z0-9_-]+$`; paths must resolve under
`/srv`.
- All routes require a valid session (`require_auth` decorator).
- **Config edits are safe:** `_parse_smb_conf()` / `_write_smb_conf()` and
`_parse_exports()` / `_write_exports()` parse into blocks and rewrite the
whole file — never blindly append for edit/delete/toggle operations.
- LAN-only. Do not add internet-facing features.
## Out of scope
Backups (Proxmox Backup Server), multi-user roles, databases, internet exposure,
multi-host management.
## Working agreement
- Work in the phases defined in `PLANNING.md`; pause after each phase for the
user to test.
- Explain changes briefly. Don't add heavy dependencies without asking.