@ -1 +1,2 @@ |
|||||||
/// <reference types="astro/client" />
|
/// <reference types="astro/client" />
|
||||||
|
/// <reference path="content.d.ts" />
|
@ -0,0 +1,7 @@ |
|||||||
|
module.exports = { |
||||||
|
plugins: [ |
||||||
|
require('@tailwindcss/postcss'), |
||||||
|
require('autoprefixer'), |
||||||
|
// ...existing plugins... |
||||||
|
], |
||||||
|
}; |
@ -0,0 +1,7 @@ |
|||||||
|
module.exports = { |
||||||
|
plugins: { |
||||||
|
'@tailwindcss/postcss7-compat': {}, |
||||||
|
tailwindcss: {}, |
||||||
|
autoprefixer: {}, |
||||||
|
}, |
||||||
|
}; |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 131 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 211 KiB |
After Width: | Height: | Size: 321 KiB |
After Width: | Height: | Size: 306 KiB |
After Width: | Height: | Size: 312 KiB |
After Width: | Height: | Size: 263 KiB |
After Width: | Height: | Size: 278 KiB |
After Width: | Height: | Size: 231 KiB |
After Width: | Height: | Size: 248 KiB |
After Width: | Height: | Size: 220 KiB |
After Width: | Height: | Size: 208 KiB |
After Width: | Height: | Size: 273 KiB |
@ -0,0 +1,86 @@ |
|||||||
|
const express = require('express'); |
||||||
|
const cors = require('cors'); |
||||||
|
const compression = require('compression'); |
||||||
|
const jwt = require('jsonwebtoken'); // JWT kütüphanesini ekleyin |
||||||
|
|
||||||
|
const app = express(); |
||||||
|
const SECRET_KEY = 'your_secret_key'; // Güvenli bir anahtar belirleyin |
||||||
|
|
||||||
|
// Middleware'ler |
||||||
|
app.use(cors({ |
||||||
|
origin: ['https://legendary-disco-pjww576pvjpq37xg7-4321.app.github.dev', 'https://legendary-disco-pjww576pvjpq37xg7-5500.app.github.dev'], // İzin verilen kökenler |
||||||
|
methods: ['GET', 'POST'], // İzin verilen HTTP metodları |
||||||
|
credentials: true, // Çerezlerin gönderilmesine izin ver |
||||||
|
})); |
||||||
|
app.use(express.json()); // JSON gövdesini ayrıştırmak için |
||||||
|
app.use(compression()); |
||||||
|
app.use((req, res, next) => { |
||||||
|
res.cookie('exampleCookie', 'value', { |
||||||
|
httpOnly: true, |
||||||
|
secure: true, |
||||||
|
sameSite: 'None', // Üçüncü taraf çerezler için gerekli |
||||||
|
}); |
||||||
|
next(); |
||||||
|
}); |
||||||
|
|
||||||
|
// Kök URL için bir uç nokta |
||||||
|
app.get('/', (req, res) => { |
||||||
|
res.send('Welcome to the AI Tutor API!'); |
||||||
|
}); |
||||||
|
|
||||||
|
// Login uç noktası |
||||||
|
app.post('/login', (req, res) => { |
||||||
|
const { username, password } = req.body; |
||||||
|
|
||||||
|
// Basit bir kullanıcı doğrulama (örnek) |
||||||
|
if (username === 'admin' && password === 'password') { |
||||||
|
// Kullanıcı bilgileriyle bir JWT oluştur |
||||||
|
const token = jwt.sign({ username }, SECRET_KEY, { expiresIn: '1h' }); |
||||||
|
return res.json({ token }); |
||||||
|
} |
||||||
|
|
||||||
|
res.status(401).json({ message: 'Invalid credentials' }); |
||||||
|
}); |
||||||
|
|
||||||
|
// JWT doğrulama middleware'i |
||||||
|
function authenticateToken(req, res, next) { |
||||||
|
const token = req.headers['authorization']?.split(' ')[1] || req.query.token; // Bearer token veya URL parametresi |
||||||
|
|
||||||
|
if (!token) { |
||||||
|
return res.status(403).json({ message: 'Token is required' }); |
||||||
|
} |
||||||
|
|
||||||
|
jwt.verify(token, SECRET_KEY, (err, user) => { |
||||||
|
if (err) { |
||||||
|
return res.status(403).json({ message: 'Invalid token' }); |
||||||
|
} |
||||||
|
req.user = user; // Doğrulanmış kullanıcıyı isteğe ekle |
||||||
|
next(); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// Korunan bir uç nokta |
||||||
|
app.get('/protected', authenticateToken, (req, res) => { |
||||||
|
res.json({ message: `Hello, ${req.user.username}! This is a protected route.` }); |
||||||
|
}); |
||||||
|
|
||||||
|
// AI Tutor uç noktası |
||||||
|
app.get('/ai-tutor', authenticateToken, (req, res) => { |
||||||
|
res.json({ message: `Welcome to AI Tutor, ${req.user.username}!` }); |
||||||
|
}); |
||||||
|
|
||||||
|
// Yeni bir AI Tutor fonksiyonu |
||||||
|
app.post('/ai-tutor/calculate', authenticateToken, (req, res) => { |
||||||
|
const { input } = req.body; |
||||||
|
if (!input) { |
||||||
|
return res.status(400).json({ message: 'Input is required' }); |
||||||
|
} |
||||||
|
|
||||||
|
// Örnek bir hesaplama işlemi |
||||||
|
const result = `Processed input: ${input}`; |
||||||
|
res.json({ result }); |
||||||
|
}); |
||||||
|
|
||||||
|
// Sunucuyu başlat |
||||||
|
const PORT = process.env.PORT || 3001; // 3001 numaralı portu kullan |
||||||
|
app.listen(PORT, () => console.log(`Server is running on http://localhost:${PORT}`)); |
@ -0,0 +1,5 @@ |
|||||||
|
export type FAQType = { |
||||||
|
question: string; |
||||||
|
answer: string; |
||||||
|
}; |
||||||
|
// Örnek içerik
|
@ -0,0 +1,7 @@ |
|||||||
|
export function classname(...classes: (string | undefined | null | false)[]): string { |
||||||
|
return classes.filter(Boolean).join(' '); |
||||||
|
} |
||||||
|
|
||||||
|
export function cn(...classes: string[]) { |
||||||
|
return classes.filter(Boolean).join(' '); |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
export declare function someFunction(): void; |
@ -0,0 +1,11 @@ |
|||||||
|
export function someFunction() { |
||||||
|
console.log("This is a utility function from roadmapUtils."); |
||||||
|
} |
||||||
|
|
||||||
|
export function generateAIRoadmapFromText(input: { nodes: any[]; edges: any[] }) { |
||||||
|
// İşleme mantığı burada
|
||||||
|
return { |
||||||
|
nodes: input.nodes.map((node) => ({ ...node, processed: true })), |
||||||
|
edges: input.edges.map((edge) => ({ ...edge, processed: true })), |
||||||
|
}; |
||||||
|
} |
@ -0,0 +1,63 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html lang="en"> |
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||||
|
<title>AI Tutor Test</title> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<h1>AI Tutor Test</h1> |
||||||
|
|
||||||
|
<!-- JWT Token Girişi --> |
||||||
|
<label for="tokenInput">JWT Token:</label> |
||||||
|
<input type="text" id="tokenInput" placeholder="Enter your JWT token" value="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNzQzMDAwMTE0LCJleHAiOjE3NDMwMDM3MTR9.aD_aInBh8jf66iMdp9TuzCJKKhunVsuV9YIfMm_0Blw"> |
||||||
|
<button id="testButton">Send Request</button> |
||||||
|
|
||||||
|
<!-- Input Data Girişi --> |
||||||
|
<label for="inputData">Input Data:</label> |
||||||
|
<input type="text" id="inputData" placeholder="Enter data for calculation"> |
||||||
|
<button id="calculateButton">Calculate</button> |
||||||
|
|
||||||
|
<!-- Yanıt Gösterimi --> |
||||||
|
<pre id="response"></pre> |
||||||
|
|
||||||
|
<script> |
||||||
|
// /ai-tutor uç noktasına GET isteği |
||||||
|
document.getElementById('testButton').addEventListener('click', async () => { |
||||||
|
const token = document.getElementById('tokenInput').value; // Kullanıcıdan token al |
||||||
|
try { |
||||||
|
const response = await fetch('https://legendary-disco-pjww576pvjpq37xg7-3001.app.github.dev/ai-tutor', { |
||||||
|
method: 'GET', |
||||||
|
headers: { |
||||||
|
'Authorization': `Bearer ${token}` |
||||||
|
} |
||||||
|
}); |
||||||
|
const data = await response.json(); |
||||||
|
document.getElementById('response').textContent = JSON.stringify(data, null, 2); |
||||||
|
} catch (error) { |
||||||
|
document.getElementById('response').textContent = `Error: ${error.message}`; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
// /ai-tutor/calculate uç noktasına POST isteği |
||||||
|
document.getElementById('calculateButton').addEventListener('click', async () => { |
||||||
|
const token = document.getElementById('tokenInput').value; |
||||||
|
const input = document.getElementById('inputData').value; |
||||||
|
try { |
||||||
|
const response = await fetch('https://legendary-disco-pjww576pvjpq37xg7-3001.app.github.dev/ai-tutor/calculate', { |
||||||
|
method: 'POST', |
||||||
|
headers: { |
||||||
|
'Authorization': `Bearer ${token}`, |
||||||
|
'Content-Type': 'application/json' |
||||||
|
}, |
||||||
|
body: JSON.stringify({ input }) |
||||||
|
}); |
||||||
|
const data = await response.json(); |
||||||
|
document.getElementById('response').textContent = JSON.stringify(data, null, 2); |
||||||
|
} catch (error) { |
||||||
|
document.getElementById('response').textContent = `Error: ${error.message}`; |
||||||
|
} |
||||||
|
}); |
||||||
|
</script> |
||||||
|
</body> |
||||||
|
</html> |
@ -1,10 +1,14 @@ |
|||||||
|
// import classname from '@utils/classname'; |
||||||
{ |
{ |
||||||
"extends": "astro/tsconfigs/strict", |
"extends": "astro/tsconfigs/strict", |
||||||
"compilerOptions": { |
"compilerOptions": { |
||||||
"module": "ESNext", |
"module": "ESNext", |
||||||
"moduleResolution": "node", |
"moduleResolution": "node", |
||||||
"jsx": "react-jsx", |
"jsx": "react-jsx", |
||||||
"jsxImportSource": "react" |
"jsxImportSource": "react", |
||||||
|
// "paths": { |
||||||
|
// "@utils/*": ["src/editor/utils/*"] |
||||||
|
// } |
||||||
}, |
}, |
||||||
"exclude": ["node_modules", "dist"] |
"exclude": ["node_modules", "dist"] |
||||||
} |
} |
||||||
|