0.1.5: uploading checks everything first; no silent joining
- Before anything is made on the team, upload checks the vault the way the hub will (the hub's per-entry check now lives in core): a vault on one device only holds every line that looks like a secret as a red card to decide; lines marked "not a secret" are told to the team's hub at upload; history with a flagged entry offers a fresh start. A refused upload no longer leaves an empty vault on the team. - A vault on one device joins a same-named team vault only when they share history; otherwise the team's vault arrives beside it in its own folder. (A failed upload's empty vault had silently swallowed Brain.) - The upload sheet follows the vault live and waits for those decisions. - Full checks of such a vault are cached by content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -248,6 +248,7 @@ function UploadSheet({ v, teams, close, done }: { v: VaultStatus; teams: string[
|
||||
const [busy, setBusy] = useState('');
|
||||
const [detached, setDetached] = useState(false);
|
||||
const elsewhere = v.elsewhere && !detached ? v.elsewhere : null;
|
||||
const undecided = v.secrets.length;
|
||||
const run = async (what: string, f: () => Promise<string>) => {
|
||||
setBusy(what);
|
||||
setError('');
|
||||
@@ -280,6 +281,9 @@ function UploadSheet({ v, teams, close, done }: { v: VaultStatus; teams: string[
|
||||
) : (
|
||||
<>
|
||||
<p className="muted">{v.name} {detached ? 'is detached and ' : ''}is only on this Mac. Uploading puts it on the team with its history; you can then give people access on the team canvas.</p>
|
||||
{undecided > 0 && (
|
||||
<p className="error">{plural(undecided, 'note')} {undecided === 1 ? 'has' : 'have'} a line that looks like a secret, marked red in the list. Decide about each there first (replace it with where to find it, or mark it not a secret); a team never takes a secret.</p>
|
||||
)}
|
||||
{teams.length > 1 && (
|
||||
<>
|
||||
<label htmlFor="up-team">Team</label>
|
||||
@@ -296,9 +300,9 @@ function UploadSheet({ v, teams, close, done }: { v: VaultStatus; teams: string[
|
||||
{elsewhere ? (
|
||||
<button className="btn btn-primary" disabled={!!busy} onClick={detach}>{busy || `Detach from ${elsewhere}`}</button>
|
||||
) : secret ? (
|
||||
<button className="btn btn-primary" disabled={!!busy} onClick={() => upload(true)}>{busy || 'Upload current notes only'}</button>
|
||||
<button className="btn btn-primary" disabled={!!busy || undecided > 0} onClick={() => upload(true)}>{busy || 'Upload current notes only'}</button>
|
||||
) : (
|
||||
<button className="btn btn-primary" disabled={!!busy} onClick={() => upload(false)}>{busy || `Upload to ${host(team)}`}</button>
|
||||
<button className="btn btn-primary" disabled={!!busy || undecided > 0} onClick={() => upload(false)}>{busy || `Upload to ${host(team)}`}</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -347,7 +351,7 @@ function App() {
|
||||
const [comparing, setComparing] = useState<{ vault: string; copy: string } | null>(null);
|
||||
const [joining, setJoining] = useState(false);
|
||||
const [leaving, setLeaving] = useState<string | null>(null);
|
||||
const [uploading, setUploading] = useState<VaultStatus | null>(null);
|
||||
const [uploading, setUploading] = useState<string | null>(null);
|
||||
const [uploadTeams, setUploadTeams] = useState<string[]>([]);
|
||||
|
||||
const load = useCallback(() => invoke<Overview>('overview').then(setO).catch((e) => setError(String(e))), []);
|
||||
@@ -402,7 +406,7 @@ function App() {
|
||||
<section className="vaults">
|
||||
{o.vaults.length === 0 && <p className="muted center">Your vaults are on their way. They'll appear in {o.folder}.</p>}
|
||||
{o.vaults.map((v) => (
|
||||
<VaultCard key={v.path} v={v} several={o.teams.length > 1} canUpload={uploadTeams.length > 0} upload={setUploading} act={act} compare={(vault, copy) => setComparing({ vault, copy })} />
|
||||
<VaultCard key={v.path} v={v} several={o.teams.length > 1} canUpload={uploadTeams.length > 0} upload={(u) => setUploading(u.path)} act={act} compare={(vault, copy) => setComparing({ vault, copy })} />
|
||||
))}
|
||||
</section>
|
||||
<footer className="foot">
|
||||
@@ -432,7 +436,7 @@ function App() {
|
||||
</>
|
||||
)}
|
||||
{comparing && <CompareSheet {...comparing} close={() => setComparing(null)} done={(msg) => { setComparing(null); setToast(msg); load(); }} />}
|
||||
{uploading && <UploadSheet v={uploading} teams={uploadTeams} close={() => { setUploading(null); load(); }} done={(msg) => { setUploading(null); setToast(msg); load(); }} />}
|
||||
{uploading && o.vaults.some((x) => x.path === uploading) && <UploadSheet v={o.vaults.find((x) => x.path === uploading)!} teams={uploadTeams} close={() => { setUploading(null); load(); }} done={(msg) => { setUploading(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>
|
||||
|
||||
Reference in New Issue
Block a user