download/thumbnail don't need authentification

This commit is contained in:
miruka
2019-11-12 09:10:00 -04:00
parent 4cc2ebf6e3
commit 73541ad7a5
18 changed files with 74 additions and 65 deletions

View File

@@ -15,7 +15,6 @@ Rectangle {
theme.controls.avatar.background.opacity
)
property string clientUserId
property string name
property alias mxc: avatarImage.mxc
@@ -53,7 +52,6 @@ Rectangle {
sourceSize.height: parent.height
fillMode: Image.PreserveAspectCrop
animate: false
clientUserId: avatar.clientUserId
HoverHandler { id: hoverHandler }
@@ -74,7 +72,6 @@ Rectangle {
contentItem: HMxcImage {
id: avatarToolTipImage
fillMode: Image.PreserveAspectCrop
clientUserId: avatar.clientUserId
mxc: avatarImage.mxc
sourceSize.width: avatarToolTip.dimension

View File

@@ -11,6 +11,7 @@ Image {
(sourceSize.width + sourceSize.height) <= 512
property bool broken: false
property bool animate: true
property bool animated: Utils.urlExtension(image.source) === "gif"
property alias progressBar: progressBar
@@ -78,7 +79,7 @@ Image {
HIcon {
anchors.centerIn: parent
visible: image.status === Image.Error
visible: broken || image.status === Image.Error
svgName: "broken-image"
dimension: Math.max(16, Math.min(parent.width, parent.height) * 0.2)
colorize: theme.colors.negativeBackground

View File

@@ -20,7 +20,6 @@ HImage {
}
property string clientUserId
property string mxc
property string sourceOverride: ""
property bool thumbnail: true
@@ -53,12 +52,16 @@ HImage {
let args = image.thumbnail ?
[image.mxc, w, h, cryptDict] : [image.mxc, cryptDict]
py.callClientCoro(
clientUserId, "media_cache." + method, args, path => {
py.callCoro("media_cache." + method, args, path => {
if (! image) return
if (image.cachedPath != path) image.cachedPath = path
show = image.visible
}
image.broken = false
image.show = image.visible
}, () => {
image.broken = true
},
)
}
}