feat: توجيه كل النداءات إلى api.intaleqapp.com وطيّ تبديل الدول
⚠️ الطيّ ضرورة أمان لا ترتيب: كل عائلة سيرفرات في links.dart كانت switch بأربعة فروع (Syria · Egypt · Jordan · default)، وفروع سوريا ومصر تشير إلى **سيرفرات سيرو الإنتاجية** (api-syria.siromove.com وغيرها). إبقاؤها في انطلق يعني أن أي جهاز مخزَّن فيه countryCode='Syria' يخاطب إنتاج سيرو مباشرة. انطلق نشرٌ واحد على مضيف واحد (docs/34: سيرفر لكل مستأجر)، والدولة تُحل على السيرفر من GLOBAL_COUNTRY. طُويت 35 كتلة switch إلى قيمة واحدة (11 rider · 11 driver · 6 admin · 7 service)، والخريطة مأخوذة من تعليق docker/nginx/default.conf نفسه («نقطة واحدة لكل الخدمات — التطبيق يغيّر الدومين فقط»): server / rideServer → https://api.intaleqapp.com/backend paymentServer → https://api.intaleqapp.com/v2/main location → …/backend/ride/location locationServerSide(د) → …/loction_server/siro/ride/location سوكيت الركاب → https://api.intaleqapp.com:3030 سوكيت السائقين → https://api.intaleqapp.com:2020 وأيضاً: - appDomain و invite: siromove.com → intaleqapp.com، والمجلد siromove.com/ → intaleqapp.com/ (فيه invite.php الذي يقصده التطبيق). - روابط التنزيل siro.app → intaleqapp.com · بريد السائق المولَّد @siromove.com → @intaleqapp.com · صفحة التتبع · محاكاة تسجيل سوريا. - حُذف getter `syria` الميت من links.dart الثلاثة (لا مستدعي له، وكان يشير إلى إنتاج سيرو). لم يُمسّ عمداً: - `ssl_pinning.dart`: `badCertificateCallback` لا يُستدعى إلا عند فشل التحقق العادي، فشهادة api.intaleqapp.com الصالحة تمرّ بلا مساس. ولا أختلق بصمة شهادة: تُضاف بصمة انطلق بعد إصدار الشهادة (docs/30 G7). - `routesjo.intaleq.xyz` و `map-saas.intaleqapp.com`: خدمات خارجية قائمة بذاتها للمالك (قرار الخرائط المباشرة) لا تُنقل إلى api. - `com.siromove.admin` في userAgentPackageName (5 مواضع): من عائلة هويات المتاجر — كوميت الهويات، وهو يحتاج قرار المالك. ⚠️ يحتاج نشراً على الطرف الآخر: invite.php و track/index.php و /driver على intaleqapp.com. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
0aab85c732
commit
53322d87a6
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Siro Unified Redirect Gateway (One-Click Redirect for non-Syrian countries)
|
||||
* URL Format: https://siromove.com/invite.php?code=REF_CODE&app=rider|driver
|
||||
*/
|
||||
|
||||
// 1. Core Config & Links
|
||||
$config = [
|
||||
'rider' => [
|
||||
'ios_store' => 'https://apps.apple.com/st/app/siro-rider/id6748075179',
|
||||
'android_store' => 'https://play.google.com/store/apps/details?id=com.Siro.siro'
|
||||
],
|
||||
'driver' => [
|
||||
'ios_store' => 'https://apps.apple.com/st/app/siro-driver/id6482995159',
|
||||
'android_store' => 'https://play.google.com/store/apps/details?id=com.siro_driver'
|
||||
]
|
||||
];
|
||||
|
||||
$code = htmlspecialchars($_GET['code'] ?? '', ENT_QUOTES, 'UTF-8');
|
||||
$appType = ($_GET['app'] ?? 'rider') === 'driver' ? 'driver' : 'rider';
|
||||
$appConfig = $config[$appType];
|
||||
|
||||
// 2. Helper Functions
|
||||
function getVisitorCountry() {
|
||||
if (!empty($_SERVER['HTTP_CF_IPCOUNTRY'])) {
|
||||
return strtoupper($_SERVER['HTTP_CF_IPCOUNTRY']);
|
||||
}
|
||||
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
if (!empty($_SESSION['visitor_country'])) {
|
||||
return $_SESSION['visitor_country'];
|
||||
}
|
||||
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
if ($ip === '127.0.0.1' || $ip === '::1' || filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false) {
|
||||
return 'JO'; // Default Jordan
|
||||
}
|
||||
|
||||
try {
|
||||
$ctx = stream_context_create(['http' => ['timeout' => 2]]);
|
||||
$apiResponse = @file_get_contents("http://ip-api.com/json/{$ip}", false, $ctx);
|
||||
if ($apiResponse) {
|
||||
$data = json_decode($apiResponse, true);
|
||||
if (!empty($data['countryCode'])) {
|
||||
$_SESSION['visitor_country'] = strtoupper($data['countryCode']);
|
||||
return $_SESSION['visitor_country'];
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Fallback
|
||||
}
|
||||
return 'JO';
|
||||
}
|
||||
|
||||
function getDeviceOS() {
|
||||
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT'] ?? '');
|
||||
if (strpos($userAgent, 'iphone') !== false || strpos($userAgent, 'ipad') !== false || strpos($userAgent, 'ipod') !== false) {
|
||||
return 'ios';
|
||||
}
|
||||
if (strpos($userAgent, 'android') !== false) {
|
||||
return 'android';
|
||||
}
|
||||
return 'desktop';
|
||||
}
|
||||
|
||||
$country = getVisitorCountry();
|
||||
$os = getDeviceOS();
|
||||
|
||||
// 3. Fallback Handoff for Syrian Users
|
||||
if ($country === 'SY') {
|
||||
header("Location: https://siromove.com/inviteSyria.php?code=" . urlencode($code) . "&app=" . urlencode($appType));
|
||||
exit;
|
||||
}
|
||||
|
||||
// 4. One-Click Instant Redirection (Jordan / Egypt / others)
|
||||
if ($os === 'ios') {
|
||||
header("Location: " . $appConfig['ios_store']);
|
||||
exit;
|
||||
} else {
|
||||
// Android or Desktop default
|
||||
header("Location: " . $appConfig['android_store']);
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user