summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2026-08-14 23:16:57 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2026-09-04 14:45:00 +0300
commit069f87c6874f87714f10ec759e01db9817cbcc28 (patch)
tree91738f15ed8db9ad1fe08b6675b3265c45053dfe
parent7be4a67abbb484f8c91604f947a9942253919baa (diff)
Add 501-based feature flag check, probed once at login
-rw-r--r--indra/newview/llbuycurrencyhtml.cpp40
-rw-r--r--indra/newview/llbuycurrencyhtml.h5
-rw-r--r--indra/newview/llfloaterbuycurrencyhtml.cpp24
-rw-r--r--indra/newview/llfloaterbuycurrencyhtml.h1
-rw-r--r--indra/newview/llstartup.cpp2
5 files changed, 56 insertions, 16 deletions
diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp
index 0ae3b6eb4a..81d9a261af 100644
--- a/indra/newview/llbuycurrencyhtml.cpp
+++ b/indra/newview/llbuycurrencyhtml.cpp
@@ -34,6 +34,8 @@
#include "llcommandhandler.h"
#include "llviewercontrol.h"
#include "llstatusbar.h"
+#include "llcorehttputil.h"
+#include "llcoros.h"
// support for secondlife:///app/buycurrencyhtml/{ACTION}/{NEXT_ACTION}/{RETURN_CODE} SLapps
class LLBuyCurrencyHTMLHandler :
@@ -86,6 +88,35 @@ public:
};
LLBuyCurrencyHTMLHandler gBuyCurrencyHTMLHandler;
+bool LLBuyCurrencyHTML::sWebFloaterEnabled = false;
+
+////////////////////////////////////////////////////////////////////////////////
+// static
+static void checkFeatureFlag_coro(std::string check_url)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter = std::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("CheckBuyCurrencyURL", httpPolicy);
+ LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
+
+ LLCore::HttpOptions::ptr_t httpOptions = std::make_shared<LLCore::HttpOptions>();
+ httpOptions->setRetries(0);
+
+ LLSD result = httpAdapter->getAndSuspend(httpRequest, check_url, httpOptions);
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ LLBuyCurrencyHTML::sWebFloaterEnabled = !(status.isHttpStatus() && status.getType() == 501);
+}
+
+// static
+void LLBuyCurrencyHTML::checkFeatureFlag()
+{
+ std::string check_url = LLFloaterBuyCurrencyHTML::buildURL();
+ LLCoros::instance().launch("checkFeatureFlag_coro",
+ [check_url]() { checkFeatureFlag_coro(check_url); });
+}
+
////////////////////////////////////////////////////////////////////////////////
// static
// Opens the legacy XUI based floater or new HTML based one based on
@@ -93,16 +124,15 @@ LLBuyCurrencyHTMLHandler gBuyCurrencyHTMLHandler;
// the case where the amount is not requested.
void LLBuyCurrencyHTML::openCurrencyFloater()
{
- if ( gSavedSettings.getBOOL( "BuyCurrencyHTML" ) )
+ if (gSavedSettings.getBOOL("BuyCurrencyHTML") && sWebFloaterEnabled)
{
- // HTML version
LLBuyCurrencyHTML::showDialog();
}
else
{
// legacy version
LLFloaterBuyCurrency::buyCurrency();
- };
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -112,7 +142,7 @@ void LLBuyCurrencyHTML::openCurrencyFloater()
// the case where the amount and a string to display are requested.
void LLBuyCurrencyHTML::openCurrencyFloater( const std::string& message, S32 sum )
{
- if ( gSavedSettings.getBOOL( "BuyCurrencyHTML" ) )
+ if (gSavedSettings.getBOOL("BuyCurrencyHTML") && sWebFloaterEnabled)
{
LLBuyCurrencyHTML::showDialog(sum - gStatusBar->getBalance());
}
@@ -120,7 +150,7 @@ void LLBuyCurrencyHTML::openCurrencyFloater( const std::string& message, S32 sum
{
// legacy version
LLFloaterBuyCurrency::buyCurrency( message, sum );
- };
+ }
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llbuycurrencyhtml.h b/indra/newview/llbuycurrencyhtml.h
index 54ee82159d..2f78199dcb 100644
--- a/indra/newview/llbuycurrencyhtml.h
+++ b/indra/newview/llbuycurrencyhtml.h
@@ -44,6 +44,11 @@ class LLBuyCurrencyHTML
// close (and destroy) the currency floater
static void closeDialog();
+
+ // probe BuyCurrencyPacksURL once at login; clears sWebFloaterEnabled if 501
+ static void checkFeatureFlag();
+
+ static bool sWebFloaterEnabled;
};
#endif // LL_LLBUYCURRENCYHTML_H
diff --git a/indra/newview/llfloaterbuycurrencyhtml.cpp b/indra/newview/llfloaterbuycurrencyhtml.cpp
index 488bd088c1..cd8e33a04b 100644
--- a/indra/newview/llfloaterbuycurrencyhtml.cpp
+++ b/indra/newview/llfloaterbuycurrencyhtml.cpp
@@ -60,25 +60,27 @@ bool LLFloaterBuyCurrencyHTML::postBuild()
return true;
}
-void LLFloaterBuyCurrencyHTML::navigateToFinalURL()
+// static
+std::string LLFloaterBuyCurrencyHTML::buildURL(S32 shortfall)
{
- std::string buy_currency_url = gSavedSettings.getString("BuyCurrencyPacksURL");
-
+ std::string url = gSavedSettings.getString("BuyCurrencyPacksURL");
LLStringUtil::format_map_t replace;
replace["[LANGUAGE]"] = LLUI::getLanguage();
- if (mShortfall > 0)
+ if (shortfall > 0)
{
- replace["[SHORTFALL]"] = std::to_string(mShortfall);
+ replace["[SHORTFALL]"] = std::to_string(shortfall);
}
-
- LLStringUtil::format(buy_currency_url, replace);
-
- if (mShortfall <= 0)
+ LLStringUtil::format(url, replace);
+ if (shortfall <= 0)
{
- LLStringUtil::replaceString(buy_currency_url, "&shortfall=[SHORTFALL]", "");
+ LLStringUtil::replaceString(url, "&shortfall=[SHORTFALL]", "");
}
+ return url;
+}
- mBrowser->navigateTo(buy_currency_url, HTTP_CONTENT_TEXT_HTML);
+void LLFloaterBuyCurrencyHTML::navigateToFinalURL()
+{
+ mBrowser->navigateTo(buildURL(mShortfall), HTTP_CONTENT_TEXT_HTML);
}
void LLFloaterBuyCurrencyHTML::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
diff --git a/indra/newview/llfloaterbuycurrencyhtml.h b/indra/newview/llfloaterbuycurrencyhtml.h
index 80e368e607..76c54c5f3b 100644
--- a/indra/newview/llfloaterbuycurrencyhtml.h
+++ b/indra/newview/llfloaterbuycurrencyhtml.h
@@ -44,6 +44,7 @@ public:
void navigateToFinalURL();
void setShortfall(S32 shortfall) { mShortfall = shortfall; }
+ static std::string buildURL(S32 shortfall = 0);
private:
LLMediaCtrl* mBrowser;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 3aa2c92590..0bc68b6717 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -207,6 +207,7 @@
#include "llsky.h"
#include "llstatview.h"
#include "llstatusbar.h" // sendMoneyBalanceRequest(), owns L$ balance
+#include "llbuycurrencyhtml.h"
#include "llsurface.h"
#include "lltexturecache.h"
#include "lltexturefetch.h"
@@ -1963,6 +1964,7 @@ bool idle_startup()
// Get L$ and ownership credit information
LL_INFOS() << "Requesting Money Balance" << LL_ENDL;
LLStatusBar::sendMoneyBalanceRequest();
+ LLBuyCurrencyHTML::checkFeatureFlag();
do_startup_frame();