Commit Graph

14 Commits

Author SHA1 Message Date
miruka
26e63e4ab2 Use new nio AsyncClient.mxc_to_http()
Has the correct behavior for all servers,
e.g. mxc://privacytoosl.io/id → https://chat.privacytools.io/...
2019-12-02 06:42:48 -04:00
miruka
2123f5a66f Improve upload code, based on nio PR #76 2019-11-17 13:31:00 -04:00
miruka
47bfad1d72 Move Size type alias to utils 2019-11-12 09:26:43 -04:00
miruka
73541ad7a5 download/thumbnail don't need authentification 2019-11-12 09:10:00 -04:00
miruka
eee2162575 Serialize Path objects to QML
- media_cache.get_(thumbnail/media) now return a Path instead of str
- When converted to strings in the serialization, the "file://" prefix
  is prepended. This fixes problems when the app is built in release
  mode with QRC resources.
2019-11-07 04:02:41 -04:00
miruka
18e184d1f0 Cache local media on upload, fix media local echo 2019-11-06 09:43:05 -04:00
miruka
1de82492dd media_cache: remove leftover pdb call 2019-11-06 09:03:50 -04:00
miruka
e45f2c9d2d Fix thumbnail API error when QML gives float sizes 2019-11-06 06:51:55 -04:00
miruka
92d3390106 Fix CryptDict redefined in media_cache.py 2019-11-06 06:30:17 -04:00
miruka
82104266fe Encrypt uploads in a thread 2019-11-04 15:18:01 -04:00
miruka
2d682516e8 Support encrypted file reading & caching
Also don't convert palette images to JPEG when creating thumbnails.
2019-11-04 14:37:48 -04:00
miruka
02c6ec4500 Implement Media download 2019-11-04 10:29:18 -04:00
miruka
484eefe86d Fix image URL preview, add Thumbnail.create()
- Make HMxcImage's mxc property work with http too (temporary quick
solution)

- Thumbnail objects can now be initialized with existing bytes and not
  have to download anything.
2019-11-04 07:00:28 -04:00
miruka
2f19ff493b Rewrite media caching (old image provider)
- Doesn't use pyotherside's image provider feature, for more flexibility
  and simplicity
- Suitable for supporting matrix media events and more later
- Avoid a lot of duplicate files that the old cache created due to
  server not returning what we expect, mistakes in Python/QML code, etc
- Changed file structure
  (e.g. thumbnails/32x32/<mxc id> instead of
   thumbnails/<mxc id>.32.32.crop)

- Backend.wait_until_account_exist: start issuing warnings if the
  function runs for more than 10s, which means in most case a bad user
  ID was passed

- New HMxcImage QML component, used in H(User/Room)Avatar
2019-11-03 13:48:12 -04:00