Skip to content

Commit

Permalink
fix: uwu detection
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed May 6, 2024
1 parent 2c034e7 commit 625596b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
20 changes: 0 additions & 20 deletions app/UWUHandler.tsx

This file was deleted.

21 changes: 19 additions & 2 deletions app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
PostHogPageview,
PHProvider as PostHogProvider,
} from '../PostHogProvider'
import { UWUHandler } from '../UWUHandler'

const fontSansEn = Manrope({
weight: ['400', '500', '700'],
Expand Down Expand Up @@ -106,10 +105,17 @@ export default async function RootLayout({
suppressHydrationWarning
className={`font-sans ${fontSansEn.variable}`}
>
<head>
<script
dangerouslySetInnerHTML={{
__html: `${uwu.toString()};uwu()`,
}}
/>
</head>
<Suspense>
<PostHogPageview />
</Suspense>
<UWUHandler />

<PostHogProvider>
<body className="bg-stone-50 text-stone-800 dark:bg-stone-900 dark:text-stone-300">
<ThemeProvider
Expand Down Expand Up @@ -140,3 +146,14 @@ export default async function RootLayout({
</html>
)
}

function uwu() {
const query = new URLSearchParams(location.search)
if (query?.has('uwu')) {
if (query.get('uwu') === '0' || query.get('uwu') === 'false') {
localStorage.removeItem('uwu')
} else {
localStorage.setItem('uwu', '1')
}
}
}

0 comments on commit 625596b

Please sign in to comment.