mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-21 23:57:30 +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
@ -41,6 +41,11 @@ let constants = {
|
||||
does_not_track: false,
|
||||
|
||||
allow_user_from_reel: "fallback", // one of: "never", "fallback", "prefer", "onlyPreferSaved", "preferForRSS"
|
||||
proxy_media: { // Whether to proxy media (images, videos, thumbnails) through Bibliogram. This is strongly recommended to protect user privacy. If proxy is turned off, some browser content blockers may break all images since they are served from Facebook domains.
|
||||
image: true,
|
||||
video: true,
|
||||
thumbnail: true
|
||||
},
|
||||
|
||||
feeds: {
|
||||
// Whether feeds are enabled.
|
||||
|
@ -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…
Reference in New Issue
Block a user