mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2026-03-22 12:21:37 +00:00
Add configuration option to disable media proxy
Media proxy is enabled by default, and was always enabled before this commit.
This commit is contained in:
parent
1ea2e2e3bb
commit
4363891fa6
3 changed files with 20 additions and 5 deletions
|
|
@ -26,11 +26,15 @@ class TimelineBaseMethods {
|
|||
}
|
||||
|
||||
getDisplayUrlP() {
|
||||
return proxyImage(this.data.display_url)
|
||||
let url = this.data.display_url
|
||||
if (constants.proxy_media.image) url = proxyImage(url)
|
||||
return url
|
||||
}
|
||||
|
||||
getVideoUrlP() {
|
||||
return proxyVideo(this.data.video_url)
|
||||
let url = this.data.video_url
|
||||
if (constants.proxy_media.video) url = proxyVideo(url)
|
||||
return url
|
||||
}
|
||||
|
||||
getAlt() {
|
||||
|
|
|
|||
|
|
@ -154,7 +154,9 @@ class TimelineEntry extends TimelineBaseMethods {
|
|||
getThumbnailSrcsetP() {
|
||||
if (this.data.thumbnail_resources) {
|
||||
return this.data.thumbnail_resources.map(tr => {
|
||||
return `${proxyImage(tr.src, tr.config_width)} ${tr.config_width}w`
|
||||
let src = tr.src
|
||||
if (constants.proxy_media.thumbnail) src = proxyImage(tr.src, tr.config_width)
|
||||
return `${src} ${tr.config_width}w`
|
||||
}).join(", ")
|
||||
} else {
|
||||
return null
|
||||
|
|
@ -174,16 +176,20 @@ class TimelineEntry extends TimelineBaseMethods {
|
|||
found = tr
|
||||
if (tr.config_width >= size) break // don't proceed once we find one large enough
|
||||
}
|
||||
let src = found.src
|
||||
if (constants.proxy_media.thumbnail) src = proxyImage(src, found.config_width) // force resize to config rather than requested
|
||||
return {
|
||||
config_width: found.config_width,
|
||||
config_height: found.config_height,
|
||||
src: proxyImage(found.src, found.config_width) // force resize to config rather than requested
|
||||
src
|
||||
}
|
||||
} else if (this.data.thumbnail_src) {
|
||||
let src = this.data.thumbnail_src
|
||||
if (constants.proxy_media.thumbnail) src = proxyImage(src, size) // force resize to requested
|
||||
return {
|
||||
config_width: size, // probably?
|
||||
config_height: size,
|
||||
src: proxyImage(this.data.thumbnail_src, size) // force resize to requested
|
||||
src
|
||||
}
|
||||
} else {
|
||||
return null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue