Invite: a friend's server's copied link carries the password you joined with

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
foxyzandClaude Opus 5.5 committed 2026-10-18 18:18:15 +03:00
1 parent cf61453e28
commit 6e14061a8a
3 files changed
+19 -6

No files matched your search

+8 -4
View File
@@ -508,7 +508,10 @@ class MembersCard extends StatelessWidget {
alignment: Alignment.centerLeft,
child: TextButton.icon(
key: const ValueKey('copy-invite'),
onPressed: () => copyToClipboard(context, friendInviteLink(address, nav.serverLabel.peek()),
onPressed: () => copyToClipboard(
context,
friendInviteLink(address, nav.serverLabel.peek(),
secret: AppScope.of(context).connection.params?.secret ?? ''),
done: 'Invite link copied'),
icon: const Icon(Icons.copy, size: 16),
label: const Text('Copy invite link'),
@@ -627,10 +630,11 @@ bool versionDiffers(String version, {String own = appVersion}) =>
version.isNotEmpty && own != '0.0.0-dev' && version != '0.0.0-dev' && version != own;
/// The invite link to a friend's server you are in ([address] as dialled,
/// "host:port"; never its password).
String friendInviteLink(String address, String name) {
/// "host:port"), with the password you joined with: the link is the key,
/// as for your own server.
String friendInviteLink(String address, String name, {String secret = ''}) {
final a = addressIn(address);
final port = a == null ? null : int.tryParse(a.port);
if (a == null || port == null) return address;
return InviteLink(host: a.host, port: port, name: name).uri;
return InviteLink(host: a.host, port: port, name: name, secret: secret).uri;
}