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