FIRE-30562 [OPENSIM] Add GridStatus support

master
Beq 2022-05-25 02:52:37 +01:00
parent 8070513312
commit 06bde96503
6 changed files with 62 additions and 14 deletions

View File

@ -302,8 +302,6 @@
execute_function="OpenGridStatus"
is_running_function="Floater.IsOpen"
is_running_parameters="grid_status"
is_enabled_function="GridCheck"
is_enabled_parameters="secondlife"
/>
<!-- Firestorm command buttons -->

View File

@ -31,6 +31,7 @@
#include "llstatusbar.h"
#include "llfloaterbuycurrency.h"
// </COLOSI opensim multi-currency support>
#include "llfloatergridstatus.h"
LFSimFeatureHandler::LFSimFeatureHandler()
: mSupportsExport(false),
@ -104,6 +105,23 @@ void LFSimFeatureHandler::setSupportedFeatures()
mShoutRange = extras.has("shout-range") ? extras["shout-range"].asInteger() : 100;
mWhisperRange = extras.has("whisper-range") ? extras["whisper-range"].asInteger() : 10;
if( extras.has("GridStatusRSS"))
{
mGridStatusRSS = extras["GridStatusRSS"];
}
else
{
mGridStatusRSS = "";
}
if( extras.has("GridStatus"))
{
mGridStatusURL = extras["GridStatus"];
}
else
{
mGridStatusURL = "";
}
if(extras.has("GridURL"))
{
// If we have GridURL specified in the extras then we use this by default
@ -250,20 +268,24 @@ void LFSimFeatureHandler::setSupportedFeatures()
mSimulatorFPSCrit = 20.f;
LLWorld::getInstance()->refreshLimits();// reset prim scales etc.
bool in_sl{LLGridManager::instance().isInSecondLife()};
mGridStatusRSS = (in_sl)? gSavedSettings.getString("GridStatusRSS"):"";
mGridStatusURL = (in_sl)? DEFAULT_GRID_STATUS_URL:"";
if (LLLoginInstance::getInstance()->hasResponse("search"))
{
mSearchURL = LLLoginInstance::getInstance()->getResponse("search").asString();
}
else
{
mSearchURL = LLGridManager::getInstance()->isInSecondLife() ? gSavedSettings.getString("SearchURL") : gSavedSettings.getString("SearchURLOpenSim");
mSearchURL = in_sl ? gSavedSettings.getString("SearchURL") : gSavedSettings.getString("SearchURLOpenSim");
}
if (LLLoginInstance::getInstance()->hasResponse("destination_guide_url"))
{
mDestinationGuideURL = LLLoginInstance::getInstance()->getResponse("destination_guide_url").asString();
}
else if (LLGridManager::instance().isInSecondLife())
else if (in_sl)
{
mDestinationGuideURL = gSavedSettings.getString("DestinationGuideURL");
}
@ -276,7 +298,7 @@ void LFSimFeatureHandler::setSupportedFeatures()
{
mAvatarPickerURL = LLLoginInstance::getInstance()->getResponse("avatar-picker-url").asString();
}
else if (LLGridManager::instance().isInSecondLife())
else if (in_sl)
{
mAvatarPickerURL = gSavedSettings.getString("AvatarPickerURL");
}

View File

@ -88,6 +88,8 @@ public:
// Accessors
bool simSupportsExport() const { return mSupportsExport; }
std::string mapServerURL() const { return mMapServerURL; }
std::string gridStatusURL() const { return mGridStatusURL; }
std::string gridStatusRSS() const { return mGridStatusRSS; }
std::string hyperGridURL() const { return mHyperGridPrefix; }
std::string searchURL() const { return mSearchURL; }
U32 sayRange() const { return mSayRange; }
@ -114,6 +116,8 @@ private:
// SignaledTypes
SignaledType<bool> mSupportsExport;
std::string mMapServerURL;
std::string mGridStatusURL;
std::string mGridStatusRSS;
std::string mHyperGridPrefix;
SignaledType<std::string> mSearchURL;
SignaledType<U32> mSayRange;

View File

@ -37,6 +37,10 @@
#include "lltoolbarview.h"
#include "llviewercontrol.h"
#include "llxmltree.h"
// <FS:Beq> FIRE-30562 [OPENSIM] Grid Status support
#include "llviewernetwork.h" // for LLGridManager
#include "lfsimfeaturehandler.h" // for Opensim feature support
// </FS:Beq>
std::map<std::string, std::string> LLFloaterGridStatus::sItemsMap;
// <FS:Ansariel> FIRE-21236 - Help Menu - Check Grid Status doesn't open using External Browser
@ -69,7 +73,10 @@ void LLFloaterGridStatus::onOpen(const LLSD& key)
applyPreferredRect();
if (mWebBrowser)
{
mWebBrowser->navigateTo(DEFAULT_GRID_STATUS_URL, HTTP_CONTENT_TEXT_HTML);
// <FS:Beq> [FIRE-30562] Support Grid Status on OpenSim
// mWebBrowser->navigateTo(DEFAULT_GRID_STATUS_URL, HTTP_CONTENT_TEXT_HTML);
mWebBrowser->navigateTo(LFSimFeatureHandler::instance().gridStatusURL(), HTTP_CONTENT_TEXT_HTML);
// </FS:Beq>
}
}
@ -101,7 +108,15 @@ void LLFloaterGridStatus::getGridStatusRSSCoro()
httpOpts->setSSLVerifyPeer(false); // We want this data even if SSL fails
httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_TEXT_XML);
std::string url = gSavedSettings.getString("GridStatusRSS");
// <FS:Beq> FIRE-30562 [OpenSim] Grid Status
// std::string url = gSavedSettings.getString("GridStatusRSS");
std::string url = LFSimFeatureHandler::instance().gridStatusRSS();
if( url.empty() )
{
return; // if OpenSim has not defined this or user has set this to undefined, then do nothing.
}
// </FS:Beq>
LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts, httpHeaders);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
@ -113,8 +128,20 @@ void LLFloaterGridStatus::getGridStatusRSSCoro()
const LLSD::Binary &rawBody = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary();
std::string body(rawBody.begin(), rawBody.end());
std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"grid_status_rss.xml");
// <FS:Beq> FIRE-30562 [OpenSim] Grid Status
// std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"grid_status_rss.xml");
std::string fullpath {};
const auto gridMgr{LLGridManager::getInstance()};
if(gridMgr->isInSecondLife())
{
fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"grid_status_rss.xml");
}
else
{
const auto& grid_status_file = LLDir::getScrubbedFileName( gridMgr->getGrid() + "_grid_status_rss.xml" );
fullpath = gDirUtilp->getExpandedFilename( LL_PATH_LOGS, grid_status_file);
}
// </FS:Beq>
if(!gSavedSettings.getBOOL("TestGridStatusRSSFromFile"))
{
llofstream custom_file_out(fullpath.c_str(), std::ios::trunc);

View File

@ -10229,9 +10229,9 @@ bool isGridFeatureEnabled(const LLSD& userdata)
// <FS:Ansariel> FIRE-21236 - Help Menu - Check Grid Status doesn't open using External Browser
void openGridStatus()
{
if (LLWeb::useExternalBrowser(DEFAULT_GRID_STATUS_URL))
if (LLWeb::useExternalBrowser(LFSimFeatureHandler::instance().gridStatusURL()))
{
LLWeb::loadURLExternal(DEFAULT_GRID_STATUS_URL);
LLWeb::loadURLExternal(LFSimFeatureHandler::instance().gridStatusURL());
}
else
{

View File

@ -2499,9 +2499,6 @@
<menu_item_check.on_check
function="Floater.Visible"
parameter="grid_status" />
<menu_item_check.on_visible
function="GridCheck"
parameter="secondlife"/>
</menu_item_check>
<menu_item_call
label="Report Abuse"