1
0
Fork 0
Commit Graph

146 Commits

Author SHA1 Message Date
Alex Palaistras 7eedd28d28 Update to latest GoPy version, fix issues
This fixes issues related to breaking changes in latest versions of
GoPy, which will now return concrete instances of corresponding classes
in iterators; previously, only a "pointer" would be returned, which
would've then needed to be set as the handle for a newly created
instance of a relevant class.

Closes: #17
2023-12-14 18:57:27 +00:00
Alex Palaistras ce1526bc6d Pin installed GoPy versions to 0.4.7
GoPy 0.4.8 and beyond introduce breaking changes related types returned
in function calls (e.g. slice element types). Previously, these would be
a pointer handle which would then need to be set into a concrete
instance of the type required by callers; GoPy will now return concrete
instances itself.

Moving to the new semantics requires changes to code, and additional
testing; pinning the version helps us migrate on our own timeline.
2023-12-14 13:49:39 +00:00
nicoco c225a899cd chore: update poetry.lock 2023-12-14 07:39:42 +01:00
Alex Palaistras 61db123ace Update dependencies, implement stub validation
Stub validation for our `Gateway` class is required in completing
registration, even though we don't process any forms.
2023-12-12 17:25:19 +00:00
nicoco 64f23f03e2 fix: group avatar unset 2023-12-11 22:35:36 +01:00
nicoco 82c3e6cb5b fix: update avatar before joining 2023-12-11 22:34:58 +01:00
nicoco 6950698ef4 chore: update poetry.lock 2023-12-05 20:27:17 +01:00
nicoco c730c8d385 ci: do not build python 3.10 wheel 2023-12-05 20:22:39 +01:00
nicoco cb43f131c5 ci: do not build arm container 2023-12-05 20:22:10 +01:00
nicoco e881e89616 fix: git merge gone wrong 2023-12-05 14:15:46 +01:00
nicoco 0b98cfff46 style: apply isort and black 2023-12-05 14:02:48 +01:00
nicoco 2644448177 fix: workaround for type-hint limitation
path should never be None when
NO_UPLOAD_METHOD != "symlink",
but the type annotation is suboptimal
2023-12-05 14:02:34 +01:00
nicoco befb1920dc feat: sync user avatar unpublishing 2023-12-05 13:34:26 +01:00
nicoco c3d27da861 feat: sync user avatar unpublishing 2023-12-05 12:18:03 +01:00
nicoco 0541894283 chore: update poetry.lock 2023-12-05 12:11:26 +01:00
nicoco 6daa5fb413 docs: fix broken link 2023-12-05 08:27:59 +01:00
Alex Palaistras 10e1b93ed1 Remove debug-only logging for `SetAvatar` 2023-12-01 13:40:52 +00:00
Alex Palaistras 54c30a4abc Cache group avatars for unique WhatsApp ID
This follows the same paradigm used for contacts, and uses the
unique (and stable) WhatsApp-provided avatar ID as a cache key.
2023-12-01 13:35:10 +00:00
Alex Palaistras a42f4c311b Handle XMPP-to-WhatsApp avatar synchronization
Setting your avatar in XMPP will now propagate to WhatsApp, but not the
other way around; even so, most XMPP clients will update the avatar anew
on new connections, which should help ensure persistent synchronization
even in the face of remote changes to the WhatsApp profile.
2023-12-01 13:32:05 +00:00
Alex Palaistras 7671411883 Update dependencies to latest versions 2023-12-01 13:31:57 +00:00
Alex Palaistras 5401803e95 Revert Poetry package updates
This is due to unknown issues with latest package versions (likely
Slidge core) that require more investigation.
2023-11-14 18:04:51 +00:00
Alex Palaistras 9be035d6a2 Update dependencies to latest versions 2023-11-14 17:33:26 +00:00
Alex Palaistras a0fb2a59bd Fix changes made by Copier update 2023-09-30 13:12:43 +01:00
Alex Palaistras 42f9551b00 Rename `media.go` to `attachment.go`
Since the latter name is more appropriate for its contents.
2023-09-30 12:34:10 +01:00
Alex Palaistras df950e0bb3 Use local, temporary files for attachments
Incoming and outgoing attachments (and preview images) will typically be
transported between the Python-Go boundary as raw, in-memory byte
representations; however, this has been the source of issues in the
past, since our Go-Python glue layer does not handle translating byte
slices in a performant enough way.

Thus, we have relied on transporting attachments as URLs, local paths,
and raw byte slices interchangeably, using whichever method has been
more appropriate for the use-case. Similarly, we have typically used
in-memory byte slices and pipes for our media conversion layer between
Go and FFmpeg, in order to avoid spurious writes to disk.

Unfortunately, FFmpeg does not handle conversion of media files using
pipes in all cases, and more specifically, in the case of MP4 container
formats, which usually require the entire buffer to be available and
cannot handle conversions from streamed sources (such as pipes).

This commit consolidates use of local, temporary file paths for the
purposes of both attachment and media conversion handling, which (may)
simplify the implementation, but may also lead to increased latency, as
files need to be read from and written to when crossing Go-Python and
FFmpeg boundaries.

Future improvements to GoPy and our FFmpeg implementation might have us
revisit and revert back to raw byte slices.
2023-09-30 12:34:07 +01:00
nicoco 61012c1124 docs: update sphinx-autoapi 2023-09-28 22:13:01 +02:00
nicoco f71e1598b3 chore: update copier 2023-09-28 22:12:22 +02:00
nicoco d11d6bb7fa ci: fix mypy 2023-09-27 08:26:39 +02:00
nicoco 802e245a85 chore: update poetry.lock 2023-09-24 14:55:39 +02:00
nicoco 5fc53ab796 chore: update slidge 2023-09-24 14:55:31 +02:00
nicoco d579c6cbeb build: fix mypy exclude paths 2023-09-24 14:55:22 +02:00
nicoco 9e54542699 Revert "docs: fix build (furo update)"
This reverts commit 83bc89d377.
2023-09-21 23:31:20 +02:00
Alex Palaistras d01c37af51 Implement phone pairing with `pair-phone` command
WhatsApp allows secondary, "linked" devices to pair with the main device
via either QR code, or more recently, via one-time code. Both methods
are equivalent in their outcomes, but one-time code pairing might be
easier to use for users that use the same device for both WhatsApp and
XMPP, as scanning a QR code temporarily requires a second device (or
printer). Conversely, one-time codes can be received and used by the
same device.

This commit implements this form of one-time code pairing via a new
`pair-phone` command, to be used as a ad-hoc command against the
Slidge component; this form of pairing requires entering the phone
number used by the main device, and returns a small one-time code that
can be used in the "Link Device" dialog on the main device.

This does not, and will not, replace QR code pairing -- both methods
will continue to be available on Slidge so long as they're available
upstream.
2023-09-17 11:28:39 +01:00
nicoco 2c34a16055 fix: TypeError when participant sends attachment(s)
send_file() now needs to return something,
and our subclass didn't, resulting in:

  File "/venv/lib/python3.11/site-packages/slidge/core/mixins/attachment.py", line 405, in send_files
    _url, msgs = await self.send_file(
    ^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object
2023-09-13 11:06:55 +02:00
nicoco 256f9c41e6 chore: update deps 2023-09-11 20:34:02 +02:00
nicoco ba6d81a0ec ci: fix poetry install for arm64 containers 2023-09-11 20:32:15 +02:00
Alex Palaistras a2c008dc9a Fix background presence sync timer
Previous iterations of the presence sync timer would `nil` out timers
when our presence isn't set to "available" when they fire, so that we
can pick up after them once we go to that status once again. However,
this was subtly broken as we were reading from the timer in between
those events, which led to (non-fatal) nil dereference errors.
2023-09-09 17:32:45 +01:00
Alex Palaistras 4d8e5a9eab Update to latest version of dependencies 2023-09-09 17:32:44 +01:00
nicoco 1443ee9e92 chore: update deps 2023-08-31 22:06:21 +02:00
nicoco 906c3f7ec9 ci: build wheels for python 3.10+3.11 and amd64+arm64 2023-08-25 07:42:48 +02:00
nicoco 83bc89d377 docs: fix build (furo update) 2023-08-25 07:42:41 +02:00
Alex Palaistras 9726982fd4 Restrict maximum preview image size to 500KiB
WhatsApp will refuse to have clients show large preview image sizes, and
seems to block the WebSocket connection for an inordinate (infinite?)
amount of time thereafter, leading to essentially a gateway freeze.

This also corrects size limits for other media, which were 1024 times
larger than they should've been.
2023-08-23 20:43:41 +01:00
Alex Palaistras d197fbe063 Reinstate background contact presence refresh
It seems that WhatsApp requires that we periodically re-refresh contact
presences, even after having our own presence be reflected correctly in
the remote server. This commit re-instates the background sync process
and has contact presences be refreshed every 12±6 hours, but only if
we're currently available.
2023-08-22 19:49:56 +01:00
Alex Palaistras 299407ea6c Directly sync XMPP client presence with WhatsApp
This commit removes period background synchronization for own presence,
and insteads synchronizes XMPP client presence with WhatsApp directly;
this in turn allows our state on WhatsApp to be more indicative of what
the actual use state is (assuming no use of official WhatsApp clients).

Synchronization of user status messages is also enabled, but only if
these are set to a non-empty value -- reverting to an empty status
message requires intervention via an official WhatsApp client.
2023-08-20 17:32:54 +01:00
Alex Palaistras 8b6fc94780 Handle Go errors in calls to GetAvatar 2023-08-12 17:51:15 +01:00
Alex Palaistras f5a0279f85 Ensure cached ID is a `str` type in GetAvatar call 2023-08-12 17:38:44 +01:00
nicoco 0bb5f48a3a perf: avoid fetching avatar URL when cached version is up-to-date 2023-08-12 11:52:08 +01:00
nicoco 6b6b53c844 ci: fix wheels build 2023-08-12 11:52:08 +01:00
nicoco d74700fd83 chore: update copier 2023-08-12 11:52:08 +01:00
nicoco 25f8e40093 fix: remove useless duplicated line 2023-08-12 11:52:08 +01:00