From 94d29975de3ff4473010192dbd71545bd01545da Mon Sep 17 00:00:00 2001 From: Christopher Date: Wed, 3 Jun 2020 08:23:40 +0200 Subject: [PATCH] fake all script returns for HG home uri --- .../Shared/Api/Implementation/OSSL_Api.cs | 56 +++++++++++++------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8289dec2e7..2c48726977 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2563,6 +2563,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string nick = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; + string FakeGridNick = Util.GetConfigVarFromSections(config, "FakeGridNick", + new string[] { "Startup", "Hypergrid" }, String.Empty); + + if (!string.IsNullOrEmpty(FakeGridNick)) + return FakeGridNick; + if (config.Configs[GridInfoServiceConfigSectionName] != null) nick = config.Configs[GridInfoServiceConfigSectionName].GetString("gridnick", nick); @@ -2579,6 +2585,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string name = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; + string FakeGridName = Util.GetConfigVarFromSections(config, "FakeGridName", + new string[] { "Startup", "Hypergrid" }, String.Empty); + + if (!string.IsNullOrEmpty(FakeGridName)) + return FakeGridName; + if (config.Configs[GridInfoServiceConfigSectionName] != null) name = config.Configs[GridInfoServiceConfigSectionName].GetString("gridname", name); @@ -2592,9 +2604,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); - string loginURI = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; + string FakeHomeURI = Util.GetConfigVarFromSections(config, "FakeHomeURI", + new string[] { "Startup", "Hypergrid" }, String.Empty); + + if (!string.IsNullOrEmpty(FakeHomeURI)) + return FakeHomeURI; + + string loginURI = String.Empty; + if (config.Configs[GridInfoServiceConfigSectionName] != null) loginURI = config.Configs[GridInfoServiceConfigSectionName].GetString("login", loginURI); @@ -2609,6 +2628,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); IConfigSource config = m_ScriptEngine.ConfigSource; + + string FakeHomeURI = Util.GetConfigVarFromSections(config, "FakeHomeURI", + new string[] { "Startup", "Hypergrid" }, String.Empty); + + if (!string.IsNullOrEmpty(FakeHomeURI)) + return FakeHomeURI; + string HomeURI = Util.GetConfigVarFromSections(config, "HomeURI", new string[] { "Startup", "Hypergrid" }, String.Empty); @@ -2630,6 +2656,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); IConfigSource config = m_ScriptEngine.ConfigSource; + + string FakeHomeURI = Util.GetConfigVarFromSections(config, "FakeHomeURI", + new string[] { "Startup", "Hypergrid" }, String.Empty); + + if (!string.IsNullOrEmpty(FakeHomeURI)) + return FakeHomeURI; + string gatekeeperURI = Util.GetConfigVarFromSections(config, "GatekeeperURI", new string[] { "Startup", "Hypergrid" }, String.Empty); @@ -2666,26 +2699,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface(); string returnValue = ""; - if (userManager != null) + if(userManager.IsLocalGridUser(new UUID(uuid))) { - returnValue = userManager.GetUserServerURL(new UUID(uuid), "HomeURI"); + return osGetGridHomeURI(); } - - if (returnValue == "") + else { - IConfigSource config = m_ScriptEngine.ConfigSource; - returnValue = Util.GetConfigVarFromSections(config, "HomeURI", - new string[] { "Startup", "Hypergrid" }, String.Empty); - - if (!string.IsNullOrEmpty(returnValue)) - return returnValue; - - // Legacy. Remove soon! - if (config.Configs["LoginService"] != null) - returnValue = config.Configs["LoginService"].GetString("SRV_HomeURI", returnValue); - - if (String.IsNullOrEmpty(returnValue)) - returnValue = GridUserInfo(InfoType.Home); + returnValue = userManager.GetUserServerURL(new UUID(uuid), "HomeURI"); } return returnValue; -- 2.25.1.windows.1