Limit hub adverts to 2 per IP address#29
Limit hub adverts to 2 per IP address#29VasilisThePikachu wants to merge 7 commits intospace-wizards:masterfrom
Conversation
|
shouldnt it be exempt, not except |
ya did not see anything |
Co-authored-by: deathride58 <deathride58@users.noreply.github.com>
| public bool IsBanned { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// This community is except from only advertising a limited amount of servers from one IP address |
| .Where(s => s.Expires > DateTime.UtcNow) | ||
| .CountAsync(); | ||
|
|
||
| var isServerRenewingAdvertisement = addressEntity != null && addressEntity.Expires > DateTime.UtcNow; |
There was a problem hiding this comment.
This check is a bit confusing. Wouldn't this mean that if an IP is already advertising the maximum amount of servers and it advertises the same server again (which would make sense right. You don't really want to refresh an entry after it expired afaik) that it gets blocked from doing so?
There was a problem hiding this comment.
From my testing no, this makes sure to enforce the fact that servers already on the hub get to advertise and that 2 servers don't fight for the spot.
And I agree it is confusing I have no idea how it works. But it does
| return Page(); | ||
| } | ||
|
|
||
| public async Task<IActionResult> OnPostSaveAsync(int id) |
There was a problem hiding this comment.
I know you didn't touch this line but this needs the ValidateAntiForgeryToken attribute.
https://learn.microsoft.com/en-us/aspnet/core/security/anti-request-forgery?view=aspnetcore-10.0#antiforgery-in-aspnet-core
https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.validateantiforgerytokenattribute?view=aspnetcore-10.0

| } | ||
|
|
||
| public async Task<IActionResult> OnPostAddAddressAsync(int id) |
| } | ||
|
|
||
| public async Task<IActionResult> OnPostDeleteAddressAsync(int address) |
| } | ||
|
|
||
| public async Task<IActionResult> OnPostAddDomainAsync(int id) |
| } | ||
|
|
||
| public async Task<IActionResult> OnPostDeleteDomainAsync(int domain) |
With support to whitelist servers in case they need it