mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-09 01:21:14 +00:00
chore: Merge master into refactoring
This commit is contained in:
parent
140acaee49
commit
9d62d3af8e
|
@ -30,7 +30,11 @@ class BackblazeApi extends ApiMap {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
BaseOptions get options {
|
BaseOptions get options {
|
||||||
final BaseOptions options = BaseOptions(baseUrl: rootAddress);
|
final BaseOptions options = BaseOptions(
|
||||||
|
baseUrl: rootAddress,
|
||||||
|
contentType: Headers.jsonContentType,
|
||||||
|
responseType: ResponseType.json,
|
||||||
|
);
|
||||||
if (isWithToken) {
|
if (isWithToken) {
|
||||||
final BackblazeCredential? backblazeCredential =
|
final BackblazeCredential? backblazeCredential =
|
||||||
getIt<ApiConfigModel>().backblazeCredential;
|
getIt<ApiConfigModel>().backblazeCredential;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:basic_utils/basic_utils.dart';
|
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
@ -20,7 +19,6 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
||||||
import 'package:selfprivacy/logic/models/hive/server_domain.dart';
|
import 'package:selfprivacy/logic/models/hive/server_domain.dart';
|
||||||
import 'package:selfprivacy/logic/models/hive/user.dart';
|
import 'package:selfprivacy/logic/models/hive/user.dart';
|
||||||
import 'package:selfprivacy/logic/models/json/device_token.dart';
|
import 'package:selfprivacy/logic/models/json/device_token.dart';
|
||||||
import 'package:selfprivacy/logic/models/message.dart';
|
|
||||||
import 'package:selfprivacy/logic/models/server_basic_info.dart';
|
import 'package:selfprivacy/logic/models/server_basic_info.dart';
|
||||||
import 'package:selfprivacy/logic/models/server_type.dart';
|
import 'package:selfprivacy/logic/models/server_type.dart';
|
||||||
import 'package:selfprivacy/logic/providers/providers_controller.dart';
|
import 'package:selfprivacy/logic/providers/providers_controller.dart';
|
||||||
|
@ -187,46 +185,20 @@ class ServerInstallationRepository {
|
||||||
final String? ip4,
|
final String? ip4,
|
||||||
final Map<String, bool> skippedMatches,
|
final Map<String, bool> skippedMatches,
|
||||||
) async {
|
) async {
|
||||||
final List<String> addresses = <String>[
|
|
||||||
'$domainName',
|
|
||||||
'api.$domainName',
|
|
||||||
'cloud.$domainName',
|
|
||||||
'meet.$domainName',
|
|
||||||
'password.$domainName'
|
|
||||||
];
|
|
||||||
|
|
||||||
final Map<String, bool> matches = <String, bool>{};
|
final Map<String, bool> matches = <String, bool>{};
|
||||||
|
await InternetAddress.lookup(domainName!).then(
|
||||||
for (final String address in addresses) {
|
(final records) {
|
||||||
if (skippedMatches[address] ?? false) {
|
for (final record in records) {
|
||||||
matches[address] = true;
|
if (skippedMatches[record.host] ?? false) {
|
||||||
continue;
|
matches[record.host] = true;
|
||||||
}
|
continue;
|
||||||
final List<RRecord>? lookupRecordRes = await DnsUtils.lookupRecord(
|
}
|
||||||
address,
|
if (record.address == ip4!) {
|
||||||
RRecordType.A,
|
matches[record.host] = true;
|
||||||
provider: DnsApiProvider.CLOUDFLARE,
|
}
|
||||||
);
|
}
|
||||||
getIt.get<ConsoleModel>().addMessage(
|
},
|
||||||
Message(
|
);
|
||||||
text:
|
|
||||||
'DnsLookup: address: $address, $RRecordType, provider: CLOUDFLARE, ip4: $ip4',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
getIt.get<ConsoleModel>().addMessage(
|
|
||||||
Message(
|
|
||||||
text:
|
|
||||||
'DnsLookup: ${lookupRecordRes == null ? 'empty' : (lookupRecordRes[0].data != ip4 ? 'wrong ip4' : 'right ip4')}',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (lookupRecordRes == null ||
|
|
||||||
lookupRecordRes.isEmpty ||
|
|
||||||
lookupRecordRes[0].data != ip4) {
|
|
||||||
matches[address] = false;
|
|
||||||
} else {
|
|
||||||
matches[address] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
@ -351,15 +323,18 @@ class ServerInstallationRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getServerIpFromDomain(final ServerDomain serverDomain) async {
|
Future<String> getServerIpFromDomain(final ServerDomain serverDomain) async {
|
||||||
final List<RRecord>? lookup = await DnsUtils.lookupRecord(
|
String? domain;
|
||||||
serverDomain.domainName,
|
await InternetAddress.lookup(serverDomain.domainName).then(
|
||||||
RRecordType.A,
|
(final records) {
|
||||||
provider: DnsApiProvider.CLOUDFLARE,
|
for (final record in records) {
|
||||||
|
domain = record.address;
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
if (lookup == null || lookup.isEmpty) {
|
if (domain == null || domain!.isEmpty) {
|
||||||
throw IpNotFoundException('No IP found for domain $serverDomain');
|
throw IpNotFoundException('No IP found for domain $serverDomain');
|
||||||
}
|
}
|
||||||
return lookup[0].data;
|
return domain!;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getDeviceName() async {
|
Future<String> getDeviceName() async {
|
||||||
|
|
|
@ -73,14 +73,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.0"
|
version: "3.0.0"
|
||||||
basic_utils:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: basic_utils
|
|
||||||
sha256: "8815477fcf58499e42326bd858e391442425fa57db9a45e48e15224c62049262"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "5.5.4"
|
|
||||||
bloc:
|
bloc:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -11,7 +11,6 @@ dependencies:
|
||||||
animations: ^2.0.7
|
animations: ^2.0.7
|
||||||
auto_route: ^7.3.2
|
auto_route: ^7.3.2
|
||||||
auto_size_text: ^3.0.0
|
auto_size_text: ^3.0.0
|
||||||
basic_utils: ^5.5.4
|
|
||||||
crypt: ^4.3.0
|
crypt: ^4.3.0
|
||||||
cubit_form: ^2.0.1
|
cubit_form: ^2.0.1
|
||||||
device_info_plus: ^9.0.2
|
device_info_plus: ^9.0.2
|
||||||
|
|
Loading…
Reference in a new issue