Do not present the main Mare server as an option
This commit is contained in:
@@ -11,7 +11,6 @@ public class ServerConfig : IMareConfiguration
|
|||||||
public List<ServerStorage> ServerStorage { get; set; } = new()
|
public List<ServerStorage> ServerStorage { get; set; } = new()
|
||||||
{
|
{
|
||||||
{ new ServerStorage() { ServerName = ApiController.LoporritServer, ServerUri = ApiController.LoporritServiceUri } },
|
{ new ServerStorage() { ServerName = ApiController.LoporritServer, ServerUri = ApiController.LoporritServiceUri } },
|
||||||
{ new ServerStorage() { ServerName = ApiController.MainServer, ServerUri = ApiController.MainServiceUri } },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public int Version { get; set; } = 1;
|
public int Version { get; set; } = 1;
|
||||||
|
|||||||
@@ -339,18 +339,28 @@ public class ServerConfigurationManager
|
|||||||
private void EnsureMainExists()
|
private void EnsureMainExists()
|
||||||
{
|
{
|
||||||
bool lopExists = false;
|
bool lopExists = false;
|
||||||
bool mainExists = false;
|
int mainIdx = -1;
|
||||||
_configService.Current.ServerStorage.ForEach((x) => {
|
for (int i = 0; i < _configService.Current.ServerStorage.Count; ++i)
|
||||||
_logger.LogDebug(" server uri = {x.ServerUri}");
|
{
|
||||||
|
var x = _configService.Current.ServerStorage[i];
|
||||||
if (x.ServerUri.Equals(ApiController.LoporritServiceUri, StringComparison.OrdinalIgnoreCase))
|
if (x.ServerUri.Equals(ApiController.LoporritServiceUri, StringComparison.OrdinalIgnoreCase))
|
||||||
lopExists = true;
|
lopExists = true;
|
||||||
else if (x.ServerUri.Equals(ApiController.MainServiceUri, StringComparison.OrdinalIgnoreCase))
|
if (x.ServerUri.Equals(ApiController.MainServiceUri, StringComparison.OrdinalIgnoreCase))
|
||||||
mainExists = true;
|
mainIdx = i;
|
||||||
});
|
}
|
||||||
|
if (mainIdx >= 0)
|
||||||
|
{
|
||||||
|
_logger.LogDebug("Removing main server {ApiController.MainServiceUri}");
|
||||||
|
_configService.Current.ServerStorage.RemoveAt(mainIdx);
|
||||||
|
if (_configService.Current.CurrentServer >= mainIdx)
|
||||||
|
_configService.Current.CurrentServer--;
|
||||||
|
}
|
||||||
if (!lopExists)
|
if (!lopExists)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Re-adding missing server {ApiController.LoporritServiceUri}");
|
_logger.LogDebug("Re-adding missing server {ApiController.LoporritServiceUri}");
|
||||||
_configService.Current.ServerStorage.Insert(0, new ServerStorage() { ServerUri = ApiController.LoporritServiceUri, ServerName = ApiController.LoporritServer });
|
_configService.Current.ServerStorage.Insert(0, new ServerStorage() { ServerUri = ApiController.LoporritServiceUri, ServerName = ApiController.LoporritServer });
|
||||||
|
if (_configService.Current.CurrentServer >= 0)
|
||||||
|
_configService.Current.CurrentServer++;
|
||||||
}
|
}
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user