Phase 3: full share CRUD + session login page

Backend:
- SMB config parser/writer (_parse_smb_conf, _write_smb_conf) for
  safe whole-file rewrites instead of append-only
- NFS exports parser/writer (_parse_exports, _write_exports) with
  support for disabled (commented-out) exports
- DELETE/PATCH/toggle endpoints for SMB and NFS shares
- parse_smb() now returns enabled field (reads available = no)
- get_nfs_shares() uses the new parser and returns enabled field
- Replace HTTP Basic Auth with Flask session auth (secret key derived
  from MICRONAS_PASS so sessions survive restarts)
- /login GET/POST, /logout routes

Frontend:
- Login page (templates/login.html) with same dark theme
- Sign out button in header
- Edit modal pre-filled with current share values
- Delete buttons wired up (with confirm dialog)
- Enable/Disable toggle per share (green/grey dot status indicator)
- Disabled shares shown at reduced opacity

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
marcandClaude Sonnet 4.6 committed 2026-06-19 22:26:32 +02:00
1 parent 1118681fd2
commit 5d9a9e62ec
4 files changed
+487 -69

No files matched your search

+23 -3
View File
@@ -48,10 +48,30 @@
</div>
</div>
<!-- Edit Share modal -->
<div class="modal fade" id="editModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="editModalTitle">Edit Share</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body" id="editModalBody"></div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" onclick="submitEdit()">Save</button>
</div>
</div>
</div>
</div>
<!-- Header -->
<div class="topbar d-flex justify-content-between align-items-center">
<span class="fw-semibold fs-5">MicroNAS</span>
<span id="lastRefresh" class="small" style="color:var(--muted)"></span>
<div class="d-flex align-items-center gap-3">
<span id="lastRefresh" class="small" style="color:var(--muted)"></span>
<a href="/logout" class="btn btn-sm" style="border:1px solid var(--border); color:var(--muted)">Sign out</a>
</div>
</div>
<div class="container-lg py-4">
@@ -147,7 +167,7 @@
<div class="fw-semibold mb-2">Shares</div>
<div class="table-responsive">
<table class="table table-striped mb-0">
<thead><tr><th>Name</th><th>Path</th><th>Valid Users</th><th>Actions</th></tr></thead>
<thead><tr><th>Name</th><th>Path</th><th>Valid Users</th><th></th><th>Actions</th></tr></thead>
<tbody id="smbTableBody">
<tr><td colspan="4" style="color:var(--muted)">Loading…</td></tr>
</tbody>
@@ -172,7 +192,7 @@
<div class="fw-semibold mb-2">Exports</div>
<div class="table-responsive">
<table class="table table-striped mb-0">
<thead><tr><th>Path</th><th>Clients</th><th>Actions</th></tr></thead>
<thead><tr><th>Path</th><th>Clients</th><th></th><th>Actions</th></tr></thead>
<tbody id="nfsTableBody">
<tr><td colspan="3" style="color:var(--muted)">Loading…</td></tr>
</tbody>