diff --git a/htdocs/index.html b/htdocs/index.html
index 53c0e75..b1d04a7 100644
--- a/htdocs/index.html
+++ b/htdocs/index.html
@@ -68,21 +68,21 @@
- Total GB: |
+ Total: |
|
|
Price (per GB): |
|
- Available GB: |
+ Available: |
|
|
Download (per GB): |
|
- Used GB: |
+ Used: |
|
|
Upload (per GB): |
diff --git a/include/siadrive_api/siacommon.h b/include/siadrive_api/siacommon.h
index a381265..8d40424 100644
--- a/include/siadrive_api/siacommon.h
+++ b/include/siadrive_api/siacommon.h
@@ -3,7 +3,7 @@
#include
#define SIDRIVE_VERSION_STRING "0.0.1"
-#define COMPAT_SIAD_VERSION "1.1.2"
+#define COMPAT_SIAD_VERSION "1.2.0"
#ifdef _WIN32
// Disable DLL-interface warnings
@@ -194,15 +194,6 @@ inline static Hastings SiaCurrencyToHastings(const SiaCurrency& currency)
return parser.stack[0].value.ToString(conv);
}
-inline static SString SiaCurrencyToGB(const SiaCurrency& value)
-{
- ttmath::Conv conv;
- conv.base = 10;
- conv.round = 3;
-
- return value.ToWString(conv);
-}
-
SString SIADRIVE_EXPORTABLE BytesToFriendlyDisplay(const SiaCurrency& bytes);
BOOL SIADRIVE_EXPORTABLE RetryAction(std::function func, std::uint16_t retryCount, const DWORD& retryDelay);
diff --git a/src/siadrive/siadriveapp.cpp b/src/siadrive/siadriveapp.cpp
index 3fab5ae..697db35 100644
--- a/src/siadrive/siadriveapp.cpp
+++ b/src/siadrive/siadriveapp.cpp
@@ -438,12 +438,13 @@ void CSiaDriveApp::SiaApiRefreshCallback(CefRefPtr context, const
global->GetValue("uiState")->SetValue("allocatedRenterFunds", CefV8Value::CreateString(SiaCurrencyToString(allocatedFunds).str()), V8_PROPERTY_ATTRIBUTE_NONE);
// Space
- SiaCurrency totalUsedGb = _siaApi->GetRenter()->GetTotalUsedBytes() ? _siaApi->GetRenter()->GetTotalUsedBytes() / (1024.0 * 1024.0 * 1024.0) : 0.0;
- auto totalAvailable = (totalUsedGb / (allocatedFunds - unspentFunds)) * allocatedFunds;
- auto totalRemainGb = totalAvailable - totalUsedGb;
- ExecuteSetter(context, renterActions, "setEstimatedSpace", SiaCurrencyToGB(totalAvailable));
- ExecuteSetter(context, renterActions, "setAvailableSpace", SiaCurrencyToGB(totalRemainGb));
- ExecuteSetter(context, renterActions, "setUsedSpace", SiaCurrencyToGB(totalUsedGb));
+ SiaCurrency totalUsed = _siaApi->GetRenter()->GetTotalUsedBytes() ? _siaApi->GetRenter()->GetTotalUsedBytes() : 0.0;
+ SiaCurrency totalAvailable;
+ _siaApi->GetRenter()->CalculateEstimatedStorage(allocatedFunds, totalAvailable);
+ auto totalRemain = totalAvailable > 0 ? totalAvailable - totalUsed : 0;
+ ExecuteSetter(context, renterActions, "setEstimatedSpace", BytesToFriendlyDisplay(totalAvailable));
+ ExecuteSetter(context, renterActions, "setAvailableSpace", BytesToFriendlyDisplay(totalRemain));
+ ExecuteSetter(context, renterActions, "setUsedSpace", BytesToFriendlyDisplay(totalUsed));
// Upload Progress
/*