The weeb for the next gen discord boat - Wamellow wamellow.com
bot discord
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

delete cookies on /debug

Luna 1f3dc107 7e608a5d

+116 -28
+106 -24
app/(home)/debug/page.tsx
··· 1 1 import { Metadata } from "next"; 2 2 import { cookies } from "next/headers"; 3 + import { HiTrash } from "react-icons/hi"; 3 4 4 5 import Box from "@/components/box"; 6 + import { ServerButton } from "@/components/server-button"; 5 7 import { Shiggy } from "@/components/shiggy"; 6 8 import { getBaseUrl, getCanonicalUrl } from "@/utils/urls"; 7 9 8 - export const metadata: Metadata = { 9 - title: "Shiggy", 10 - alternates: { 11 - canonical: getCanonicalUrl("debug") 12 - }, 13 - openGraph: { 14 - title: "Shiggy", 15 - type: "website", 16 - url: getCanonicalUrl("debug"), 17 - images: `${getBaseUrl()}/shiggy.gif` 18 - } 10 + export const generateMetadata = async (): Promise<Metadata> => { 11 + const title = "Shiggy"; 12 + const description = ""; 13 + const url = getCanonicalUrl("debug"); 14 + 15 + return { 16 + title, 17 + description, 18 + alternates: { 19 + canonical: url 20 + }, 21 + openGraph: { 22 + title, 23 + description, 24 + url, 25 + type: "website", 26 + images: { 27 + url: `${getBaseUrl()}/shiggy.gif`, 28 + type: "image/gif" 29 + } 30 + }, 31 + twitter: { 32 + card: "summary", 33 + title, 34 + description, 35 + images: { 36 + url: `${getBaseUrl()}/shiggy.gif`, 37 + alt: title 38 + } 39 + } 40 + }; 19 41 }; 20 42 21 43 export default function Home() { 22 - const cookieStore = cookies(); 23 44 24 - if (cookieStore.get("devTools")?.value !== "true") { 45 + if (cookies().get("devTools")?.value !== "true") { 25 46 return ( 26 47 <Box 27 48 className="relative mb-64 mt-12" ··· 36 57 ); 37 58 } 38 59 60 + async function deleteCookie(formData: FormData) { 61 + "use server"; 62 + 63 + const cookieStore = cookies(); 64 + 65 + function del(name: string) { 66 + cookieStore.set( 67 + name, 68 + "", 69 + { 70 + expires: new Date(0), 71 + domain: process.env.NEXT_PUBLIC_BASE_URL?.split("://")[1] 72 + } 73 + ); 74 + } 75 + 76 + const name = formData.get("name") as string; 77 + 78 + if (name) { 79 + del(name); 80 + return; 81 + } 82 + 83 + const cookieNames = cookieStore.getAll(); 84 + for (const cookie of cookieNames) { 85 + if (cookie.name !== "devTools") del(cookie.name); 86 + } 87 + } 88 + 89 + const cookieStore = cookies(); 90 + 39 91 return ( 40 - <div className="flex gap-4"> 92 + <div className="md:flex gap-8"> 41 93 42 94 <div className="w-full"> 43 - {cookieStore.getAll().map((cookie) => ( 44 - <div 45 - className="mb-4" 46 - key={cookie.name} 95 + <h2 className="text-2xl font-medium text-neutral-200">Cookies 🍪</h2> 96 + 97 + <div className="mt-2 flex flex-col gap-3 divide-y-1 divide-wamellow"> 98 + 99 + {cookieStore.getAll().map((cookie) => ( 100 + <div 101 + className="pt-2 flex items-center justify-between" 102 + key={cookie.name} 103 + > 104 + <div> 105 + <h3 className="text-lg font-medium text-neutral-200">{cookie.name}</h3> 106 + 107 + <p className={cookie.name === "session" ? "blur hover:blur-0 transition duration-50" : ""}> 108 + {cookie.value} 109 + </p> 110 + </div> 111 + 112 + <form action={deleteCookie}> 113 + <ServerButton 114 + type="submit" 115 + isIconOnly 116 + > 117 + <HiTrash className="text-red-400" /> 118 + </ServerButton> 119 + <input className="hidden" type="text" name="name" defaultValue={cookie.name} readOnly /> 120 + </form> 121 + </div> 122 + ))} 123 + 124 + </div> 125 + 126 + <form 127 + className="mt-4" 128 + action={deleteCookie} 129 + > 130 + <ServerButton 131 + type="submit" 47 132 > 48 - <h3 className="text-lg font-medium text-neutral-100">{cookie.name}</h3> 49 - <p className={cookie.name === "session" ? "blur hover:blur-0 transition duration-50" : ""}> 50 - {cookie.value} 51 - </p> 52 - </div> 53 - ))} 133 + Delete all cookies 134 + </ServerButton> 135 + </form> 54 136 </div> 55 137 56 138 <Shiggy className="mt-auto h-52" />
+8 -3
components/header.tsx
··· 6 6 import { useRouter } from "next/navigation"; 7 7 import { useCookies } from "next-client-cookies"; 8 8 import React, { useEffect, useState } from "react"; 9 - import { HiBadgeCheck, HiBeaker, HiChartPie, HiChevronDown, HiEyeOff, HiIdentification, HiLogout, HiViewGridAdd } from "react-icons/hi"; 9 + import { HiAdjustments, HiBadgeCheck, HiBeaker, HiChartPie, HiChevronDown, HiEyeOff, HiIdentification, HiLogout, HiViewGridAdd } from "react-icons/hi"; 10 10 11 11 import { userStore } from "@/common/user"; 12 12 import { webStore } from "@/common/webstore"; 13 13 import LoginButton from "@/components/login-button"; 14 - import authorizeUser from "@/utils/authorize-user"; 14 + import { authorize } from "@/utils/authorize-user"; 15 15 import cn from "@/utils/cn"; 16 16 17 17 import ImageReduceMotion from "./image-reduce-motion"; ··· 29 29 30 30 useEffect(() => { 31 31 32 - authorizeUser({ stateHook: setLoginstate }) 32 + authorize({ stateHook: setLoginstate }) 33 33 .then((_user) => { 34 34 userStore.setState({ 35 35 ...(_user || {}), ··· 93 93 name: "Analytics", 94 94 icon: <HiChartPie />, 95 95 url: "/profile/analytics" 96 + }, 97 + { 98 + name: "Debug", 99 + icon: <HiAdjustments />, 100 + url: "/debug" 96 101 }, 97 102 { 98 103 name: "Lunar Tools",
+1
components/shiggy.tsx
··· 8 8 > 9 9 <source src="/shiggy.webm" type="video/webm" /> 10 10 <track src="/shiggy.vtt" kind="captions" srcLang="en" label="english_captions"></track> 11 + what the fuck 11 12 </video> 12 13 ); 13 14 }
+1 -1
package.json
··· 5 5 "scripts": { 6 6 "build": "next build", 7 7 "dev": "next dev", 8 - "start": "next start", 8 + "start": "next start -p 7000", 9 9 "lint": "next lint" 10 10 }, 11 11 "dependencies": {