selfprivacy.org.app/lib/logic/api_maps/server.dart

47 lines
1.2 KiB
Dart
Raw Normal View History

2021-01-21 21:01:42 +00:00
import 'dart:io';
2021-01-21 07:35:38 +00:00
import 'package:dio/dio.dart';
import 'api_map.dart';
class ServerApi extends ApiMap {
2021-03-15 15:39:44 +00:00
ServerApi(String? domainName) {
2021-01-21 21:01:42 +00:00
loggedClient.options = BaseOptions(
baseUrl: 'https://api.$domainName',
);
}
Future<bool> isHttpServerWorking() async {
bool res;
Response response;
try {
response = await loggedClient.get('/serviceStatus');
res = response.statusCode == HttpStatus.ok;
} catch (e) {
res = false;
2021-01-21 07:35:38 +00:00
}
2021-01-21 21:01:42 +00:00
return res;
2021-01-21 07:35:38 +00:00
}
2021-01-21 21:01:42 +00:00
2021-02-15 18:58:29 +00:00
// Future<String> getDkim(String domainName) async {
// var response = await loggedClient.get(
// '/getDKIM',
// options: Options(responseType: ResponseType.plain),
// );
// return _decodeAndCutData(response.data, domainName);
// }
2021-01-21 21:01:42 +00:00
}
2021-02-15 18:58:29 +00:00
// String _decodeAndCutData(String text, String domainName) {
// var decodedTextString = text.substring(1, text.length - 1);
// var stringToBase64 = utf8.fuse(base64);
2021-01-21 21:01:42 +00:00
2021-02-15 18:58:29 +00:00
// return stringToBase64
// .decode(decodedTextString)
// .replaceAll("selector._domainkey IN TXT ( ", "")
// .replaceAll("\"\n \"", "")
// .replaceAll(' ) ; ----- DKIM key selector for $domainName\n', '');
// }