Commit Graph

629 Commits

Author SHA1 Message Date
frank 5d62a9eef4
Fix/mobile issue 16043 (#3560)
* update color hash/id on login

* bump version

* fix test

* fix conflict with LoginAccount
2023-06-01 20:57:05 +08:00
Siddarth Kumar d37b605796
adjust padding for QR Images (#3510) 2023-06-01 13:41:01 +05:30
Igor Sirotin a7df4ed388
Local Pairing update for `StopNode` (#3536) 2023-06-01 08:33:57 +03:00
Jonathan Rainville b701005f3b
fix(pins): prepare content of pin messages so stickers work (#3523) 2023-05-30 15:05:38 -04:00
Richard Ramos b1a6607dbb chore: upgrade libp2p 2023-05-30 10:49:52 -04:00
Richard Ramos 3e4fe1e12f refactor: move circuit relay code to go-waku 2023-05-30 10:49:52 -04:00
Jonathan Rainville b68853c53e
fix(messenger_handler): fix group chat not being set as active (#3545)
Fixes an issue where if a group chat was first received from a non-contact, and later received from a contact, it still wouldn't save it as active.

That's because we checked if we were **newly** added instead of just if we were added. That meant that in the case I described above, the chat would then never have the chance to be set active.
2023-05-30 09:49:46 -04:00
Roman Volosovskyi aded83fc6e
Fix panic on receiving nil message at handleSyncKeypair 2023-05-26 18:43:44 +02:00
Roman Volosovskyi ee4003279a
Changes necessary to restore wallet on mobile app 2023-05-25 21:08:34 +02:00
Sale Djenic eeaaf0ce3f feat: accounts improvements applied
- old `accounts` table is moved/mapped to `keypairs` and `keypairs_accounts`
- `keycards` table has foreign key which refers to `keypairs.key_uid`
- `Keypair` introduced as a new type
- api endpoints updated according to this change
2023-05-25 19:46:47 +02:00
Michal Iskierko 1c17fbeacc feat(RemoteBurn): Add remote burn collectibles functionality
* Updating smart contract (new burn function)
* remoteBurn() and estimateRemoteBurn() functions
2023-05-25 13:34:53 +02:00
Vitaliy Vlasov ddfd0c5b14 Add lc-proxy-wrapper dep 2023-05-24 18:48:16 +03:00
frank 75864528b1
fix: display name/nickname/ens which includes dash is not resolved in the chat when mentioned (#3516) 2023-05-23 18:07:49 +08:00
Andrea Maria Piana 959e370389 config: add new Push notifications fleet
Also drop no longer existing `eth.test` fleet.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-05-19 17:29:18 +01:00
Andrea Maria Piana 6acb34bab7 Allow setting up wallet with new config
This commit does a few things:

1) Extend create/import account endpoint to get wallet config, some of
   which has been moved to the backend
2) Set up a loop for retrieving balances every 10 minutes, caching the
   balances
3) Return information about which checks are not passing when trying to
   join a token gated community
4) Add tests to the token gated communities
5) Fixes an issue with addresses not matching when checking for
   permissions

The move to the wallet as a background task is not yet complete, I need
to publish a signal, and most likely I will disable it before merging
for now, as it's currently not used by desktop/mobile, but the PR was
  getting to big
2023-05-19 13:23:21 +01:00
Icaro Motta 6fa8c11382
URL unfurling (initial implementation) (#3471)
This is the initial implementation for the new URL unfurling requirements. The
most important one is that only the message sender will pay the privacy cost for
unfurling and extracting metadata from websites. Once the message is sent, the
unfurled data will be stored at the protocol level and receivers will just
profit and happily decode the metadata to render it.

Further development of this URL unfurling capability will be mostly guided by
issues created on clients. For the moment in status-mobile:
https://github.com/status-im/status-mobile/labels/url-preview

- https://github.com/status-im/status-mobile/issues/15918
- https://github.com/status-im/status-mobile/issues/15917
- https://github.com/status-im/status-mobile/issues/15910
- https://github.com/status-im/status-mobile/issues/15909
- https://github.com/status-im/status-mobile/issues/15908
- https://github.com/status-im/status-mobile/issues/15906
- https://github.com/status-im/status-mobile/issues/15905

### Terminology

In the code, I've tried to stick to the word "unfurl URL" to really mean the
process of extracting metadata from a website, sort of lower level. I use "link
preview" to mean a higher level structure which is enriched by unfurled data.
"link preview" is also how designers refer to it.

### User flows

1. Carol needs to see link previews while typing in the chat input field. Notice
   from the diagram nothing is persisted and that status-go endpoints are
   essentially stateless.

```
#+begin_src plantuml :results verbatim
  Client->>Server: Call wakuext_getTextURLs
  Server-->>Client: Normalized URLs
  Client->>Client: Render cached unfurled URLs
  Client->>Server: Unfurl non-cached URLs.\nCall wakuext_unfurlURLs
  Server->>Website: Fetch metadata
  Website-->>Server: Metadata (thumbnail URL, title, etc)
  Server->>Website: Fetch thumbnail
  Server->>Website: Fetch favicon
  Website-->>Server: Favicon bytes
  Website-->>Server: Thumbnail bytes
  Server->>Server: Decode & process images
  Server-->>Client: Unfurled data (thumbnail data URI, etc)
#+end_src
```

```
     ,------.                                 ,------.                             ,-------.
     |Client|                                 |Server|                             |Website|
     `--+---'                                 `--+---'                             `---+---'
        |        Call wakuext_getTextURLs        |                                     |
        | --------------------------------------->                                     |
        |                                        |                                     |
        |             Normalized URLs            |                                     |
        | <- - - - - - - - - - - - - - - - - - - -                                     |
        |                                        |                                     |
        |----.                                   |                                     |
        |    | Render cached unfurled URLs       |                                     |
        |<---'                                   |                                     |
        |                                        |                                     |
        |         Unfurl non-cached URLs.        |                                     |
        |         Call wakuext_unfurlURLs        |                                     |
        | --------------------------------------->                                     |
        |                                        |                                     |
        |                                        |            Fetch metadata           |
        |                                        | ------------------------------------>
        |                                        |                                     |
        |                                        | Metadata (thumbnail URL, title, etc)|
        |                                        | <- - - - - - - - - - - - - - - - - -
        |                                        |                                     |
        |                                        |           Fetch thumbnail           |
        |                                        | ------------------------------------>
        |                                        |                                     |
        |                                        |            Fetch favicon            |
        |                                        | ------------------------------------>
        |                                        |                                     |
        |                                        |            Favicon bytes            |
        |                                        | <- - - - - - - - - - - - - - - - - -
        |                                        |                                     |
        |                                        |           Thumbnail bytes           |
        |                                        | <- - - - - - - - - - - - - - - - - -
        |                                        |                                     |
        |                                        |----.                                |
        |                                        |    | Decode & process images        |
        |                                        |<---'                                |
        |                                        |                                     |
        | Unfurled data (thumbnail data URI, etc)|                                     |
        | <- - - - - - - - - - - - - - - - - - - -                                     |
     ,--+---.                                 ,--+---.                             ,---+---.
     |Client|                                 |Server|                             |Website|
     `------'                                 `------'                             `-------'
```

2. Carol sends the text message with link previews in the RPC request
   wakuext_sendChatMessages. status-go assumes the link previews are good
   because it can't and shouldn't attempt to re-unfurl them.

```
#+begin_src plantuml :results verbatim
  Client->>Server: Call wakuext_sendChatMessages
  Server->>Server: Transform link previews to\nbe proto-marshalled
  Server->DB: Write link previews serialized as JSON
  Server-->>Client: Updated message response
#+end_src
```

```
     ,------.                       ,------.                                  ,--.
     |Client|                       |Server|                                  |DB|
     `--+---'                       `--+---'                                  `+-'
        | Call wakuext_sendChatMessages|                                       |
        | ----------------------------->                                       |
        |                              |                                       |
        |                              |----.                                  |
        |                              |    | Transform link previews to       |
        |                              |<---' be proto-marshalled              |
        |                              |                                       |
        |                              |                                       |
        |                              | Write link previews serialized as JSON|
        |                              | -------------------------------------->
        |                              |                                       |
        |   Updated message response   |                                       |
        | <- - - - - - - - - - - - - - -                                       |
     ,--+---.                       ,--+---.                                  ,+-.
     |Client|                       |Server|                                  |DB|
     `------'                       `------'                                  `--'
```

3. The message was sent over waku and persisted locally in Carol's device. She
   should now see the link previews in the chat history. There can be many link
   previews shared by other chat members, therefore it is important to serve the
   assets via the media server to avoid overloading the ReactNative bridge with
   lots of big JSON payloads containing base64 encoded data URIs (maybe this
   concern is meaningless for desktop). When a client is rendering messages with
   link previews, they will have the field linkPreviews, and the thumbnail URL
   will point to the local media server.

```
 #+begin_src plantuml :results verbatim
   Client->>Server: GET /link-preview/thumbnail (media server)
   Server->>DB: Read from user_messages.unfurled_links
   Server->Server: Unmarshal JSON
   Server-->>Client: HTTP Content-Type: image/jpeg/etc
 #+end_src
```

```
     ,------.                                    ,------.                                  ,--.
     |Client|                                    |Server|                                  |DB|
     `--+---'                                    `--+---'                                  `+-'
        | GET /link-preview/thumbnail (media server)|                                       |
        | ------------------------------------------>                                       |
        |                                           |                                       |
        |                                           | Read from user_messages.unfurled_links|
        |                                           | -------------------------------------->
        |                                           |                                       |
        |                                           |----.                                  |
        |                                           |    | Unmarshal JSON                   |
        |                                           |<---'                                  |
        |                                           |                                       |
        |     HTTP Content-Type: image/jpeg/etc     |                                       |
        | <- - - - - - - - - - - - - - - - - - - - -                                        |
     ,--+---.                                    ,--+---.                                  ,+-.
     |Client|                                    |Server|                                  |DB|
     `------'                                    `------'                                  `--'
```

### Some limitations of the current implementation

The following points will become separate issues in status-go that I'll work on
over the next couple weeks. In no order of importance:

- Improve how multiple links are fetched; retries on failure and testing how
  unfurling behaves around the timeout limits (deterministically, not by making
  real HTTP calls as I did). https://github.com/status-im/status-go/issues/3498
- Unfurl favicons and store them in the protobuf too.
- For this PR, I added unfurling support only for websites with OpenGraph
  https://ogp.me/ meta tags. Other unfurlers will be implemented on demand. The
  next one will probably be for oEmbed https://oembed.com/, the protocol
  supported by YouTube, for example.
- Resize and/or compress thumbnails (and favicons). Often times, thumbnails are
  huge for the purposes of link previews. There is already support for
  compressing JPEGs in status-go, but I prefer to work with compression in a
  separate PR because I'd like to also solve the problem for PNGs (probably
  convert them to JPEGs, plus compress them). This would be a safe choice for
  thumbnails, favicons not so much because transparency is desirable.
- Editing messages is not yet supported.
- I haven't coded any artificial limit on the number of previews or on the size
  of the thumbnail payload. This will be done in a separate issue. I have heard
  the ideal solution may be to split messages into smaller chunks of ~125 KiB
  because of libp2p, but that might be too complicated at this stage of the
  product (?).
- Link preview deletion.
- For the moment, OpenGraph metadata is extracted by requesting data for the
  English language (and fallback to whatever is available). In the future, we'll
  want to unfurl by respecting the user's local device language. Some websites,
  like GoDaddy, are already localized based on the device's IP, but many aren't.
- The website's description text should be limited by a certain number of
  characters, especially because it's outside our control. Exactly how much has
  not been decided yet, so it'll be done separately.
- URL normalization can be tricky, so I implemented only the basics to help with
  caching. For example, the url https://status.im and HTTPS://status.im are
  considered identical. Also, a URL is considered valid for unfurling if its TLD
  exists according to publicsuffix.EffectiveTLDPlusOne. This was essential,
  otherwise the default Go url.Parse approach would consider many invalid URLs
  valid, and thus the server would waste resources trying to unfurl the
  unfurleable.

### Other requirements

- If the message is edited, the link previews should reflect the edited text,
  not the original one. This has been aligned with the design team as well.
- If the website's thumbnail or the favicon can't be fetched, just ignore them.
  The only mandatory piece of metadata is the website's title and URL.
- Link previews in clients should be generated in near real-time, that is, as
  the user types, previews are updated. In mobile this performs very well, and
  it's what other clients like WhatsApp, Telegram, and Facebook do.

### Decisions

- While the user typing in the input field, the client is constantly (debounced)
  asking status-go to parse the text and extract normalized URLs and then the
  client checks if they're already in its in-memory cache. If they are, no RPC
  call is made. I chose this approach to achieve the best possible performance
  in mobile and avoid the whole RPC overhead, since the chat experience is
  already not smooth enough. The mobile client uses URLs as cache keys in a
  hashmap, i.e. if the key is present, it means the preview is readily available
  (naive, but good enough for now). This decision also gave me more flexibility
  to find the best UX at this stage of the feature.
- Due to the requirement that users should be able to see independent loading
  indicators for each link preview, when status-go can't unfurl a URL, it
  doesn't return it in the response.
- As an initial implementation, I added the BLOB column unfurled_links to the
  user_messages table. The preview data is then serialized as JSON before being
  stored in this column. I felt that creating a separate table and the related
  code for this initial PR would be inconvenient. Is that reasonable to you?
  Once things stabilize I can create a proper table if we want to avoid this
  kind of solution with serialized columns.
2023-05-18 15:43:06 -03:00
frank c7aebfeed3
Fix/mobile issue 15899 : error when trying login under updated password (#3493)
* fix: unable to reset password for newly created account using CreateAccountAndLogin

* remove unnecessary print

* add TestCreateAccountAndLogin

* update TestCreateAccountAndLogin

* bump version
2023-05-18 22:00:55 +08:00
yqrashawn 23138d0dbb
feat: start media server with no db right after logout (#3505) 2023-05-18 19:22:20 +08:00
yqrashawn 6fed50ce53
feat: media server and colorhash related change (#3500) 2023-05-18 14:27:16 +08:00
Andrea Maria Piana c26f45ae3d
Bump version to 0.151.8 2023-05-17 18:22:50 +01:00
Jonathan Rainville 9151aa7f04
fix(unviewed): fix edge case where unviewed count would be -1 (#3491) (#3496) 2023-05-16 12:11:52 -04:00
Ibrahem Khalil 1b6cebac22
Return consistent version of muteTill (#3460) 2023-05-15 18:12:26 +03:00
frank 31d02f5197
fix: Suggested list of mentions does not appear initially when '@' is typed in the editing message composer (#3484)
* fix: Suggested list of mentions does not appear initially when '@' is typed in the editing message composer

* bump version
2023-05-15 20:15:10 +08:00
frank 39f486a47a
optimize mention (#3479)
* optimize mention

* bump version
2023-05-15 15:21:41 +08:00
frank 0197e6c484
Feat/sync local deleted message (#3476)
* sync local deleted messages

* rebase

* add REPLACE

* fix lint

* defer rows.Close() / rename function

* add local pair test

* replace unused clock with _
2023-05-12 16:31:34 +08:00
Patryk Osmaczko fd05016c6e fix: mark imported messages as seen
fixes: status-im/status-desktop#10600
2023-05-10 18:51:48 +02:00
Ibrahem Khalil ff75280b30
Return compressed key with emojis (#3410) 2023-05-10 13:45:42 +03:00
Richard Ramos acad6e4958 chore: bump go-waku 2023-05-09 17:26:29 -04:00
frank 98d3b4198b
sync message for `delete for me` should not be sent to someone else (#3462)
* sync message for `delete for me` should not be sent to someone else

* addressed feedback from review

* remove LocalChatID

* bump version
2023-05-09 20:54:56 +08:00
Sale Djenic 31144ed5a3 chore: `password` removed from the `DeleteAccount` function
Asking for a password when removing a key is not necessary.
2023-05-09 10:48:44 +02:00
Jonathan Rainville edf8869ff2
fix(communities/manager): use sync.map to fix concurrent map writes err (#3445) 2023-05-05 14:13:55 -04:00
Michal Iskierko 4935848287 fix(GetAllCommunityTokens): Add GetAllCommunityTokens function
Issue #10254
2023-05-05 18:14:55 +02:00
frank a8fe8edd45
Fix/flaky test sync installation (#3452)
* fix flaky test: sync installation

* bump version

* fix error description
2023-05-05 14:44:26 +08:00
Boris Melnik ebf997bf63
fix(communities): Ignore requests to join from banned user (#3030) 2023-05-03 18:01:55 +03:00
Richard Ramos 975883407f refactor: improve mailserver batch handling 2023-05-02 07:27:57 -04:00
frank 8608aecdb4
fix mobile mention issue #15616 (#3388)
* fix mobile mention issue #15616

* add state != nil

* clear previous text when clear mentions

* fix: after selected mention user, and type @ not working

* bump version
2023-04-27 11:06:40 +08:00
frank a2ed1b78dd
feat:support backup/sync ens name (#3415) 2023-04-26 23:37:18 +08:00
Mohamed Javid 141a3e2633
[Fix] Added Community Kicked notification to response (#3427)
* [Fix] Added Community Kicked notification to response

* Added unit test and updated response merge method

* Update VERSION
2023-04-26 19:30:54 +05:30
Igor Sirotin b8209cbc7d
fix(pairing): Received installation event (#3422) 2023-04-26 14:48:49 +03:00
Andrea Maria Piana 213dc463bc
Bump version to 0.147.1 2023-04-25 16:02:29 +01:00
Mikhail Rogachev 96532f97c4
Unifying the endpoints for contact flows (#3379)
* fix: Contact requests flows

fix: pending CR notification
fix: use CR as message with provided text

* fix: Remove legacy default contact request

* fix: Add test case sending CR after removal from contacts

* fix: refactor contact request tests to have common steps

* fix: activate chat on sender side after receiveing the CR

* chore: Return defaultContactRequestID function

* fix: force activate chat on reciever's side

* fix: ensure AC notification's name for CR notifiaction match contact's primary name
2023-04-25 15:27:15 +04:00
Anthony Laibe dd7c59423f feat: add saved address created at 2023-04-22 10:22:43 +02:00
Sale Djenic a0b062b503 chore: unused `latest_derived_path` removed from `settings` table 2023-04-21 16:35:24 +02:00
Mohamed Javid 0eff61c57a
Community request to join changes for pending and declined states (#3387)
* Community request to join changes

* Fix read state for request to join notification

* Bring back deleted notification when updated with response

* Update Request timeout to 7 days

* Update VERSION
2023-04-21 14:48:47 +05:30
John Ngei 9dea0aaee3
Remove contact from the contact list of contacts the blocked contact
* Remove contact from the user's list of contacts when the contact is blocked by the user

* added test for removed blocked contact
2023-04-20 13:52:08 +03:00
frank 272173c939
feat:support backup/sync social settings (#3407)
* feat:support backup/sync social settings

* update binddata.go

* fix lint issue

* addressed feedback from @saledjenic @osmaczko

* addressed feedback from @saledjenic @osmaczko

* add corresponding test for local pairing

* addressed feedback from @saledjenic
2023-04-20 06:59:09 +08:00
Richard Ramos 2ebe5b97e7 fix: set default value in sync period column to 9d 2023-04-18 09:41:42 -04:00
Samuel Hawksby-Robinson 5a993e8f98 Added functionality to slow stop UDP beacon multicast/listen 2023-04-17 12:01:38 +01:00
Ibrahem Khalil 719af90fcc
Add muted_till param for chats (#3258) 2023-04-16 17:06:00 +02:00
Jonathan Rainville 62da2d404c
fix(image-album): make sure to delete all images part of an album (#3380)
* fix(image-album): make sure to delete all images part of an album

* test(delete): add test that deletes a message part of an album

* test(delete): add test where the signal to delete images is after

also adds the handling of deleteForMe

* fix(delete): add album deletion handling for deleteForMe
2023-04-14 13:17:56 -04:00