1
0
Fork 0
4Creative-Changes/Patch/0001-fake-all-script-return...

120 lines
5.2 KiB
Diff
Raw Normal View History

2020-06-03 15:23:31 +00:00
From 94d29975de3ff4473010192dbd71545bd01545da Mon Sep 17 00:00:00 2001
From: Christopher <git@clatza.dev>
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<string>(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<string>(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<string>(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<string>(config, "FakeHomeURI",
+ new string[] { "Startup", "Hypergrid" }, String.Empty);
+
+ if (!string.IsNullOrEmpty(FakeHomeURI))
+ return FakeHomeURI;
+
string HomeURI = Util.GetConfigVarFromSections<string>(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<string>(config, "FakeHomeURI",
+ new string[] { "Startup", "Hypergrid" }, String.Empty);
+
+ if (!string.IsNullOrEmpty(FakeHomeURI))
+ return FakeHomeURI;
+
string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
new string[] { "Startup", "Hypergrid" }, String.Empty);
@@ -2666,26 +2699,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>();
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<string>(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