fix mount settings encrypt
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
parent
a28151068a
commit
164f8ffc7c
@ -107,6 +107,17 @@ Map<String, dynamic> createDefaultSettings(String mountType) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void displayAuthError() {
|
||||||
|
if (constants.navigatorKey.currentContext == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayErrorMessage(
|
||||||
|
constants.navigatorKey.currentContext!,
|
||||||
|
"Authentication failed",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void displayErrorMessage(context, String text) {
|
void displayErrorMessage(context, String text) {
|
||||||
if (!context.mounted) {
|
if (!context.mounted) {
|
||||||
return;
|
return;
|
||||||
|
@ -180,6 +180,11 @@ class Mount with ChangeNotifier {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.statusCode == 500) {
|
||||||
|
displayAuthError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:repertory/constants.dart' as constants;
|
import 'package:repertory/constants.dart' as constants;
|
||||||
import 'package:repertory/helpers.dart'
|
import 'package:repertory/helpers.dart'
|
||||||
show getSettingDescription, getSettingValidators;
|
show convertAllToString, getSettingDescription, getSettingValidators;
|
||||||
import 'package:repertory/models/mount.dart';
|
import 'package:repertory/models/mount.dart';
|
||||||
import 'package:repertory/models/mount_list.dart';
|
import 'package:repertory/models/mount_list.dart';
|
||||||
import 'package:repertory/settings.dart';
|
import 'package:repertory/settings.dart';
|
||||||
@ -615,24 +615,41 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
if (!widget.isAdd) {
|
if (!widget.isAdd) {
|
||||||
var settings = widget.mount.mountConfig.settings;
|
var settings = widget.mount.mountConfig.settings;
|
||||||
|
Map<String, dynamic> changedSettings = {};
|
||||||
if (!DeepCollectionEquality().equals(widget.settings, settings)) {
|
if (!DeepCollectionEquality().equals(widget.settings, settings)) {
|
||||||
widget.settings.forEach((key, value) {
|
widget.settings.forEach((key, value) {
|
||||||
if (!DeepCollectionEquality().equals(settings[key], value)) {
|
if (!DeepCollectionEquality().equals(settings[key], value)) {
|
||||||
if (value is Map<String, dynamic>) {
|
if (value is Map<String, dynamic>) {
|
||||||
|
changedSettings[key] = <String, dynamic>{};
|
||||||
value.forEach((subKey, subValue) {
|
value.forEach((subKey, subValue) {
|
||||||
if (!DeepCollectionEquality().equals(
|
if (!DeepCollectionEquality().equals(
|
||||||
settings[key][subKey],
|
settings[key][subKey],
|
||||||
subValue,
|
subValue,
|
||||||
)) {
|
)) {
|
||||||
widget.mount.setValue('$key.$subKey', subValue.toString());
|
changedSettings[key][subKey] = subValue;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
widget.mount.setValue(key, value.toString());
|
changedSettings[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changedSettings.isNotEmpty) {
|
||||||
|
convertAllToString(changedSettings).then((map) {
|
||||||
|
map.forEach((key, value) {
|
||||||
|
if (value is Map<String, dynamic>) {
|
||||||
|
value.forEach((subKey, subValue) {
|
||||||
|
widget.mount.setValue('$key.$subKey', subValue);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
widget.mount.setValue(key, value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
@ -8,6 +8,7 @@ import 'package:repertory/helpers.dart'
|
|||||||
show
|
show
|
||||||
AuthenticationFailedException,
|
AuthenticationFailedException,
|
||||||
convertAllToString,
|
convertAllToString,
|
||||||
|
displayAuthError,
|
||||||
displayErrorMessage,
|
displayErrorMessage,
|
||||||
getBaseUri,
|
getBaseUri,
|
||||||
getSettingDescription,
|
getSettingDescription,
|
||||||
@ -107,15 +108,6 @@ class _UISettingsWidgetState extends State<UISettingsWidget> {
|
|||||||
widget.settings,
|
widget.settings,
|
||||||
widget.origSettings,
|
widget.origSettings,
|
||||||
)) {
|
)) {
|
||||||
displayAuthError() {
|
|
||||||
if (constants.navigatorKey.currentContext != null) {
|
|
||||||
displayErrorMessage(
|
|
||||||
constants.navigatorKey.currentContext!,
|
|
||||||
"Authentication failed",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
convertAllToString(widget.settings)
|
convertAllToString(widget.settings)
|
||||||
.then((map) async {
|
.then((map) async {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user