Skip to content

API آمن لتقديم سكريبت Roblox Lua مع المصادقة - A secure API for serving Roblox Lua scripts with authentication

Notifications You must be signed in to change notification settings

KULTHX/roblox-script-api

Repository files navigation

Roblox Script API

A secure Vercel-deployed JavaScript API that serves Roblox Lua scripts with authentication and User-Agent validation.

مشروع API لسكريبت Roblox

API آمن مُنشر على Vercel يخدم سكريبت Roblox Lua مع المصادقة والتحقق من User-Agent.

Features / الميزات

  • ✅ Secure API endpoint with secret-based authentication
  • ✅ User-Agent validation for Roblox clients
  • ✅ Returns Roblox Lua scripts as plain text
  • ✅ Proper error handling and HTTP status codes
  • ✅ Ready for Vercel deployment
  • ✅ Environment variable configuration

API Endpoint

GET /api/script

Parameters

  • secret (required): Authentication secret

Headers

  • User-Agent (required): Must contain "Roblox"

Responses

  • 200 OK: Returns Lua script as plain text
  • 403 Forbidden: Invalid secret or User-Agent
  • 405 Method Not Allowed: Non-GET requests
  • 500 Internal Server Error: Server error

إرشادات رفع المشروع إلى GitHub

1. إنشاء Repository جديد على GitHub

  1. اذهب إلى GitHub.com وسجل دخولك
  2. اضغط على زر "New repository" أو "+" ثم "New repository"
  3. املأ البيانات التالية:
    • Repository name: roblox-script-api
    • Description: API آمن لتقديم سكريبت Roblox Lua مع المصادقة
    • اختر Public أو Private حسب رغبتك
    • لا تضع علامة على "Add a README file" لأنه موجود بالفعل
  4. اضغط "Create repository"

2. رفع الملفات إلى GitHub

بعد إنشاء Repository، استخدم هذه الأوامر في Terminal:

# إضافة جميع الملفات
git add .

# إنشاء commit
git commit -m "Initial commit: Roblox Script API with authentication"

# ربط المشروع بـ GitHub (غير <username> و <repository-name> بالأسماء الصحيحة)
git remote add origin https://github.com/<username>/<repository-name>.git

# رفع الملفات
git push -u origin main

Deployment Instructions / تعليمات النشر

1. نشر المشروع على Vercel مباشرة من GitHub

الطريقة الأولى: نشر مباشر عبر Vercel Dashboard

  1. اذهب إلى vercel.com وسجل دخولك
  2. اضغط "New Project"
  3. اختر "Import Git Repository"
  4. اختر repository الخاص بك roblox-script-api
  5. في إعدادات Environment Variables، أضف:
    • API_SECRET: ضع كلمة السر الخاصة بك (مثل: my_secure_secret_key_2024)
  6. اضغط "Deploy"

الطريقة الثانية: استخدام Vercel CLI

# تثبيت Vercel CLI
npm install -g vercel

# تسجيل الدخول
vercel login

# نشر المشروع
vercel

# إضافة متغير البيئة
vercel env add API_SECRET

2. Clone and Setup للتطوير المحلي

git clone https://github.com/<your-username>/roblox-script-api.git
cd roblox-script-api
npm install

# تشغيل السيرفر محلياً للاختبار
npm start

كيفية استخدام API مع Roblox

1. الحصول على السكريبت من داخل Roblox

-- مثال على كيفية استدعاء API من داخل Roblox
local HttpService = game:GetService("HttpService")

-- تأكد من تفعيل HTTP Requests في Game Settings > Security > Allow HTTP Requests

local function loadScriptFromAPI()
    local success, result = pcall(function()
        local response = HttpService:GetAsync(
            "https://your-vercel-app.vercel.app/api/script?secret=your_secret_key_here",
            false, -- لا نحتاج sync
            {
                ["User-Agent"] = "Roblox/WinInet"
            }
        )
        return response
    end)
    
    if success then
        print("تم تحميل السكريبت بنجاح!")
        -- تنفيذ السكريبت المُحمّل
        loadstring(result)()
    else
        print("خطأ في تحميل السكريبت:", result)
    end
end

-- استدعاء الدالة
loadScriptFromAPI()

2. إعدادات مطلوبة في Roblox Studio

  1. في Roblox Studio، اذهب إلى:
    • Game Settings > Security
    • فعّل Allow HTTP Requests
  2. ضع السكريبت أعلاه في ServerScriptService
  3. غيّر الرابط ليطابق رابط Vercel الخاص بك
  4. غيّر your_secret_key_here إلى كلمة السر الصحيحة

3. مثال متقدم مع معالجة الأخطاء

local HttpService = game:GetService("HttpService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local API_URL = "https://your-vercel-app.vercel.app/api/script"
local API_SECRET = "your_secret_key_here"

local function loadAndExecuteScript()
    local url = API_URL .. "?secret=" .. API_SECRET
    
    local success, response = pcall(function()
        return HttpService:GetAsync(url, false, {
            ["User-Agent"] = "Roblox/WinInet"
        })
    end)
    
    if success then
        print("✅ تم تحميل السكريبت من API")
        
        -- تنفيذ السكريبت
        local executeSuccess, executeError = pcall(function()
            loadstring(response)()
        end)
        
        if executeSuccess then
            print("✅ تم تنفيذ السكريبت بنجاح")
        else
            print("❌ خطأ في تنفيذ السكريبت:", executeError)
        end
    else
        print("❌ خطأ في تحميل السكريبت:", response)
    end
end

-- تنفيذ السكريبت
loadAndExecuteScript()

الأمان والحماية

نصائح أمنية:

  • لا تشارك API Secret مع أي شخص
  • استخدم كلمة سر قوية ومعقدة
  • غيّر كلمة السر بانتظام
  • راقب استخدام API من خلال Vercel Analytics

التحقق من المصدر:

  • API يتحقق من User-Agent ليتأكد أن الطلب من Roblox
  • يرفض جميع الطلبات بدون كلمة السر الصحيحة
  • يسجل جميع المحاولات للوصول غير المصرح

استكشاف الأخطاء

مشاكل شائعة:

  1. 403 Forbidden: تأكد من صحة كلمة السر
  2. HTTP not enabled: فعّل HTTP Requests في Game Settings
  3. User-Agent مرفوض: تأكد من استخدام User-Agent صحيح
  4. CORS errors: API يدعم CORS تلقائياً

اختبار API:

# اختبار مع curl
curl -H "User-Agent: Roblox/WinInet" \
     "https://your-vercel-app.vercel.app/api/script?secret=your_secret_key"

About

API آمن لتقديم سكريبت Roblox Lua مع المصادقة - A secure API for serving Roblox Lua scripts with authentication

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published