Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f62716b510 | ||
|
|
771b436c69 |
@@ -44,9 +44,12 @@ $INTERNAL_KEY = trim(file_get_contents('/home/location/.internal_socket_key'));
|
|||||||
// });
|
// });
|
||||||
function authenticateJWT()
|
function authenticateJWT()
|
||||||
{
|
{
|
||||||
$secretKey = trim(file_get_contents('/home/location/.secret_key')); // Access secret key (ensure it's set in .env)
|
$secretKeyFile = file_exists(__DIR__ . '/../../loction-keys/.secret_key')
|
||||||
|
? __DIR__ . '/../../loction-keys/.secret_key'
|
||||||
|
: (file_exists('/keys/.secret_key') ? '/keys/.secret_key' : '/home/location/.secret_key');
|
||||||
|
$secretKey = trim((string) @file_get_contents($secretKeyFile)); // Access secret key (ensure it's set in .env)
|
||||||
if (!$secretKey) {
|
if (!$secretKey) {
|
||||||
error_log("SECRET_KEY not set in environment variables.");
|
error_log("SECRET_KEY not set in environment variables. Path checked: $secretKeyFile");
|
||||||
http_response_code(500); // Internal Server Error
|
http_response_code(500); // Internal Server Error
|
||||||
echo json_encode(['error' => 'Internal server configuration error.']);
|
echo json_encode(['error' => 'Internal server configuration error.']);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class AppLink {
|
|||||||
case 'Egypt':
|
case 'Egypt':
|
||||||
return 'https://location-egypt.siromove.com/siro/ride/location';
|
return 'https://location-egypt.siromove.com/siro/ride/location';
|
||||||
case 'Jordan':
|
case 'Jordan':
|
||||||
return 'https://jordan-siro.intaleqapp.com/backend/ride/location';
|
return 'https://jordan-siro.intaleqapp.com/loction_server/siro/ride/location';
|
||||||
default:
|
default:
|
||||||
return 'https://location-jordan.siromove.com/siro/ride/location';
|
return 'https://location-jordan.siromove.com/siro/ride/location';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,6 +266,12 @@ class LocationController extends GetxController with WidgetsBindingObserver {
|
|||||||
|
|
||||||
if (sid != null || eid != null) {
|
if (sid != null || eid != null) {
|
||||||
isSocketConnected = true;
|
isSocketConnected = true;
|
||||||
|
|
||||||
|
if (myLocation.latitude != 0) {
|
||||||
|
print("🚀 Sending initial location to socket after connect...");
|
||||||
|
emitLocationToSocket(myLocation, heading, speed);
|
||||||
|
}
|
||||||
|
|
||||||
_startHeartbeat();
|
_startHeartbeat();
|
||||||
|
|
||||||
// 🆕 طلب أي رحلات انتظار فاتتنا أثناء انقطاع الاتصال
|
// 🆕 طلب أي رحلات انتظار فاتتنا أثناء انقطاع الاتصال
|
||||||
@@ -444,10 +450,6 @@ class LocationController extends GetxController with WidgetsBindingObserver {
|
|||||||
void _startHeartbeat() {
|
void _startHeartbeat() {
|
||||||
_socketHeartbeat?.cancel();
|
_socketHeartbeat?.cancel();
|
||||||
_socketHeartbeat = Timer.periodic(const Duration(seconds: 25), (timer) {
|
_socketHeartbeat = Timer.periodic(const Duration(seconds: 25), (timer) {
|
||||||
// [Fix 6] تخطي الإرسال إذا كان stream الموقع نشطاً.
|
|
||||||
// الـ _locSub يرسل update_location عند كل تحرك (كل 5-10 ثوانٍ) تلقائياً.
|
|
||||||
// الـ heartbeat يكون مفيداً فقط عندما يتوقف الـ stream (الجهاز ثابت أو أوقف الخدمة).
|
|
||||||
if (_locSub != null) return;
|
|
||||||
if (socket == null || !isSocketConnected || myLocation.latitude == 0) return;
|
if (socket == null || !isSocketConnected || myLocation.latitude == 0) return;
|
||||||
|
|
||||||
if (isBusMode) {
|
if (isBusMode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user