Skip to content

Sprint 11 (v1.4.0): Sites Manager — domain lokal via hosts#11

Merged
devhardiyanto merged 3 commits into
mainfrom
sprint-11-sites
Jul 24, 2026
Merged

Sprint 11 (v1.4.0): Sites Manager — domain lokal via hosts#11
devhardiyanto merged 3 commits into
mainfrom
sprint-11-sites

Conversation

@devhardiyanto

Copy link
Copy Markdown
Owner

What

Fitur Sites Manager: petakan domain lokal (mis. myapp.test127.0.0.1) dengan mengelola file hosts sistem secara aman. Tab baru di Settings → Sites.

Why

Melengkapi roadmap M11/v1.4.0 — dev butuh domain lokal tanpa edit hosts manual. Fitur terberat (tulis file sistem + privilege elevation), sehingga dikawal spike gate lebih dulu.

How

  • Managed-block sentinel: Servel hanya menyentuh baris di antara marker # >>> servel managed block >>>; isi hosts di luar blok byte-identik. Idempoten, CRLF/LF aware.
  • Elevation per-operasi: app tetap non-admin; hanya sites_apply/restore memicu UAC (Windows Start-Process -Verb RunAs, macOS osascript, Linux pkexec + fallback manual). Cancel = no-op bersih.
  • Backup + diff + confirm: backup hosts (rotasi 5) sebelum tiap write; modal diff wajib dikonfirmasi sebelum elevation.
  • Data model: sites: Vec<Site> di config.json, migrasi v2→v3 (serde default []). Hosts = proyeksi sites yang enabled.

Keputusan owner (open question): tab Settings · custom IP (validasi IPv4) · manual apply + konfirmasi · Linux fallback manual.

Changes

  • tauri: commands/hosts.rs (baru) — managed-block engine, backup, elevated write, command sites_status/apply/restore + event sites-changed; config.rs skema sites + migrasi v2→v3 + load_config; register di lib.rs.
  • frontend: useSites.ts (baru) composable CRUD + apply/restore/status + validasi; tab "Sites" di Settings.vue dengan modal diff-confirm & restore; useConfig.ts schema.
  • release: bump v1.4.0.

Testing

  • 82 unit test Rust hijau (managed-block: inject/replace/preserve/idempoten/CRLF, migrasi v2→v3, backup rotasi, guard path-traversal). vue-tsc hijau, build bersih.
  • Spike elevation Windows PASS di hosts asli (UAC, blok masuk, baris luar utuh, tak korup, backup terbentuk).
  • ⚠️ Jalur cancel-UAC belum diuji empiris — perlu verifikasi manual QA (klik No → hosts tak berubah).

devhardiyanto

…3, elevated write, commands)

- Managed-block engine (parse/generate/diff) — hanya sentuh blok sentinel, idempoten, CRLF/LF aware.
- Skema config `sites` + migrasi v2->v3 + backup hosts (rotasi 5).
- Elevated write primitive: Windows RunAs (terbukti via spike), macOS osascript, Linux pkexec + fallback.
- Command sites_status/apply/restore + event sites-changed. Semua Result<T,String>, guard path-traversal restore.
- 82 unit test hijau.

devhardiyanto
… (diff-confirm)

- Composable useSites: CRUD (add/edit/delete/toggle) via useConfig persist, apply/restore/status, validasi IPv4 & domain.
- Tab Settings "Sites": daftar domain (domain -> ip, toggle, edit/hapus), input tambah custom IP, indikator sinkron/drift.
- Modal diff-confirm sebelum tulis hosts (UAC manual) + section restore backup.

devhardiyanto
@devhardiyanto
devhardiyanto merged commit eeadee2 into main Jul 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant