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