Add WebDAV support via Apache mod_dav

Backend:
- WebDAV config managed at /etc/apache2/conf-available/micronas-webdav.conf
  with BEGIN/END markers per share; reload apache2 on every write
- htpasswd file at /etc/micronas-webdav.passwd synced automatically on
  create_user, change_password, delete_user
- Full CRUD: POST/PATCH/DELETE /api/share/webdav[/<name>]
- _validate_webdav_users(): space-separated, no @group (not supported by Apache)
- Fix: _validate_users() now allows @groupname for SMB (was incorrectly rejected)
- Dashboard: apache2 status + restart button; webdav shares in /api/dashboard

Frontend:
- WebDAV tab: create form + table with clickable access URLs
- Edit modal supports 'webdav' type (name, path, users, permissions section)
- badge-webdav CSS class (green tint) in app.css
- dashboard.js renders badge-<type> dynamically (smb/nfs/webdav)

Docs: README WebDAV mount guide (Linux davfs2, Windows, Mac), PLANNING phase 4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
marcandClaude Sonnet 4.6 committed 2026-06-20 01:22:19 +02:00
1 parent 1be6a05cef
commit 7c9fe07a17
7 files changed
+338 -19

No files matched your search

+29 -1
View File
@@ -21,7 +21,14 @@ Run everything below **inside the LXC container** as root.
```bash
apt update
apt install -y git samba nfs-kernel-server python3 python3-venv
apt install -y git samba nfs-kernel-server apache2 apache2-utils python3 python3-venv
```
Enable Apache WebDAV modules:
```bash
a2enmod dav dav_fs auth_basic authn_file
systemctl restart apache2
```
### 2. Clone the repo
@@ -200,6 +207,27 @@ mount -t nfs <nas-ip>:/srv/data /mnt/nas
**Multiple networks (e.g. LAN + Tailscale):** enter both subnets space-separated in the Clients field when creating the export, e.g. `192.168.1.0/24 100.64.0.0/10`. Both get the same ro/rw setting.
### WebDAV
WebDAV shares are served by Apache at `http://<nas-ip>/dav/<sharename>` (port 80).
```bash
# Mount WebDAV on Linux (davfs2)
apt install davfs2
mount -t davfs http://<nas-ip>/dav/photos /mnt/webdav -o username=alice
# Permanent — /etc/fstab:
http://<nas-ip>/dav/photos /mnt/webdav davfs username=alice,_netdev 0 0
# Store password in /etc/davfs2/secrets:
http://<nas-ip>/dav/photos alice yourpassword
```
On **Windows**: open File Explorer → "Map network drive" → `\\<nas-ip>\DavWWWRoot\dav\photos` (WebDAV via WebClient service), or use `http://<nas-ip>/dav/photos` directly in the address bar.
On **Mac**: Finder → Go → Connect to Server → `http://<nas-ip>/dav/photos`.
User passwords are synced automatically — when you set a password in the Users tab it is also written to the WebDAV htpasswd file. Existing users created before WebDAV was set up need their password changed once to register.
### Useful commands
```bash