Compare commits

..

No commits in common. "ee1638e1dda4437959fc7858dfce348fb455202f" and "b15393bacf109c9915dbd8169c51d558f2ed2949" have entirely different histories.

5 changed files with 8 additions and 32 deletions

View File

@ -168,10 +168,8 @@ handlers::handlers(mgmt_app_config *config, httplib::Server *server)
event_system::instance().start();
server_->listen("127.0.0.1", config_->get_api_port());
if (this_server != nullptr) {
this_server = nullptr;
server_->stop();
}
this_server = nullptr;
}
handlers::~handlers() { event_system::instance().stop(); }
@ -365,17 +363,12 @@ void handlers::handle_post_mount(auto &&req, auto &&res) const {
if (unmount) {
launch_process(prov, name, "-unmount");
} else {
#if defined(_WIN32)
if (utils::file::directory{location}.exists()) {
#else // !defined(_WIN32)
if (not utils::file::directory{location}.exists()) {
#endif // defined(_WIN32)
res.status = http_error_codes::internal_error;
return;
}
launch_process(prov, name, fmt::format(R"("{}")", location), true);
config_->set_mount_location(prov, name, location);
}
res.status = http_error_codes::ok;
@ -467,7 +460,7 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
recur_mutex_lock inst_lock(inst_mtx);
if (background) {
#if defined(_WIN32)
system(fmt::format(R"(start "" /MIN {})", cmd_line).c_str());
system(fmt::format(R"(start "" /b {})", cmd_line).c_str());
#elif defined(__linux__) // defined(__linux__)
system(fmt::format("nohup {} 1>/dev/null 2>&1", cmd_line).c_str());
#else // !defined(__linux__) && !defined(_WIN32)

View File

@ -1,5 +1,4 @@
autofocus
canvaskit
cupertino
cupertinoicons
fromargb

View File

@ -9,7 +9,6 @@ import 'package:repertory/types/mount_config.dart';
class Mount with ChangeNotifier {
final MountConfig mountConfig;
final MountList? _mountList;
bool _isMounting = false;
Mount(this.mountConfig, this._mountList, {isAdd = false}) {
if (isAdd) {
return;
@ -78,8 +77,6 @@ class Mount with ChangeNotifier {
Future<bool> mount(bool unmount, {String? location}) async {
try {
_isMounting = true;
mountConfig.mounted = null;
notifyListeners();
@ -92,13 +89,11 @@ class Mount with ChangeNotifier {
);
if (response.statusCode == 404) {
_isMounting = false;
_mountList?.reset();
return true;
}
await refresh(force: true);
_isMounting = false;
await refresh();
if (!unmount && response.statusCode == 500) {
return false;
@ -107,15 +102,10 @@ class Mount with ChangeNotifier {
debugPrint('$e');
}
_isMounting = false;
return true;
}
Future<void> refresh({bool force = false}) async {
if (!force && _isMounting) {
return;
}
Future<void> refresh() async {
await _fetch();
return _fetchStatus();
}
@ -150,7 +140,7 @@ class Mount with ChangeNotifier {
final response = await http.get(
Uri.parse(
Uri.encodeFull(
'${getBaseUri()}/api/v1/mount_location?name=$name&type=$type',
'${getBaseUri()}/api/v1/get_mount_location?name=$name&type=$type',
),
),
);
@ -159,8 +149,7 @@ class Mount with ChangeNotifier {
return null;
}
final location = jsonDecode(response.body)['Location'] as String;
return location.trim().isEmpty ? null : location;
return jsonDecode(response.body)['Location'] as String;
} catch (e) {
debugPrint('$e');
}

View File

@ -110,7 +110,7 @@ class _MountWidgetState extends State<MountWidget> {
return cleanup();
}
displayErrorMessage(context, "Mount location is not available");
displayErrorMessage(context, "Mount location not found");
return cleanup();
}
: null;

View File

@ -33,11 +33,6 @@
<link rel="manifest" href="manifest.json">
</head>
<body>
<script>
window.flutterConfiguration = {
canvasKitBaseUrl: "/canvaskit/"
};
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>