aboutsummaryrefslogtreecommitdiff
path: root/apps/web/src/app
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-02-26 17:53:38 -0700
committerDhravya <[email protected]>2024-02-26 17:53:38 -0700
commiteba818ffb4ca84f24f4d29924533bc2c098c88ce (patch)
tree542bbc30559a93bc4569fcc103e9cc2fdc20e50c /apps/web/src/app
parentchaos (diff)
downloadsupermemory-eba818ffb4ca84f24f4d29924533bc2c098c88ce.tar.xz
supermemory-eba818ffb4ca84f24f4d29924533bc2c098c88ce.zip
EVERYTHING WORKING PERFECTLY
Diffstat (limited to 'apps/web/src/app')
-rw-r--r--apps/web/src/app/MessagePoster.tsx19
-rw-r--r--apps/web/src/app/api/[...nextauth]/route.ts (renamed from apps/web/src/app/api/auth/[...nextauth]/route.ts)0
-rw-r--r--apps/web/src/app/api/hello/route.ts22
-rw-r--r--apps/web/src/app/api/store/route.ts9
-rw-r--r--apps/web/src/app/favicon.icobin0 -> 25931 bytes
-rw-r--r--apps/web/src/app/globals.css33
-rw-r--r--apps/web/src/app/layout.tsx26
-rw-r--r--apps/web/src/app/not-found.tsx58
-rw-r--r--apps/web/src/app/page.tsx9
9 files changed, 154 insertions, 22 deletions
diff --git a/apps/web/src/app/MessagePoster.tsx b/apps/web/src/app/MessagePoster.tsx
new file mode 100644
index 00000000..ad7d450d
--- /dev/null
+++ b/apps/web/src/app/MessagePoster.tsx
@@ -0,0 +1,19 @@
+'use client';
+
+import { useEffect } from 'react';
+
+function MessagePoster({ jwt }: { jwt: string }) {
+ useEffect(() => {
+ if (typeof window === 'undefined') return;
+
+ window.postMessage({ jwt }, '*');
+ }, [jwt]);
+
+ return (
+ <button onClick={() => window.postMessage({ jwt }, '*')}>
+ Validate Extension
+ </button>
+ );
+}
+
+export default MessagePoster;
diff --git a/apps/web/src/app/api/auth/[...nextauth]/route.ts b/apps/web/src/app/api/[...nextauth]/route.ts
index db7d1fb8..db7d1fb8 100644
--- a/apps/web/src/app/api/auth/[...nextauth]/route.ts
+++ b/apps/web/src/app/api/[...nextauth]/route.ts
diff --git a/apps/web/src/app/api/hello/route.ts b/apps/web/src/app/api/hello/route.ts
new file mode 100644
index 00000000..705b3cb8
--- /dev/null
+++ b/apps/web/src/app/api/hello/route.ts
@@ -0,0 +1,22 @@
+import type { NextRequest } from 'next/server'
+import { getRequestContext } from '@cloudflare/next-on-pages'
+
+export const runtime = 'edge'
+
+export async function GET(request: NextRequest) {
+ let responseText = 'Hello World'
+
+ // In the edge runtime you can use Bindings that are available in your application
+ // (for more details see:
+ // - https://developers.cloudflare.com/pages/framework-guides/deploy-a-nextjs-site/#use-bindings-in-your-nextjs-application
+ // - https://developers.cloudflare.com/pages/functions/bindings/
+ // )
+ //
+ // KV Example:
+ // const myKv = getRequestContext().env.MY_KV
+ // await myKv.put('suffix', ' from a KV store!')
+ // const suffix = await myKv.get('suffix')
+ // responseText += suffix
+
+ return new Response(responseText)
+}
diff --git a/apps/web/src/app/api/store/route.ts b/apps/web/src/app/api/store/route.ts
index 0d1c38ff..c1c3eee1 100644
--- a/apps/web/src/app/api/store/route.ts
+++ b/apps/web/src/app/api/store/route.ts
@@ -7,15 +7,18 @@ export const runtime = "edge";
export async function GET(req: NextRequest) {
try {
- const token = req.cookies.get("next-auth.session-token")?.value ?? req.headers.get("Authorization")?.replace("Bearer ", "");
+ const token = req.cookies.get("next-auth.session-token")?.value ?? req.cookies.get("authjs.session-token")?.value ?? req.headers.get("Authorization")?.replace("Bearer ", "");
+
+ console.log(token ? token : 'token not found lol')
+ console.log(process.env.DATABASE)
const session = await db.select().from(sessions).where(eq(sessions.sessionToken, token!))
- .leftJoin(users, eq(sessions.userId, users.id))
+ .leftJoin(users, eq(sessions.userId, users.id)).limit(1)
if (!session || session.length === 0) {
return NextResponse.json({ message: "Invalid Key, session not found." }, { status: 404 });
}
- return NextResponse.json({ message: "OK", data: session[0] }, { status: 200 });
+ return NextResponse.json({ message: "OK", data: session }, { status: 200 });
} catch (error) {
return NextResponse.json({ message: "Error", error }, { status: 500 });
}
diff --git a/apps/web/src/app/favicon.ico b/apps/web/src/app/favicon.ico
new file mode 100644
index 00000000..718d6fea
--- /dev/null
+++ b/apps/web/src/app/favicon.ico
Binary files differ
diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.css
new file mode 100644
index 00000000..875c01e8
--- /dev/null
+++ b/apps/web/src/app/globals.css
@@ -0,0 +1,33 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
+
+:root {
+ --foreground-rgb: 0, 0, 0;
+ --background-start-rgb: 214, 219, 220;
+ --background-end-rgb: 255, 255, 255;
+}
+
+@media (prefers-color-scheme: dark) {
+ :root {
+ --foreground-rgb: 255, 255, 255;
+ --background-start-rgb: 0, 0, 0;
+ --background-end-rgb: 0, 0, 0;
+ }
+}
+
+body {
+ color: rgb(var(--foreground-rgb));
+ background: linear-gradient(
+ to bottom,
+ transparent,
+ rgb(var(--background-end-rgb))
+ )
+ rgb(var(--background-start-rgb));
+}
+
+@layer utilities {
+ .text-balance {
+ text-wrap: balance;
+ }
+}
diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx
index 9d62d395..3314e478 100644
--- a/apps/web/src/app/layout.tsx
+++ b/apps/web/src/app/layout.tsx
@@ -1,28 +1,22 @@
-import '@/styles/globals.css';
+import type { Metadata } from "next";
+import { Inter } from "next/font/google";
+import "./globals.css";
-import { Inter } from 'next/font/google';
+const inter = Inter({ subsets: ["latin"] });
-const inter = Inter({
- subsets: ['latin'],
- variable: '--font-sans',
-});
-
-export const metadata = {
- title: 'Create T3 App',
- description: 'Generated by create-t3-app',
- icons: [{ rel: 'icon', url: '/favicon.ico' }],
+export const metadata: Metadata = {
+ title: "Create Next App",
+ description: "Generated by create next app",
};
-export const runtime = 'edge';
-
export default function RootLayout({
children,
-}: {
+}: Readonly<{
children: React.ReactNode;
-}) {
+}>) {
return (
<html lang="en">
- <body className={`font-sans ${inter.variable}`}>{children}</body>
+ <body className={inter.className}>{children}</body>
</html>
);
}
diff --git a/apps/web/src/app/not-found.tsx b/apps/web/src/app/not-found.tsx
new file mode 100644
index 00000000..3409889a
--- /dev/null
+++ b/apps/web/src/app/not-found.tsx
@@ -0,0 +1,58 @@
+export const runtime = "edge";
+
+export default function NotFound() {
+ return (
+ <>
+ <title>404: This page could not be found.</title>
+ <div style={styles.error}>
+ <div>
+ <style
+ dangerouslySetInnerHTML={{
+ __html: `body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}`,
+ }}
+ />
+ <h1 className="next-error-h1" style={styles.h1}>
+ 404
+ </h1>
+ <div style={styles.desc}>
+ <h2 style={styles.h2}>This page could not be found.</h2>
+ </div>
+ </div>
+ </div>
+ </>
+ );
+}
+
+const styles = {
+ error: {
+ fontFamily:
+ 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
+ height: "100vh",
+ textAlign: "center",
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ justifyContent: "center",
+ },
+
+ desc: {
+ display: "inline-block",
+ },
+
+ h1: {
+ display: "inline-block",
+ margin: "0 20px 0 0",
+ padding: "0 23px 0 0",
+ fontSize: 24,
+ fontWeight: 500,
+ verticalAlign: "top",
+ lineHeight: "49px",
+ },
+
+ h2: {
+ fontSize: 14,
+ fontWeight: 400,
+ lineHeight: "49px",
+ margin: 0,
+ },
+} as const;
diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx
index 3b9e44c4..f6c8981f 100644
--- a/apps/web/src/app/page.tsx
+++ b/apps/web/src/app/page.tsx
@@ -1,12 +1,15 @@
-import { cookies } from 'next/headers';
-import MessagePoster from '../../../anycontext-front/src/app/MessagePoster';
+import Image from "next/image";
+import MessagePoster from "./MessagePoster";
+import { cookies } from "next/headers";
+import { Component } from "@/components/component";
export const runtime = 'edge';
-export default function HomePage() {
+export default function Home() {
return (
<main>
<MessagePoster jwt={cookies().get('next-auth.session-token')?.value!} />
+ <Component/>
</main>
);
}