Commit Graph

1135 Commits

Author SHA1 Message Date
Jonathan Rainville b2d8f7f416
feat: add bookmarks table for the browser bookmarks
plus get bookmark icon using a lib
2020-11-16 13:31:34 -05:00
flexsurfer e8dbc66227
timeline reactions (#2079) 2020-11-16 12:54:39 +01:00
Roman Volosovskyi 4026841dc1
Add `New` flag to a received message
This change allows to count unviewed messages properly on the client
side when replied message is attached to reply before being passed.
2020-11-10 18:02:38 +02:00
Andrea Maria Piana f10e70ce96 Incerase verified count when ENS name does not verify
In some cases no error is returned but the name is not verified.
Before this ENS names would get verified again every 30s.
This commit changes the logic so that if they fail to verify without
error they will still exponentially backoff.
2020-11-10 08:11:39 +01:00
Roman Volosovskyi d20cf2583f
Revert "Allow receiving old messages after rejoining a pubchat"
This reverts commit fa136ebaa7.
2020-11-06 17:09:49 +02:00
andrey 40e2fc7526 fix timeline 2020-11-06 12:31:14 +01:00
Andrea Maria Piana 8966d81199 linting 2020-11-06 06:35:35 +01:00
andrey 6f207def2b timeline 2020-11-06 06:35:35 +01:00
Roman Volosovskyi fa136ebaa7
Allow receiving old messages after rejoining a pubchat 2020-11-05 15:13:38 +02:00
Andrea Maria Piana 75e0809f50 Split datasync messages in batches
When sending messages in quick succession, it might be that multiple
messages are batched together in datasync, resulting in a single large
payload.
This commit changes the behavior so that we can pass a max-message-size
and we split the message in batches before sending.

A more elegant way would be to split at the transport layer (i.e
waku/whisper), but that would be incompatible with older client.

We can still do that eventually to support larger messages.
2020-11-05 12:45:29 +01:00
Volodymyr Kozieiev 9dffff042e Don't send new members event when there are no new members 2020-11-02 17:05:56 +01:00
Volodymyr Kozieiev 3e446eed8c
Link previews support (#2059) 2020-10-27 19:35:28 +02:00
andrey b388002771 profile status updates 2020-10-27 14:56:35 +01:00
Andrea Maria Piana 5cea355541 Use in memory database for messenger tests 2020-10-14 08:37:23 +02:00
Andrea Maria Piana b11399ffc6 Use ErrRecordNotFound instead of sql.ErrNoRows
We were checking for the wrong error kind when pulling messages from the
database, which resulted in the code not retrying to pull the message,
giving flaky tests / race condition (that's present in production as
well)
2020-10-08 13:23:00 +02:00
Andrea Maria Piana 896f5c24bf Force migration if dirty 2020-10-01 13:47:59 +02:00
Andrea Maria Piana 200273aa0e Count runes and not characters 2020-09-25 14:02:09 +02:00
Andrea Maria Piana a759d9dd67 Fix push notification & mentions
The code had an issue where it would not register a chat if just joined
as re-register push notifications was called before the chat had been
added.
This commit fixes the behavior by making sure that the chat just joined
is included.
2020-09-17 07:35:18 +02:00
Andrea Maria Piana 61b345ff33 Add index on seen & hide long messages
This commit does two things:
1) Add an index on seen & update only the not-seen messages in the query
2) Hide long messages in the database, as that's likely spam
2020-09-10 10:26:59 +02:00
Andrea Maria Piana 3c6b741f71
Add tests for send notification & review feedback 2020-09-09 21:22:34 +02:00
Andrea Maria Piana 28e06daf6d
Dont sent messages to user who have not joined 2020-09-09 21:22:18 +02:00
Andrea Maria Piana 2d525f9503
Set block mentions 2020-09-09 21:22:17 +02:00
Andrea Maria Piana 4e18d21129
Re-register on adding or removing a chat 2020-09-09 21:22:16 +02:00
Andrea Maria Piana 0d998e1858
Show correct text in case of mentions 2020-09-09 21:22:15 +02:00
Andrea Maria Piana 18877cae6f
Handle mentions on server 2020-09-09 21:22:14 +02:00
Andrea Maria Piana 8ee3c75510
Support for basic push notification for mentions 2020-09-09 21:22:13 +02:00
Andrea Maria Piana 00c5b60d7f
Move message to common namespace 2020-09-09 21:22:12 +02:00
Andrea Maria Piana 7d5d413222
Add parsing and storing of mentions 2020-09-09 21:22:07 +02:00
Roman Volosovskyi 57728224d4
[mentions] ParsedText in quoted message
ParsedText is needed to properly display mention in quoted message.
2020-09-09 16:07:31 +03:00
Andrea Maria Piana 32b0af8ecc Add index to emoji reactions 2020-09-09 15:02:54 +02:00
andrey 3b748a2e46 group chat invitation 2020-09-07 12:15:58 +02:00
andrey 2eaa1fcad7 [#11046] Add local contact names 2020-09-07 11:34:06 +02:00
Volodymyr Kozieiev 88a3022ea8
Drop messages with text longer than 4096 characters (#2029) 2020-09-01 17:38:36 +03:00
Andrea Maria Piana 4a87764cca
seed mrand 2020-09-01 10:31:12 +02:00
Andrea Maria Piana 2ef1aa89f4
Handle connection change
Currently messenger has no notion of being online.
This might cause a problem as we retry to register with a push
notification server even if not connected to any peer, which will
inevitably fail.
This commit adds a method `handleConnectionChange` that will be called
every time the connection change state.
2020-08-27 18:54:31 +02:00
Andrea Maria Piana 0ff2542939
Don't add contact on update
When sending a contact update we automatically added the contact,
but that resulted in the contact not being synced correctly as
`saveContact` will not trigger the side effects.

For now I have removed this behavior. Ideally we should have a single
call that handles the side effects, but for that ENS names should be
stored in messenger, so we can propagate it.
2020-08-27 18:54:30 +02:00
Andrea Maria Piana 640f5533ca
handle notifications at-most-once 2020-08-27 18:54:29 +02:00
Andrea Maria Piana d7222c89e0
shuffle servers and limit & filter by chat id 2020-08-27 18:54:28 +02:00
Andrea Maria Piana 401d18e558
Enabled push notifications by default and add fleet 2020-08-27 18:54:06 +02:00
Andrea Maria Piana d09eaeacb8 Allow node to start a push notification server
This commit allows a node to start a push notification server.
If the config is set it will start a messenger with a corresponding pn
server.
2020-08-20 10:54:33 +02:00
Andrea Maria Piana ac6aff2486
Re-issue bundle on changed parameters 2020-08-19 11:57:39 +02:00
Andrea Maria Piana 4cf491ae38
add push notification type 2020-08-18 16:29:58 +02:00
Andrea Maria Piana 874d1d0fa6
Update protocol/pushnotificationclient/client.go
Co-authored-by: Samuel Hawksby-Robinson <samuel@samyoul.com>
2020-08-18 16:29:57 +02:00
Andrea Maria Piana 2b2616f82c
Bump version to 0.57.0 2020-08-18 16:29:55 +02:00
Andrea Maria Piana 5544e710ab
send push notification info with contact code 2020-08-18 16:29:38 +02:00
Andrea Maria Piana 541756c777
move contact code to subscription 2020-08-18 16:29:37 +02:00
Andrea Maria Piana b557a64612
move shared secrets to subscription 2020-08-18 16:29:36 +02:00
Andrea Maria Piana dd3cf55556
move installations to subscription 2020-08-18 16:29:35 +02:00
Andrea Maria Piana be8e64fe8d
fix version check 2020-08-18 16:29:35 +02:00
Andrea Maria Piana 46aef6f3df
nil registration when unregistering 2020-08-18 16:29:34 +02:00
Andrea Maria Piana aa78b89b40
handle unregistered clients 2020-08-18 16:29:33 +02:00
Andrea Maria Piana 4b9d3df5ad
Set RemotePushNotifications 2020-08-18 16:29:32 +02:00
Andrea Maria Piana 91074ac95e
Add apn-topic & token-type set by the client 2020-08-18 16:29:31 +02:00
Andrea Maria Piana 60e61caad8
invalidate token if allow from contacts only has been enabled 2020-08-18 16:29:30 +02:00
Andrea Maria Piana e8daee3712
Add topic 2020-08-18 16:29:29 +02:00
Andrea Maria Piana 2e231e690e Fix mark messages seen
If a chat had a last message the persistence call `Chat()` would not
decode `LastMessage` correctly.
This commit fixes the issue.
2020-08-17 13:40:10 +02:00
Samuel Hawksby-Robinson 19487da894
Fixes a minor rebase quirk (#2016)
See commit fc7b311838
2020-08-13 18:57:17 +01:00
Andrea Maria Piana 2d0818d873 Add SignMessageWithChatKey 2020-07-31 14:51:24 +02:00
Andrea Maria Piana ab01a05cd6 Don't use bytes anymore for LastMessage
LastMessage in chat was encoded in bytes so that we don't have to
encoded/decode everytime we save to db or pass the client.

An issue with emoji surfaced a problem with this approach.
Chat.LastClockValue represent the last clock value of any type of
message exchanged in a chat (emoji,group membership updates, contact
updates).
So when receving a new message, we should update LastMessage if the
clock of the LastMessage is lower than the received message, and we
should not only check LastClockValue, otherwise the message might be
discarded although it is the most recent.

This commit fixes the issue by keeping LastMessage as an object and
comparing LastMessage.Clock instead of LastClockValue
2020-07-31 13:40:11 +02:00
Andrea Maria Piana 5e4d58a807
Fix lastMessage when receive an emoji out of order 2020-07-30 21:14:47 +02:00
Andrea Maria Piana 2cc3a9bab1
increase count & add comment 2020-07-30 20:21:10 +02:00
Andrea Maria Piana b17d51e83d
describe chat entity comment 2020-07-30 20:21:08 +02:00
Andrea Maria Piana 33c87a670a
Uncommet test 2020-07-30 20:21:07 +02:00
Andrea Maria Piana 5910de3683
Handle emoji reaction in group chat 2020-07-30 20:21:06 +02:00
Andrea Maria Piana b3c6afe99b
dont use a pointer 2020-07-30 20:21:05 +02:00
Andrea Maria Piana eb087a00a4
add retracted 2020-07-30 20:21:04 +02:00
Andrea Maria Piana fcb901daf2
remove leftover emojialias 2020-07-30 20:21:03 +02:00
Andrea Maria Piana 4a83c86c3e
Add EmojiReaction to membershipupdatemessage 2020-07-30 20:21:02 +02:00
Andrea Maria Piana 7e7d95a907
camel case emojiReactions 2020-07-30 20:21:01 +02:00
Andrea Maria Piana a1a6e1c6c0
linting 2020-07-30 20:21:00 +02:00
Andrea Maria Piana 29f25c5486
Use local chat-id for matching messages 2020-07-30 20:20:59 +02:00
Andrea Maria Piana d067b56fc2
Fix cursored query for emoji 2020-07-30 20:20:58 +02:00
Andrea Maria Piana 37a2073008
add endpoint for getting emojis 2020-07-30 20:20:40 +02:00
Andrea Maria Piana 3e4e1ff663
update migrations 2020-07-30 20:20:39 +02:00
Andrea Maria Piana db43fa4894
camel case emojiReactions 2020-07-30 20:20:38 +02:00
Andrea Maria Piana 5a178939de
Use same message with flag for emoji retraction and use compound id 2020-07-30 20:20:37 +02:00
Andrea Maria Piana 2bf1991190
Use reflect.Value as ParsedMessage type and handle type case 2020-07-30 20:20:36 +02:00
Samuel Hawksby-Robinson de79f2ced0
Fix bug, logger var name collided with package name 2020-07-30 20:20:35 +02:00
Samuel Hawksby-Robinson acfcac6748
Implemented encodeChatEntity() into SendChatMessage and SendEmojiReaction 2020-07-30 20:20:34 +02:00
Samuel Hawksby-Robinson b70c362f2b
Bug fix on SendChatMessage() related to membership update 2020-07-30 20:20:33 +02:00
Samuel Hawksby-Robinson e9eb05e3d1
Bug fix on HandleMembershipUpdate() 2020-07-30 20:20:32 +02:00
Samuel Hawksby-Robinson 45c1e5ba1c
Updated MembershipUpdateMessage to use interfaced ChatEntity
Replaces ChatMessage only field
2020-07-30 20:20:31 +02:00
Samuel Hawksby-Robinson b6d24e950c
Added oneof chat_entity option to membership_update_message 2020-07-30 20:20:30 +02:00
Samuel Hawksby-Robinson 3e857203ac
Created ChatEntity encoding per chat type 2020-07-30 20:20:29 +02:00
Samuel Hawksby-Robinson 6ffe67deec
Added ChatEntity interface and made required changes for its use 2020-07-30 20:20:28 +02:00
Samuel Hawksby-Robinson ceed618102
Updated all MessageType references 2020-07-30 20:20:27 +02:00
Samuel Hawksby-Robinson c0a0238b0e
Moved protobuf MessageType enum into dedicated file 2020-07-30 20:20:26 +02:00
Samuel Hawksby-Robinson 373ddc5449
Added chat id to emoji reaction protobuf 2020-07-30 20:20:25 +02:00
Samuel Hawksby-Robinson 9a775619cd
Added basic EmojiReaction handler 2020-07-30 20:20:24 +02:00
Samuel Hawksby-Robinson eb562122b6
Added general protobuf umarshaller function 2020-07-30 20:20:23 +02:00
Samuel Hawksby-Robinson 5823ebe446
Added emoji reaction retraction message type unmarshalling 2020-07-30 20:20:22 +02:00
Samuel Hawksby-Robinson 5ee3a0a1b5
Added check emoji reaction retraction sender against current identity 2020-07-30 20:20:21 +02:00
Samuel Hawksby-Robinson 0a26d5a37d
Added emoji reaction retraction persistence 2020-07-30 20:20:20 +02:00
Samuel Hawksby-Robinson 106ccfcf0f
Added main functionality for SendEmojiReactionRetraction() 2020-07-30 20:20:19 +02:00
Samuel Hawksby-Robinson 8779b9a333
Added emoji_reaction get by id db func 2020-07-30 20:20:18 +02:00
Samuel Hawksby-Robinson fdc180039f
Added emoji_reaction persistence 2020-07-30 20:20:17 +02:00
Samuel Hawksby-Robinson 241439e56b
make generate 2020-07-30 20:20:16 +02:00
Samuel Hawksby-Robinson 9b8d0ba167
Added chat_id to emoji_reactions table 2020-07-30 20:20:15 +02:00
Samuel Hawksby-Robinson 4899b43a48
delinted 2020-07-30 20:20:14 +02:00
Samuel Hawksby-Robinson 0fdb2de6d1
Added return to prevent compile fail 2020-07-30 20:20:13 +02:00
Samuel Hawksby-Robinson db517eb1f4
Removed lines I've added 2020-07-30 20:20:12 +02:00
Samuel Hawksby-Robinson ae1e6db883
Removed original iteration 2020-07-30 20:20:11 +02:00
Samuel Hawksby-Robinson 2d9db29f31
Added Messenger.SendEmojiReaction()
stubbed SendEmojiReactionRetraction() added new protocol/EmojiReaction{}
2020-07-30 20:20:10 +02:00
Samuel Hawksby-Robinson 1dadab9104
Added emoji reaction app meta message type 2020-07-30 20:20:09 +02:00
Samuel Hawksby-Robinson f6594cc306
make generate for new emoji reaction table 2020-07-30 20:20:08 +02:00
Samuel Hawksby-Robinson 57319599de
created emoji_reaction table migration
Signed-off-by: Samuel Hawksby-Robinson <samuel@samyoul.com>
2020-07-30 20:20:07 +02:00
Samuel Hawksby-Robinson 961c00069b
Added emoji_reaction.proto to protobuf/service.go 2020-07-30 20:20:06 +02:00
Samuel Hawksby-Robinson 7049dfc0b8
Split emoji_reaction into dedicated proto 2020-07-30 20:20:05 +02:00
Samuel Hawksby-Robinson f16285ea0d
Fix of minor JSON formating bug 2020-07-30 20:20:04 +02:00
Samuel Hawksby-Robinson 412f6c6280
Lint fixes 2020-07-30 20:20:03 +02:00
Samuel Hawksby-Robinson 8cff21d254
make generate 2020-07-30 20:20:02 +02:00
Samuel Hawksby-Robinson a899264bc7
Added emoji reaction migrations 2020-07-30 20:20:01 +02:00
Samuel Hawksby-Robinson fc7b311838
Added switch to persistence 2020-07-30 20:20:01 +02:00
Samuel Hawksby-Robinson 351cc4403d
Added emoji reaction to message persistence 2020-07-30 20:20:00 +02:00
Samuel Hawksby-Robinson 073ff0b6af
Added message validator tests for emoji reactions 2020-07-30 20:19:59 +02:00
Samuel Hawksby-Robinson a0e7e0751c
Added emoji reaction message type validation 2020-07-30 20:19:58 +02:00
Samuel Hawksby-Robinson 154a169ffb
Moved message.ContentType base checks to a switch 2020-07-30 20:19:57 +02:00
Samuel Hawksby-Robinson 8089468e83
Added emoji reaction JSON RPC un/marshalling 2020-07-30 20:19:56 +02:00
Samuel Hawksby-Robinson 39bd6d479a
Added emoji retraction type 2020-07-30 20:19:55 +02:00
Samuel Hawksby-Robinson 9e09a265e2
Added emoji reaction content type 2020-07-30 20:19:54 +02:00
Samuel Hawksby-Robinson 2f5f00f1a8
Added EmojiReaction and EmojiReactionRetraction protobuf 2020-07-30 20:19:22 +02:00
Andrea Maria Piana eadf68325e Fix audio null value
If a message was inserted before the migration the field
audio_duration_ms would be set to NULL, and would not be serialized into
go correctly, as uint is non-nullable.
this commit fixes the issue by calling COALESCE on the value.
2020-07-30 15:00:39 +02:00
Andrea Maria Piana 0fb5ed2207 dont use a pointer for public methods 2020-07-29 12:51:48 +02:00
Andrea Maria Piana 45815e57d7
Add feature flag for push notifications and bump version 2020-07-27 17:20:16 +02:00
Andrea Maria Piana 4ae2c59e9b
Update protocol/message.go
Co-authored-by: Samuel Hawksby-Robinson <samuel@samyoul.com>
2020-07-27 17:15:16 +02:00
Andrea Maria Piana bdb2708a39
log 2020-07-27 17:15:15 +02:00
Andrea Maria Piana a2f273e616
use ms 2020-07-27 17:15:14 +02:00
Andrea Maria Piana 8716a8ce45
add audio duration 2020-07-27 17:15:10 +02:00
Andrea Maria Piana e58ba1e9c8
Add audio messages
Why make this change?

We are adding support of audio recorded files, similarly to how we did
with images

What has changed?

- Added protobuf definition, only AAC supported
- Added migrations to store files
- Fixed an issue with nil pointer when transaction would fail to be
created, causing the application to crash
2020-07-27 17:14:50 +02:00
Andrea Maria Piana 4b8739a8bc
Polish up and address review feedback 2020-07-27 08:51:28 +02:00
Andrea Maria Piana 63af6aa79b
Use ephemeral keys for sending messsages 2020-07-27 08:51:27 +02:00
Andrea Maria Piana 2be8dff54a
Make sure pn is resent and succesful in tests 2020-07-27 08:51:26 +02:00
Andrea Maria Piana 59d1ee4bb9
full e2e tests 2020-07-27 08:51:25 +02:00
Andrea Maria Piana 149fc5e3eb
Test token invalidation 2020-07-27 08:51:24 +02:00
Andrea Maria Piana d775bb888a
Handle retries & use sendChatMessage for e2e tests 2020-07-27 08:51:23 +02:00
Andrea Maria Piana aa5aa63342
Save response from push notification 2020-07-27 08:51:22 +02:00
Andrea Maria Piana 52e7089e39
Test contact only notifications 2020-07-27 08:51:21 +02:00
Andrea Maria Piana 58817aad5b
Use separate flag for allowonlyfromcontacst 2020-07-27 08:51:20 +02:00
Andrea Maria Piana bec8fbb855
Handle allowedContact lists 2020-07-27 08:51:19 +02:00
Andrea Maria Piana 12a3c5a31a
Add version to notification info 2020-07-27 08:51:18 +02:00
Andrea Maria Piana 026e16533f
Register asynchronously 2020-07-27 08:51:17 +02:00
Andrea Maria Piana 7a54d9b1c9
add unregister 2020-07-27 08:51:16 +02:00
Andrea Maria Piana 7bad800cb8
Add endpoints to enable/disable pns 2020-07-27 08:51:15 +02:00
Andrea Maria Piana be1800f2ec
drive settings from client 2020-07-27 08:51:14 +02:00
Andrea Maria Piana 8130e5b402
Run registration loop when servers are not fully registered 2020-07-27 08:51:13 +02:00
Andrea Maria Piana d2ab7f1bcd
refresh token only on revocation 2020-07-27 08:51:12 +02:00
Andrea Maria Piana 6f8c3025f3
Retrieve and add push notification registration 2020-07-27 08:51:11 +02:00
Andrea Maria Piana e89e36b081
Use resend automatically for datasync 2020-07-27 08:51:10 +02:00
Andrea Maria Piana c88df6c1c7
Handle messages sent to all devices 2020-07-27 08:51:09 +02:00
Andrea Maria Piana 7e8d1353d0
Create server identity on start if necessary 2020-07-27 08:51:08 +02:00
Andrea Maria Piana 3f4575b802
Add grant validation 2020-07-27 08:51:07 +02:00
Andrea Maria Piana 83e859c75f
add migrations 2020-07-27 08:51:06 +02:00
Andrea Maria Piana 20fb8607cb
keep track of queries & actually send pns, hurray 2020-07-27 08:51:05 +02:00
Andrea Maria Piana 1c379984cb
Handle registration with server 2020-07-27 08:51:04 +02:00
Andrea Maria Piana 7e16f940de
Handle query response 2020-07-27 08:51:03 +02:00
Andrea Maria Piana 7f6c8db6db
Handle push notification registration e2e 2020-07-27 08:51:02 +02:00
Andrea Maria Piana d985af4a7e
Implement server persistence for client & basic tests 2020-07-27 08:51:01 +02:00
Andrea Maria Piana 3afde67022
Move message processor to common and allow subscribing to sent messages 2020-07-27 08:51:00 +02:00
Andrea Maria Piana 9da64ef251
add basic config 2020-07-27 08:50:59 +02:00
Andrea Maria Piana 15a3b710a0
Add parsing of messages 2020-07-27 08:50:58 +02:00
Andrea Maria Piana 927f762589
Send gorush notifications 2020-07-27 08:50:57 +02:00
Andrea Maria Piana 6ed7f705b9
validate token type 2020-07-27 08:50:56 +02:00
Andrea Maria Piana 52da9de0c6
Handle query from client 2020-07-27 08:50:56 +02:00
Andrea Maria Piana 2eee956dc6
Store hashes pk 2020-07-27 08:50:55 +02:00
Andrea Maria Piana a15919527b
implement handle push notification registration 2020-07-27 08:50:54 +02:00
Andrea Maria Piana 91c7869d98
implement migrations & persistence for pns 2020-07-27 08:50:53 +02:00
Andrea Maria Piana 24df11bcf9
Pull push notification options from persistence 2020-07-27 08:50:52 +02:00
Andrea Maria Piana eed0df3420
Return decrypted options on validation 2020-07-27 08:50:51 +02:00
Andrea Maria Piana c5077609ee
remove push notification preferences 2020-07-27 08:50:50 +02:00
Andrea Maria Piana f984a041df
decrypt push notification preferences 2020-07-27 08:50:49 +02:00
Andrea Maria Piana e19c799be2
Remove PushNotificationRegister as we can use ApplicationMessage as a wrapper 2020-07-27 08:50:48 +02:00
Andrea Maria Piana 4ded7bf74c
Add skeleton for server and separate namespace for client 2020-07-27 08:50:48 +02:00
Andrea Maria Piana 92b699b59d
Add push notification register message 2020-07-27 08:50:47 +02:00
Andrea Maria Piana c4fa9825a9
Mute chat 2020-07-27 08:50:46 +02:00
Andrea Maria Piana 4720224ba2 expose getContactByID method 2020-06-17 12:24:58 +02:00
Andrea Maria Piana 20f45a7c1c Create different index for filtering
The index for message was fairly inefficient as it was only using the
cursor, as it was referring to the old `chat_id` field.

This meant that newer messages would be fetched much faster then older
messages.

The index has been changed so that now it includes `local_chat_id`
(which is currently used for filtering), and not using `hide`.

The reason being is that `hide` is a low cardinality index, so there's
no performance benefit to have it in, also it's mostly ignored by the
query planner.

This commit also adds the missing migrations, we generated the file, but
the source was missing, probably I forgot to add them in a rebase. They
have been generated from the migration file, using `RestoreAsset`.
2020-06-08 10:02:31 +02:00
Samuel Hawksby-Robinson 88f4f75ae1
Added basic history of the protocol package (#1984)
'm trying to add more documentation to parts of the repo that I go into.

I feel this basic history will make it easier to understand why the protocol package is as big as it is compared to the other packages in the repo, and help in understanding its existence.
2020-06-04 11:23:09 +01:00
Andrea Maria Piana 0bffeab908 Address feedback from code review and add quoted image 2020-06-01 11:30:04 +02:00
Andrea Maria Piana 2d17c40631 Refactor *Raw methods in message_processor.go
We used *Raw method in message_processor as before we had non-Raw method
during the transition from status-react to status-go. This naming is not
meaningful anymore, so I have changed it.
2020-06-01 11:30:04 +02:00
Andrea Maria Piana 8ba6625df0 Lower PoW for messages
Images are too large to be sent over waku/whisper with the
current PoW (0.002).

This commit lowers the PoW for sending messages to a lower value,
depending on the size.

This means that older clients will not be able to receive messages that
are greater than 50KB (none of the messages we currently send is anywhere close to
that, most of them are less than 1KB).

I would have preferred to set the PoW explicitly for images to be lower,
but it's not trivial as we use `datasync` to send messages and its
interface takes a payload that is to be dispatched and a function to
dispatch, at initialization stage.

This make it difficult (impossible?) to set a different PoW for a
particular message, without changing function signature in datasync
(which is agnostic to the transport used).

So a less cumbersome approach is to just fingerprint on size.
2020-06-01 11:30:04 +02:00
Andrea Maria Piana f5ab58b87f Add support for images
This commit adds support for images in protobuf messages.

The client can specify a path which will be used to load the image
and set the corresponding fields.

This makes the assumption that the RCP server runs on the same machine
as the client and they have access to the same files. This holds
currently for both status-react and status-console-client, we could
revisit and adds an upload if that changes in the future.
2020-06-01 11:30:04 +02:00
Andrea Maria Piana ee0a83fdc4 Load identicon & alias in chat.
Why make the changes?

Mainly performance, those fields are almost always present in the
database but they are re-calculated on load by the client as it does not
have necessarily access to it.

What has changed?
- Remove `_legacy` persistence namespaces as it's a vestige of the
initial move frmo status-react to status-go
- Pulling chats is now a join with contacts to add contact & alias
2020-05-25 14:00:04 +02:00
André Medeiros be683556ff
fix: close resultsets so we don't leak them (#1809)
* fix: close resultsets so we don't leak them

* Refactor browsers/database

To implement PR suggestions and improve code quality.

* Refactor services/permissions/database

To implement PR suggestions and improve code quality.

Co-authored-by: Samuel Hawksby-Robinson <samuel@samyoul.com>
2020-05-14 11:51:32 +01:00
Andrea Maria Piana 7bbe9561de Set chat active on being re-invited
If the user deletes/leaves a group chat, the chat is set as not active.
This means that if we are re-invited to the chat it won't be shown to
the user.

This commit changes this behavior so that if we are re-invited to the
chat it is set as active again.
2020-04-23 11:04:50 +02:00
Andrea Maria Piana 2d1f6c1cfa Don't pass contacts without custom fields to the client
When receiving a message with save a contact in the database in order to
avoid re-calculating image/profile.
This contact is then passed to the client, which can negatively impact
performance.

This commit changes the behavior so that only those contacts that have
some custom fields (have been explicitly added by the user, have been
blocked by the user, have sent a contact request or have a verified ens
name) are passed to the client.
2020-04-21 09:09:27 +02:00
Andrea Maria Piana 3a84afd0f1 Add replies to messages
Currently replies to messages are handled in status-react.
This causes some issues with the fact that sometimes replies might come
out of order, they might be offloaded to the database etc.

This commit changes the behavior so that status-go always returns the
replies, and in case a reply comes out of order (first the reply, later
the message being replied to), it will include in the messages the
updated message.

It also adds some fields (RTL,Replace,LineCount) to the database which
were not previously saved, resulting in some potential bugs.

The method that we use to pull replies is currently a bit naive, we just
pull all the message again from the database, but has the advantage of
being simple. It will go through performance testing to make sure
performnace are acceptable, if so I think it's reasonable to avoid some
complexity.
2020-04-16 15:51:28 +02:00
Andrea Maria Piana 4d2fb67add Allow to leave chat without removing it 2020-04-14 14:08:54 +02:00
Andrea Maria Piana f3fc6812cd Add change group chat name endpoint 2020-04-14 14:08:54 +02:00
Andrea Maria Piana 79be6eaf3a Increment retry count when ENS verification fails
We did not increment the counter when verification failed, which meant
that we would not backoff and retry more often that we should have.
2020-04-14 11:16:43 +02:00
Adam Babik 2948544b7a
update protocol package README (#1934) 2020-04-09 23:28:40 +02:00
Andrea Maria Piana 3c5354280c Return count of updated messages in MarkMessagesSeen
The frontend needs to know if the messaged marked as seen was actually
seen or not, as we might not have it loaded in the frontend.
2020-04-07 13:23:21 +02:00
Andrea Maria Piana a5874fdb21 Add content type for group chats 2020-03-25 09:29:08 +01:00
Andrea Maria Piana b9689fe109 add transparent background to identicon 2020-03-25 09:02:58 +01:00
Andrea Maria Piana fd4c627c2e Ignore full node flag when in topic mode 2020-03-23 15:10:07 +01:00
Andrea Maria Piana 9ee0e52ea3 Ignore full node flag when in topic mode 2020-03-23 15:10:07 +01:00
Adam Babik 831ab85561
Upgrade deps (#1892) 2020-03-09 08:55:58 +01:00
Adam Babik 17f91b3141
Clean up protocol package (#1890) 2020-03-09 07:19:23 +01:00
Andrea Maria Piana 7be1fcb978 Dont use system time for clock value in create group chat event 2020-02-29 11:28:46 +01:00
Andrea Maria Piana 5cc60de80b
Add mark as read endpoint (#1863) 2020-02-26 13:31:48 +01:00
Andrea Maria Piana 849492fda9
Add statusUpdate code (#1861)
* Add status-option code

This commits changes the behavior of waku introducing a new status-code,
`2`, that replaces the current single options codes.

* linting
2020-02-21 15:48:53 +01:00
Jakub Sokołowski 7a97325850 add GetContactByID to Messenger
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-02-13 12:55:09 +01:00
Adam Babik 1b515a5a5e
Implement new waku/0 handshake (#1848) 2020-02-11 17:59:21 +01:00
Jakub Sokołowski cca47ef6e1 rename gomarkdown/markdown to status-im/markdown
This resolves a dependency conflict we have with MatterBridge
which was using a newer version of the same package.
This resulted in a JSON marshalling bug that would crash the bridge.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-02-11 16:06:43 +01:00
Adam Babik 8b61d92d58
Remove protocol and eth-node submodules (#1835) 2020-02-10 12:22:37 +01:00
Andrea Maria Piana 0b6ad662b5
Bug/validate pubkey (#1838)
* validate chat before persisting

* add comment to public key generation
2020-02-07 12:56:30 +01:00
Adam Babik d27a507e0d
make Messenger.Timesource public (#1837) 2020-02-07 12:30:26 +01:00
Andrea Maria Piana f2eebd1e49
Verify ENS in the background (#1824)
Currently ENS are verified explicitly by status-react, this is not ideal
as if that fails it will have to be explicilty retried in status-react.
This commits changes that behavior so that ENS are verified in a loop
and updated if new messages are received.
2020-02-05 11:09:33 +01:00
Andrea Maria Piana 8931b14c4e
Explicitly init messenger (#1821)
Messenger needs to wait until all the topics/mailservers are loaded in
the client, so we explicitly add a way to call Init.
2020-01-29 20:40:06 +01:00
Pedro Pombeiro 741f43cb0c Fix wrong field being logged in `EnvelopesMonitor` 2020-01-23 17:19:10 +01:00
Andrea Maria Piana a4f88d0017
Fix ens names and contact (#1810)
Currently the wrong pk format was used to query the in-memory contacts,
this commit corrects the behavior.
2020-01-23 09:24:28 +01:00
Adam Babik 79b8112f89
Split shhext into shhext and wakuext (#1803) 2020-01-20 21:56:06 +01:00
Andrea Maria Piana 456bcfa022
Peg clock value to whisper timestamp (#1804)
This commit pegs the clock value to maximum + 120 seconds from the whisper
timestamp.
In this way the we avoid the scenario where a client makes the timestamp
increase arbitrarely.
2020-01-20 17:44:32 +01:00
Andrea Maria Piana 25d46c6d82
Fix waku tests & contact ens (#1802) 2020-01-17 13:39:09 +01:00
Pedro Pombeiro 7f45c43196 make lint-fix 2020-01-16 13:18:36 +01:00
Andrea Maria Piana c569d8a4ed
Sync installation messages & contact requests (#1791) 2020-01-15 08:25:09 +01:00
Adam Babik 44aa313981
Make shhext and protocol work with Waku (#1777)
This change makes shhext and protocol submodule work with Waku and Whisper.
2020-01-13 20:17:30 +01:00
Jakub Sokołowski 330d177de6 specify gomarkdown/markdown version to fix conflicts
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-01-11 19:41:24 +01:00
Andrea Maria Piana 88a1d0111e
Add Commands (#1731)
This commit adds handling of Transaction commands.
2020-01-10 19:59:01 +01:00
Adam Babik 37a508a97b
Integrate Waku service (#1759) 2020-01-08 12:12:23 +01:00
Pedro Pombeiro c8a911ebd1 Use goimports instead of gofmt 2020-01-06 10:17:23 +01:00
Pedro Pombeiro f494576ca2 Run `gofmt -s -w` 2019-12-20 11:24:26 +01:00
flexsurfer 9a656fe151 Fix sticker pack with id = 0 (#1749) 2019-12-20 10:35:07 +01:00
Pedro Pombeiro 0cf24d2c3e Remove unnecessary call to `GetFilter` 2019-12-19 14:11:48 +01:00
Pedro Pombeiro a5cf17cf4b Improve logging format in `messageProcessor.handleMessages` 2019-12-19 14:11:48 +01:00
Andrea Maria Piana baa0767c26
Handle membership update message
This commit does a few things:

1) Handle membership updates using protobuf and adds the relevant
endpoints.
2) Store in memory a map of chats + contacts for faster lookups, which
are then flushed to disk on each update
3) Validate incoming messages

Sorry for the large pr, but you know, v1 :)
2019-12-10 15:20:28 +01:00
Adam Babik 8069b8cd82
clean up eth-node and protocol versions 2019-12-09 18:35:11 +01:00
Adam Babik 392ec7ae8e
fix whisper v6 module definition 2019-12-09 16:29:47 +01:00
Adam Babik 0c6a4e0e65
fix Whisper submodule version; bump go-ethereum version 2019-12-09 16:26:00 +01:00
Adam Babik a636f33109
Set Whisper version submodule to v6 (#1725) 2019-12-09 11:36:14 +01:00
Adam Babik 4ac4a61e20
Move whisper to status-go monorepo (#1720) 2019-12-09 11:06:04 +01:00
Andrea Maria Piana fd49b0140e
Move to protobuf for Message type (#1706)
* Use a single Message type `v1/message.go` and `message.go` are the same now, and they embed `protobuf.ChatMessage`

* Use `SendChatMessage` for sending chat messages, this is basically the old `Send` but a bit more flexible so we can send different message types (stickers,commands), and not just text.

* Remove dedup from services/shhext. Because now we process in status-protocol, dedup makes less sense, as those messages are going to be processed anyway, so removing for now, we can re-evaluate if bringing it to status-go or not.

* Change the various retrieveX method to a single one:
`RetrieveAll` will be processing those messages that it can process (Currently only `Message`), and return the rest in `RawMessages` (still transit). The format for the response is:
`Chats`: -> The chats updated by receiving the message
`Messages`: -> The messages retrieved (already matched to a chat)
`Contacts`: -> The contacts updated by the messages
`RawMessages` -> Anything else that can't be parsed, eventually as we move everything to status-protocol-go this will go away.
2019-12-05 17:25:34 +01:00
Pedro Pombeiro 26b6d7c36a Create a home submodule for Eth node bridges- Rename StatusBackend to GethStatusBackend 2019-11-27 17:02:09 +01:00
Adam Babik 47ccf32cdb
Upgrade zap to v1.13.0 (#1694) 2019-11-25 21:16:00 +01:00
Adam Babik 10635d555f
Make extkeys as a submodule (#1691) 2019-11-22 13:58:03 +01:00
Pedro Pombeiro ed5a5c154d
Move to monorepo structure (#1684)
Move to a monorepo structure with submodules

- Rename status-protocol-go to status-go/protocol
2019-11-21 17:19:22 +01:00