Leave a team, delete a vault; keep tests out of the real settings

- A hub test unset LUNE_HOME for the whole test run, so later tests saved
  into the real user's config. Tests now always keep their own settings
  folder.
- Leaving a team: `lunesync leave` and the app's Leave hand over and remove
  this device there; a hub that's gone can be forgotten (folders stay).
- Deleting a vault (owner): everyone is removed the usual way, the history
  is archived on the hub and the name is freed. Canvas asks first.
- Connect this Mac says what to do when Lune isn't installed.
- Update checks skip http hubs instead of failing for all of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 14:36:46 +07:00
parent 7d1437e3ec
commit 4f6414b256
16 changed files with 278 additions and 10 deletions

View File

@@ -233,12 +233,47 @@ function CompareSheet({ vault, copy, close, done }: { vault: string; copy: strin
);
}
/** Leaving a team on this Mac. A team whose hub is gone can be forgotten here instead. */
function LeaveSheet({ team, close, done }: { team: string; close: () => void; done: (msg: string) => void }) {
const [error, setError] = useState('');
const [busy, setBusy] = useState(false);
const leave = async (forget: boolean) => {
setBusy(true);
setError('');
try {
done(await invoke<string>('leave_team', { team, forget }));
} catch (e) {
setError(String(e));
} finally {
setBusy(false);
}
};
const unreachable = error.includes("can't reach");
return (
<div className="scrim" onPointerDown={(e) => { if (e.target === e.currentTarget) close(); }}>
<div className="dialog" role="dialog" aria-modal="true" aria-label={`Leave ${host(team)}?`}>
<h2 className="disp">Leave {host(team)}?</h2>
<p className="muted">This Mac hands anything not yet shared to that team, then stops syncing its vaults. The team can add you back later.</p>
{error && <p className="error">{error}</p>}
{unreachable && <p className="muted">If that team is gone for good, forget it on this Mac only: its folders stay where they are, no longer synced.</p>}
<div className="actions">
<button className="btn" onClick={close}>Cancel</button>
{unreachable
? <button className="btn btn-danger" disabled={busy} onClick={() => leave(true)}>Forget it on this Mac</button>
: <button className="btn btn-danger" disabled={busy} onClick={() => leave(false)}>{busy ? 'Leaving…' : 'Leave'}</button>}
</div>
</div>
</div>
);
}
function App() {
const [o, setO] = useState<Overview | null>(null);
const [error, setError] = useState('');
const [toast, setToast] = useState('');
const [comparing, setComparing] = useState<{ vault: string; copy: string } | null>(null);
const [joining, setJoining] = useState(false);
const [leaving, setLeaving] = useState<string | null>(null);
const load = useCallback(() => invoke<Overview>('overview').then(setO).catch((e) => setError(String(e))), []);
useEffect(() => {
@@ -292,7 +327,10 @@ function App() {
{o.teams.map((t) => (
<li key={t}>
<span>{host(t)}</span>
<button className="btn btn-small btn-ghost" onClick={() => act('open_canvas', { team: t }, '')}>Open canvas</button>
<span>
<button className="btn btn-small btn-ghost" onClick={() => act('open_canvas', { team: t }, '')}>Open canvas</button>
<button className="btn btn-small btn-ghost" onClick={() => setLeaving(t)}>Leave</button>
</span>
</li>
))}
</ul>
@@ -310,6 +348,7 @@ function App() {
</>
)}
{comparing && <CompareSheet {...comparing} close={() => setComparing(null)} done={(msg) => { setComparing(null); setToast(msg); load(); }} />}
{leaving && <LeaveSheet team={leaving} close={() => setLeaving(null)} done={(msg) => { setLeaving(null); setToast(msg); load(); }} />}
{toast && <div className="toast-d" role="status">{toast}</div>}
</main>
);