diff --git a/repertory/repertory/src/ui/handlers.cpp b/repertory/repertory/src/ui/handlers.cpp index d8173254..c0f081d9 100644 --- a/repertory/repertory/src/ui/handlers.cpp +++ b/repertory/repertory/src/ui/handlers.cpp @@ -210,12 +210,16 @@ void handlers::handle_get_mount_status(auto &&req, auto &&res) const { void handlers::handle_post_mount(auto &&req, auto &&res) const { auto type = req.get_param_value("type"); auto name = req.get_param_value("name"); + auto location = req.get_param_value("location"); auto unmount = utils::string::to_bool(req.get_param_value("unmount")); auto prov = provider_type_from_string(type); if (unmount) { read_process(prov, name, "-unmount"); + } else { + read_process(prov, name, fmt::format("\"{}\"", location)); } + res.status = http_error_codes::ok; } diff --git a/web/repertory/lib/models/mount.dart b/web/repertory/lib/models/mount.dart index dbab2f62..f4bb1412 100644 --- a/web/repertory/lib/models/mount.dart +++ b/web/repertory/lib/models/mount.dart @@ -48,11 +48,11 @@ class Mount with ChangeNotifier { notifyListeners(); } - Future mount(bool unmount) async { + Future mount(bool unmount, {String? location}) async { await http.post( Uri.parse( Uri.encodeFull( - '${Uri.base.origin}/api/v1/mount?unmount=$unmount&name=$name&type=$type', + '${Uri.base.origin}/api/v1/mount?unmount=$unmount&name=$name&type=$type&location=$location', ), ), ); @@ -76,4 +76,8 @@ class Mount with ChangeNotifier { return refresh(); } + + Future getMountLocation() async { + return "~/mnt/encrypt"; + } } diff --git a/web/repertory/lib/widgets/mount_widget.dart b/web/repertory/lib/widgets/mount_widget.dart index d50e11f4..c1f37f98 100644 --- a/web/repertory/lib/widgets/mount_widget.dart +++ b/web/repertory/lib/widgets/mount_widget.dart @@ -65,30 +65,29 @@ class _MountWidgetState extends State { ), onPressed: _enabled - ? () { + ? () async { setState(() { _enabled = false; }); - if (isActive) { - mount - .mount(isActive) - .then((_) { - setState(() { - _enabled = true; - }); - }) - .catchError((_) { - setState(() { - _enabled = true; - }); - }); - return; + String? location; + if (!isActive) { + location = await mount.getMountLocation(); + if (location == null) {} } - setState(() { - _enabled = true; - }); + mount + .mount(isActive, location: location) + .then((_) { + setState(() { + _enabled = true; + }); + }) + .catchError((_) { + setState(() { + _enabled = true; + }); + }); } : null, ),