Commit Graph

321 Commits

Author SHA1 Message Date
Damir Jelić
8c831cee1e tests: Rename a test with a duplicate name. 2019-07-12 10:55:20 +02:00
Damir Jelić
48b4baf79c pantalaimon: Update to nio 0.4. 2019-07-12 10:55:20 +02:00
Damir Jelić
a9b00dfa37 tests: Test fetcher task creation and handling. 2019-07-04 14:58:30 +02:00
Damir Jelić
25f284f8de tests: Improve the pan client test. 2019-07-04 14:58:15 +02:00
Damir Jelić
fb0bc090c7 client: Formatting fix. 2019-07-04 14:56:16 +02:00
Damir Jelić
1b58d60abc client: Fire out events when the fetcher loop iterates. 2019-07-04 14:55:21 +02:00
Damir Jelić
bf64f4cbae client: Add/delete a continued/old fetcher task atomically. 2019-07-04 14:54:27 +02:00
Damir Jelić
98dfda9496 client: Add missing await. 2019-07-04 14:53:27 +02:00
Damir Jelić
c17a737c42 tests: Add initial pan client tests. 2019-07-03 17:49:45 +02:00
Damir Jelić
22ee14e7b9 client: Only run sync specific tasks if there's a new sync token. 2019-07-03 17:46:38 +02:00
Damir Jelić
85993b16a6 README: Describe the E2E search feature. 2019-07-03 17:46:04 +02:00
Damir Jelić
5d3016e1db setup.py: Add tantivy to the optional dependencies. 2019-07-03 17:44:07 +02:00
Damir Jelić
088b0a22d2 ui: Remove a duplicate import. 2019-07-03 17:43:48 +02:00
Damir Jelić
a5e1c59931 panctl: Don't duplicate the commands in a list.
The commands are already stored in a dictionary holding the command and
their respective help message.
2019-07-03 17:42:48 +02:00
Damir Jelić
758ca1fd85 client: Allow the pan client sync loop to have a timeout between iterations. 2019-07-03 17:42:14 +02:00
Damir Jelić
53d1a2945d index: Make the index optional.
This patch disables the message indexer an message store if
tantivy is not installed.

The search API endpoint forwards all search requests to the homeserver.
2019-07-03 17:41:49 +02:00
Damir Jelić
fa1c2bb694 client: Use coroutines for the event callbacks. 2019-07-03 09:50:45 +02:00
Damir Jelić
3e32b9544b daemon: Update the devices in the UI thread after a send and ignore. 2019-07-02 14:12:27 +02:00
Damir Jelić
6510bd7eb9 client: Only send device update messages if there were changed devices. 2019-07-01 18:19:36 +02:00
Damir Jelić
f2415738f3 ui: Don't load the devices from the store.
The device list in the UI thread is replicated so we can show UI clients
the list without the need for a lock.

The previous implementation relied on loading and reloading of the device
list from the store every time an event changed either the devices or their
trust state.

This leads to a couple of ineficiencies leading to timeouts while
waiting on the database lock if a user has a large number of devices.

The new implementation never loads devices in the UI thread from the
database, they get passed through the thread queue by the main thread
which already holds them in memory.
2019-07-01 18:19:30 +02:00
Damir Jelić
9308dfec3f tests: Test that we're sending out user updates from the daemon. 2019-06-19 15:55:40 +02:00
Damir Jelić
62d0e5607e ui: Don't load pan users from the db, pass them over the queue. 2019-06-19 15:54:58 +02:00
Damir Jelić
dae6084919 tests: Check if the proxy uploaded keys. 2019-06-19 13:38:04 +02:00
Damir Jelić
c9ebfd71ec pantalaimon: Format the source tree using black. 2019-06-19 12:37:44 +02:00
Damir Jelić
531d686d8f pantalaimon: Run isort. 2019-06-19 12:07:56 +02:00
Damir Jelić
1311dbdef0 tests: Make the indexstore test async. 2019-06-19 12:01:11 +02:00
Damir Jelić
42e363fafc tests: Test pan client syncs. 2019-06-19 11:57:01 +02:00
Damir Jelić
773b708f14 daemon: Remove unnecessary pass. 2019-06-19 11:56:32 +02:00
Damir Jelić
92267f9fc9 tests: Add initial proxy_tests. 2019-06-19 11:22:47 +02:00
Damir Jelić
315c4bb6f7 tests: Add fixtures for proxydaemon tests. 2019-06-19 11:22:11 +02:00
Damir Jelić
2c831de532 config: Set some more default values for the server config. 2019-06-19 11:21:43 +02:00
Damir Jelić
c8d81b9cf4 client: Catch keyboard exceptions for the client tasks. 2019-06-18 16:31:17 +02:00
Damir Jelić
e766b1ae4b config: Make the delay between room history fetching configurable. 2019-06-18 16:30:38 +02:00
Damir Jelić
0ad0da2151 daemon: Add missing await. 2019-06-18 15:35:50 +02:00
Damir Jelić
aafc56b44d daemon: Add CORS headers to the responses.
This add CORS headers to all the responses, they are required for web
based clients (e.g. Riot) to work.
2019-06-18 10:10:25 +02:00
Damir Jelić
f5ffd69a79 config: Make the batch size for room history fetching configurable. 2019-06-17 16:59:54 +02:00
Damir Jelić
0940b67eb8 pantalaimon: Add the ability to index only encrypted rooms.
Since some public rooms can be quite large downloading the room history
for such rooms can be quite resource intensive.

Replicating the whole room history locally for such rooms might be
undesirable. This patch adds the ability to only download room history
and index messages for encrypted rooms.

Do note that the search API supports searching in multiple rooms, thus
if the indexing is restricted to encrypted rooms a search across
multiple rooms will need to make a search request to the server as well
as a local search. This mode is currently unsupported.
2019-06-17 15:23:06 +02:00
Damir Jelić
83f62b0378 config: Make additional Homeserver requests for the search endpoint optional. 2019-06-17 12:26:38 +02:00
Damir Jelić
a6a62434e0 client: Add the context token fetching back for the search. 2019-06-17 10:29:23 +02:00
Damir Jelić
1850ead698 daemon: Sort the imports. 2019-06-14 15:23:41 +02:00
Damir Jelić
fa3e11a1ec index: Catch query parsing errors.
Tantivy's query parser can throw errors if the syntax of the query is
invalid.

There is a more lenient query parser[1] in the works but until then
catch query parser errors and return an error response to the user.

[1] https://github.com/tantivy-search/tantivy/issues/5
2019-06-14 15:15:58 +02:00
Damir Jelić
3a1b001244 index: Rewrite the search logic.
This patch moves all the indexing, event storing and searching into a
separate class.

The index and message store are now represented as a single class and
messages are indexed and stored atomically now which should minimize the
chance of store/index inconsistencies.

Messages are now loaded from the store as a single SQL query and the
context for the messages is as well loaded from the store instead of
fetched from the server.

The room state and start/end tokens for the context aren't currently
loaded.
2019-06-14 14:53:25 +02:00
Damir Jelić
a489031962 client: Fix a style issue. 2019-06-13 13:01:58 +02:00
Damir Jelić
1f5afd75c6 client: Allow per room search.
This is not ideal. We only support a single room or all rooms, which is
good enough for now since riot does that.

The tantivy boolean query logic isn't ideal and didn't work out with
multiple rooms in the query.
2019-06-13 12:32:52 +02:00
Damir Jelić
fe10f54ea9 client: Error out gracefully if we get an invalid limit. 2019-06-13 12:32:21 +02:00
Damir Jelić
ba09f77cb6 client: Simplify the sync logic. 2019-06-12 16:24:03 +02:00
Damir Jelić
6092e27748 client: Pass the sync token to the sync method. 2019-06-12 15:39:43 +02:00
Damir Jelić
b4e60b603a client: Store the history fetcher tasks to the db. 2019-06-12 15:39:08 +02:00
Damir Jelić
1ad2a3af28 daemon: Add access control headers to the search endpoint.
These headers are important for riot to be able to use pan's search
endpoint instead of the default Homeserver endpoint. It fails to search
using pan with CORS errors.
2019-06-12 15:34:08 +02:00
Damir Jelić
a2d6f3cc84 client: Fetch room members before the first encrytped send. 2019-06-12 15:33:27 +02:00