mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 22:01:13 +00:00
Prevent images from downloading without consent
This commit is contained in:
parent
ce723776a5
commit
3cbe7e1efc
6 changed files with 44 additions and 40 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit e78c744abe5c3824f9ca7de7f1ee086468385ee0
|
Subproject commit c88dd1e3b36ee1617f1b86acf94c1b7946e97cd4
|
|
@ -461,11 +461,3 @@ br.big {
|
||||||
.totp-link {
|
.totp-link {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
#app[data-adult-consent] {
|
|
||||||
filter: blur(10px);
|
|
||||||
-webkit-filter: blur(10px);
|
|
||||||
-moz-filter: blur(10px);
|
|
||||||
-o-filter: blur(10px);
|
|
||||||
-ms-filter: blur(10px);
|
|
||||||
}
|
|
||||||
|
|
|
@ -98,6 +98,16 @@ export async function createSsrHtml(
|
||||||
${helmet.title.toString()}
|
${helmet.title.toString()}
|
||||||
${helmet.meta.toString()}
|
${helmet.meta.toString()}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#app[data-adult-consent] {
|
||||||
|
filter: blur(10px);
|
||||||
|
-webkit-filter: blur(10px);
|
||||||
|
-moz-filter: blur(10px);
|
||||||
|
-o-filter: blur(10px);
|
||||||
|
-ms-filter: blur(10px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- Required meta tags -->
|
<!-- Required meta tags -->
|
||||||
<meta name="Description" content="Lemmy">
|
<meta name="Description" content="Lemmy">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
|
@ -40,7 +40,7 @@ export default class App extends Component<any, any> {
|
||||||
id="app"
|
id="app"
|
||||||
className="lemmy-site"
|
className="lemmy-site"
|
||||||
ref={this.rootRef}
|
ref={this.rootRef}
|
||||||
data-adult-consent={this.isoData.showAdultConsentModal}
|
data-adult-consent={this.isoData.showAdultConsentModal || null}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
@ -89,8 +89,8 @@ interface AdultConsentModalState {
|
||||||
|
|
||||||
function handleAdultConsent(i: AdultConsentModal) {
|
function handleAdultConsent(i: AdultConsentModal) {
|
||||||
document.cookie = `${adultConsentCookieKey}=true; Path=/; SameSite=Strict${isHttps() ? "; Secure" : ""}`;
|
document.cookie = `${adultConsentCookieKey}=true; Path=/; SameSite=Strict${isHttps() ? "; Secure" : ""}`;
|
||||||
document.querySelector("#app")?.removeAttribute("data-adult-consent");
|
|
||||||
i.setState({ show: false });
|
i.setState({ show: false });
|
||||||
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAdultConsentGoBack(i: AdultConsentModal) {
|
function handleAdultConsentGoBack(i: AdultConsentModal) {
|
||||||
|
|
|
@ -2,6 +2,8 @@ import classNames from "classnames";
|
||||||
import { Component } from "inferno";
|
import { Component } from "inferno";
|
||||||
|
|
||||||
import { UserService } from "../../services";
|
import { UserService } from "../../services";
|
||||||
|
import { setIsoData } from "@utils/app";
|
||||||
|
import { IsoData } from "../../interfaces";
|
||||||
|
|
||||||
const iconThumbnailSize = 96;
|
const iconThumbnailSize = 96;
|
||||||
const thumbnailSize = 256;
|
const thumbnailSize = 256;
|
||||||
|
@ -19,9 +21,7 @@ interface PictrsImageProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PictrsImage extends Component<PictrsImageProps, any> {
|
export class PictrsImage extends Component<PictrsImageProps, any> {
|
||||||
constructor(props: any, context: any) {
|
private readonly isoData: IsoData = setIsoData(this.context);
|
||||||
super(props, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { src, icon, iconOverlay, banner, thumbnail, nsfw, pushup, cardTop } =
|
const { src, icon, iconOverlay, banner, thumbnail, nsfw, pushup, cardTop } =
|
||||||
|
@ -33,6 +33,7 @@ export class PictrsImage extends Component<PictrsImageProps, any> {
|
||||||
true);
|
true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
!this.isoData.showAdultConsentModal && (
|
||||||
<picture>
|
<picture>
|
||||||
<source srcSet={this.src("webp")} type="image/webp" />
|
<source srcSet={this.src("webp")} type="image/webp" />
|
||||||
<source srcSet={src} />
|
<source srcSet={src} />
|
||||||
|
@ -59,6 +60,7 @@ export class PictrsImage extends Component<PictrsImageProps, any> {
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</picture>
|
</picture>
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue