Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

# Docker sandbox
SANDBOX_IMAGE=simples-runner:latest
EXEC_TIMEOUT_S=10
COMPILE_TIMEOUT_S=15
EXEC_TIMEOUT_S=30
COMPILE_TIMEOUT_S=30
MAX_CODE_KB=64
RUNS_PER_MINUTE=30

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ services:
- SUPABASE_URL=${SUPABASE_URL:-}
- SUPABASE_ANON_KEY=${SUPABASE_ANON_KEY:-}
- SUPABASE_JWT_SECRET=${SUPABASE_JWT_SECRET:-}
- EXEC_TIMEOUT_S=${EXEC_TIMEOUT_S:-10}
- COMPILE_TIMEOUT_S=${COMPILE_TIMEOUT_S:-15}
- EXEC_TIMEOUT_S=${EXEC_TIMEOUT_S:-30}
- COMPILE_TIMEOUT_S=${COMPILE_TIMEOUT_S:-30}
- MAX_CODE_KB=${MAX_CODE_KB:-64}
- RUNS_PER_MINUTE=${RUNS_PER_MINUTE:-30}
- SANDBOX_IMAGE=${SANDBOX_IMAGE:-simples-runner:latest}
Expand Down
14 changes: 0 additions & 14 deletions frontend/app.config.ts

This file was deleted.

64 changes: 34 additions & 30 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ function App() {

case "asm_generated":
setAsmOutput((msg.asm as string) || "");
setIsCompiling(false);
termRef.current?.writeln("\x1b[1;32m✓ Compilação concluída (NASM gerado)\x1b[0m");
break;

Expand All @@ -344,6 +345,7 @@ function App() {
break;

case "compile_error": {
setIsCompiling(false);
const rawErrors = msg.errors as CompileError[] | undefined;
const errors: CompileError[] = rawErrors?.length ? rawErrors : [{
line: (msg.line as number) || 0,
Expand Down Expand Up @@ -384,37 +386,39 @@ function App() {
setCompileErrors([]);
clearEditorMarkers();

// First, compile via REST
fetch("/api/compile", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ code: currentCode }),
})
.then((res) => res.json())
.then((data: { success: boolean; asm?: string; errors?: CompileError[] }) => {
if (data.success) {
setAsmOutput(data.asm || "");
// Now execute via WebSocket
const ws = wsRef.current;
if (ws?.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify({ type: "compile_and_run", code: currentCode }));
}
} else {
const errors = data.errors?.length ? data.errors : [{
line: 0, column: 0, message: "Erro de compilação", phase: "compiler",
}];
setCompileErrors(errors);
setEditorMarkers(errors);
}
})
.catch((e) => {
setCompileErrors([{
line: 0, column: 0,
message: `Erro de rede: ${e instanceof Error ? e.message : String(e)}`,
phase: "network",
}]);
// Send via WebSocket — o handler WS compila, retorna NASM (asm_generated)
// e executa em uma única requisição. Evita compilar DUAS vezes.
const ws = wsRef.current;
if (ws?.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify({ type: "compile_and_run", code: currentCode }));
} else {
// Fallback: WebSocket não conectado — compila via REST (somente NASM)
fetch("/api/compile", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ code: currentCode }),
})
.finally(() => setIsCompiling(false));
.then((res) => res.json())
.then((data: { success: boolean; asm?: string; errors?: CompileError[] }) => {
if (data.success) {
setAsmOutput(data.asm || "");
} else {
const errors = data.errors?.length ? data.errors : [{
line: 0, column: 0, message: "Erro de compilação", phase: "compiler",
}];
setCompileErrors(errors);
setEditorMarkers(errors);
}
})
.catch((e) => {
setCompileErrors([{
line: 0, column: 0,
message: `Erro de rede: ${e instanceof Error ? e.message : String(e)}`,
phase: "network",
}]);
})
.finally(() => setIsCompiling(false));
}
}, [code, clearEditorMarkers, setEditorMarkers]);

const handleStop = useCallback(() => {
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/client.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/src/components/LoginPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Auth } from "@supabase/auth-ui-react";
import { ThemeSupa } from "@supabase/auth-ui-shared";
import { supabase } from "src/lib/supabase";
import { supabase } from "../lib/supabase";

const siteUrl = import.meta.env.VITE_SITE_URL || (typeof window !== "undefined" ? window.location.origin : "");

Expand Down
11 changes: 0 additions & 11 deletions frontend/src/routeTree.gen.ts

This file was deleted.

18 changes: 0 additions & 18 deletions frontend/src/router.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions frontend/src/routes/__root.tsx

This file was deleted.

27 changes: 0 additions & 27 deletions frontend/src/routes/index.tsx

This file was deleted.

37 changes: 0 additions & 37 deletions frontend/src/routes/login.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions frontend/src/ssr.tsx

This file was deleted.

1 change: 1 addition & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default defineConfig({
resolve: {
alias: {
"@": "/src",
src: "/src",
},
},
server: {
Expand Down
Loading