more on GridInfo, and inventory

This commit is contained in:
UbitUmarov
2020-09-25 20:48:36 +01:00
parent 4319f451e6
commit b468ac3814
5 changed files with 25 additions and 20 deletions

View File

@@ -321,6 +321,16 @@ namespace OpenSim.Framework
}
}
public string HomeURLNoEndSlash
{
get
{
if (m_homeURL.URLType != UriHostNameType.Unknown)
return m_homeURL.URL.Substring(0, m_gateKeeperURL.URL.Length - 1);
return null;
}
}
// -2 dns failed
// -1 if bad url
// 0 if not local

View File

@@ -57,11 +57,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
get { return m_assMapper; }
}
private string m_HomeURI;
private bool m_OutboundPermission;
private string m_ThisGatekeeper;
private bool m_RestrictInventoryAccessAbroad;
private bool m_bypassPermissions = true;
// This simple check makes it possible to support grids in which all the simulators
@@ -99,13 +96,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
if (thisModuleConfig != null)
{
m_HomeURI = Util.GetConfigVarFromSections<string>(source, "HomeURI",
new string[] { "Startup", "Hypergrid", "HGInventoryAccessModule" }, String.Empty);
m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "HGInventoryAccessModule" }, String.Empty);
// Legacy. Renove soon!
m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", m_ThisGatekeeper);
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true);
m_CheckSeparateAssets = thisModuleConfig.GetBoolean("CheckSeparateAssets", false);
@@ -129,7 +119,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return;
base.AddRegion(scene);
m_assMapper = new HGAssetMapper(scene, m_HomeURI);
if(!m_thisGridInfo.HasHGConfig)
{
m_Enabled = false;
return;
}
m_assMapper = new HGAssetMapper(scene, m_thisGridInfo.HomeURLNoEndSlash);
scene.EventManager.OnNewInventoryItemUploadComplete += PostInventoryAsset;
scene.EventManager.OnTeleportStart += TeleportStart;
scene.EventManager.OnTeleportFail += TeleportFail;
@@ -237,13 +234,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
prefix = "HG ";
else
prefix = string.Empty;
suffix = " @ " + m_ThisGatekeeper;
suffix = " @ " + m_thisGridInfo.GateKeeperURLNoEndSlash;
Vector3 pos = presence.AbsolutePosition;
return String.Format(Culture.FormatProvider, "Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\ngatekeeper {5}\n",
presence.Scene.RegionInfo.RegionID,
pos.X, pos.Y, pos.Z,
presence.RegionHandle,
m_ThisGatekeeper);
m_thisGridInfo.GateKeeperURLNoEndSlash);
}

View File

@@ -58,6 +58,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
protected bool m_Enabled = false;
protected Scene m_Scene;
protected GridInfo m_thisGridInfo;
protected IUserManagement m_UserManagement;
protected IUserManagement UserManagementModule
{
@@ -125,6 +127,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return;
m_Scene = scene;
if (m_thisGridInfo == null)
m_thisGridInfo = scene.SceneGridInfo;
scene.RegisterModuleInterface<IInventoryAccessModule>(this);
scene.EventManager.OnNewClient += OnNewClient;
@@ -139,9 +143,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
if (!m_Enabled)
return;
m_thisGridInfo = null;
}
public virtual void RemoveRegion(Scene scene)
{
if (!m_Enabled)

View File

@@ -178,8 +178,6 @@
; Change this to your server
; accessible from other grids
;
HomeURI = "${Const|BaseURL}:${Const|PublicPort}"
Gatekeeper = "${Const|BaseURL}:${Const|PublicPort}"
;; If you want to protect your assets from being copied by foreign visitors
;; set this to false. You may want to do this on sims that have licensed content.
;; Default is true.

View File

@@ -351,10 +351,6 @@
; DisallowImport ="LSLBytecode"
[HGInventoryAccessModule]
;; If you have these set under [Hypergrid], no need to set it here, leave it commented
; HomeURI = "${Const|BaseURL}:${Const|PublicPort}"
; GatekeeperURI = "${Const|BaseURL}:${Const|PublicPort}"
;; If you want to protect your assets from being copied by foreign visitors
;; uncomment the next line. You may want to do this on sims that have licensed content.
;; true = allow exports, false = disallow exports. True by default.