From 08cf4913ebc26442657d2f558b15811242cbb666 Mon Sep 17 00:00:00 2001 From: OfficialDakari Date: Tue, 21 Oct 2025 21:45:05 +0500 Subject: [PATCH] adapt to current matrix-dart-sdk changes use proxy by default (gonna remove later) --- lib/pages/chat/chat.dart | 2 +- lib/utils/client_manager.dart | 2 +- lib/utils/custom_http_client.dart | 32 ++++++++++++++++++++----------- pubspec.lock | 10 ++++------ pubspec.yaml | 7 ++++--- 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 84d63ff..d978346 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -105,7 +105,7 @@ class ChatController extends State late Client sendingClient; - Timeline? timeline; + RoomTimeline? timeline; late final String readMarkerEventId; diff --git a/lib/utils/client_manager.dart b/lib/utils/client_manager.dart index f8741f0..8e3afb2 100644 --- a/lib/utils/client_manager.dart +++ b/lib/utils/client_manager.dart @@ -115,7 +115,7 @@ abstract class ClientManager { return Client( clientName, httpClient: - PlatformInfos.isAndroid ? CustomHttpClient.createHTTPClient() : null, + CustomHttpClient.createHTTPClient(), verificationMethods: { KeyVerificationMethod.numbers, if (kIsWeb || PlatformInfos.isMobile || PlatformInfos.isLinux) diff --git a/lib/utils/custom_http_client.dart b/lib/utils/custom_http_client.dart index c310fdd..96b17fc 100644 --- a/lib/utils/custom_http_client.dart +++ b/lib/utils/custom_http_client.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:extera_next/utils/platform_infos.dart'; import 'package:http/http.dart' as http; import 'package:http/io_client.dart'; @@ -10,20 +11,29 @@ class CustomHttpClient { static HttpClient customHttpClient(String? cert) { final context = SecurityContext.defaultContext; - try { - if (cert != null) { - final bytes = utf8.encode(cert); - context.setTrustedCertificatesBytes(bytes); - } - } on TlsException catch (e) { - if (e.osError != null && - e.osError!.message.contains('CERT_ALREADY_IN_HASH_TABLE')) { - } else { - rethrow; + if (PlatformInfos.isAndroid) { + try { + if (cert != null) { + final bytes = utf8.encode(cert); + context.setTrustedCertificatesBytes(bytes); + } + } on TlsException catch (e) { + if (e.osError != null && + e.osError!.message.contains('CERT_ALREADY_IN_HASH_TABLE')) { + } else { + rethrow; + } } } - return HttpClient(context: context); + // Use Nekoray mixed proxy + // Made it for myself, remove later + final httpClient = HttpClient(context: context); + httpClient.findProxy = (uri) { + return 'PROXY localhost:2080;'; + }; + + return httpClient; } static http.Client createHTTPClient() => IOClient(customHttpClient(ISRG_X1)); diff --git a/pubspec.lock b/pubspec.lock index feacc4c..06fcbca 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1201,12 +1201,10 @@ packages: matrix: dependency: "direct main" description: - path: "." - ref: main - resolved-ref: "58c4cf19d010d9ae193e9df10bd1f8fdf02277b0" - url: "https://git.extera.xyz/OfficialDakari/matrix-dart-sdk.git" - source: git - version: "2.0.1" + path: "/home/officialdakari/repos/matrix-dart-sdk" + relative: false + source: path + version: "3.0.1" meta: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 619a8e1..5a88b0c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -65,9 +65,10 @@ dependencies: linkify: ^5.0.0 material: ^1.0.0+2 matrix: - git: - url: https://git.extera.xyz/OfficialDakari/matrix-dart-sdk.git - ref: main + path: /home/officialdakari/repos/matrix-dart-sdk + # git: + # url: https://git.extera.xyz/OfficialDakari/matrix-dart-sdk.git + # ref: feature/threads mime: ^1.0.6 native_imaging: ^0.2.0 opus_caf_converter_dart: ^1.0.1