Commit Graph

515 Commits

Author SHA1 Message Date
Evgeny Poberezkin
2d4e99d610
cli: set device name for remote control via CLI option (#3427)
* cli: set device name for remote control via CLI option

* fix

* add property in tests
2023-11-22 22:11:32 +00:00
Evgeny Poberezkin
324f614e00
core: return remote controller port to UI (#3430) 2023-11-22 17:40:10 +00:00
spaced4ndy
a8576c2340
core: test forwarded message deduplication, mute terminal error (#3414) 2023-11-21 19:25:50 +04:00
Evgeny Poberezkin
47cd7de1ae core: 5.4.0.4 2023-11-21 00:00:29 +00:00
Evgeny Poberezkin
970ca3a409 Merge branch 'master' into remote-desktop 2023-11-20 10:35:20 +00:00
Alexander Bondarenko
68cbc605be
add remote session sequence to prevent stale state updates (#3390)
* add remote session sequence to prevent stale state updates

* remote RHStateKey

* add StateSeq check to controller

* clean up

* simplify

* undo withRemoteXSession API change

* simplify

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-11-20 10:19:00 +00:00
spaced4ndy
85e44dcb77
core: split group message forwarding tests (#3400) 2023-11-20 13:05:59 +04:00
Evgeny Poberezkin
cc434cda55 Merge branch 'master' into remote-desktop 2023-11-18 18:03:13 +00:00
spaced4ndy
c0e8740f50
core: group message forwarding (#3360)
* core: group message forwarding types

* xgrpmemcon

* rework xgrpmemcon to use intros table

* only forward w/t error

* forward msg

* xGrpMsgForward, check integrity outside

* deduplicate group messages

* test

* change error

* item forwarded flag

* intro_chat_protocol_version, bump version

* comment

* highly available client option

* more comments

* notify xgrpmemcon on deduplication

* member vrange

* encoding

* remove MsgForward

* remove import

* exclude files from forwarding

* refactor

* rename to align with protocol

* forward more message types

* add events

* remove unused error, function

* add x.file.cancel, x.info and x.grp.mem.new to forwarded messages

* remove unused x.msg.file.cancel

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-11-18 17:52:01 +00:00
Alexander Bondarenko
42e0400014
core: add remote controller discovery with multicast (#3369)
* draft multicast chat api

* prepare tests

* Plug discovery into chat api

* Add discovery timeout

* post-merge fixes

* rename discovery state to match others

* update for unified invitation

* fix review notices

* rename, remove stack, update simplexmq

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-11-17 18:50:38 +00:00
Alexander Bondarenko
cf102da4d3
remote: add test for rejected ca detection and stability (#3382)
* add test for rejected ca detection and stability

* update mq commit
2023-11-17 11:19:33 +00:00
Alexander Bondarenko
339c3d2be1
Send CRRemote*Stopped on all errors (#3376)
* Send CRRemote*Stopped on all errors

Commands use the same action, made idempotent and don't send events.

* fix tests

* get http2 cancelling back
2023-11-15 17:31:36 +00:00
Evgeny Poberezkin
3d617bce25
core: test JSON conversion (#3370) 2023-11-14 22:40:15 +00:00
Evgeny Poberezkin
c91625b32a
core: update remote host session state, terminate TLS in one more case (#3364)
* core: update remote host session state, terminate TLS in one more case

* name
2023-11-13 20:16:34 +00:00
Evgeny Poberezkin
72b25385ba
core: event when new remote host added (#3355) 2023-11-12 21:43:43 +00:00
Evgeny Poberezkin
92e3f576ca
core: return controller app info in response when connecting, validate ID key (#3353) 2023-11-12 14:40:49 +00:00
Evgeny Poberezkin
8b67ff7a00
core: remote error handling (#3347)
* core: remote error handling

* fix test, show DB errors
2023-11-11 16:03:12 +00:00
Alexander Bondarenko
227007c8f6
add /switch remote host (#3342)
* Add SwitchRemoteHost

* Add message test

* Match remote prefix and the rest of the line

* Move prefix match to utils
2023-11-10 17:49:23 +00:00
Alexander Bondarenko
f41861c026
core: terminate remote control TLS connection on both sides (#3338)
* handle session setup errors

* add command/async wrapper

* move furniture around

* detect disconnects and force them with closeConnection

* simplify http server log

* close TLS in other cases

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-11-09 22:43:44 +00:00
Alexander Bondarenko
b729144773
core: use xrcp protocol for desktop/mobile connection (#3305)
* WIP: start working on /connect remote ctrl

OOB is broken, requires fixing simplexmq bits.

* WIP: pull CtrlCryptoHandle from xrcp

* place xrcp stubs

* WIP: start switching to RemoteControl.Client types

* fix http2 sha

* fix sha256map.nix

* fix cabal.project

* update RC test

* WIP: add new remote session

* fix compilation

* simplify

* attach HTTP2 server to TLS

* starting host session in controller (WIP)

* more WIP

* compiles

* compiles2

* wip

* pass startRemote' test

* async to poll for events from host, test to send messages fails

* move xrcp handshake test to simplexmq

* detect session stops

* fix connectRemoteCtrl

* use step type

* app info

* WIP: pairing stores

* plug in hello/appInfo/pairings

* negotiate app version

* update simplexmw, remove KEM secrets from DB

* fix file tests

* tone down http2 shutdown errors

* Add stored session test

* bump simplexmq tag

* update simplexmq

* refactor, fix

* removed unused errors

* rename fields, remove unused file

* rename errors

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-11-08 20:13:52 +00:00
Evgeny Poberezkin
3839267f88 Merge branch 'master' into remote-desktop 2023-11-08 13:10:42 +00:00
spaced4ndy
8722d35278
core: fix deletion of contact without connections (#3327) 2023-11-08 13:15:08 +04:00
spaced4ndy
a04dc5d05b
core: preset simplex contact (#3321) 2023-11-07 17:45:59 +04:00
Evgeny Poberezkin
8482dbfd99
core: update remote API commands/events (#3295)
* core: update remote API

* Add session verification event between tls and http2

* roll back char_ '@' parsers

* use more specific parser for verification codes

* cabal.project.local for mac

---------

Co-authored-by: IC Rainbow <aenor.realm@gmail.com>
2023-11-01 19:08:36 +00:00
Evgeny Poberezkin
b2f9270452 Merge branch 'master' into remote-desktop 2023-11-01 18:05:51 +00:00
Evgeny Poberezkin
c8c17a2f68
core: fix uri parse to not include trailing punctuation in URIs (#3296)
* core: fix uri parse to not include trailing punctuation in URIs

* simplify
2023-11-01 13:10:19 +00:00
Alexander Bondarenko
02c0cd5619
Cut at attaching http server/client (#3299)
* Cut at attaching http server/client

* switch to xrcp branch
2023-11-01 10:48:58 +00:00
spaced4ndy
07173f7b2f
core: add delays to testXFTPMarkToReceive test (#3294) 2023-10-31 10:51:20 +04:00
spaced4ndy
b1fdc936a6 Merge branch 'master' into remote-desktop 2023-10-30 20:58:39 +04:00
spaced4ndy
f34bbdbd9c
core: improve group link protocol (immediately establish group connection without first creating contact) (#3288) 2023-10-30 20:40:20 +04:00
Alexander Bondarenko
be44632b0b
implement some of the robust discovery rfc (#3283)
* implement robust discovery

* remove qualified

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-10-30 14:00:54 +00:00
Evgeny Poberezkin
d90da57f12
core: store/get remote files (#3289)
* core: store remote files (wip)

* fix/test store remote file

* get remote file

* get file

* validate remote file metadata before sending to controller

* CLI commands, test

* update store method
2023-10-29 19:06:32 +00:00
Evgeny Poberezkin
16bda26022
core: derive JSON with TH (#3275)
* core: derive JSON with TH

* fix tests

* simplify events

* reduce diff

* fix

* update simplexmq

* update simplexmq
2023-10-26 15:44:50 +01:00
Evgeny Poberezkin
3790752378 Merge branch 'master' into remote-desktop 2023-10-26 00:00:58 +01:00
Evgeny Poberezkin
4a8da196ad
core: more permissive display name validation, only allow single quotes in CLI for the names with spaces (#3282) 2023-10-25 11:55:06 +01:00
Evgeny Poberezkin
6185971827 Merge branch 'master' into remote-desktop 2023-10-24 23:19:49 +01:00
spaced4ndy
239765e482
core: create new group with incognito membership (#3277) 2023-10-24 20:59:06 +04:00
Evgeny Poberezkin
b5e114d834 Merge branch 'master' into remote-desktop 2023-10-22 13:04:15 +01:00
Alexander Bondarenko
0d1a080a6e
remote protocol (#3225)
* draft remote protocol types and external api

* types (it compiles)

* add error

* move remote controller from http to remote host client protocol

* refactor (doesnt compile)

* fix compile

* Connect remote session

* WIP: wire in remote protocol

* add commands and events

* cleanup

* fix desktop shutdown

* prepare for testing remote files

* Add file IO

* update simplexmq to master

with http2 to 4.1.4

* use json transcoder

* update simplexmq

* collapse RemoteHostSession states

* fold RemoteHello back into the protocol command
move http-command-response-http wrapper to protocol

* use sendRemoteCommand with optional attachments
use streaming request/response

* ditch lazy body streaming

* fix formatting

* put body builder/processor closer together

* wrap handleRemoteCommand around sending files

* handle ChatError's too

* remove binary, use 32-bit encoding for JSON bodies

* enable tests

* refactor

* refactor request handling

* return ChatError

* Flatten remote host

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-10-22 09:42:19 +01:00
spaced4ndy
87d84cfccc
core: filter connection plan query results by user_id (#3251) 2023-10-21 19:13:32 +04:00
Evgeny Poberezkin
92eae012b3 Merge branch 'master' into remote-desktop 2023-10-16 21:38:54 +01:00
spaced4ndy
e4c8386f3f
core: replace simplex:/ with simplex.chat links in view; remove trustedUri flag from simplex links markdown format (#3235) 2023-10-16 19:23:38 +04:00
spaced4ndy
9ed31261e1
core: check saved links and hashes by both connection request uri schemas for connection plan (#3233) 2023-10-16 16:16:03 +04:00
spaced4ndy
4b6df43e97
core: confirm to reconnect via address plan (#3212)
* core: confirm to reconnect plan

* rework query to prefer connections with contacts
2023-10-16 16:10:56 +04:00
Evgeny Poberezkin
c2a320640b
core: local encryption for auto-received inline files (e.g. small voice messages) (#3224)
* core: local encryption for auto-received inline files

* update view, test
2023-10-15 18:16:12 +01:00
Evgeny Poberezkin
fc1bba8817
remote: refactor (WIP) (#3222)
* remote: refactor (WIP)

* refactor discoverRemoteCtrls

* refactor processRemoteCommand, storeRemoteFile

* refactor fetchRemoteFile

* refactor startRemoteHost, receiving files

* refactor relayCommand
2023-10-15 14:17:36 +01:00
Evgeny Poberezkin
f5e9bd4f8b
core: add set display name (#3216)
* core: add set display name

* enable all tests
2023-10-14 13:10:06 +01:00
Evgeny Poberezkin
5e6aaffb09
simplify remote api, add ios api (#3213) 2023-10-13 22:35:30 +01:00
Alexander Bondarenko
193361c09a
core: fix remote handshake test (#3209)
* Fix remoteHandshakeTest

Sidesteps some yet to be uncovered bug when
mobile stops its side before the desktop.

* remove ambiguous update warning

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-10-13 18:53:04 +01:00
Evgeny Poberezkin
392447ea33 core: fix test 2023-10-13 17:52:27 +01:00
Evgeny Poberezkin
5d4006f291 Merge branch 'master' into remote-desktop 2023-10-13 17:46:14 +01:00
Evgeny Poberezkin
ab290fb068
core: track network statuses, use in commands/events (#3211)
* core: track network statuses, use in commands/events

* ui types, test

* remove comment
2023-10-13 11:51:01 +01:00
Evgeny Poberezkin
6dca71cc87 Merge branch 'master' into remote-desktop 2023-10-12 11:40:23 +01:00
Evgeny Poberezkin
73652e4bba Merge branch 'master' into remote-desktop 2023-10-12 10:43:59 +01:00
spaced4ndy
b956988a83 tests: simplify testMemberContactInvitedConnectionReplaced (for stable) 2023-10-12 12:20:31 +04:00
spaced4ndy
7b488c7f1b
tests: improve tests (#3203) 2023-10-12 11:52:14 +04:00
Evgeny Poberezkin
c2a858b06e
core: convert single-field to tagged JSON encoding (#3183)
* core: convert single-field to tagged JSON encoding

* rename

* rename

* fixes, test

* refactor
2023-10-11 19:11:01 +01:00
Evgeny Poberezkin
bca9473d77
core: settings to hide member messages, to show only reply (and mention) notifications (#3190)
* core: settings to hide member messages, to show only reply (and mention) notifications

* change type for showMessages

* commands for member settings

* member and notification settings

* test

* take member settings into account when showing messages and notifications

* fix to show sent messages

* store blocked items

* types

* rename to MFMentions
2023-10-11 19:10:38 +01:00
spaced4ndy
b03fe183bb
tests: modify testMemberContactInvitedConnectionReplaced to not rely on chat item order, print output (#3198) 2023-10-11 15:26:44 +04:00
Evgeny Poberezkin
4ecf94dfad
core: move CLI notifications and active chat to view layer (for remote CLI) (#3196)
* core: move CLI notifications to view layer (to allow notifications in remote CLI)

* remove unused

* refactor activeTo

* move activeTo to ChatTerminal

* refactor

* move back

* remove extension
2023-10-11 09:50:11 +01:00
Alexander Bondarenko
6f5ba54f7b
core: remote session files (#3189)
* Receiving files on CRRcvFileComplete

* Add remote /fr test

* Add broken startFileTransfer notice

* Sending files with SendFile/SendImage

With tests for SendFile.

* Add APISendMessage handling

* Test file preconditions

No files should be in stores before actual sending.

* Fix mobile paths in storeFile
2023-10-11 09:45:05 +01:00
spaced4ndy
a67b79952b
core: connection plan api; check connection plan before connecting in terminal api (#3176) 2023-10-10 21:19:04 +04:00
Evgeny Poberezkin
2b228a893a Merge branch 'master' into remote-desktop 2023-10-09 17:21:47 +01:00
spaced4ndy
d72c04682f
Merge pull request #3174 from simplex-chat/contact-merge-improvements
contact merge improvements
2023-10-09 18:05:46 +04:00
Evgeny Poberezkin
2eb213741c Merge branch 'master' into remote-desktop 2023-10-09 10:35:38 +01:00
Evgeny Poberezkin
bc26c23d58 fix MobileTests (add single field JSON tag) 2023-10-09 10:35:13 +01:00
spaced4ndy
ab46cbc5dd
core: relax contact probing: don't send probe hashes to new contacts except group link hosts; still send probe hashes to group members (#3180) 2023-10-09 09:46:58 +04:00
Alexander Bondarenko
91561da351
core: http transport for remote session (#3178)
* Wire some of the session endpoints

* Start sending remote commands

* Expand remote controller

- Fix queues for pumping to remote
- Add 3-way test
- WIP: Add TTY wrapper for remote hosts
- Stop remote controller w/o ids to match starting

* Fix view events

* Drop notifications, add message test

* refactor, receive test

* hunt down stray asyncs

* Take discovery sockets in brackets

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-10-07 14:23:24 +01:00
spaced4ndy
303d0eedf5
core: merge new contacts with existing contacts and group members (#3173) 2023-10-04 20:58:22 +04:00
Evgeny Poberezkin
7959c75df7 Merge branch 'master' into remote-desktop 2023-10-04 16:37:15 +01:00
Alexander Bondarenko
0bcf5c9c66
Add commands for remote session credentials (#3161)
* Add remote host commands

* Make startRemoteHost async

* Add tests

* Trim randomStorePath to 16 chars

* Add chat command tests

* add view, use view output in test

* enable all tests

* Fix discovery listener host

Must use any, not broadcast on macos.

* Fix missing do

* address, names

* Fix session host flow

* fix test

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-10-04 16:36:10 +01:00
Evgeny Poberezkin
38be27271f
core: profile names with spaces (#3105)
* core: profile names with spaces

* test

* more test

* update name validation, export C API

* refactor

* validate name when creating profile in CLI

* validate display name in all APIs when it is changed
2023-10-02 21:56:11 +01:00
Evgeny Poberezkin
1d34500fba
core: revert stop/close changes made for Windows (#3145)
* Revert "core: return error response when wrong passphrase is passed to start"

This reverts commit ea319313f1.

* Revert "core: support closing/re-opening store on chat stop/start (#3132)"

This reverts commit 3c7fc6b0ee.
2023-09-29 11:14:10 +01:00
spaced4ndy
957f3b3eb0
core: delete unused contact silently (#3140) 2023-09-28 13:16:03 +04:00
Evgeny Poberezkin
ea319313f1 core: return error response when wrong passphrase is passed to start 2023-09-27 21:15:19 +01:00
spaced4ndy
c64d1e8361
core: notify contact about contact deletion (#3131) 2023-09-27 19:36:13 +04:00
Evgeny Poberezkin
3c7fc6b0ee
core: support closing/re-opening store on chat stop/start (#3132)
* core: support closing/re-opening store on chat stop/start

* update .nix refs

* kotlin: types

* add test

* update simplexmq
2023-09-27 15:26:03 +01:00
Evgeny Poberezkin
b3e880ee54
core: optimize C apis (#3100)
* core: optimize C apis

* more

* fix tests

* use pokeByteOff

* write lazy bytestring to buffer without conversion to strict

* avoid conversion of JSON to strict bytestrings
2023-09-22 13:45:16 +01:00
Evgeny Poberezkin
92ac3e2a8a
core: update contact and member profiles for both sides when contact is created with member (WIP) (#3081)
* core: update contact and member profiles for both sides when contact is created with member (WIP)

* send both sides, correctly process update

* refactor

* revert diff

* comments

* test

---------

Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
2023-09-20 16:45:04 +04:00
Evgeny Poberezkin
52966e7e3d
core: optionally encrypt SMP files (#3082)
* core: optionally encrypt SMP files

* encrypt to temp file and rename or remove encryption args if it fails

* fix file encryption error handling
2023-09-20 13:05:09 +01:00
spaced4ndy
1928256b09
core: connect existing contacts to new members when profile matches, enable skipping direct connections in groups (#3056)
* core: test group members are assigned different LDNs in group when direct connections aren't created

* disable test output

* core: connect existing contacts to new members when profile matches (#3059)

* core: connect existing contacts to new members when profile matches

* fix migration

* progress

* xInfoProbeOk for member

* fix tests

* add test

* fix tests

* tests

* remove deleteSentProbe

* remove deleteContactProfile_

* views

* don't check connections in deleteUnusedProfile_

* Revert "don't check connections in deleteUnusedProfile_"

This reverts commit 2016a0efde.

* fix test

* core: update member merge

* update saved schema

* fix queries and tests

* rename tables to original names

* remove index, corrections

* update schema dump

---------

Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-09-19 21:26:03 +01:00
Evgeny Poberezkin
904b758e79 Merge branch 'master' into master-ghc9 2023-09-18 21:46:27 +01:00
spaced4ndy
04770fb30d
core: terminal api to send message to / connect with member contact (#3065)
* core: terminal api to send message to / connect with member contact

* style

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-09-16 21:30:20 +04:00
spaced4ndy
0e5b16498a
core: api to create contacts with group members (#3053)
* core: api to create contacts with group members

* implementation

* fix contact replace, more tests

* comment

* rename fields

* fix

* fix

* test group is still incognito

* fix

* replace connection instead of contact

* fix

* check version

* style, names

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2023-09-16 17:55:48 +04:00
spaced4ndy
8178e8183e
core: show rcv file error (#3054) 2023-09-13 15:28:46 +04:00
spaced4ndy
01f99baaac Revert "core: direct messages in group (#2994)"
This reverts commit 5fddf64adb.
2023-09-12 17:36:47 +04:00
spaced4ndy
5fddf64adb
core: direct messages in group (#2994) 2023-09-11 18:38:57 +04:00
Evgeny Poberezkin
fedc31c72c Merge branch 'master' into master-ghc9 2023-09-10 21:11:35 +01:00
Alexander Bondarenko
2dff6c8859
core: do not subscribe to new connections from iOS NSE (subscribe=off flag), subscribe in app when it activates (#3016)
* Trace auto-subs flag

* Replace Bool with SubscriptionMode

* Add subscriptionMode to chat controller

* Start using subscriptionMode in event handlers

* Add need_subs to chat connections

* Add onlyNeeded to subscribeUserConnections

* Post-rebase fixes

* Pass onlyNeeded to Store functions

* Drop needs_sub for connections registered with agent

* update simplexmq, fix activate

* fix rebase, reduce diff

* fix rebase, tests

* fix rebase, executeMany, always subscribe on activate

* test

* update queries

* Update src/Simplex/Chat.hs

Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>

* unset connections to subscribe on start

* update simplexmq

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
2023-09-10 20:40:15 +01:00
Evgeny Poberezkin
82fd3b9004
core: change encoding of the result returned by chat_read_file C API (#3036)
* core: change encoding of the result returned by chat_read_file C API

* remove unused dependency

* remove pointer cast
2023-09-07 20:18:43 +01:00
Evgeny Poberezkin
b5a0269aa2
core: support unicode filenames and catch IO exceptions in C API for local file encryption (#3035)
* core: support unicode filenames in C API

* catch IO exceptions and return as errors
2023-09-07 13:44:37 +01:00
Evgeny Poberezkin
edeaf36e8b
core: C api to encrypt/decrypt local app files (#3029)
* core: C api to encrypt/decrypt local app files

* do not call CF.hPut with empty chunk
2023-09-06 19:54:13 +01:00
spaced4ndy
37eef3c6c9
core: enable creation of direct connections in group (revert this instead of #3022) (#3025) 2023-09-06 18:05:42 +04:00
spaced4ndy
b6c23b59ca
core: change logic of checking if peer supports feature (check if peer version is compatible) (#3024) 2023-09-06 17:48:37 +04:00
spaced4ndy
e6baca5610
core: rename conn vrange into peer vrange (#3023) 2023-09-06 11:41:23 +04:00
spaced4ndy
0c4b843a3f Merge branch 'master' into chat-version-negotiation 2023-09-06 10:41:06 +04:00
spaced4ndy
68f359c904
core: enable creation of direct connections in group for chat protocol v2 (for beta; to be reverted for full release) (#3022) 2023-09-06 10:15:32 +04:00
spaced4ndy
43e233f0eb
core: don't create direct connections in group (#2996) 2023-09-05 20:15:50 +04:00
Evgeny Poberezkin
4793173465
core: update return type of read/write file C api, tests (#3010) 2023-09-03 22:25:19 +01:00
Evgeny Poberezkin
af02a92442
core: fix WebRTC encryption, test (#3005) 2023-09-02 23:34:00 +01:00