Skip to content

Limit hub adverts to 2 per IP address#29

Open
VasilisThePikachu wants to merge 7 commits intospace-wizards:masterfrom
VasilisThePikachu:max-two-ads
Open

Limit hub adverts to 2 per IP address#29
VasilisThePikachu wants to merge 7 commits intospace-wizards:masterfrom
VasilisThePikachu:max-two-ads

Conversation

@VasilisThePikachu
Copy link
Copy Markdown
Member

@VasilisThePikachu VasilisThePikachu commented Sep 29, 2025

With support to whitelist servers in case they need it

@LaCumbiaDelCoronavirus
Copy link
Copy Markdown

shouldnt it be exempt, not except

@VasilisThePikachu
Copy link
Copy Markdown
Member Author

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exempt

.Where(s => s.Expires > DateTime.UtcNow)
.CountAsync();

var isServerRenewingAdvertisement = addressEntity != null && addressEntity.Expires > DateTime.UtcNow;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

public async Task<IActionResult> OnPostAddAddressAsync(int id)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

}

public async Task<IActionResult> OnPostDeleteAddressAsync(int address)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

}

public async Task<IActionResult> OnPostAddDomainAsync(int id)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

}

public async Task<IActionResult> OnPostDeleteDomainAsync(int domain)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants