fix: remove duplicate middleware, add some docs content

This commit is contained in:
Waleed Latif
2025-03-14 17:06:57 -07:00
parent c3aa3261f5
commit 13134f801c
4 changed files with 10 additions and 55 deletions

View File

@@ -3,6 +3,7 @@ import Link from 'next/link'
import { DocsLayout } from 'fumadocs-ui/layouts/docs'
import { GithubIcon } from 'lucide-react'
import { source } from '@/lib/source'
import { AgentIcon } from '@/components/icons'
const GitHubLink = () => (
<div className="fixed bottom-4 left-4 z-50">
@@ -23,7 +24,12 @@ export default function Layout({ children }: { children: ReactNode }) {
<DocsLayout
tree={source.pageTree}
nav={{
title: 'Sim Studio',
title: (
<div className="flex items-center gap-2">
<AgentIcon className="h-4 w-4" />
Sim Studio
</div>
),
}}
>
{children}

View File

@@ -1,6 +1,6 @@
---
title: Execution
description: The execution of a workflow.
description: Sim Studio provides a powerful execution engine that brings your workflows to life. Understanding how execution works will help you design more effective workflows and troubleshoot any issues that arise..
---
import { Card, Cards } from 'fumadocs-ui/components/card'
@@ -10,10 +10,6 @@ import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { AgentIcon, ApiIcon, ConditionalIcon, CodeIcon, ChartBarIcon, ConnectIcon, GmailIcon, PerplexityIcon, NotionIcon, ExaAIIcon, FirecrawlIcon, SlackIcon } from '@/components/icons'
# Workflow Execution
Sim Studio provides a powerful execution engine that brings your workflows to life. Understanding how execution works will help you design more effective workflows and troubleshoot any issues that arise.
## Execution Flow
When you execute a workflow in Sim Studio, the system follows a predictable pattern:

View File

@@ -1,37 +0,0 @@
import { NextRequest, NextResponse } from 'next/server'
export async function middleware(request: NextRequest) {
// Check if the path is exactly /w
if (request.nextUrl.pathname === '/w') {
return NextResponse.redirect(new URL('/w/1', request.url))
}
// Skip auth check if DISABLE_AUTH is set (for standalone mode)
if (process.env.DISABLE_AUTH === 'true' || process.env.NEXT_PUBLIC_DISABLE_AUTH === 'true') {
return NextResponse.next()
}
const cookieHeader = request.headers.get("cookie");
const cookies = cookieHeader?.split("; ").reduce((acc, cookie) => {
const [key, value] = cookie.split("=");
acc.set(key, value);
return acc;
}, new Map());
const sessionCookie =
cookies?.get("better-auth.session_token") ||
cookies?.get("__Secure-better-auth.session_token");
if (!sessionCookie) {
return NextResponse.redirect(new URL('/login', request.url))
}
return NextResponse.next()
}
// TODO: Add protected routes
export const config = {
matcher: [
'/w', // Match exactly /w
'/w/:path*', // Keep existing matcher for protected routes
],
}

View File

@@ -1,4 +1,5 @@
import { NextRequest, NextResponse } from 'next/server'
import { getSessionCookie } from "better-auth/cookies"
export async function middleware(request: NextRequest) {
// Check if the path is exactly /w
@@ -11,18 +12,7 @@ export async function middleware(request: NextRequest) {
return NextResponse.next()
}
const cookieHeader = request.headers.get("cookie");
const cookies = cookieHeader?.split("; ").reduce((acc, cookie) => {
const [key, value] = cookie.split("=");
acc.set(key, value);
return acc;
}, new Map());
const sessionCookie =
cookies?.get("better-auth.session_token") ||
cookies?.get("__Secure-better-auth.session_token");
// Existing auth check for protected routes
const sessionCookie = getSessionCookie(request)
if (!sessionCookie) {
return NextResponse.redirect(new URL('/login', request.url))
}