Use new nio AsyncClient.mxc_to_http()
Has the correct behavior for all servers, e.g. mxc://privacytoosl.io/id → https://chat.privacytools.io/...
This commit is contained in:
parent
3919b964ca
commit
26e63e4ab2
7
TODO.md
7
TODO.md
|
@ -1,8 +1,9 @@
|
|||
- Media
|
||||
- Verify things work with chat.privacytools.io (subdomain weirdness)
|
||||
- Upload progression and pausing
|
||||
- Confirmation box after picking file to upload
|
||||
- Handle upload/set avatar errors: bad path, is a dir, file too big, etc
|
||||
- Show real progression for mxc thumbnail loadings, uploads and downloads
|
||||
- Handle set avatar upload errors
|
||||
- Show real progression for mxc thumbnail loadings
|
||||
- Support encrypted m.file
|
||||
|
||||
- Show reason under broken thumbnail icons
|
||||
- Support m.file thumbnails
|
||||
|
|
|
@ -136,11 +136,6 @@ class Backend:
|
|||
return hsluv.hsluv_to_rgb([hue, saturation, lightness])
|
||||
|
||||
|
||||
@staticmethod
|
||||
async def mxc_to_http(mxc: str) -> Optional[str]:
|
||||
return nio.Api.mxc_to_http(mxc)
|
||||
|
||||
|
||||
async def load_settings(self) -> tuple:
|
||||
from .config_files import Theme
|
||||
settings = await self.ui_settings.read()
|
||||
|
|
|
@ -40,11 +40,6 @@ class Media:
|
|||
raise ValueError(f"Invalid mxc URI: {self.mxc}")
|
||||
|
||||
|
||||
@property
|
||||
def http(self) -> str:
|
||||
return nio.Api.mxc_to_http(self.mxc)
|
||||
|
||||
|
||||
@property
|
||||
def local_path(self) -> Path:
|
||||
parsed = urlparse(self.mxc)
|
||||
|
|
|
@ -57,7 +57,8 @@ HMxcImage {
|
|||
let isMxc = toOpen.startsWith("mxc://")
|
||||
|
||||
isMxc ?
|
||||
py.callCoro("mxc_to_http", [toOpen], callback) : callback(toOpen)
|
||||
py.callClientCoro(chatPage.userId, "mxc_to_http", [toOpen], callback) :
|
||||
callback(toOpen)
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user