Skip to content

Commit b56a503

Browse files
authored
Merge branch 'main' into task/contact-security-opensource-pages
2 parents a538c76 + fe39042 commit b56a503

8 files changed

Lines changed: 381 additions & 6 deletions

File tree

bun.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@radix-ui/react-slot": "^1.2.3",
1515
"class-variance-authority": "^0.7.1",
1616
"clsx": "^2.1.1",
17+
"esbuild": "0.25.8",
1718
"fumadocs-core": "15.6.5",
1819
"fumadocs-mdx": "11.7.0",
1920
"fumadocs-ui": "15.6.5",
@@ -24,15 +25,18 @@
2425
"ogl": "^1.0.11",
2526
"prettier": "^3.6.2",
2627
"prettier-plugin-tailwindcss": "^0.6.14",
28+
"prismjs": "^1.30.0",
2729
"react": "^19.1.0",
2830
"react-dom": "^19.1.0",
31+
"react-simple-code-editor": "^0.14.1",
2932
"sharp": "^0.34.3",
3033
"tailwind-merge": "^3.3.1"
3134
},
3235
"devDependencies": {
3336
"@tailwindcss/postcss": "^4.1.11",
3437
"@types/mdx": "^2.0.13",
3538
"@types/node": "24.0.15",
39+
"@types/prismjs": "^1.26.5",
3640
"@types/react": "^19.1.8",
3741
"@types/react-dom": "^19.1.6",
3842
"eslint": "^9.31.0",

src/app/api/playground/route.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// src/app/api/run-java/route.ts
2+
3+
import { NextResponse } from 'next/server';
4+
5+
export async function POST(req: Request) {
6+
try {
7+
const { code } = await req.json();
8+
9+
const response = await fetch('https://api.jdoodle.com/v1/execute', {
10+
method: 'POST',
11+
headers: {
12+
'Content-Type': 'application/json',
13+
},
14+
body: JSON.stringify({
15+
script: code,
16+
language: 'java',
17+
versionIndex: '3', // Java 11
18+
clientId: '' ,// ← replace with your actual clientId
19+
clientSecret: '', // ← replace with your actual clientSecret
20+
}),
21+
});
22+
23+
const data = await response.json();
24+
25+
return new NextResponse(JSON.stringify({
26+
run: {
27+
output: data.output || 'No output',
28+
},
29+
}), {
30+
status: 200,
31+
headers: { 'Content-Type': 'application/json' },
32+
});
33+
34+
} catch (err) {
35+
console.error(err);
36+
return new NextResponse(JSON.stringify({ error: 'Execution failed' }), {
37+
status: 500,
38+
headers: { 'Content-Type': 'application/json' },
39+
});
40+
}
41+
}

src/app/layout.config.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export const baseOptions: BaseLayoutProps = {
2929
text: "Sponsors",
3030
url: "/sponsors",
3131
},
32+
{
33+
text: "Playground",
34+
url: "/playground",
35+
}
3236
],
3337
githubUrl: "https://github.com/javaistic/javaistic",
3438
themeSwitch: {

src/app/playground/layout.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { baseOptions } from "@/app/layout.config";
2+
import Particles from "@/components/Particles";
3+
import { HomeLayout } from "fumadocs-ui/layouts/home";
4+
import type { ReactNode } from "react";
5+
6+
export default function Layout({ children }: { children: ReactNode }) {
7+
return (
8+
<HomeLayout
9+
{...baseOptions}
10+
style={{
11+
"--spacing-fd-container": "1280px",
12+
} as React.CSSProperties}
13+
>
14+
{children}
15+
</HomeLayout>
16+
);
17+
}

0 commit comments

Comments
 (0)