mirror of
https://gitlab.com/mysocialportal/relatica
synced 2024-10-18 10:03:31 +00:00
Fix for self signed certs issue (but only partially implemented dev-mode settings)
This commit is contained in:
parent
2c9357741f
commit
b280a74e40
7 changed files with 38 additions and 5 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -42,3 +42,8 @@ app.*.map.json
|
|||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
||||
|
||||
# Environment variables
|
||||
.env
|
||||
.env*
|
|
@ -2,4 +2,7 @@
|
|||
|
||||
A Flutter application for interfacing with the Friendica social network.
|
||||
|
||||
Licensed with the Mozilla Public License 2.0 copyleft license.
|
||||
For Linux development be sure that libsecret-1-dev and libjsoncpp-dev are installed on the machine. For running only make sure the non-dev versions are...
|
||||
|
||||
|
||||
Licensed with the Mozilla Public License 2.0 copyleft license.
|
||||
|
|
|
@ -168,6 +168,7 @@ class FriendicaClient {
|
|||
|
||||
FutureResult<String, ExecError> _getUrl(Uri url) async {
|
||||
try {
|
||||
//SecurityContext.defaultContext.setTrustedCertificates('/etc/apache2/certificate/apache-certificate.crt');
|
||||
final response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:result_monad/result_monad.dart';
|
||||
|
@ -15,6 +18,16 @@ import 'services/timeline_manager.dart';
|
|||
import 'utils/app_scrolling_behavior.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await dotenv.load(fileName: '.env');
|
||||
final inDevMode = dotenv.env['USE_DEV_MODE'] == 'true' ? true : false;
|
||||
if (inDevMode) {
|
||||
print('In Dev Mode');
|
||||
SecurityContext.defaultContext.setTrustedCertificates(
|
||||
'/etc/apache2/certificate/apache-certificate.crt');
|
||||
} else {
|
||||
print('In Regular Mode');
|
||||
}
|
||||
Logger.root.level = Level.ALL;
|
||||
Logger.root.onRecord.listen((event) {
|
||||
final logName = event.loggerName.isEmpty ? 'ROOT' : event.loggerName;
|
||||
|
@ -22,7 +35,7 @@ void main() async {
|
|||
'${event.level.name} - $logName @ ${event.time}: ${event.message}';
|
||||
print(msg);
|
||||
});
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
final authService = AuthService();
|
||||
final secretsService = SecretsService();
|
||||
final entryManagerService = EntryManagerService();
|
||||
|
|
|
@ -49,7 +49,7 @@ class _SignInScreenState extends State<SignInScreen> {
|
|||
TextFormField(
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
controller: usernameController,
|
||||
validator: (value) => EmailValidator.validate(value ?? '')
|
||||
validator: (value) => true //EmailValidator.validate(value ?? '')
|
||||
? null
|
||||
: 'Not a valid Friendica Account Address',
|
||||
decoration: InputDecoration(
|
||||
|
@ -99,7 +99,7 @@ class _SignInScreenState extends State<SignInScreen> {
|
|||
final result = await Credentials.buildFromHandle(
|
||||
usernameController.text,
|
||||
passwordController.text,
|
||||
).andThenSuccess((creds) async {
|
||||
).andThenAsync((creds) async {
|
||||
return await getIt<AuthService>().signIn(creds);
|
||||
});
|
||||
|
||||
|
|
|
@ -139,6 +139,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.3.0"
|
||||
flutter_dotenv:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_dotenv
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.2"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
|
@ -29,6 +29,7 @@ dependencies:
|
|||
uuid: ^3.0.6
|
||||
time_machine: ^0.9.17
|
||||
url_launcher: ^6.1.6
|
||||
flutter_dotenv: ^5.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -37,7 +38,9 @@ dev_dependencies:
|
|||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
assets:
|
||||
# Add assets from the images directory to the application.
|
||||
- .env
|
||||
parts:
|
||||
uet-lms:
|
||||
source: .
|
||||
|
@ -79,3 +82,4 @@ parts:
|
|||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
|
||||
|
|
Loading…
Reference in a new issue