Commit graph

169 commits

Author SHA1 Message Date
Daniel García Moreno
c3f299c617 api: Log every channel sender send error
We were ignoring channel send errors and it could be interesting to have
a log about this not sent messages.

This patch adds a new trait to extend the Result<(), SendError<T>> type
and provide a new method called expect_log, that doesn't panic on error
but logs the message in that case.
2019-09-10 15:00:41 +00:00
Daniel García Moreno
0b71ffdd22 api: Remove all channel sender unwraps
To avoid crashes when the channel is closed and we try to send something
we should manage the response of `send` instead of calling directly to
`unwrap`.
2019-09-10 15:00:41 +00:00
Alejandro Domínguez
fb77a4c163 API, Backend: replace Clone impl with derive 2019-08-29 23:07:47 +02:00
Alistair Francis
e1c2153caa fractal-gtk: Disable text entry if the user doesn't have send permission
Disable the ability to write text in rooms where the user doesn't have
write permission.

This fixes: https://gitlab.gnome.org/GNOME/fractal/issues/500

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2019-08-23 18:14:17 +00:00
Alistair Francis
45939221bc fractal-gtk: Rename power_levels to admins
The current power_levels variable really only describes the admins
(hence the call to get_admins()) so let's rename it to be more accurate.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2019-08-23 18:14:17 +00:00
Alejandro Domínguez
50803772f2 API, user: Separate endpoint connection from query build 2019-08-20 20:21:52 +00:00
Alejandro Domínguez
587a8c3caf API, register: Separate endpoint connection from query build 2019-08-20 20:21:52 +00:00
Alejandro Domínguez
1142c83e9a API, sync and filter: Separate endpoint connection from query build 2019-08-20 20:21:52 +00:00
Alejandro Domínguez
962143c95d API, directory: Separate endpoint connection from query build 2019-08-20 20:21:52 +00:00
Daniel García Moreno
65ed458295 Release 4.2.0 2019-07-27 09:30:29 +02:00
Christopher Davis
d4af8fb48e Cargo: Update dependencies
The latest version of the libhandy bindings requires an
update to the latest version of the gtk-rs bindings. This
update comes with a few changes, including the removal of the
`Into<Option<T>` pattern in favor of explicitly using `Some(T)` for options.
2019-07-19 12:59:17 -07:00
Daniel García Moreno
d5a85f436d Get the list of direct rooms before update
We only get the list of direct rooms in the initial sync so that list is
not up to date. This patch reloads the direct rooms hashmap before
trying to update to avoid remove existing direct chat rooms.

Fix https://gitlab.gnome.org/GNOME/fractal/issues/203
2019-07-11 23:47:24 +00:00
Daniel García Moreno
c5c17a492f Use lazy_load_members in sync
Instead of ignore member events we can use the lazy_load_members filter
flag to retrieve only relevant members.

Fix https://gitlab.gnome.org/GNOME/fractal/issues/432
2019-07-08 08:16:41 +02:00
Daniel Garcia Moreno
64540c9f5c Apply suggestion to fractal-matrix-api/src/backend/room.rs 2019-07-02 06:06:09 +00:00
Daniel García Moreno
1dbb81e1fe Ignore self typing notifications 2019-07-02 06:06:09 +00:00
Daniel García Moreno
0e55e01e40 Send typing notifications 2019-07-02 06:06:09 +00:00
Christopher Davis
38628c4311 Update gtk-rs stack
Closes https://gitlab.gnome.org/GNOME/fractal/issues/489
2019-06-12 11:59:57 -07:00
Alexandre Franke
98d8a82e7d api: don’t unwrap blindly for left rooms
The Option can be None in some cases.
2019-06-10 14:13:16 +00:00
Alexandre Franke
93bb860559 api: pass ms for sync timeout param 2019-06-05 19:32:09 +02:00
Isaac Curtis
250376a7bd Initial support for being kicked
Remove translatable from kicked dialog
2019-05-28 21:30:15 -06:00
Christopher Davis
2018a70c75 api: Properly parse invite events
Events are wrapped in a content block like so:

```
"content" : {
    "membership" : "invite"
}
```

However we were parsing it as just `"membership" : "invite"`.
Now we properly expect it to be within a content block.

Fixes https://gitlab.gnome.org/GNOME/fractal/issues/456
2019-05-01 20:29:19 +00:00
Christopher Davis
17aca31844 api: Fix publicRooms request
Previously we passed a String as "filter" in our
PublicRoomsRequest, but we needed to be passing
a Filter object. Somewhere along the way the String
stopped being accepted, breaking search.

Fixes https://gitlab.gnome.org/GNOME/fractal/issues/451
2019-05-01 18:04:49 +00:00
Scott Sweeny
1224e8e86f Only set Content-Length header on POSTs 2019-04-29 14:31:02 +00:00
Scott Sweeny
0748badf1a Add Content-Length: 0 header to JSON queries if the length is in fact zero
When using lighttpd as a reverse proxy empty POSTs get rejected by the
server if they don't have Content-Length set to zero, so some calls like
marking a room as read fail to make it to the homeserver.

fixes: GNOME/fractal#475
2019-04-29 14:31:02 +00:00
Christopher Davis
c76a8b17f3 build: Don't use globbing to find sources
Previously we were using a script to grab our sources
automatically. However, this was error-prone and meson
didn't actually understand the output.

Now we declare our sources manually. This helps meson
know when to trigger a build based on what files have
changed.
2019-04-27 16:24:08 +00:00
Christopher Davis
2a659b3962 api: Create types for well-known request
Instead of asking for the identity server and homeserver
url for login, we can ask the users to give us a domain
and make a request to .well-known/matrix/client. This
will give us the identity server and the true url for
the homeserver.

See https://matrix.org/docs/spec/client_server/latest#well-known-uri for details
2019-04-15 10:30:58 -04:00
Alexandre Franke
7eec414e3c rust: fix some warnings 2019-04-14 18:07:26 +02:00
Christopher Davis
8c97771dab fractal-matrix-api: Add workaround for synapse bug 4898
Synapse has a bug that can cause 'ts' for read receipts
to be malformed: https://github.com/matrix-org/synapse/issues/4898

This sets a workaround by replacing the malformed timestamp
to be replaced with 0.

Closes https://gitlab.gnome.org/GNOME/fractal/issues/472
2019-04-08 07:36:58 +00:00
Christopher Davis
2f4e1ecba6 fractal-matrix-api: set history visibility for direct chats
We didn't specify the visibility for participants in direct chats. The default behavior when unspecified is confusing,
and leads to messages sent between the sending of an invite
and the acceptance of it being dropped.

Now we append a state event to our room creation that
sets the room visibility to "invited", meaning users
can see messages from when they were invited.

Closes https://gitlab.gnome.org/GNOME/fractal/issues/327
2019-04-08 07:06:38 +00:00
Xiang Fan
f9fb4455c7 backend: Initial support for session proxy
This patch adds support for using the current session's HTTP and HTTPS
proxy from gio's ProxyResolver. For each type of proxy, it only uses the
first url because reqwest only supports that. We reuse the client
connection pool until it detects any proxy change.
2019-04-03 06:55:20 +00:00
Rasmus Rendal
48c8013be4 Add typing notifications
Add handler for incoming typing notifications in the sync loop
Add an appop handler for typing notifications to the frontend

Feature added for #305
2019-03-07 08:40:03 +00:00
mairandomness
9eb315a816 delete temporary thumbnail file 2019-02-24 07:58:57 -05:00
mairandomness
d71da4afec change thumb path to random file name in temp 2019-02-24 07:58:57 -05:00
mairandomness
a384c19472 create upload_thumbnail
change get_image_media_info to include thumbnail

propagate need for backend

try to debug the code

remove a println I forgot

Progress on using channel for thumb uploads

move thumbnail code to the backend

fix mimetype on json and only call ge_image_media_info on image files

remove random 'e' from util.rs

move get_image_media_info back to the frontend

create Info struct

hehe

lol
2019-02-24 07:58:57 -05:00
Julian Sparber
29a87501af backend: use gloable timeout for http request 2019-02-18 08:55:22 +00:00
Julian Sparber
dd9a14ddce backend: create only one reqwest client 2019-02-18 08:55:22 +00:00
Alejandro Domínguez
2d8e9764e3 API: use global variable for device name 2019-02-15 13:19:52 +00:00
Alejandro Domínguez
dc924b1be0 API: Implement and use user request and response types 2019-02-15 13:19:52 +00:00
Alejandro Domínguez
1ce06f4245 API: rework authentication in register model 2019-02-15 13:19:52 +00:00
Christopher Davis
1239698960 dependencies: Remove tree_magic from fractal-matrix-api
tree_magic was also used to get the mime type of uploads. We
can instead use gio::content_type_guess(). We can use it here because we are handling bytes, which is what it requires.
2019-02-14 16:51:34 -05:00
Julian Sparber
9cdf4760cd room: download full list of members for each room 2019-02-01 08:46:03 +00:00
Julian Sparber
c40553c9d3 avatar: download, cache and remove room avatar 2019-02-01 08:46:03 +00:00
Julian Sparber
9b1756575b backend: clean up room avatar request
We used to request the complete room state to get only the memebers list
if there was no avatar, which was expensive and we actually have already
the members list.
This reduces memory use.
2019-02-01 08:46:03 +00:00
Alejandro Domínguez
e1455bb5fb Readability improvements to model/room.rs 2019-01-26 05:22:38 +01:00
Alejandro Domínguez
dcf51f2ef7 Backend: Implement and use filter API 2019-01-24 23:26:13 +01:00
Alejandro Domínguez
3194c13f1d Backend: Implement and use sync response types and cleanup
We implemented the structs to which we parse the sync response except
the events, which are a tough case for another commit. Some enhancements
and cleanups were made to the code surrounding the sync management in
order to be able to remove unnecessary error handling and/or queries.
2019-01-24 23:26:13 +01:00
Alejandro Domínguez
46ac06576f Backend: enhancements to backend/sync.rs
Removed a mut variable, replaced a match with an if let and used time::Duration
for storing time instead of plain integers.
2019-01-24 15:08:10 +01:00
Alejandro Domínguez
ede3e4b454 Backend: Implement and use register request and response types 2019-01-24 04:08:15 +01:00
Alejandro Domínguez
e24ef247c7 Backend: Implement and use login request and response types 2019-01-24 04:08:15 +01:00
Alejandro Domínguez
b6bde7e99c Backend: implement PublicRoomsRequest
Previously we built the JSON request for listing the rooms directly. Here we do the same
by constructing a struct and then serializing it.
2019-01-22 20:57:06 +01:00