Embedded images: serve via CDN for IP protection. (#1009)
## Ticket 536 "Embedding images without proxy is probably not in compliance with data protection regulations in Germany/Europe (GDPR)"
This commit is contained in:
parent
27f70d5f90
commit
2eae20f0bd
1 changed files with 18 additions and 12 deletions
|
@ -1,8 +1,9 @@
|
|||
// @flow
|
||||
import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS, SIMPLE_SITE } from 'config';
|
||||
import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS, MISSING_THUMB_DEFAULT } from 'config';
|
||||
import { formattedEmote, inlineEmote } from 'util/remark-emote';
|
||||
import { formattedLinks, inlineLinks } from 'util/remark-lbry';
|
||||
import { formattedTimestamp, inlineTimestamp } from 'util/remark-timestamp';
|
||||
import { getThumbnailCdnUrl } from 'util/thumbnail';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as React from 'react';
|
||||
import Button from 'component/button';
|
||||
|
@ -194,17 +195,22 @@ export default React.memo<MarkdownProps>(function MarkdownPreview(props: Markdow
|
|||
),
|
||||
// Workaraund of remarkOptions.Fragment
|
||||
div: React.Fragment,
|
||||
img: (imgProps) =>
|
||||
isStakeEnoughForPreview(stakedLevel) && !isEmote(imgProps.title, imgProps.src) ? (
|
||||
<ZoomableImage {...imgProps} />
|
||||
) : (
|
||||
<SimpleImageLink
|
||||
src={imgProps.src}
|
||||
alt={imgProps.alt}
|
||||
title={imgProps.title}
|
||||
helpText={SIMPLE_SITE ? __("This channel isn't staking enough Credits for inline image previews.") : ''}
|
||||
/>
|
||||
),
|
||||
img: (imgProps) => {
|
||||
const imageCdnUrl =
|
||||
getThumbnailCdnUrl({ thumbnail: imgProps.src, width: 0, height: 0, quality: 85 }) || MISSING_THUMB_DEFAULT;
|
||||
if (isStakeEnoughForPreview(stakedLevel) && !isEmote(imgProps.title, imgProps.src)) {
|
||||
return <ZoomableImage {...imgProps} src={imageCdnUrl} />;
|
||||
} else {
|
||||
return (
|
||||
<SimpleImageLink
|
||||
src={imageCdnUrl}
|
||||
alt={imgProps.alt}
|
||||
title={imgProps.title}
|
||||
helpText={__("This channel isn't staking enough Credits for inline image previews.")}
|
||||
/>
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue