diff --git a/lemmy-translations b/lemmy-translations index d250d15f..e78c744a 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit d250d15f4fbf3e1b9565529f7d0cea90c8270757 +Subproject commit e78c744abe5c3824f9ca7de7f1ee086468385ee0 diff --git a/src/assets/css/main.css b/src/assets/css/main.css index cc962abc..a7d7e706 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -461,7 +461,3 @@ br.big { .totp-link { width: fit-content; } - -#adultConsentModal { - backdrop-filter: blur(10px); -} diff --git a/src/server/utils/create-ssr-html.tsx b/src/server/utils/create-ssr-html.tsx index c47e1dae..688b65aa 100644 --- a/src/server/utils/create-ssr-html.tsx +++ b/src/server/utils/create-ssr-html.tsx @@ -75,6 +75,20 @@ export async function createSsrHtml( .map(x => ``) .join(""); + // Blurring has to happen even if all style sheets fail to load. + const blurStyles = !site?.site_view.site.content_warning + ? "" + : ` + `; + return ` @@ -84,7 +98,12 @@ export async function createSsrHtml( const light = window.matchMedia("(prefers-color-scheme: light)").matches; document.documentElement.setAttribute("data-bs-theme", light ? "light" : "dark"); } + if (document.documentElement.hasAttribute("data-lemmy-blur")) { + const consent = localStorage.getItem("adult-consent") === "true"; + document.documentElement.setAttribute("data-lemmy-blur", consent ? "off" : "on"); + } + ${blurStyles} ${lazyScripts} diff --git a/src/shared/components/common/adult-consent-modal.tsx b/src/shared/components/common/adult-consent-modal.tsx index 30df0483..38ed259c 100644 --- a/src/shared/components/common/adult-consent-modal.tsx +++ b/src/shared/components/common/adult-consent-modal.tsx @@ -4,7 +4,9 @@ import { adultConsentLocalStorageKey } from "../../config"; import { setIsoData } from "@utils/app"; import { IsoDataOptionalSite } from "../../interfaces"; import { mdToHtml } from "../../markdown"; -import { I18NextService, UserService } from "../../services"; +import { I18NextService } from "../../services"; +import { isBrowser } from "@utils/browser"; +import { Helmet } from "inferno-helmet"; interface AdultConsentModalProps { contentWarning: string; @@ -33,6 +35,13 @@ class AdultConsentModalInner extends Component { data-bs-backdrop="static" ref={this.modalDivRef} > +