Compare commits

..

No commits in common. "18a66953f29d4a971059b45a4392ed5f40dc2ddb" and "e35f43af97ea64e5ce716898817041e36c3118bd" have entirely different histories.

16 changed files with 162 additions and 291 deletions

View File

@ -12,7 +12,6 @@
### Changes from v2.0.4-rc
* Continue documentation updates
* Require `--name,-na` option for encryption provider
## v2.0.4-rc

View File

@ -36,9 +36,10 @@ template <typename drive> inline void help(std::vector<const char *> args) {
std::cout << " -di,--drive_information Display mounted drive "
"information"
<< std::endl;
std::cout << " -na,--name Unique configuration "
"name [Required for Encrypt, S3 and Sia]"
<< std::endl;
std::cout
<< " -na,--name Unique name for S3 or Sia "
"instance [Required]"
<< std::endl;
std::cout << " -s3,--s3 Enables S3 mode"
<< std::endl;
std::cout

View File

@ -105,8 +105,7 @@ auto main(int argc, char **argv) -> int {
}
}
}
} else if ((prov == provider_type::s3) || (prov == provider_type::sia) ||
(prov == provider_type::encrypt)) {
} else if ((prov == provider_type::s3) || (prov == provider_type::sia)) {
std::string data;
res = utils::cli::parse_string_option(
args, utils::cli::options::name_option, data);
@ -116,9 +115,9 @@ auto main(int argc, char **argv) -> int {
if (prov == provider_type::sia) {
unique_id = "default";
} else {
std::cerr << "Configuration name for '"
std::cerr << "Name of "
<< app_config::get_provider_display_name(prov)
<< "' was not provided" << std::endl;
<< " instance not provided" << std::endl;
res = exit_code::invalid_syntax;
}
}

View File

@ -171,6 +171,12 @@ void handlers::handle_get_mount_list(auto &&res) const {
auto data_dir = utils::file::directory{app_config::get_root_data_directory()};
nlohmann::json result;
auto encrypt_dir = data_dir.get_directory("encrypt");
if (encrypt_dir && encrypt_dir->get_file("config.json")) {
result["encrypt"].emplace_back("encrypt");
}
const auto process_dir = [&data_dir, &result](std::string_view name) {
auto name_dir = data_dir.get_directory(name);
if (not name_dir) {
@ -187,7 +193,6 @@ void handlers::handle_get_mount_list(auto &&res) const {
}
};
process_dir("encrypt");
process_dir("remote");
process_dir("s3");
process_dir("sia");
@ -218,12 +223,14 @@ void handlers::handle_get_mount_status(auto &&req, auto &&res) const {
auto status_name = app_config::get_provider_display_name(prov);
switch (prov) {
case provider_type::encrypt:
break;
case provider_type::remote: {
auto parts = utils::string::split(name, '_', false);
status_name = fmt::format("{}{}:{}", status_name, parts[0U], parts[1U]);
} break;
case provider_type::encrypt:
case provider_type::sia:
case provider_type::s3:
status_name = fmt::format("{}{}", status_name, name);
@ -298,7 +305,7 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
std::string str_type;
switch (prov) {
case provider_type::encrypt:
str_type = fmt::format("-en -na {}", name);
str_type = "-en";
break;
case provider_type::remote: {

View File

@ -35,16 +35,12 @@ namespace {
std::unordered_map<repertory::provider_type,
std::unordered_map<std::string, std::string>>
map_of_maps{
{repertory::provider_type::encrypt, nlohmann::json::object()},
{repertory::provider_type::remote, nlohmann::json::object()},
{repertory::provider_type::s3, nlohmann::json::object()},
{repertory::provider_type::sia, nlohmann::json::object()},
{repertory::provider_type::encrypt, {}},
{repertory::provider_type::remote, {}},
{repertory::provider_type::s3, {}},
{repertory::provider_type::sia, {}},
};
if (json.is_null() || json.empty()) {
return map_of_maps;
}
for (const auto &[prov, map] : map_of_maps) {
for (const auto &[key, value] :
json[repertory::provider_type_to_string(prov)].items()) {
@ -60,7 +56,7 @@ namespace {
}
[[nodiscard]] auto to_json(const auto &map_of_maps) -> nlohmann::json {
auto json = nlohmann::json::object();
nlohmann::json json;
for (const auto &[prov, map] : map_of_maps) {
for (const auto &[key, value] : map) {
json[repertory::provider_type_to_string(prov)][key] = value;
@ -79,18 +75,9 @@ mgmt_app_config::mgmt_app_config() {
utils::path::combine(app_config::get_root_data_directory(), {"ui.json"});
try {
if (not utils::file::directory{app_config::get_root_data_directory()}
.create_directory()) {
throw utils::error::create_exception(
function_name, {
"failed to create directory",
app_config::get_root_data_directory(),
});
}
nlohmann::json data;
if (utils::file::read_json_file(config_file, data)) {
api_auth_ = data.at(JSON_API_PASSWORD).get<std::string>();
api_auth_ = data.at(JSON_API_AUTH).get<std::string>();
api_port_ = data.at(JSON_API_PORT).get<std::uint16_t>();
api_user_ = data.at(JSON_API_USER).get<std::string>();
locations_ = from_json(data.at(JSON_MOUNT_LOCATIONS));
@ -100,7 +87,6 @@ mgmt_app_config::mgmt_app_config() {
utils::error::raise_error(
function_name, utils::get_last_error_code(),
fmt::format("failed to read file|{}", config_file));
save();
} catch (const std::exception &ex) {
utils::error::raise_error(
function_name, ex, fmt::format("failed to read file|{}", config_file));
@ -135,7 +121,7 @@ void mgmt_app_config::save() const {
}
nlohmann::json data;
data[JSON_API_PASSWORD] = api_auth_;
data[JSON_API_AUTH] = api_auth_;
data[JSON_API_PORT] = api_port_;
data[JSON_API_USER] = api_user_;
data[JSON_MOUNT_LOCATIONS] = to_json(locations_);

View File

@ -1,6 +1,4 @@
autofocus
cupertino
cupertinoicons
fromargb
onetwothree
rocksdb
onetwothree

View File

@ -1 +1 @@
const String appTitle = 'Repertory Management Portal';
const String appTitle = "Repertory Management Portal";

View File

@ -1,15 +1,15 @@
import 'package:flutter/foundation.dart';
String formatMountName(String type, String name) {
if (type == 'remote') {
return name.replaceAll('_', ':');
if (type == "remote") {
return name.replaceAll("_", ":");
}
return name;
}
String getBaseUri() {
if (kDebugMode) {
return 'http://127.0.0.1:30000';
return "http://127.0.0.1:30000";
}
return Uri.base.origin;
}

View File

@ -1,9 +1,11 @@
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:repertory/constants.dart' as constants;
import 'package:repertory/helpers.dart';
import 'package:repertory/models/mount.dart';
import 'package:repertory/models/mount_list.dart';
import 'package:repertory/types/mount_config.dart';
import 'package:repertory/widgets/add_mount_widget.dart';
import 'package:repertory/widgets/mount_list_widget.dart';
import 'package:repertory/widgets/mount_settings.dart';
@ -18,7 +20,7 @@ class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(context) {
Widget build(BuildContext context) {
return MaterialApp(
title: constants.appTitle,
theme: ThemeData(
@ -76,64 +78,11 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
bool _allowAdd = true;
String? _apiPassword;
String? _apiPort;
String? _bucket;
String? _encryptionToken;
String? _hostNameOrIp;
String _mountType = 'Encrypt';
String _mountType = "S3";
String _mountName = "";
String? _path;
void _resetData() {
_apiPassword = null;
_apiPort = null;
_bucket = null;
_encryptionToken = null;
_hostNameOrIp = null;
_mountName = "";
_mountType = 'Encrypt';
_path = null;
}
void _updateData(String name, String? value) {
switch (name) {
case 'ApiPassword':
_apiPassword = value ?? '';
return;
case 'ApiPort':
_apiPort = value ?? '';
return;
case 'Bucket':
_bucket = value ?? '';
return;
case 'EncryptionToken':
_encryptionToken = value ?? '';
return;
case 'HostNameOrIp':
_hostNameOrIp = value ?? '';
return;
case 'Name':
_mountName = value ?? '';
return;
case 'Provider':
_mountType = value ?? 'Encrypt';
return;
case 'Path':
_path = value ?? '';
return;
}
}
@override
Widget build(context) {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
@ -147,14 +96,25 @@ class _MyHomePageState extends State<MyHomePage> {
? () {
showDialog(
context: context,
builder: (context) {
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Add Mount'),
content: Consumer<MountList>(
builder: (_, MountList mountList, __) {
builder: (_, mountList, __) {
return AddMountWidget(
allowEncrypt:
mountList.items.firstWhereOrNull(
(MountConfig item) =>
item.type.toLowerCase() == "encrypt",
) ==
null,
mountType: _mountType,
onDataChanged: _updateData,
onNameChanged: (mountName) {
_mountName = mountName ?? "";
},
onTypeChanged: (mountType) {
_mountType = mountType ?? "S3";
},
);
},
),
@ -162,7 +122,8 @@ class _MyHomePageState extends State<MyHomePage> {
TextButton(
child: const Text('Cancel'),
onPressed: () {
_resetData();
_mountType = "S3";
_mountName = "";
Navigator.of(context).pop();
},
),
@ -172,18 +133,10 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() => _allowAdd = false);
Provider.of<MountList>(context, listen: false)
.add(
_mountType,
_mountName,
apiPassword: _apiPassword,
apiPort: _apiPort,
bucket: _bucket,
encryptionToken: _encryptionToken,
hostNameOrIp: _hostNameOrIp,
path: _path,
)
.add(_mountType, _mountName)
.then((_) {
_resetData();
_mountType = "S3";
_mountName = "";
setState(() {
_allowAdd = true;
});
@ -206,13 +159,4 @@ class _MyHomePageState extends State<MyHomePage> {
),
);
}
@override
void setState(VoidCallback fn) {
if (!mounted) {
return;
}
super.setState(fn);
}
}

View File

@ -79,18 +79,6 @@ class Mount with ChangeNotifier {
}
Future<String?> getMountLocation() async {
final response = await http.get(
Uri.parse(
Uri.encodeFull(
'${getBaseUri()}/api/v1/get_mount_location?name=$name&type=$type',
),
),
);
if (response.statusCode != 200) {
return null;
}
return jsonDecode(response.body)['Location'] as String;
return "~/mnt/encrypt";
}
}

View File

@ -48,22 +48,11 @@ class MountList with ChangeNotifier {
});
}
Future<void> add(
String type,
String name, {
String? apiPassword,
String? apiPort,
String? bucket,
String? encryptionToken,
String? hostNameOrIp,
String? path,
}) async {
Future<void> add(String type, String name) async {
await http.post(
Uri.parse(
Uri.encodeFull(
'${getBaseUri()}/api/v1/add_mount?name=$name&type=$type&bucket=$bucket'
'&path=$path&apiPassword=$apiPassword&apiPort=$apiPort&hostNameOrIp=$hostNameOrIp'
'&encryptionToken=$encryptionToken',
'${getBaseUri()}/api/v1/add_mount?name=$name&type=$type',
),
),
);

View File

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
class MountConfig {
final String _name;
String _path = '';
String _path = "";
Map<String, dynamic> _settings = {};
IconData _state = Icons.toggle_off;
final String _type;
@ -25,7 +25,7 @@ class MountConfig {
}
void updateStatus(Map<String, dynamic> status) {
_path = status['Location'] as String;
_state = status['Active'] as bool ? Icons.toggle_on : Icons.toggle_off;
_path = status["Location"] as String;
_state = status["Active"] as bool ? Icons.toggle_on : Icons.toggle_off;
}
}

View File

@ -1,23 +1,30 @@
import 'package:flutter/material.dart';
class AddMountWidget extends StatefulWidget {
final bool allowEncrypt;
final String mountType;
final void Function(String name, String? value) onDataChanged;
final void Function(String? newName) onNameChanged;
final void Function(String? newType) onTypeChanged;
const AddMountWidget({
final _items = <String>["S3", "Sia"];
AddMountWidget({
super.key,
required this.allowEncrypt,
required this.mountType,
required this.onDataChanged,
});
required this.onNameChanged,
required this.onTypeChanged,
}) {
if (allowEncrypt) {
_items.insert(0, "Encrypt");
}
}
@override
State<AddMountWidget> createState() => _AddMountWidgetState();
}
class _AddMountWidgetState extends State<AddMountWidget> {
static const _items = <String>['Encrypt', 'Remote', 'S3', 'Sia'];
static const _padding = 15.0;
String? _mountType;
@override
@ -26,33 +33,8 @@ class _AddMountWidgetState extends State<AddMountWidget> {
super.initState();
}
List<Widget> _createTextField(
String title,
String dataName, {
String? value,
}) {
return [
const SizedBox(height: _padding),
Text(
title,
textAlign: TextAlign.left,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.bold,
),
),
TextField(
decoration: InputDecoration(),
onChanged: (value) => widget.onDataChanged(dataName, value),
controller: TextEditingController(text: value),
),
];
}
@override
Widget build(BuildContext context) {
final mountTypeLower = _mountType?.toLowerCase();
return Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
@ -70,17 +52,17 @@ class _AddMountWidgetState extends State<AddMountWidget> {
fontWeight: FontWeight.bold,
),
),
const SizedBox(width: _padding),
const SizedBox(width: 10),
DropdownButton<String>(
value: _mountType,
onChanged: (value) {
setState(() {
_mountType = value;
});
widget.onDataChanged('Provider', value);
widget.onTypeChanged(value);
},
items:
_items.map<DropdownMenuItem<String>>((item) {
widget._items.map<DropdownMenuItem<String>>((item) {
return DropdownMenuItem<String>(
value: item,
child: Text(item),
@ -89,31 +71,22 @@ class _AddMountWidgetState extends State<AddMountWidget> {
),
],
),
if (mountTypeLower != 'remote')
..._createTextField('Configuration Name', 'Name'),
if (mountTypeLower == 'encrypt') ..._createTextField('Path', 'Path'),
if (mountTypeLower == 'sia')
..._createTextField('ApiPassword', 'ApiPassword'),
if (mountTypeLower == 's3' || mountTypeLower == 'sia')
..._createTextField(
'Bucket',
'Bucket',
value: mountTypeLower == 'sia' ? 'default' : null,
const SizedBox(height: 10),
if (_mountType?.toLowerCase() != 'encrypt')
Text(
'Configuration Name',
textAlign: TextAlign.left,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.bold,
),
),
if (mountTypeLower == 'remote' || mountTypeLower == 'sia')
..._createTextField(
'HostNameOrIp',
'HostNameOrIp',
value: 'localhost',
if (_mountType?.toLowerCase() != 'encrypt')
TextField(
autofocus: true,
decoration: InputDecoration(),
onChanged: widget.onNameChanged,
),
if (mountTypeLower == 'remote' || mountTypeLower == 'sia')
..._createTextField(
'ApiPort',
'ApiPort',
value: mountTypeLower == 'sia' ? '9980' : null,
),
if (mountTypeLower == 'remote')
..._createTextField('EncryptionToken', 'EncryptionToken'),
],
);
}

View File

@ -4,9 +4,14 @@ import 'package:repertory/models/mount.dart';
import 'package:repertory/models/mount_list.dart';
import 'package:repertory/widgets/mount_widget.dart';
class MountListWidget extends StatelessWidget {
class MountListWidget extends StatefulWidget {
const MountListWidget({super.key});
@override
State<MountListWidget> createState() => _MountListWidgetState();
}
class _MountListWidgetState extends State<MountListWidget> {
@override
Widget build(BuildContext context) {
return Consumer<MountList>(

View File

@ -200,70 +200,70 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
List<SettingsTile> siaConfigSettings = [];
_settings.forEach((key, value) {
if (key == 'ApiAuth') {
if (key == "ApiAuth") {
_addPasswordSetting(commonSettings, _settings, key, value);
} else if (key == 'ApiPort') {
} else if (key == "ApiPort") {
_addIntSetting(commonSettings, _settings, key, value);
} else if (key == 'ApiUser') {
} else if (key == "ApiUser") {
_addStringSetting(commonSettings, _settings, key, value, Icons.person);
} else if (key == 'DatabaseType') {
} else if (key == "DatabaseType") {
_addListSetting(commonSettings, _settings, key, value, [
'rocksdb',
'sqlite',
"rocksdb",
"sqlite",
], Icons.dataset);
} else if (key == 'DownloadTimeoutSeconds') {
} else if (key == "DownloadTimeoutSeconds") {
_addIntSetting(commonSettings, _settings, key, value);
} else if (key == 'EnableDownloadTimeout') {
} else if (key == "EnableDownloadTimeout") {
_addBooleanSetting(commonSettings, _settings, key, value);
} else if (key == 'EnableDriveEvents') {
} else if (key == "EnableDriveEvents") {
_addBooleanSetting(commonSettings, _settings, key, value);
} else if (key == 'EventLevel') {
} else if (key == "EventLevel") {
_addListSetting(commonSettings, _settings, key, value, [
'critical',
'error',
'warn',
'info',
'debug',
'trace',
"critical",
"error",
"warn",
"info",
"debug",
"trace",
], Icons.event);
} else if (key == 'EvictionDelayMinutes') {
} else if (key == "EvictionDelayMinutes") {
_addIntSetting(commonSettings, _settings, key, value);
} else if (key == 'EvictionUseAccessedTime') {
} else if (key == "EvictionUseAccessedTime") {
_addBooleanSetting(commonSettings, _settings, key, value);
} else if (key == 'MaxCacheSizeBytes') {
} else if (key == "MaxCacheSizeBytes") {
_addIntSetting(commonSettings, _settings, key, value);
} else if (key == 'MaxUploadCount') {
} else if (key == "MaxUploadCount") {
_addIntSetting(commonSettings, _settings, key, value);
} else if (key == 'OnlineCheckRetrySeconds') {
} else if (key == "OnlineCheckRetrySeconds") {
_addIntSetting(commonSettings, _settings, key, value);
} else if (key == 'PreferredDownloadType') {
} else if (key == "PreferredDownloadType") {
_addListSetting(commonSettings, _settings, key, value, [
'default',
'direct',
'ring_buffer',
"default",
"direct",
"ring_buffer",
], Icons.download);
} else if (key == 'RetryReadCount') {
} else if (key == "RetryReadCount") {
_addIntSetting(commonSettings, _settings, key, value);
} else if (key == 'RingBufferFileSize') {
} else if (key == "RingBufferFileSize") {
_addIntListSetting(
commonSettings,
_settings,
key,
value,
['128', '256', '512', '1024', '2048'],
["128", "256", "512", "1024", "2048"],
512,
Icons.animation,
);
} else if (key == 'EncryptConfig') {
} else if (key == "EncryptConfig") {
value.forEach((subKey, subValue) {
if (subKey == 'EncryptionToken') {
if (subKey == "EncryptionToken") {
_addPasswordSetting(
encryptConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'Path') {
} else if (subKey == "Path") {
_addStringSetting(
encryptConfigSettings,
_settings[key],
@ -273,9 +273,9 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
);
}
});
} else if (key == 'HostConfig') {
} else if (key == "HostConfig") {
value.forEach((subKey, subValue) {
if (subKey == 'AgentString') {
if (subKey == "AgentString") {
_addStringSetting(
hostConfigSettings,
_settings[key],
@ -283,21 +283,21 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
subValue,
Icons.support_agent,
);
} else if (subKey == 'ApiPassword') {
} else if (subKey == "ApiPassword") {
_addPasswordSetting(
hostConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'ApiPort') {
} else if (subKey == "ApiPort") {
_addIntSetting(
hostConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'ApiUser') {
} else if (subKey == "ApiUser") {
_addStringSetting(
hostConfigSettings,
_settings[key],
@ -305,7 +305,7 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
subValue,
Icons.person,
);
} else if (subKey == 'HostNameOrIp') {
} else if (subKey == "HostNameOrIp") {
_addStringSetting(
hostConfigSettings,
_settings[key],
@ -313,7 +313,7 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
subValue,
Icons.computer,
);
} else if (subKey == 'Path') {
} else if (subKey == "Path") {
_addStringSetting(
hostConfigSettings,
_settings[key],
@ -321,16 +321,16 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
subValue,
Icons.route,
);
} else if (subKey == 'Protocol') {
} else if (subKey == "Protocol") {
_addListSetting(
hostConfigSettings,
_settings[key],
subKey,
subValue,
['http', 'https'],
["http", "https"],
Icons.http,
);
} else if (subKey == 'TimeoutMs') {
} else if (subKey == "TimeoutMs") {
_addIntSetting(
hostConfigSettings,
_settings[key],
@ -339,23 +339,23 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
);
}
});
} else if (key == 'RemoteConfig') {
} else if (key == "RemoteConfig") {
value.forEach((subKey, subValue) {
if (subKey == 'ApiPort') {
if (subKey == "ApiPort") {
_addIntSetting(
remoteConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'EncryptionToken') {
} else if (subKey == "EncryptionToken") {
_addPasswordSetting(
remoteConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'HostNameOrIp') {
} else if (subKey == "HostNameOrIp") {
_addStringSetting(
remoteConfigSettings,
_settings[key],
@ -363,21 +363,21 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
subValue,
Icons.computer,
);
} else if (subKey == 'MaxConnections') {
} else if (subKey == "MaxConnections") {
_addIntSetting(
remoteConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'ReceiveTimeoutMs') {
} else if (subKey == "ReceiveTimeoutMs") {
_addIntSetting(
remoteConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'SendTimeoutMs') {
} else if (subKey == "SendTimeoutMs") {
_addIntSetting(
remoteConfigSettings,
_settings[key],
@ -386,27 +386,27 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
);
}
});
} else if (key == 'RemoteMount') {
} else if (key == "RemoteMount") {
value.forEach((subKey, subValue) {
if (subKey == 'Enable') {
if (subKey == "Enable") {
List<SettingsTile> tempSettings = [];
_addBooleanSetting(tempSettings, _settings[key], subKey, subValue);
remoteMountSettings.insertAll(0, tempSettings);
} else if (subKey == 'ApiPort') {
} else if (subKey == "ApiPort") {
_addIntSetting(
remoteMountSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'ClientPoolSize') {
} else if (subKey == "ClientPoolSize") {
_addIntSetting(
remoteMountSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'EncryptionToken') {
} else if (subKey == "EncryptionToken") {
_addPasswordSetting(
remoteMountSettings,
_settings[key],
@ -415,16 +415,16 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
);
}
});
} else if (key == 'S3Config') {
} else if (key == "S3Config") {
value.forEach((subKey, subValue) {
if (subKey == 'AccessKey') {
if (subKey == "AccessKey") {
_addPasswordSetting(
s3ConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'Bucket') {
} else if (subKey == "Bucket") {
_addStringSetting(
s3ConfigSettings,
_settings[key],
@ -432,14 +432,14 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
subValue,
Icons.folder,
);
} else if (subKey == 'EncryptionToken') {
} else if (subKey == "EncryptionToken") {
_addPasswordSetting(
s3ConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'Region') {
} else if (subKey == "Region") {
_addStringSetting(
s3ConfigSettings,
_settings[key],
@ -447,16 +447,16 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
subValue,
Icons.map,
);
} else if (subKey == 'SecretKey') {
} else if (subKey == "SecretKey") {
_addPasswordSetting(
s3ConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'TimeoutMs') {
} else if (subKey == "TimeoutMs") {
_addIntSetting(s3ConfigSettings, _settings[key], subKey, subValue);
} else if (subKey == 'URL') {
} else if (subKey == "URL") {
_addStringSetting(
s3ConfigSettings,
_settings[key],
@ -464,14 +464,14 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
subValue,
Icons.http,
);
} else if (subKey == 'UsePathStyle') {
} else if (subKey == "UsePathStyle") {
_addBooleanSetting(
s3ConfigSettings,
_settings[key],
subKey,
subValue,
);
} else if (subKey == 'UseRegionInURL') {
} else if (subKey == "UseRegionInURL") {
_addBooleanSetting(
s3ConfigSettings,
_settings[key],
@ -480,9 +480,9 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
);
}
});
} else if (key == 'SiaConfig') {
} else if (key == "SiaConfig") {
value.forEach((subKey, subValue) {
if (subKey == 'Bucket') {
if (subKey == "Bucket") {
_addStringSetting(
siaConfigSettings,
_settings[key],
@ -527,7 +527,7 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
SettingsSection(
title: const Text('Remote Mount'),
tiles:
_settings['RemoteMount']['Enable'] as bool
_settings["RemoteMount"]["Enable"] as bool
? remoteMountSettings
: [remoteMountSettings[0]],
),
@ -565,13 +565,4 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
_settings = jsonDecode(jsonEncode(widget.mount.mountConfig.settings));
super.initState();
}
@override
void setState(VoidCallback fn) {
if (!mounted) {
return;
}
super.setState(fn);
}
}

View File

@ -109,13 +109,4 @@ class _MountWidgetState extends State<MountWidget> {
Provider.of<Mount>(context, listen: false).refresh();
});
}
@override
void setState(VoidCallback fn) {
if (!mounted) {
return;
}
super.setState(fn);
}
}