(async function() {
'use strict';
// --- الإعدادات الأساسية ---
const SECRET_KEY = "ST_CORE_LOCK_2026";
const COPYRIGHT_LINK = "sitegeeky.com";
// --- 1. نظام شل أدوات المطور (Anti-Debugging) ---
// هذا الكود سيقوم بتجميد متصفح السارق فوراً إذا حاول فتح (DevTools)
setInterval(function() {
(function() { return false; }['constructor']('debugger')());
}, 50);
// --- 2. دالة إغلاق الطوارئ الشاملة (الشاشة الحمراء/الزرقاء) ---
function lockTemplateUI(type, extraInfo = "") {
document.head.innerHTML = "
تنبيه الأمان";
let title = "نسخة غير مفعلة";
let message = "هذا القالب غير مفعل حالياً. يرجى الحصول على كود التفعيل المعتمد وإضافته من تخطيط مدونتك.";
let iconColor = "#3b82f6";
if (type === 'pirated') {
title = "تم رصد انتهاك وحظر القالب";
message = "هذه النسخة مقرصنة أو تم التلاعب بهيكل القالب.
تفاصيل الخطأ: " + extraInfo + "";
iconColor = "#ef4444";
}
document.body.style.opacity = "1";
document.body.style.visibility = "visible";
document.body.style.pointerEvents = "auto";
document.body.style.overflow = "visible";
document.body.style.height = "auto";
document.body.innerHTML = "";
window.stop();
}
// --- 3. نظام فحص مفتاح الترخيص الجديد الميت (STK-XXXXX-XXXXX) ---
async function checkLicense() {
const currentHost = window.location.hostname.replace(/^www\./, '').toLowerCase();
const metaLicense = document.querySelector('meta[name="st-license"]');
// التحقق من أن الميتا تاج موجودة ومقروءة
if (!metaLicense || !metaLicense.content) return false;
const userKey = metaLicense.content.trim().toUpperCase();
if (!userKey.startsWith("STK-")) return false;
try {
const enc = new TextEncoder();
const cryptoKey = await crypto.subtle.importKey("raw", enc.encode(SECRET_KEY), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
const hashBuffer = await crypto.subtle.sign("HMAC", cryptoKey, enc.encode(currentHost));
let binary = '';
const bytes = new Uint8Array(hashBuffer);
for (let i = 0; i < bytes.byteLength; i++) {
binary += String.fromCharCode(bytes[i]);
}
const b64 = btoa(binary);
let cleanStr = b64.replace(/\+/g, 'X').replace(/\//g, 'Y').replace(/=/g, '').toUpperCase();
let chunks = [];
for (let i = 0; i < cleanStr.length; i += 5) {
chunks.push(cleanStr.substring(i, i + 5));
}
const expectedKey = "STK-" + chunks.join('-');
if (userKey !== expectedKey) {
lockTemplateUI('pirated', "ترخيص غير صالح للنطاق الحالى");
return false;
}
return true;
} catch (e) {
return false;
}
}
// --- تأخير التنفيذ حتى يكتمل تحميل هيكل القالب بالكامل ---
document.addEventListener('DOMContentLoaded', async function() {
// تنفيذ فحص الترخيص أولاً بعد تحميل الصفحة
const isVerified = await checkLicense();
if (!isVerified) {
lockTemplateUI('unlicensed');
return; // إيقاف تنفيذ باقي الكود إذا لم يكن مفعل
}
// إضافة كلاس يثبت تفعيل القالب بأمان (ويزيل الستارة البصرية)
document.documentElement.classList.add('st-activated-securely');
// --- 4. نظام حقن الحقوق الخاص بك ---
const authWrap = document.getElementById('st-auth-wrap');
if (!authWrap) { lockTemplateUI('pirated', 'محاولة حذف منطقة الحقوق'); return; }
authWrap.innerHTML = `
جميع الحقوق محفوظة © 2026 | تصميم وتطوير:
`;
// --- 5. المراقب الصارم لهيكل القالب (DOM Enforcer) ---
var _0xNodes = [
{ id: 'siteHeader', c: 'nx-core-hdr', d: 'x1', req: true },
{ id: 'st-dynamic-slider', c: 'nx-core-sld', d: 'x2', req: false },
{ id: 'main-posts-wrap', c: 'nx-core-idx', d: 'x3', req: false },
{ id: 'post-body-wrap', c: 'nx-core-sng', d: 'x4', req: false },
{ id: 'siteFooter', c: 'nx-core-ftr', d: 'x5', req: true },
{ id: 'st-auth-wrap', c: 'nx-core-auth', d: 'x6', req: true }
];
setInterval(function() {
try {
// فحص الخداع البصري (إخفاء الحقوق بملفات CSS خارجية)
let pseudoStyle = window.getComputedStyle(document.documentElement, '::before').display;
if(pseudoStyle && pseudoStyle !== 'none' && document.documentElement.classList.contains('st-activated-securely')) {
lockTemplateUI('pirated', 'تم التلاعب بستارة الأمان البصرية'); return;
}
for (var i = 0; i < _0xNodes.length; i++) {
var node = _0xNodes[i];
var el = document.getElementById(node.id);
if (node.req && !el) { lockTemplateUI('pirated', "حذف كتلة أساسية: " + node.id); return; }
if (el) {
if (!el.classList.contains(node.c) || el.getAttribute('data-render-id') !== node.d) {
lockTemplateUI('pirated', "تغيير معرفات الكتلة: " + node.id); return;
}
if (node.id === 'st-auth-wrap') {
var st = window.getComputedStyle(el);
if (st.display === 'none' || !el.innerHTML.includes(COPYRIGHT_LINK)) {
lockTemplateUI('pirated', 'تم إخفاء أو التلاعب بمنطقة الحقوق'); return;
}
}
}
}
} catch (e) {
// منع توقف السكربت في حالة حدوث خطأ مؤقت في المتصفح
}
}, 2000);
});
})();