Skip to content

Commit

Permalink
Merge pull request #57 from EvgeniySpinov/master
Browse files Browse the repository at this point in the history
*[Login]: Added check against X509 global certificate storage on internal (to Dio) X509 certificate validation failure.
  • Loading branch information
remi-martin committed Nov 15, 2021
2 parents fe7c975 + 89fb963 commit 86172cf
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (keystorePropertiesFile.exists()) {


android {
compileSdkVersion 30
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -43,7 +43,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.piwigo.piwigo_ng"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.5.31'
repositories {
google()
jcenter()
Expand Down
10 changes: 5 additions & 5 deletions lib/api/ImageAPI.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ Future<String> _getDownloadPath() async {
}
Future<void> _showNotification(Map<String, dynamic> downloadStatus) async {
final android = AndroidNotificationDetails(
'channel id',
'channel name',
'channel description',
priority: Priority.high,
importance: Importance.max
'channel id',
'channel name',
channelDescription: 'channel description',
priority: Priority.high,
importance: Importance.max
);
final platform = NotificationDetails(android: android);
final isSuccess = downloadStatus['isSuccess'];
Expand Down
2 changes: 1 addition & 1 deletion lib/api/SessionAPI.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Future<String> loginUser(String url, String username, String password) async {
}

} catch(e) {
return 'Dio: Invalid url';
return 'Dio: Invalid url. Exception: ' + e.toString();
}
return 'Something happened';
}
Expand Down
10 changes: 10 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
Expand All @@ -13,6 +15,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
HttpOverrides.global = MyHttpOverrides();
await dotenv.load(fileName: ".env");
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
Expand All @@ -34,6 +37,13 @@ void initLocalNotifications() {
API.localNotification.initialize(initSettings);
}

class MyHttpOverrides extends HttpOverrides{
@override
HttpClient createHttpClient(context){
return super.createHttpClient(context)
..badCertificateCallback = (X509Certificate cert, String host, int port)=> true;
}
}

class MyApp extends StatelessWidget {

Expand Down
2 changes: 1 addition & 1 deletion lib/services/upload/Uploader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Uploader {
final android = AndroidNotificationDetails(
'channel id',
'channel name',
'channel description',
channelDescription: 'channel description',
priority: Priority.high,
importance: Importance.max
);
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dependencies:
camera:
wakelock:
better_player:
flutter_absolute_path:

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 86172cf

Please sign in to comment.