Auto-mount
This commit is contained in:
@@ -178,7 +178,8 @@
|
||||
document.body.innerHTML = '';
|
||||
document.body.appendChild(div);
|
||||
div.classList.remove('hidden-element');
|
||||
}
|
||||
},
|
||||
notifyDriveMounting: _notifyDriveMounting
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -301,6 +302,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
function _notifyDriveMounting(mountLocation) {
|
||||
const mountButton = document.getElementById('ID_MountButton');
|
||||
const mountSelect = document.getElementById('ID_MountDrives');
|
||||
mountButton.innerText = "Unmount";
|
||||
mountButton.onclick = _mountHandler;
|
||||
mountSelect['allow_change'] = false;
|
||||
mountSelect.disabled = true;
|
||||
mountSelect.value = mountLocation;
|
||||
}
|
||||
|
||||
function _notifyDriveUnmounted() {
|
||||
const mountButton = document.getElementById('ID_MountButton');
|
||||
const mountSelect = document.getElementById('ID_MountDrives');
|
||||
|
@@ -72,11 +72,14 @@ private:
|
||||
const auto lastMountLocation = _siaDriveConfig->GetLastMountLocation();
|
||||
if (!lastMountLocation.empty())
|
||||
{
|
||||
// Change mount location
|
||||
// Disable mount location
|
||||
// Change mount button to 'Unmount'
|
||||
// Disable mount button
|
||||
std::thread([this, lastMountLocation, context, cb]()
|
||||
auto global = context->GetGlobal();
|
||||
auto uiUpdate = global->GetValue("uiUpdate");
|
||||
auto notifyDriveMounting = uiUpdate->GetValue("notifyDriveMounting");;
|
||||
|
||||
CefV8ValueList args2;
|
||||
args2.push_back(CefV8Value::CreateString(lastMountLocation));
|
||||
notifyDriveMounting->ExecuteFunction(nullptr, args2);
|
||||
std::thread([this, lastMountLocation, context]()
|
||||
{
|
||||
_siaDrive->Mount(lastMountLocation[0], _siaDriveConfig->GetCacheFolder(), 0);
|
||||
}).detach();
|
||||
@@ -616,10 +619,13 @@ void CSiaDriveApp::SiaApiRefreshCallback(CefRefPtr<CefV8Context> context, const
|
||||
const auto lastMountLocation = _siaDriveConfig->GetLastMountLocation();
|
||||
if (!lastMountLocation.empty())
|
||||
{
|
||||
// Change mount location
|
||||
// Disable mount location
|
||||
// Change mount button to 'Unmount'
|
||||
// Disable mount button
|
||||
auto uiUpdate = global->GetValue("uiUpdate");
|
||||
auto notifyDriveMounting = uiUpdate->GetValue("notifyDriveMounting");;
|
||||
|
||||
CefV8ValueList args2;
|
||||
args2.push_back(CefV8Value::CreateString(lastMountLocation));
|
||||
notifyDriveMounting->ExecuteFunction(nullptr, args2);
|
||||
|
||||
std::thread([this, lastMountLocation]()
|
||||
{
|
||||
_siaDrive->Mount(lastMountLocation[0], _siaDriveConfig->GetCacheFolder(), 0);
|
||||
|
Reference in New Issue
Block a user