feat: N1d/N2/N3 + قانون فلاتر وإعادة ضبط تطبيق السائق
الباك إند: - تعيين أول أدمن صار يُنشئ المستخدم إن لم يوجد — كان يشترط دخولاً سابقاً، وهي بيضة ودجاجة تمنع الدخول إلى لوحة أي مستأجر جديد أصلاً. - OTP_DEV_MODE كان يفشل مفتوحاً (`!== 'false'`): غياب المتغيّر أو خطأ مطبعي يترك الإنتاج برمز ثابت يفتح كل حساب، ويحرس السحب المالي كذلك. صار `=== 'true'` في الإعداد وفي قارئَيه، مع تحذير عند الإقلاع. - N2: التحقّق من اللوغو عند الرفع (PNG/JPEG · 512+ · مربّع · سقف 5MB) عبر قراءة الترويسة بلا اعتمادية — بدل اكتشاف أيقونة ممطوطة بعد النشر. N3: السكربت يولّد build_config.dart بأعلام const (طبقات docs/22 §1.5)، ويضبط bundle IDs واسم التطبيق والأيقونات/splash، و--build يشغّل Shorebird. فلاتر: - docs/23: قانون مُلزِم للتطبيقين (البنية · Cubit · طبقة الشبكة · الأعلام). - السائق: أُزيل Dart القديم (GetX) مع الإبقاء على الأصيل والإضافات وشهادات التوقيع وShorebird وFirebase الخاص به، وأُعيد هيكلته مطابقاً للراكب. - طبقة الشبكة ترسل x-device-id وتجدّد التوكن عند 401 مرة واحدة فقط. - الحزم موحّدة بين التطبيقين، والـAPI https حصراً في الاثنين. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
3ab74a13a8
commit
de4bbd00ac
@@ -1,94 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:sefer_driver/constant/api_key.dart';
|
||||
import 'package:sefer_driver/constant/box_name.dart';
|
||||
import 'package:sefer_driver/main.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/io_client.dart';
|
||||
|
||||
import '../../constant/links.dart';
|
||||
import 'encrypt_decrypt.dart';
|
||||
import 'upload_image.dart';
|
||||
|
||||
Future<String> faceDetector() async {
|
||||
await ImageController().choosFace(AppLink.uploadEgypt, 'face_detect');
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
|
||||
var headers = {
|
||||
// 'Authorization': 'Basic ${AK.basicCompareFaces}',
|
||||
'Authorization': 'Basic hamza:12345678',
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
|
||||
var request = http.Request(
|
||||
// todo change server link
|
||||
'POST',
|
||||
Uri.parse('https://mohkh.online:5000/compare_faces'));
|
||||
|
||||
request.body = json.encode({
|
||||
"url1": // TODO: jpg?
|
||||
"${AppLink.server}/auth/uploads/documents_egypt/eg_id_front_${(box.read(BoxName.driverID))}.webp",
|
||||
"url2":
|
||||
"${AppLink.server}/card_image/face_detect-${(box.read(BoxName.driverID))}.jpg"
|
||||
});
|
||||
print('request.body: ${request.body}');
|
||||
request.headers.addAll(headers);
|
||||
|
||||
try {
|
||||
http.Client client = await createHttpClient();
|
||||
http.StreamedResponse response = await client.send(request);
|
||||
// http.StreamedResponse response = await request.send();
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
String result = await response.stream.bytesToString();
|
||||
print('result: ${result}');
|
||||
return result;
|
||||
} else {
|
||||
print('Error: ${response.reasonPhrase}');
|
||||
return 'Error: ${response.reasonPhrase}';
|
||||
}
|
||||
} catch (e) {
|
||||
print('Exception occurred: $e');
|
||||
return 'Error: $e';
|
||||
}
|
||||
}
|
||||
|
||||
Future<http.Client> createHttpClient() async {
|
||||
final SecurityContext securityContext = SecurityContext();
|
||||
HttpClient httpClient = HttpClient(context: securityContext);
|
||||
httpClient.badCertificateCallback =
|
||||
(X509Certificate cert, String host, int port) => true; // Bypass SSL
|
||||
return IOClient(httpClient);
|
||||
}
|
||||
|
||||
Future<String> faceDetector2(String url1, String url2) async {
|
||||
var headers = {
|
||||
'Authorization': 'Basic hamza:12345678',
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
|
||||
var request = http.Request(
|
||||
'POST', Uri.parse('https://mohkh.online:5000/compare_faces'));
|
||||
|
||||
request.body = json.encode({"url1": url1, "url2": url2});
|
||||
request.headers.addAll(headers);
|
||||
|
||||
try {
|
||||
http.Client client = await createHttpClient(); // Use custom client
|
||||
DateTime startTime = DateTime.now();
|
||||
http.StreamedResponse response = await client.send(request);
|
||||
DateTime endTime = DateTime.now();
|
||||
Duration duration = endTime.difference(startTime);
|
||||
if (response.statusCode == 200) {
|
||||
print(await response.stream.bytesToString());
|
||||
print(duration.inSeconds);
|
||||
|
||||
return await response.stream.bytesToString();
|
||||
} else {
|
||||
print(await response.stream.bytesToString());
|
||||
return 'Error: ${response.reasonPhrase}';
|
||||
}
|
||||
} catch (e) {
|
||||
return 'Exception: $e';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user