Add landing and API test pages
This commit is contained in:
@@ -0,0 +1,134 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ar" dir="rtl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>فحص الـ API - منصة صقل</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f7f6; margin: 0; padding: 20px; color: #333; }
|
||||||
|
h1, h2 { text-align: center; }
|
||||||
|
.card { background: white; padding: 20px; margin: 20px auto; max-width: 600px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
|
||||||
|
.form-group { margin-bottom: 15px; }
|
||||||
|
label { display: block; margin-bottom: 5px; font-weight: bold; }
|
||||||
|
input, select { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
|
||||||
|
button { background-color: #27ae60; color: white; border: none; padding: 10px 15px; cursor: pointer; border-radius: 4px; font-weight: bold; margin-bottom: 5px; }
|
||||||
|
button:hover { background-color: #2ecc71; }
|
||||||
|
pre { background: #2c3e50; color: #ecf0f1; padding: 15px; border-radius: 4px; overflow-x: auto; direction: ltr; text-align: left; max-height: 300px; }
|
||||||
|
.btn-danger { background-color: #e74c3c; }
|
||||||
|
.btn-danger:hover { background-color: #c0392b; }
|
||||||
|
.btn-info { background-color: #3498db; }
|
||||||
|
.btn-info:hover { background-color: #2980b9; }
|
||||||
|
.nav { text-align: center; margin-bottom: 20px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="nav">
|
||||||
|
<a href="/">العودة للرئيسية</a>
|
||||||
|
</div>
|
||||||
|
<h1>أداة فحص الواجهات البرمجية (API Tester)</h1>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h2>تسجيل الدخول (Login)</h2>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>البريد الإلكتروني:</label>
|
||||||
|
<input type="email" id="login-email" value="test@example.com" placeholder="أدخل إيميل المستخدم">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>كلمة المرور:</label>
|
||||||
|
<input type="password" id="login-password" value="password" placeholder="أدخل كلمة المرور">
|
||||||
|
</div>
|
||||||
|
<button onclick="testLogin()">تسجيل الدخول</button>
|
||||||
|
<button onclick="testLogout()" class="btn-danger">تسجيل الخروج</button>
|
||||||
|
|
||||||
|
<h3>النتيجة:</h3>
|
||||||
|
<pre id="login-result">في انتظار التنفيذ...</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h2>تصفح الدورات (Courses) - يتطلب تسجيل دخول</h2>
|
||||||
|
<button onclick="testCourses()" class="btn-info">جلب الدورات (/api/courses)</button>
|
||||||
|
|
||||||
|
<h3>النتيجة:</h3>
|
||||||
|
<pre id="courses-result">في انتظار التنفيذ...</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let authToken = '';
|
||||||
|
|
||||||
|
async function testLogin() {
|
||||||
|
const email = document.getElementById('login-email').value;
|
||||||
|
const password = document.getElementById('login-password').value;
|
||||||
|
const resultBox = document.getElementById('login-result');
|
||||||
|
|
||||||
|
resultBox.innerHTML = 'جاري الاتصال بـ /api/auth/login...';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/auth/login', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ email, password })
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
resultBox.innerHTML = JSON.stringify(data, null, 2);
|
||||||
|
|
||||||
|
if (data.access_token) {
|
||||||
|
authToken = data.access_token;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
resultBox.innerHTML = 'خطأ في الاتصال: ' + error.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function testLogout() {
|
||||||
|
const resultBox = document.getElementById('login-result');
|
||||||
|
if (!authToken) {
|
||||||
|
resultBox.innerHTML = 'لا يوجد توكن حالياً. يرجى تسجيل الدخول أولاً.';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resultBox.innerHTML = 'جاري تسجيل الخروج من /api/auth/logout...';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/auth/logout', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + authToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
resultBox.innerHTML = JSON.stringify(data, null, 2);
|
||||||
|
authToken = '';
|
||||||
|
} catch (error) {
|
||||||
|
resultBox.innerHTML = 'خطأ في الاتصال: ' + error.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function testCourses() {
|
||||||
|
const resultBox = document.getElementById('courses-result');
|
||||||
|
|
||||||
|
resultBox.innerHTML = 'جاري جلب الدورات من /api/courses...';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/courses', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + authToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
resultBox.innerHTML = JSON.stringify(data, null, 2);
|
||||||
|
} catch (error) {
|
||||||
|
resultBox.innerHTML = 'خطأ في الاتصال: ' + error.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ar" dir="rtl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>منصة صقل - الرئيسية</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; text-align: center; margin: 0; padding: 0; background-color: #f4f7f6; color: #333; }
|
||||||
|
header { background-color: #2c3e50; color: white; padding: 2rem 0; }
|
||||||
|
h1 { margin: 0; font-size: 2.5rem; }
|
||||||
|
p { font-size: 1.2rem; }
|
||||||
|
.container { padding: 3rem 1rem; }
|
||||||
|
.btn { display: inline-block; background-color: #3498db; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px; font-weight: bold; margin-top: 20px; transition: 0.3s; }
|
||||||
|
.btn:hover { background-color: #2980b9; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<h1>منصة صقل</h1>
|
||||||
|
<p>المنصة التعليمية الأولى لتطوير المهارات</p>
|
||||||
|
</header>
|
||||||
|
<div class="container">
|
||||||
|
<h2>مرحباً بك في منصة صقل</h2>
|
||||||
|
<p>النظام الأساسي (Backend) يعمل بنجاح تام!</p>
|
||||||
|
<a href="/api-test" class="btn">الانتقال لصفحة فحص الـ API</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -3,5 +3,9 @@
|
|||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('welcome');
|
return view('landing');
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::get('/api-test', function () {
|
||||||
|
return view('api-test');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
{{ssl_certificate_key}}
|
||||||
|
{{ssl_certificate}}
|
||||||
|
server_name saqel.intaleqapp.com;
|
||||||
|
{{root}}
|
||||||
|
|
||||||
|
{{nginx_access_log}}
|
||||||
|
{{nginx_error_log}}
|
||||||
|
|
||||||
|
if ($scheme != "https") {
|
||||||
|
rewrite ^ https://$host$uri permanent;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /.well-known {
|
||||||
|
auth_basic off;
|
||||||
|
allow all;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{settings}}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# Forward all traffic to the Docker Nginx container listening on port 8085
|
||||||
|
proxy_pass http://127.0.0.1:8085;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Forwarded-Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_hide_header X-Varnish;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_max_temp_file_size 0;
|
||||||
|
proxy_connect_timeout 720;
|
||||||
|
proxy_send_timeout 720;
|
||||||
|
proxy_read_timeout 720;
|
||||||
|
proxy_buffer_size 128k;
|
||||||
|
proxy_buffers 4 256k;
|
||||||
|
proxy_busy_buffers_size 256k;
|
||||||
|
proxy_temp_file_write_size 256k;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map|mjs)$ {
|
||||||
|
add_header Access-Control-Allow-Origin "*";
|
||||||
|
expires max;
|
||||||
|
access_log off;
|
||||||
|
# Proxy static files to Docker as well so Nginx in Docker serves them
|
||||||
|
proxy_pass http://127.0.0.1:8085;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.(ht|svn|git) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-f $request_filename) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user