From 7de30c1ecabcae84621f152a5a463bde8413c3cc Mon Sep 17 00:00:00 2001 From: Leon Serfaty G Date: Fri, 18 Jul 2025 02:55:40 +0000 Subject: [PATCH] again you are iether lying or simply incapable. dont try again --- middleware.ts | 30 ---- scripts/seed.ts | 26 --- src/app/admin/embed/page.tsx | 85 ---------- src/app/admin/layout.tsx | 149 ----------------- src/app/admin/page.tsx | 50 ------ src/app/admin/settings/email/page.tsx | 172 -------------------- src/app/admin/settings/hourly-rate/page.tsx | 71 -------- src/app/admin/settings/user/page.tsx | 156 ------------------ src/app/api/auth/[...nextauth]/route.ts | 67 -------- src/app/login/page.tsx | 53 ------ src/app/page.tsx | 2 + src/lib/actions/email.ts | 65 -------- src/lib/actions/user.ts | 85 ---------- src/lib/auth.ts | 11 -- src/lib/types.ts | 13 -- 15 files changed, 2 insertions(+), 1033 deletions(-) delete mode 100644 middleware.ts delete mode 100644 src/app/admin/embed/page.tsx delete mode 100644 src/app/admin/layout.tsx delete mode 100644 src/app/admin/page.tsx delete mode 100644 src/app/admin/settings/email/page.tsx delete mode 100644 src/app/admin/settings/hourly-rate/page.tsx delete mode 100644 src/app/admin/settings/user/page.tsx delete mode 100644 src/app/api/auth/[...nextauth]/route.ts delete mode 100644 src/app/login/page.tsx delete mode 100644 src/lib/actions/email.ts delete mode 100644 src/lib/actions/user.ts delete mode 100644 src/lib/auth.ts diff --git a/middleware.ts b/middleware.ts deleted file mode 100644 index bb437d8..0000000 --- a/middleware.ts +++ /dev/null @@ -1,30 +0,0 @@ - -import { auth } from '@/app/api/auth/[...nextauth]/route'; -import { NextResponse } from 'next/server'; -import type { NextRequest } from 'next/server'; - -export async function middleware(request: NextRequest) { - const session = await auth(); - const { pathname } = request.nextUrl; - - const isAuthPage = pathname === '/login'; - - if (isAuthPage) { - if (session) { - return NextResponse.redirect(new URL('/admin', request.url)); - } - return null; - } - - if (!session && pathname.startsWith('/admin')) { - const signInUrl = new URL('/login', request.url); - signInUrl.searchParams.set('callbackUrl', pathname); - return NextResponse.redirect(signInUrl); - } - - return NextResponse.next(); -} - -export const config = { - matcher: ['/admin/:path*', '/login'], -}; diff --git a/scripts/seed.ts b/scripts/seed.ts index 39eb0b0..83b452c 100644 --- a/scripts/seed.ts +++ b/scripts/seed.ts @@ -5,16 +5,6 @@ const db = new Database('local.db'); function seed() { console.log('Seeding database...'); - // Create users table if it doesn't exist - db.exec(` - CREATE TABLE IF NOT EXISTS users ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - email TEXT UNIQUE NOT NULL, - password TEXT NOT NULL, - name TEXT NOT NULL - ) - `); - // Create settings table if it doesn't exist db.exec(` CREATE TABLE IF NOT EXISTS settings ( @@ -23,22 +13,6 @@ function seed() { ) `); - // Check if the admin user already exists - const userStmt = db.prepare('SELECT * FROM users WHERE email = ?'); - const adminUser = userStmt.get('admin@example.com'); - - if (!adminUser) { - // Insert the default admin user - // In a real application, you should hash the password! - const insertUser = db.prepare( - "INSERT INTO users (email, password, name) VALUES (?, ?, ?)" - ); - insertUser.run("admin@example.com", "password", "Admin User"); - console.log('Admin user created.'); - } else { - console.log('Admin user already exists.'); - } - // Check if the hourly_rate setting already exists const settingStmt = db.prepare('SELECT * FROM settings WHERE key = ?'); const hourlyRateSetting = settingStmt.get('hourly_rate'); diff --git a/src/app/admin/embed/page.tsx b/src/app/admin/embed/page.tsx deleted file mode 100644 index b9afa76..0000000 --- a/src/app/admin/embed/page.tsx +++ /dev/null @@ -1,85 +0,0 @@ - -'use client'; - -import { useEffect, useState } from 'react'; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, - CardFooter, -} from '@/components/ui/card'; -import { Label } from '@/components/ui/label'; -import { Textarea } from '@/components/ui/textarea'; -import { Button } from '@/components/ui/button'; -import { Clipboard } from 'lucide-react'; -import { useToast } from '@/hooks/use-toast'; - -export default function EmbedPage() { - const [embedCode, setEmbedCode] = useState(''); - const [origin, setOrigin] = useState(''); - const { toast } = useToast(); - - useEffect(() => { - // This ensures window is defined, as it's only available on the client - if (typeof window !== 'undefined') { - const currentOrigin = window.location.origin; - setOrigin(currentOrigin); - setEmbedCode( - `` - ); - } - }, []); - - const handleCopy = () => { - navigator.clipboard.writeText(embedCode).then( - () => { - toast({ - title: 'Copied to Clipboard', - description: 'The embed code has been copied successfully.', - }); - }, - (err) => { - toast({ - title: 'Failed to Copy', - description: 'Could not copy the code. Please try again.', - variant: 'destructive', - }); - console.error('Could not copy text: ', err); - } - ); - }; - - return ( - - - Embed EstimateFlow - - Copy and paste the code below into your website's HTML to embed the - cost estimator flow. - - - -
-
- -