feat(core,app,android,ios): add a first share without a detour or a name to invent

The empty library said to add a link "under Shares, then refresh" with
nothing to press on the phones, and on the desktop only switched page.
All three now open the add form from there, the desktop with the caret
in the link field; and adding already crawls, so there is nothing to
refresh.

A share's name was required before the viewer had seen anything to name.
It is optional now: without one, ShareStore::add_verified takes the
shared folder's own name from the link it has just opened. The link
comes first in each form. The desktop form submits on Enter, and the
Android link field has an eye to check what was pasted.
This commit is contained in:
nvrl committed 2026-10-12 22:37:17 +02:00
1 parent 5807493a4a
commit 603cc0c1a9
14 files changed
+153 -50

No files matched your search

+14 -2
View File
@@ -422,7 +422,7 @@ impl ShareStore {
}
/// [`Self::add`], but only once the link has been opened with the
/// password given.
/// password given. An empty `name` takes the shared folder's own.
///
/// A link that is mistyped, expired or behind the wrong password used to
/// be stored anyway, so the first try failed on the crawl and every retry
@@ -444,7 +444,19 @@ impl ShareStore {
}
let custom_password = custom_password.filter(|password| !password.is_empty());
let client = open_link(url, custom_password).await?;
let share = self.add(name, url, custom_password)?;
// A name is the viewer's to give, not theirs to invent before they
// can see anything: without one, the shared folder's own name.
let name = match name.trim() {
"" => client
.root_node()
.await
.ok()
.map(|root| root.name)
.filter(|name| !name.trim().is_empty())
.unwrap_or_else(|| "Shared folder".to_owned()),
given => given.to_owned(),
};
let share = self.add(&name, url, custom_password)?;
Ok((share, client))
}