Update: 2026-07-26 02:51:53
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
@@ -29,7 +30,10 @@ class CRUD {
|
||||
return;
|
||||
}
|
||||
|
||||
dev = Platform.isAndroid ? 'android' : 'ios';
|
||||
// Note: We send 'android' instead of 'web' because the backend's loginAdmin.php
|
||||
// explicitly validates the audience against 'allowedDriver1' (android) and 'allowedDriver2' (ios).
|
||||
// Sending 'web' will cause a 400 Bad Request error.
|
||||
dev = kIsWeb ? 'android' : (Platform.isAndroid ? 'android' : 'ios');
|
||||
|
||||
var payload = {
|
||||
'id': 'admin',
|
||||
@@ -261,7 +265,7 @@ class CRUD {
|
||||
var payload = {
|
||||
'id': box.read(BoxName.driverID) ?? '1',
|
||||
'password': AK.passnpassenger,
|
||||
'aud': '${Env.allowedWallet}${Platform.isAndroid ? 'android' : 'ios'}',
|
||||
'aud': '${Env.allowedWallet}${kIsWeb ? 'android' : (Platform.isAndroid ? 'android' : 'ios')}',
|
||||
'fingerPrint': fingerPrint
|
||||
};
|
||||
var fallbackRes = await _client.post(
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:jailbreak_root_detection/jailbreak_root_detection.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
|
||||
class DeviceHelper {
|
||||
static Future<String> getDeviceFingerprint() async {
|
||||
@@ -15,11 +16,15 @@ class DeviceHelper {
|
||||
Map<String, dynamic> deviceData;
|
||||
|
||||
try {
|
||||
if (kIsWeb) {
|
||||
WebBrowserInfo webInfo = await deviceInfoPlugin.webBrowserInfo;
|
||||
return '${webInfo.vendor}_${webInfo.browserName.name}';
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
// Fetch Android-specific device information
|
||||
AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
|
||||
deviceData = androidInfo.toMap(); // Convert to a map for easier access
|
||||
// Log.print('deviceData: ${jsonEncode(deviceData)}');
|
||||
} else if (Platform.isIOS) {
|
||||
// Fetch iOS-specific device information
|
||||
IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo;
|
||||
@@ -29,7 +34,7 @@ class DeviceHelper {
|
||||
MacOsDeviceInfo macInfo = await deviceInfoPlugin.macOsInfo;
|
||||
deviceData = macInfo.toMap();
|
||||
} else {
|
||||
throw UnsupportedError('Unsupported platform');
|
||||
return 'unknown_platform';
|
||||
}
|
||||
|
||||
String deviceId = 'unknown';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/io_client.dart' as http_io;
|
||||
@@ -25,6 +26,10 @@ class SslPinning {
|
||||
];
|
||||
|
||||
static http.Client createPinnedClient() {
|
||||
if (kIsWeb) {
|
||||
return http.Client();
|
||||
}
|
||||
|
||||
final httpClient = HttpClient()
|
||||
..badCertificateCallback =
|
||||
(X509Certificate cert, String host, int port) {
|
||||
|
||||
Reference in New Issue
Block a user