File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
apps/sim/app/api/tools/command/exec Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -2,18 +2,20 @@ import { spawn } from "child_process";
22import { NextRequest , NextResponse } from "next/server" ;
33import type { CommandInput , CommandOutput } from "@/tools/command/types" ;
44
5+ import { getSession } from '@/lib/auth'
6+
57export async function POST ( request : NextRequest ) {
68 try {
7- const params : CommandInput = await request . json ( ) ;
8-
9- // Validate input
10- if ( ! params . command ) {
9+ const session = await getSession ( )
10+ if ( ! session ?. user ?. id ) {
1111 return NextResponse . json (
12- { error : "Command is required" } ,
13- { status : 400 } ,
14- ) ;
12+ { error : 'Unauthorized' } ,
13+ { status : 401 } ,
14+ )
1515 }
1616
17+ const params : CommandInput = await request . json ( )
18+
1719 // Set default values
1820 const workingDirectory = params . workingDirectory || process . cwd ( ) ;
1921 const timeout = params . timeout || 30000 ;
You can’t perform that action at this time.
0 commit comments