mirror of
https://github.com/foss42/apidash.git
synced 2025-06-07 03:48:11 +08:00
edited collection_provider
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
import 'package:apidash_core/apidash_core.dart';
|
import 'package:apidash_core/apidash_core.dart';
|
||||||
|
//import 'package:apidash_core/services/no_ssl_http_service.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:apidash/consts.dart';
|
import 'package:apidash/consts.dart';
|
||||||
import 'providers.dart';
|
import 'providers.dart';
|
||||||
@ -273,12 +274,21 @@ class CollectionStateNotifier
|
|||||||
sendingTime: DateTime.now(),
|
sendingTime: DateTime.now(),
|
||||||
);
|
);
|
||||||
state = map;
|
state = map;
|
||||||
|
late (HttpResponse?, Duration?, String?)? responseRec;
|
||||||
(HttpResponse?, Duration?, String?)? responseRec = await request(
|
if(!ref.watch(settingsProvider).isSSLDisabled){
|
||||||
|
responseRec = await request(
|
||||||
requestId,
|
requestId,
|
||||||
substitutedHttpRequestModel,
|
substitutedHttpRequestModel,
|
||||||
defaultUriScheme: defaultUriScheme,
|
defaultUriScheme: defaultUriScheme,
|
||||||
);
|
);
|
||||||
|
}else{
|
||||||
|
responseRec = await noSSLrequest(
|
||||||
|
requestId,
|
||||||
|
substitutedHttpRequestModel,
|
||||||
|
defaultUriScheme: defaultUriScheme,
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
late final RequestModel newRequestModel;
|
late final RequestModel newRequestModel;
|
||||||
if (responseRec.$1 == null) {
|
if (responseRec.$1 == null) {
|
||||||
|
@ -22,6 +22,7 @@ class ThemeStateNotifier extends StateNotifier<SettingsModel> {
|
|||||||
|
|
||||||
Future<void> update({
|
Future<void> update({
|
||||||
bool? isDark,
|
bool? isDark,
|
||||||
|
bool? isSSLDisabled,
|
||||||
bool? alwaysShowCollectionPaneScrollbar,
|
bool? alwaysShowCollectionPaneScrollbar,
|
||||||
Size? size,
|
Size? size,
|
||||||
Offset? offset,
|
Offset? offset,
|
||||||
@ -35,6 +36,7 @@ class ThemeStateNotifier extends StateNotifier<SettingsModel> {
|
|||||||
}) async {
|
}) async {
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
isDark: isDark,
|
isDark: isDark,
|
||||||
|
isSSLDisabled: isSSLDisabled,
|
||||||
alwaysShowCollectionPaneScrollbar: alwaysShowCollectionPaneScrollbar,
|
alwaysShowCollectionPaneScrollbar: alwaysShowCollectionPaneScrollbar,
|
||||||
size: size,
|
size: size,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
|
@ -43,10 +43,10 @@ class SettingsPage extends ConsumerWidget {
|
|||||||
hoverColor: kColorTransparent,
|
hoverColor: kColorTransparent,
|
||||||
title: const Text('Disabling SSL verification'),
|
title: const Text('Disabling SSL verification'),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'Current selection: ${settings.isDark ? "Dark Mode" : "Light mode"}'),
|
'Current selection: ${settings.isSSLDisabled ? "SSL Verification Disabled" : "SSL Verification Enabled"}'),
|
||||||
value: settings.isDark,
|
value: settings.isSSLDisabled,
|
||||||
onChanged: (bool? value) {
|
onChanged: (bool? value) {
|
||||||
ref.read(settingsProvider.notifier).update(isDark: value);
|
ref.read(settingsProvider.notifier).update(isSSLDisabled: value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
|
@ -8,8 +8,9 @@ import '../consts.dart';
|
|||||||
import '../models/models.dart';
|
import '../models/models.dart';
|
||||||
import '../utils/utils.dart';
|
import '../utils/utils.dart';
|
||||||
import 'http_client_manager.dart';
|
import 'http_client_manager.dart';
|
||||||
|
import 'http_service.dart';
|
||||||
|
|
||||||
|
|
||||||
typedef HttpResponse = http.Response;
|
|
||||||
|
|
||||||
/// Create a custom `HttpClient` with SSL verification disabled.
|
/// Create a custom `HttpClient` with SSL verification disabled.
|
||||||
http.Client createHttpClientWithNoSSL() {
|
http.Client createHttpClientWithNoSSL() {
|
||||||
@ -19,7 +20,7 @@ http.Client createHttpClientWithNoSSL() {
|
|||||||
return IOClient(ioClient);
|
return IOClient(ioClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<(HttpResponse?, Duration?, String?)> request(
|
Future<(HttpResponse?, Duration?, String?)> noSSLrequest(
|
||||||
String requestId,
|
String requestId,
|
||||||
HttpRequestModel requestModel, {
|
HttpRequestModel requestModel, {
|
||||||
SupportedUriSchemes defaultUriScheme = kDefaultUriScheme,
|
SupportedUriSchemes defaultUriScheme = kDefaultUriScheme,
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
export 'http_client_manager.dart';
|
export 'http_client_manager.dart';
|
||||||
export 'http_service.dart';
|
export 'http_service.dart';
|
||||||
|
export 'no_ssl_http_service.dart';
|
||||||
|
Reference in New Issue
Block a user