finish alias fixes
add manual webfront bind url
This commit is contained in:
parent
9494a17997
commit
cf5ee8765d
@ -16,6 +16,8 @@ namespace SharedLibraryCore.Configuration
|
|||||||
public string SocialLinkAddress { get; set; }
|
public string SocialLinkAddress { get; set; }
|
||||||
public string SocialLinkTitle { get; set; }
|
public string SocialLinkTitle { get; set; }
|
||||||
public string WebfrontBindUrl { get; set; }
|
public string WebfrontBindUrl { get; set; }
|
||||||
|
public string ManualWebfrontUrl { get; set; }
|
||||||
|
public string WebfrontUrl => string.IsNullOrEmpty(ManualWebfrontUrl) ? WebfrontBindUrl.Replace("0.0.0.0", "127.0.0.1") : ManualWebfrontUrl;
|
||||||
public string CustomParserEncoding { get; set; }
|
public string CustomParserEncoding { get; set; }
|
||||||
public string CustomLocale { get; set; }
|
public string CustomLocale { get; set; }
|
||||||
public string DatabaseProvider { get; set; } = "sqlite";
|
public string DatabaseProvider { get; set; } = "sqlite";
|
||||||
|
@ -435,7 +435,7 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
// reserved slots stuff
|
// reserved slots stuff
|
||||||
// todo: is this broken on T6?
|
// todo: is this broken on T6?
|
||||||
if (CurrentServer.MaxClients - (CurrentServer.GetClientsAsList().Count(_client => !_client.IsPrivileged())) < CurrentServer.ServerConfig.ReservedSlotNumber &&
|
if (CurrentServer.MaxClients - (CurrentServer.GetClientsAsList().Count(_client => !_client.IsPrivileged())) < CurrentServer.ServerConfig.ReservedSlotNumber &&
|
||||||
!this.IsPrivileged())
|
!this.IsPrivileged() && CurrentServer.GameName != Server.Game.T6M /* HACK: temporary */)
|
||||||
{
|
{
|
||||||
CurrentServer.Logger.WriteDebug($"Kicking {this} their spot is reserved");
|
CurrentServer.Logger.WriteDebug($"Kicking {this} their spot is reserved");
|
||||||
Kick(loc["SERVER_KICK_SLOT_IS_RESERVED"], Utilities.IW4MAdminClient(CurrentServer));
|
Kick(loc["SERVER_KICK_SLOT_IS_RESERVED"], Utilities.IW4MAdminClient(CurrentServer));
|
||||||
@ -490,6 +490,7 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
AutomatedOffense = ban.AutomatedOffense
|
AutomatedOffense = ban.AutomatedOffense
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a reban of the new GUID and IP
|
// this is a reban of the new GUID and IP
|
||||||
Ban($"{ban.Offense}", autoKickClient, false);
|
Ban($"{ban.Offense}", autoKickClient, false);
|
||||||
return false;
|
return false;
|
||||||
|
@ -94,45 +94,55 @@ namespace SharedLibraryCore.Services
|
|||||||
// the existing alias matches ip and name, so we can just ignore the temporary one
|
// the existing alias matches ip and name, so we can just ignore the temporary one
|
||||||
if (exactAliasMatch)
|
if (exactAliasMatch)
|
||||||
{
|
{
|
||||||
|
entity.CurrentServer.Logger.WriteDebug($"{entity} has exact alias match");
|
||||||
// they're using the same alias as before, so we need to make sure the current aliases is set to it
|
// they're using the same alias as before, so we need to make sure the current aliases is set to it
|
||||||
if (entity.CurrentAliasId != existingAlias.AliasId)
|
if (entity.CurrentAliasId != existingAlias.AliasId)
|
||||||
{
|
{
|
||||||
context.Update(entity);
|
context.Update(entity);
|
||||||
|
|
||||||
entity.CurrentAlias = existingAlias;
|
entity.CurrentAlias = existingAlias;
|
||||||
entity.CurrentAliasId = existingAlias.AliasId;
|
if (existingAlias.AliasId > 0)
|
||||||
|
{
|
||||||
|
entity.CurrentAliasId = existingAlias.AliasId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entity.CurrentServer.Logger.WriteDebug($"Updating alias for {entity} failed");
|
||||||
|
}
|
||||||
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// theres no exact match, but they've played before with the GUID or IP
|
// theres no exact match, but they've played before with the GUID or IP
|
||||||
else if (hasExistingAlias)
|
else if (hasExistingAlias)
|
||||||
{
|
{
|
||||||
|
context.Update(entity);
|
||||||
|
entity.AliasLink = aliasLink;
|
||||||
|
entity.AliasLinkId = aliasLink.AliasLinkId;
|
||||||
|
|
||||||
// the current link is temporary so we need to update
|
// the current link is temporary so we need to update
|
||||||
if (!entity.AliasLink.Active)
|
if (!entity.AliasLink.Active)
|
||||||
{
|
{
|
||||||
|
entity.CurrentServer.Logger.WriteDebug($"{entity} has temporary alias so we are deleting");
|
||||||
|
|
||||||
// we want to delete the temporary alias link
|
// we want to delete the temporary alias link
|
||||||
context.Entry(entity.AliasLink).State = EntityState.Deleted;
|
context.Entry(entity.AliasLink).State = EntityState.Deleted;
|
||||||
context.Update(entity);
|
entity.AliasLink = null;
|
||||||
|
|
||||||
entity.AliasLink = aliasLink;
|
|
||||||
entity.AliasLinkId = aliasLink.AliasLinkId;
|
|
||||||
|
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// they have an existing link
|
|
||||||
context.Update(entity);
|
|
||||||
entity.CurrentServer.Logger.WriteDebug($"Connecting player is using a new alias {entity}");
|
entity.CurrentServer.Logger.WriteDebug($"Connecting player is using a new alias {entity}");
|
||||||
entity.CurrentAlias = new EFAlias()
|
|
||||||
|
var newAlias = new EFAlias()
|
||||||
{
|
{
|
||||||
DateAdded = DateTime.UtcNow,
|
DateAdded = DateTime.UtcNow,
|
||||||
IPAddress = ip,
|
IPAddress = ip,
|
||||||
Link = aliasLink,
|
Link = aliasLink,
|
||||||
LinkId = aliasLink.AliasLinkId,
|
|
||||||
Name = name
|
Name = name
|
||||||
};
|
};
|
||||||
context.Aliases.Add(entity.CurrentAlias);
|
|
||||||
entity.AliasLink.Children.Add(entity.CurrentAlias);
|
context.Aliases.Add(newAlias);
|
||||||
|
entity.CurrentAlias = newAlias;
|
||||||
|
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
@ -140,19 +150,21 @@ namespace SharedLibraryCore.Services
|
|||||||
// no record of them playing
|
// no record of them playing
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
context.Update(entity);
|
entity.CurrentServer.Logger.WriteDebug($"{entity} has not be seen before");
|
||||||
context.Update(entity.AliasLink);
|
var newAlias = new EFAlias()
|
||||||
entity.CurrentAlias = new EFAlias()
|
|
||||||
{
|
{
|
||||||
DateAdded = DateTime.UtcNow,
|
DateAdded = DateTime.UtcNow,
|
||||||
IPAddress = ip,
|
IPAddress = ip,
|
||||||
Link = aliasLink,
|
Link = entity.AliasLink,
|
||||||
Name = name
|
Name = name
|
||||||
};
|
};
|
||||||
|
|
||||||
|
context.Update(entity);
|
||||||
|
context.Update(entity.AliasLink);
|
||||||
|
|
||||||
entity.AliasLink.Active = true;
|
entity.AliasLink.Active = true;
|
||||||
context.Aliases.Add(entity.CurrentAlias);
|
context.Aliases.Add(newAlias);
|
||||||
entity.AliasLink.Children.Add(entity.CurrentAlias);
|
entity.CurrentAlias = newAlias;
|
||||||
|
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user