Files
MicroNAS/CLAUDE.md
T
marcandClaude Sonnet 4.6 1be6a05cef Add dashboard IPs/restart/connections, SMB read-only and recycle bin
Dashboard:
- Server IPs card showing all non-loopback IPv4 interfaces
- Restart buttons next to smbd/nfsd status dots (POST /api/service/<name>/restart)
- Active SMB connections table (smbstatus -b parsed in backend)

SMB edit modal:
- Read only toggle (writable vs read only in smb.conf)
- Recycle Bin toggle (vfs objects = recycle, files go to .recycle folder)

Docs: PLANNING.md phase 3.5, README recycle bin + read-only, CLAUDE.md JS overview

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 01:13:32 +02:00

2.7 KiB

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: status, IPs, shares, active connections, restart buttons.
  • static/js/shares.js — SMB/NFS CRUD (create, edit, delete, toggle). Edit modal is async (fetches users+groups for dropdowns).
  • static/js/users.js — user CRUD + password modal + group management (loadGroups, createGroup, addMember, removeMember). Caches user list in _cachedUsers for group table.
  • static/js/main.js — page init and 30 s auto-refresh (calls loadDashboard, loadShares, loadUsers, loadGroups).
  • 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.