Skip to content

Commit 5bafff6

Browse files
shai-almogclaude
andcommitted
Parley: no regex split in the compiled server, guide prose, a sturdier admin menu pick
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent a89ed22 commit 5bafff6

6 files changed

Lines changed: 44 additions & 14 deletions

File tree

‎docs/developer-guide/Parley-Implementors-Guide.asciidoc‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
== Parley: Building on the sample
33

44
Parley is a messenger, and most of what makes one isn't in the server. The
5-
server stores and relays envelopes it can't open; the keys, the sessions, the
5+
server stores and relays ciphertext it can't open; the keys, the sessions, the
66
encryption and the history are in the app. Parley kept what it shares with
77
<<wayline-implementors-guide,Wayline>> and <<savor-implementors-guide,Savor>>: the
88
module layout, the accounts and sign-in, text messages, push notifications, the
@@ -188,8 +188,8 @@ the user's guide says so.
188188
=== Calls
189189

190190
A call is two apps and a relay. The server never touches the media: it rings the
191-
callee, relays the signalling, and hands out the addresses of the servers the apps
192-
use to reach each other. The media itself is WebRTC's, encrypted with DTLS-SRTP
191+
callee, relays the signalling, and hands out the addresses of the servers through which
192+
the apps reach each other. The media itself is WebRTC's, encrypted with DTLS-SRTP
193193
between the two devices.
194194

195195
The app owns the signalling, which is how `com.codename1.webrtc` is meant to be used
@@ -247,8 +247,8 @@ include::../demos/common/src/main/snippets/developer-guide/parley.sh[tag=parley-
247247

248248
`parley.ice.secret` is the secret shared with the TURN server -- coturn's
249249
`static-auth-secret`, with `use-auth-secret` on. `Calls.ice` builds the credential
250-
the way coturn checks it: the user name is the expiry time and the account, and the
251-
password is the HMAC-SHA1 of the user name under the secret. Nothing is stored, and
250+
the way coturn checks it: the username is the expiry time and the account, and the
251+
password is the HMAC-SHA1 of the username under the secret. Nothing is stored, and
252252
a leaked credential stops working on its own after `parley.ice.ttl` seconds. With
253253
no TURN server set, only STUN is handed out, and calls between networks that block
254254
a direct path fail. The default STUN server is a public one; run your own for a
@@ -275,7 +275,7 @@ include::../demos/common/src/main/snippets/developer-guide/parley.sh[tag=parley-
275275
`/bridge/whatsapp`, answers the verify token when subscribing, and signs every
276276
delivery with the app secret, which the server checks.
277277

278-
image::img/parley-bot-chat.png["A chat with the demo bot under a banner that says its messages are not end-to-end encrypted",scaledwidth=40%]
278+
image::img/parley-bot-chat.png["A chat with the demo bot under a banner that says its messages aren't end-to-end encrypted",scaledwidth=40%]
279279

280280
==== The privacy trade-off
281281

‎docs/developer-guide/Parley-Users-Guide.asciidoc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ There are three kinds of conversation:
121121
|===
122122

123123
The button on the chat list starts a conversation: find a person by name,
124-
username or phone number, make a group, or join one with an invite link.
124+
username or phone number, make a group, or join one with an invitation link.
125125

126126
A conversation shows its messages as they arrive, a typing indicator, and the
127127
state of each message you sent: sent, delivered, and read. A message can be

‎docs/developer-guide/languagetool-accept.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,3 +809,10 @@ inlined
809809
Parley
810810
Savor
811811
Wayline
812+
prekey
813+
prekeys
814+
rekey
815+
callee
816+
signalling
817+
coturn
818+
unconfigured
280 Bytes
Binary file not shown.

‎scripts/parley/backend/src/main/java/com/codenameone/examples/parley/call/Calls.java‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,19 @@ private void replay(CallRecord row) {
321321
return;
322322
}
323323
live.toDevice(row.getCalleeDevice(), replayed(row, OFFER, setup.getOffer()));
324-
String[] each = setup.getCandidates().split("\n");
325-
for (int iter = 0; iter < each.length; iter++) {
326-
if (each[iter].length() > 0) {
327-
live.toDevice(row.getCalleeDevice(), replayed(row, ICE, each[iter]));
324+
// One candidate a line. Walked by hand: the compiled backend has no
325+
// String.split, which is a regular expression.
326+
String all = setup.getCandidates();
327+
int start = 0;
328+
while (start < all.length()) {
329+
int end = all.indexOf('\n', start);
330+
if (end < 0) {
331+
end = all.length();
332+
}
333+
if (end > start) {
334+
live.toDevice(row.getCalleeDevice(), replayed(row, ICE, all.substring(start, end)));
328335
}
336+
start = end + 1;
329337
}
330338
setups.deleteById(row.getId());
331339
}

‎scripts/parley/web-e2e.mjs‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,24 @@ try {
342342
return seeded.some(name => text.includes(name));
343343
});
344344
// The admin's menu ends with the console, after Settings.
345-
await overflowCommand(4);
346-
await waitFor('the admin console', stepSeconds, async () =>
347-
/Messages\s+today/.test(await screenText()));
345+
// The menu's rows are clicked where they are drawn, and on a slow runner the
346+
// popup can still be sliding in when the click lands: a click that missed
347+
// leaves the chats list up, so the menu is opened and picked again.
348+
for (let attempt = 1; ; attempt++) {
349+
await overflowCommand(4);
350+
try {
351+
await waitFor('the admin console', attempt < 3 ? 15 : stepSeconds, async () =>
352+
/Messages\s+today/.test(await screenText()));
353+
break;
354+
} catch (e) {
355+
if (attempt >= 3 || problems.length > 0) {
356+
throw e;
357+
}
358+
say('the admin console did not open; picking it from the menu again');
359+
await page.keyboard.press('Escape');
360+
await settled();
361+
}
362+
}
348363
await waitFor('the console to ask the server for its figures', stepSeconds, async () =>
349364
requests.some(r => /^200 GET \/api\/admin\//.test(r)));
350365
await page.waitForTimeout(3000);

0 commit comments

Comments
 (0)