Commit Graph

298 Commits

Author SHA1 Message Date
Damir Jelić
186560dd4f daemon: Connect the queue for unverified devices messages while sending. 2019-05-22 11:51:49 +02:00
Damir Jelić
212baad49e store: Remove unused client info storing functionality. 2019-05-21 16:55:07 +02:00
Damir Jelić
a823d85cd8 pantalaimon: Isort the repo. 2019-05-21 16:48:46 +02:00
Damir Jelić
c85f82423d main: Remove spurious print. 2019-05-21 16:47:56 +02:00
Damir Jelić
d0d0e80931 daemon: Fix a typo in a variable name. 2019-05-21 16:47:31 +02:00
Damir Jelić
42a4391597 pantalaimon: Remove an unused variable and fix a whitespace issue. 2019-05-21 16:46:50 +02:00
Damir Jelić
d5b1ef27a9 pantalaimon: Add license headers. 2019-05-21 16:46:22 +02:00
Damir Jelić
3d87b468b2 daemon: Ask the homeserver about unknown access tokens.
This patch changes the way clients register to pantalaimon. If there is
already a pan client running for a given user ID clients can now avoid
logging in.

Pantalaimon checks with the homeserver if the access token
is valid and for a user that we already have a pan client running.

This also removes the need to remember access tokens that don't belong
to a pan client.

This partially fixes #14.
2019-05-21 16:25:23 +02:00
Damir Jelić
a6bc5de523 client: Don't verify devices automatically anymore. 2019-05-21 13:43:05 +02:00
Damir Jelić
cb38112160 tests: Fix the dbus test. 2019-05-21 13:42:48 +02:00
Damir Jelić
48da1b6b14 config: Add the ability to disable device verification. 2019-05-21 13:23:07 +02:00
Damir Jelić
1ad5cf6e66 daemon: Keep the proxy config in the daemon class around. 2019-05-21 12:35:55 +02:00
Damir Jelić
90e803900d panctl: Add send-anyways and cancel-send commands. 2019-05-21 12:33:10 +02:00
Damir Jelić
ae85ec22bb ui: Send the room display name in the UnverifiedDevices signal. 2019-05-21 12:31:58 +02:00
Damir Jelić
ff2fc7e448 daemon: Handle the case where we try to send to unverified devices. 2019-05-21 10:25:59 +02:00
Damir Jelić
c40af38b33 panctl: Print out if a device is ignored. 2019-05-20 16:50:27 +02:00
Damir Jelić
ff0f6c50f9 daemon: Return the proper content type if we are using json responses. 2019-05-20 15:30:58 +02:00
Damir Jelić
4f90e578ef store: Use the server name to store info.
This way multiple proxy servers that point to the same homeserver are
allowed.
2019-05-17 16:49:02 +02:00
Damir Jelić
e0b5d3e2b6 panctl: List the trust state of devices. 2019-05-17 14:57:57 +02:00
Damir Jelić
48f94851d2 ui: Allow devices to be blackliksted and unblacklisted. 2019-05-17 14:57:36 +02:00
Damir Jelić
694903e8bd pantalaimon: Allow pan users to be dynamically updated in the ui thread. 2019-05-17 14:56:40 +02:00
Damir Jelić
ed13f78383 panctl: Fix a typo in the command parser. 2019-05-17 14:35:52 +02:00
Damir Jelić
2d487c55f5 ui: Update the device list in the ui thread dynamically.
This updates the copy of the device list in the ui thread every time the
device list or the verification of devices changes in the ui thread.
2019-05-17 14:33:48 +02:00
Damir Jelić
2ca850bf72 client: Connection error messages need to be strings. 2019-05-17 14:27:43 +02:00
Damir Jelić
00f2b51fa9 store: Change the way device keys are loaded. 2019-05-16 10:10:27 +02:00
Damir Jelić
a114b7b1a9 ui: Add support for starting/canceling key verifications. 2019-05-15 11:51:33 +02:00
Damir Jelić
e9d0f52a5c pantalaimon: Isort the tree. 2019-05-14 21:50:30 +02:00
Damir Jelić
22fcbff44b pantalaimon: Formatting fixes. 2019-05-14 21:29:59 +02:00
Damir Jelić
69d14f3c68 daemon: Import/export key functions are now coroutines. 2019-05-14 16:11:50 +02:00
Damir Jelić
90d887e2fa client: Mypy fixes. 2019-05-14 16:11:39 +02:00
Damir Jelić
6749a0bfd2 daemon: Remove unused import. 2019-05-14 14:14:38 +02:00
Damir Jelić
2151f55337 daemon: Simplify the room send logic. 2019-05-14 13:52:55 +02:00
Damir Jelić
bfd7144b4f daemon: Fetch joined members correctly while trying to send messages. 2019-05-14 12:58:16 +02:00
Damir Jelić
42450b51c7 ui: Rework the way the dbus thread and main thread communicate. 2019-05-13 16:32:12 +02:00
Damir Jelić
1cbe5b8a6d ui: Rewrite the dbus code using pydbus. 2019-05-13 16:32:12 +02:00
Damir Jelić
c60e554fc2 store: Change the name of the device key fields in the dict. 2019-05-13 16:32:12 +02:00
Damir Jelić
671fe9dbd0 pantalaimon: Version the dbus API. 2019-05-13 16:32:12 +02:00
Damir Jelić
840e568eac client: Don't accept a SAS automatically. 2019-05-13 16:32:12 +02:00
Damir Jelić
cb04e962f1 panctl: Add a list devices command. 2019-05-13 16:32:12 +02:00
Damir Jelić
bf25a35b31 daemon: Expand the user for the import/export path. 2019-05-09 16:49:44 +02:00
Damir Jelić
ba4ed34941 client: Add a missing await. 2019-05-09 16:49:16 +02:00
Damir Jelić
a560462da7 pacntl: Switch to argparse and add more functionality. 2019-05-09 16:48:29 +02:00
Damir Jelić
6adedbaa0b panctl: Improve the completions. 2019-05-09 13:47:29 +02:00
Damir Jelić
10bb16b210 panctl: Handle an empty command string properly. 2019-05-09 10:54:42 +02:00
Damir Jelić
1d2d0d6bba daemon: Use the right queue to send messages. 2019-05-09 10:54:22 +02:00
Damir Jelić
1f548f3a7e client: Handle client errors while confirming the auth string. 2019-05-09 10:54:01 +02:00
Damir Jelić
de29df75b9 pantalaimon: Refactor out the thread messages. 2019-05-09 10:53:20 +02:00
Damir Jelić
1a8e5ca65d config: Fix a whitespace issue. 2019-05-08 17:40:16 +02:00
Damir Jelić
b687f503d4 main: Add a SIGTERM signal handler. 2019-05-08 16:11:07 +02:00
Damir Jelić
cc7b257345 main: Route ui messages to the correct daemon. 2019-05-08 15:47:16 +02:00
Damir Jelić
2946acbd6c main: Enable ssl configuration again. 2019-05-08 15:00:50 +02:00
Damir Jelić
2127a7cba5 main: Start all the configured servers. 2019-05-08 14:21:38 +02:00
Damir Jelić
0d89987ec1 config: Add the section name to the config class. 2019-05-08 14:20:47 +02:00
Damir Jelić
3d34a26dac config: Handle some invalid configurations. 2019-05-08 12:43:21 +02:00
Damir Jelić
2987589854 pantalaimon: Add a configuration file for the daemon. 2019-05-08 12:33:42 +02:00
Damir Jelić
65d1401b76 main: Remove unused function. 2019-05-08 10:27:55 +02:00
Damir Jelić
31ab200763 client: Only try to decrypt m.room.encrypted messages in the sync decryption. 2019-05-07 18:38:08 +02:00
Damir Jelić
7318690e2c daemon: Buffer the messages endpoint if there are undecryptable messages. 2019-05-07 18:37:32 +02:00
Damir Jelić
400c299187 daemon: Add Bearer to the auth header if we're overriding the token. 2019-05-07 18:36:05 +02:00
Damir Jelić
6b8758f2cb main: Remove cli commands for key export/import.
The functionality is now available over dbus.
2019-05-07 15:34:29 +02:00
Damir Jelić
cd5565b4b3 client: Remove unused encrypt function. 2019-05-07 15:00:51 +02:00
Damir Jelić
aa1143328f client: Remove unused asyncio events. 2019-05-07 14:57:53 +02:00
Damir Jelić
6988a1de95 daemon: The filter query parameter in a sync needs to be a str. 2019-05-07 14:52:01 +02:00
Damir Jelić
cf07cfdc16 client: Use the new AsyncClient functionality from nio for syncing. 2019-05-07 14:44:29 +02:00
Damir Jelić
c96bdea1d3 pantalaimon: Refactor out the daemon start logic into a separate file. 2019-05-07 10:42:40 +02:00
Damir Jelić
e961ff6035 ui: Create a glib class and simplify the shutdown logic. 2019-05-07 10:26:13 +02:00
Damir Jelić
57f3a00a78 client: Switch to the new confirm auth string function. 2019-05-07 09:33:12 +02:00
Damir Jelić
5ef5551977 client: Use the nio provided method to find a SAS object. 2019-05-03 16:09:06 +02:00
Damir Jelić
46ff19ea3c panctl: Remove unneeded DbusT class. 2019-05-03 14:12:33 +02:00
Damir Jelić
6dd47e7a53 pantalaimon: Rename accept_sas to confirm sas. 2019-05-03 14:01:01 +02:00
Damir Jelić
90ec4e2e96 daemon: Send some messages to the ui thread. 2019-05-03 13:48:28 +02:00
Damir Jelić
103a17998a panctl: Allow the user to confirm the short auth string. 2019-05-03 13:46:19 +02:00
Damir Jelić
7f8d18d857 daemon: Handle json errors in the sync and messages methods.
A valid 200 response from the server doesn't necessarily mean that the
content will be valid json.

Handle decode errors and return the raw body if we're unable to decode.
2019-05-02 14:49:24 +02:00
Damir Jelić
a996d4acd3 daemon: Don't use the text method to get the content.
The content doesn't necessarily have to be unicode (e.g. for media
content) and the text() method tries to decode the body of the request.

Use read() instead, this way we get the raw bytes of the body, we also
set the content header manually.

This fixes #8.
2019-05-02 14:46:53 +02:00
Damir Jelić
d90eebf1e0 daemon: Remove redundant or clause. 2019-05-02 14:44:25 +02:00
Damir Jelić
e84bcea389 pantalaimon: Catch all aiohttp client connection errors. 2019-05-02 13:55:20 +02:00
Damir Jelić
f1fefb952c daemon: Buffer the sync response if there are decryption failures. 2019-05-02 13:30:31 +02:00
Damir Jelić
46aa303654 client: Clear the synced event when we start the loop. 2019-05-02 13:28:41 +02:00
Damir Jelić
ba28580aca client: Replace undecryptable megolm events with an error message. 2019-05-02 13:27:50 +02:00
Damir Jelić
db43c3efbd client: Request room keys if we're unable to decrypt a megolm event. 2019-05-02 12:09:49 +02:00
Damir Jelić
7d58da93f9 client: No need to mark to-device messages as sent anymore. 2019-04-30 18:15:39 +02:00
Damir Jelić
0972be29c1 client: Allow other event types to be decrypted. 2019-04-30 14:54:01 +02:00
Damir Jelić
7bb47092ff ui: Disable device updates for now. 2019-04-30 13:08:22 +02:00
Damir Jelić
da552973ff daemon: Overide the filter API endpoint. 2019-04-30 13:07:11 +02:00
Damir Jelić
90a87460e8 client: Use user lazy loading. 2019-04-29 16:56:50 +02:00
Damir Jelić
94e6058ef4 daemon: Handle connection errors when doing requests. 2019-04-29 16:53:31 +02:00
Damir Jelić
253424b8c3 daemon: Make the query parameters always editable in forward_request(). 2019-04-29 13:15:21 +02:00
Damir Jelić
3671660e64 daemon: Send out non-encrypted messages as well using pan's token. 2019-04-29 13:13:00 +02:00
Damir Jelić
17a20195c0 daemon: Use pan's token to perform client syncs.
The clients need to use pan's sync token so the transaction ids in the
sync response don't get lost since sending happens using pan's device
and token.
2019-04-29 12:58:59 +02:00
Damir Jelić
7a2ee980ff client: Handle key verification exceptions. 2019-04-29 09:49:42 +02:00
Damir Jelić
7aa7014431 client: Handle SAS key verification.
This adds the ability to receive and accept SAS key verification.
The verification process is accepted automatically for now.
2019-04-28 21:17:10 +02:00
Damir Jelić
3e67010278 client: Don't check for the room id until we know it's a valid event. 2019-04-28 21:16:14 +02:00
Damir Jelić
0a1008a127 client: Send out outgoing to-device messages. 2019-04-28 21:15:14 +02:00
Damir Jelić
2c218bfd04 client: Handle server disconnect exceptions. 2019-04-28 21:14:57 +02:00
Damir Jelić
5f124806d8 pantalaimon: Add a Cli dbus based client. 2019-04-22 21:28:15 +02:00
Damir Jelić
e43b8c750c ui: Expose key imports from the dbus API. 2019-04-18 16:56:53 +02:00
Damir Jelić
2bb6ac7196 daemon: Change the working dir to our homedir. 2019-04-18 15:53:25 +02:00
Damir Jelić
3c09dbc80a ui: Expose key exports on the dbus API. 2019-04-18 15:52:21 +02:00
Damir Jelić
8f57e42c2c ui: Change the name of the Users dbus class. 2019-04-18 14:12:31 +02:00
Damir Jelić
daacd340f9 ui: Allow devices to be unverified over the dbus API. 2019-04-18 14:01:57 +02:00
Damir Jelić
09bd6ddbde ui: Change the log message to not mention dbus. 2019-04-18 13:10:51 +02:00
Damir Jelić
e32a73a011 daemon: Allow device verification over the dbus API. 2019-04-18 13:01:10 +02:00
Damir Jelić
1613a2fa5a pan: Move the dbus code into a separate file. 2019-04-18 11:43:07 +02:00
Damir Jelić
7038462e01 daemon: Expose daemon users and user devices over a dbus interface. 2019-04-17 14:20:54 +02:00
Damir Jelić
42fc14ee35 client: Only wait for the task to be canceled if it's started. 2019-04-17 14:20:54 +02:00
Damir Jelić
827549ab7c client: Handle connection errors in the client. 2019-04-17 14:20:54 +02:00
Damir Jelić
444cf64fb5 daemon: Use the system keyring to store access tokens. 2019-04-17 14:20:54 +02:00
Damir Jelić
ea33359daa store: The daemon clients need to be per homeserver. 2019-04-12 17:59:30 +02:00
Damir Jelić
d1090a714a daemon: Add key export/import commands. 2019-04-12 16:18:26 +02:00
Damir Jelić
f2907b1811 daemon: Handle the room/messages endpoint. 2019-04-12 14:19:37 +02:00
Damir Jelić
1bbf38e240 daemon: Store and restore client info of our children. 2019-04-11 16:59:37 +02:00
Damir Jelić
88757965cd client: Small docfix. 2019-04-11 14:23:48 +02:00
Damir Jelić
c57b4c1210 daemon: Catch content type errors. 2019-04-11 14:23:32 +02:00
Damir Jelić
b1444568d4 daemon: Save and restore daemon clients. 2019-04-11 14:22:55 +02:00
Damir Jelić
25f30f2e36 client: Use a sqlitestore for our client. 2019-04-11 14:21:39 +02:00
Damir Jelić
5151095740 client: Fix the gracefull shutdown of a client. 2019-04-11 14:20:09 +02:00
Damir Jelić
78041c7a6a daemon: Mypy fixes. 2019-04-10 14:46:11 +02:00
Damir Jelić
51700068b9 pantalaimon: Isort the repo. 2019-04-10 12:25:21 +02:00
Damir Jelić
4bf5955031 pantalaimon: Add pantalaimon store class. 2019-04-10 12:03:17 +02:00
Damir Jelić
d10a68add1 daemon: Remove some unused imports and variables. 2019-04-10 11:36:37 +02:00
Damir Jelić
d36d2107a9 client: Skip unknown rooms while decrypting.
This fixes a crash but the real reason why the room is unknown for
pantalaimons client is if the other sync stream is ahead of
pantalaimons. This will end up in undecryptable messages unless the
client waits for pantalaimon to finish its own sync.

This closes #11.
2019-04-05 18:40:25 +02:00
Damir Jelić
e2da496f93 client: raise the LocalProtocolError. 2019-04-05 15:33:46 +02:00
Damir Jelić
4ef329df41 daemon: Set the log level for our logger when we set it on the cli. 2019-04-04 19:47:22 +02:00
Damir Jelić
1378dca195 daemon: Decouple the client sync from the daemon sync. 2019-04-04 19:39:44 +02:00
Damir Jelić
f27eb836fe pantalaimon: Add propper logging support. 2019-04-04 11:30:42 +02:00
Damir Jelić
3fa6ce9292 daemon: Add some documentation to the daemon methods. 2019-04-03 17:05:04 +02:00
Damir Jelić
1c45fabe9f pantalaimon: Split out the sync response decryption. 2019-04-03 17:04:06 +02:00
Damir Jelić
8cfc7df551 daemon: Refactor out the request forwarding logic. 2019-04-03 15:40:07 +02:00
Damir Jelić
ae770b3a67 daemon: Move the login user finding out of the login function. 2019-04-03 15:40:07 +02:00
Damir Jelić
e5558c5a1a daemon: Whitespace fixes. 2019-04-03 15:40:07 +02:00
Damir Jelić
9a3329e86e daemon: Move the data dir creation out of the login handler. 2019-04-03 15:40:07 +02:00
Damir Jelić
fa3caa1c01 daemon: If there is not initial device name set one. 2019-04-02 16:07:00 +02:00
Damir Jelić
04f1a16eb7 daemon: Remove the host header in the main router.
The host header can cause confusion since we are forwarding the request
as is in the main router.

Remove it since aiohttp will create a sane new one for us.

This fixes #2.
2019-04-02 14:41:22 +02:00
Damir Jelić
95a6a14049 daemon: Use the proxy setting provided by the command line. 2019-03-29 19:21:30 +01:00
Damir Jelić
a3643cf6b2 pantalaimon: Add a __init__ file for the package. 2019-03-28 17:09:51 +01:00
Damir Jelić
a1fadbb867 daemon: Remove numeric filters properly. 2019-03-28 17:08:58 +01:00
Damir Jelić
237f35af0a daemon: Remove unneeded print calls. 2019-03-28 17:08:39 +01:00
Damir Jelić
1fb15eb77e daemon: Add some command line switches. 2019-03-28 17:07:57 +01:00
Damir Jelić
95f271f45e daemon: Fix a typo in the unkown_token response method. 2019-03-27 14:30:21 +01:00
Damir Jelić
ad641f2a42 daemon: Remove numeric filters from the sync request. 2019-03-27 14:13:05 +01:00
Damir Jelić
cb85544ff9 daemon: Explain the status quo with quaternion. 2019-03-26 17:55:47 +01:00
Damir Jelić
7ee128f185 daemon: Add initial room sending support.
Note: Sending a message for now works only if the other clients have
started Olm sessions for us already.
2019-03-26 13:45:25 +01:00
Damir Jelić
a5930e449c daemon: Automatically verify new devices.
This is a stopgap before some UI is exposed to let the user verify
devices.
2019-03-26 13:03:41 +01:00
Damir Jelić
79aecc1826 daemon: Only handle the response if it's a valid sync response. 2019-03-26 13:00:10 +01:00
Damir Jelić
ea9a30367a daemon: Refactor out the error responses. 2019-03-26 12:59:46 +01:00
Damir Jelić
6a9a75d3f7 daemon: Don't use a proxy for the connections. 2019-03-25 14:03:27 +01:00
Damir Jelić
05c8f22b58 daemon: Add initial decryption support. 2019-03-25 13:19:22 +01:00
Damir Jelić
2702b51698 pantalaimon: Move the daemon into it's subdir. 2019-03-25 09:34:05 +01:00