From ba8390f02a3cd3c4b95a3b8bbc4786f146cdc456 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 11 Jun 2021 14:32:16 +1000 Subject: [PATCH 1/4] Upgrade nim-waku to v0.4 --- CHANGELOG.md | 3 +++ nim-waku | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9cfced124..b206dfce75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Test: Upgrade nim-waku node to v0.4. + ## [0.6.0] - 2021-06-09 ### Changed diff --git a/nim-waku b/nim-waku index 44cafcfee3..5c58a19f4f 160000 --- a/nim-waku +++ b/nim-waku @@ -1 +1 @@ -Subproject commit 44cafcfee339bed7ff7d014e9cb3111d0c46c733 +Subproject commit 5c58a19f4f50e207dcfbf34f4514cc7e88c709e5 From bc544c8e0bbace22b9aa6c369b379974738bc4ac Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 11 Jun 2021 14:32:49 +1000 Subject: [PATCH 2/4] Update Light Push protocol string to match nim-waku v0.4 --- CHANGELOG.md | 1 + src/lib/waku_light_push/index.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b206dfce75..d2e0164202 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Test: Upgrade nim-waku node to v0.4. +- Waku Light Push upgraded to `2.0.0-beta1`. ## [0.6.0] - 2021-06-09 diff --git a/src/lib/waku_light_push/index.ts b/src/lib/waku_light_push/index.ts index c5a6c58046..da86796906 100644 --- a/src/lib/waku_light_push/index.ts +++ b/src/lib/waku_light_push/index.ts @@ -10,7 +10,7 @@ import { DefaultPubsubTopic } from '../waku_relay'; import { PushRPC } from './push_rpc'; -export const LightPushCodec = '/vac/waku/lightpush/2.0.0-alpha1'; +export const LightPushCodec = '/vac/waku/lightpush/2.0.0-beta1'; export { PushResponse }; export interface CreateOptions { From 8073021d820d2ed45f065eeff5bddcb1d6d4a5e6 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 11 Jun 2021 14:33:03 +1000 Subject: [PATCH 3/4] Do not fail if a chat message is malformed --- CHANGELOG.md | 1 + examples/web-chat/src/Message.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2e0164202..0e316f039b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Test: Upgrade nim-waku node to v0.4. - Waku Light Push upgraded to `2.0.0-beta1`. +- Examples (web chat): Catch error if chat message decoding fails. ## [0.6.0] - 2021-06-09 diff --git a/examples/web-chat/src/Message.ts b/examples/web-chat/src/Message.ts index cb49a14440..2ec9884caf 100644 --- a/examples/web-chat/src/Message.ts +++ b/examples/web-chat/src/Message.ts @@ -12,9 +12,17 @@ export class Message { static fromWakuMessage(wakuMsg: WakuMessage): Message | undefined { if (wakuMsg.payload) { - const chatMsg = ChatMessage.decode(wakuMsg.payload); - if (chatMsg) { - return new Message(chatMsg, wakuMsg.timestamp); + try { + const chatMsg = ChatMessage.decode(wakuMsg.payload); + if (chatMsg) { + return new Message(chatMsg, wakuMsg.timestamp); + } + } catch (e) { + console.error( + 'Failed to decode chat message', + wakuMsg.payloadAsUtf8, + e + ); } } return; From c293e268e83cceccdb1316caf12a0ea8a7f17d50 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 11 Jun 2021 14:34:50 +1000 Subject: [PATCH 4/4] Do not send message if a modifier is pressed to enable multiline msgs --- CHANGELOG.md | 1 + examples/web-chat/src/MessageInput.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e316f039b..adf23ef2b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Test: Upgrade nim-waku node to v0.4. - Waku Light Push upgraded to `2.0.0-beta1`. - Examples (web chat): Catch error if chat message decoding fails. +- Examples (web chat): Do not send message if shift/alt/ctrl is pressed, enabling multiline messages. ## [0.6.0] - 2021-06-09 diff --git a/examples/web-chat/src/MessageInput.tsx b/examples/web-chat/src/MessageInput.tsx index 3911bb873b..9322779d14 100644 --- a/examples/web-chat/src/MessageInput.tsx +++ b/examples/web-chat/src/MessageInput.tsx @@ -29,7 +29,12 @@ export default function MessageInput(props: Props) { }; const keyPressHandler = async (event: KeyboardEvent) => { - if (event.key === 'Enter') { + if ( + event.key === 'Enter' && + !event.altKey && + !event.ctrlKey && + !event.shiftKey + ) { await sendMessage(); } };