Backend:
- ListStorageJobs, ListSambaShares, ListNFSExports, ListUsers,
ListDirty, ListApplyLog, ListWatchedMounts: initialize with
make([]T, 0) instead of var x []T to avoid JSON null on empty.
Fixes "Cannot read properties of null" crash on /storage.
Frontend:
- Storage.tsx: defensive setJobs(res.jobs ?? []) to guard against
API returning null.
Tests:
- Add TestListStorageJobsEmptyReturnsSlice.
Version: 0.7.1
New 'Almacenamiento' page with:
- Auto-detection of rsync, mergerfs, snapraid binaries and mergerfs mount
- Configurable pool settings (source/dest, macOS cleanup, rsync flags)
- Mergerfs mover with dry-run preview and live SSE output streaming
- SnapRAID diff/sync/scrub/check with live SSE output
- Async job system (1 concurrent job) with SSE streaming
- Job history table
Backend:
- internal/storage/ package with capabilities, mergerfs, snapraid, jobs
- storage_config and storage_jobs DB tables (migration 0008)
- GET/PUT /api/storage/config, GET /api/storage/capabilities
- POST/GET /api/storage/jobs, GET /api/storage/jobs/{id}/stream
- Storage operations disabled when NASCTL_EXEC_SYSTEM=false
Closes #new-feature
Samba shares now support an 'invalid users' list (deny list), written
as 'invalid users = u1,u2' in smb.conf. The UI shows a ChipPicker
for valid_users and invalid_users, mutually exclusive, sourced from
the system user list.
feat: add ImportSystemUsers for fresh installations
When NASCTL_IMPORT_ON_BOOT=true, nasctl now imports existing system
users from /etc/passwd (UID 1000-60000) and /etc/group (supplemental
groups), and detects which have Samba accounts via 'pdbedit -L'.
Imported users are marked dirty so the admin can review before applying.
New POST /api/import/users endpoint for manual re-import.
This mirrors the existing import-on-boot flow for smb.conf and /etc/exports.
Migration 0005 (MigrateNFSClients) only runs once when first applied,
so any fsid=0 rows present before 0005 was applied never get repaired.
Migration 0006 triggers FixZeroFSIDs() which:
- Queries all nfs_exports rows with fsid=0
- Generates a new random fsid per row
- Updates the row
Version: 0.5.2
When migrating old clients format (string array) to new format
(NFSClient objects), also fix any exports that have fsid=0 by
generating a new random fsid. This resolves exportfs errors like:
exportfs: /path fsid=0 requires fsid= for NFS export
The migration now checks if r.FSID == 0 and generates a new one
using system.GenerateRandomFSID() before updating the row.
This is a backward-compatible MINOR bump (0.4.0 → 0.5.0).
BREAKING NOTES (for users upgrading from pre-0.5.0):
- The nfs_exports.clients column schema changed from []string to
[]NFSClient (per-host options). A migration (0005) transforms existing
string arrays into object arrays, taking export-level options as
defaults for each host.
- ValidateNFSClient now only accepts IPv4 (192.168.1.1) or IPv4/CIDR
(192.168.1.0/24). Hostnames, wildcards, netgroups are rejected.
- If you use NASCTL_IMPORT_ON_BOOT, re-import your /etc/exports to pick
up per-host options.
What changed:
- NFSClient type: {host, read_only, async, root_squash, subtree_check, advanced}
- NFSExport.Clients is now []NFSClient (was []string)
- export-level flags (ro/async/root_squash/subtree_check/advanced) are
preserved as template defaults for newly added hosts in the UI.
- buildExportLine generates: path host1(ro,sync,...) host2(rw,async,...) fsid=N
- ValidateNFSClient: strict IPv4/CIDR only (0-255 octets, /0-32 prefix)
- parseExportLine now parses per-host options from /etc/exports (previously
only the first host's options were kept, others were discarded)
- UI: per-host rows with toggles (ro/async/root_squash/subtree_check) and
advanced options (all_squash, secure, wdelay, hide, crossmnt)
Migration 0002 added fsid column with DEFAULT 0 but never
populated existing rows. Now PopulateLegacyFSIDs() runs after 0002
to extract fsid from legacy options string or generate random.
Also: move generateRandomFSID to internal/system to avoid import
cycles. Migration 0004 drops the legacy options column.
Version: 0.3.1 -> 0.3.2
NFS exports: replace plain-text options string with typed booleans
(read_only, async, root_squash, subtree_check) + advanced JSON blob.
fsid is auto-generated via crypto/rand with collision retry and is
never user-settable. Breaking API change (options field removed).
Dashboard: filter disks to manual+samba+nfs sources only; no more
auto-discovery of all /proc/mounts entries.
Settings: new 'Puntos de montaje vigilados' card with add/remove
for manual mount points. AllowedRoots validation applied.
Version bump: 0.1.10 -> 0.2.0
The previous SAVEPOINT approach failed because Go's tx.Exec() stops at
the first error and never reaches the ROLLBACK TO statements. This caused
every subsequent startup to re-run migration 0002, fail on the first
ALTER (column already exists from a prior partial run), and crash.
Fix runMigration() to:
- Execute migrations without a wrapping transaction (DDL in SQLite is
auto-commit anyway)
- Treat "duplicate column name" / "already exists" errors as success
and record the migration anyway, covering cases where a previous
failed attempt already partially modified the schema
Also simplify 0002_nfs_structured.sql back to plain ALTER TABLE
statements (no SAVEPOINT needed with the new Go-level tolerance).
Bump VERSION 0.1.9 -> 0.1.10
- Add schema_migrations table to track applied migrations
- Migrate() now checks if a migration was already applied before running
- 0002 rewritten to use SAVEPOINT+ROLLBACK per column, making it safe
to run even if some columns were partially added previously
- Each migration runs in its own transaction; INSERT into schema_migrations
only happens if the SQL executes without error
- Bump VERSION 0.1.8 -> 0.1.9
SQLite does not support adding multiple columns in a single ALTER TABLE
statement. The previous migration tried to add 6 columns at once and
caused a syntax error, crashing the service at startup.
Bump VERSION 0.1.7 -> 0.1.8
Backend:
- Add source/used_by/available/error fields to diskUsage in system status
- collectDiskUsage() now reads /proc/mounts, samba shares and NFS exports from DB
- Paths are deduplicated; shared paths list all shares/exports using them
- syscall.Statfs errors surface as available=false with user-facing error
- collectServiceStatus made a method of Server (receiver consistency)
Frontend:
- Settings page now shows two cards: mount points and shared resources
- Each path shows source badge (Sistema/Mount/SMB/NFS), used_by chips, progress bar
- Unavailable paths show amber warning instead of progress bar
- DiskUsage interface updated with new fields
- NFSExport interface updated with structured fields (fsid, async, etc)
- NFS page updated to use new export fields
Adds auto-detection of pre-existing Samba shares and NFS exports when
nasctl is installed on a host that already has these configs.
New package internal/importer parses smb.conf (INI-style) and
/etc/exports (line-based) and imports them into SQLite.
Imported shares/exports are marked dirty so the user must review
and apply manually before any file is overwritten.
Backup: before the first Apply, each module backs up the original
config to <path>.nasctl.bak.<timestamp> (one time only).
New CLI flag --import-on-boot / NASCTL_IMPORT_ON_BOOT env var
(default false, opt-in).
New API endpoints:
GET /api/import/status
POST /api/import/samba
POST /api/import/nfs
New DB methods ReplaceSambaShares/ReplaceNFSExports (transactional
replace-all), guarded by import.samba.done / import.nfs.done
settings flags.