mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-06 03:48:40 +00:00
Check if there are no free slots *after* handling republished levels
Closes #179
This commit is contained in:
parent
40ce3edba7
commit
3e3d6b74aa
1 changed files with 9 additions and 8 deletions
|
@ -41,11 +41,6 @@ public class PublishController : ControllerBase
|
|||
User user = userAndToken.Value.Item1;
|
||||
GameToken gameToken = userAndToken.Value.Item2;
|
||||
|
||||
if (user.GetUsedSlotsForGame(gameToken.GameVersion, database) > 50)
|
||||
{
|
||||
return this.StatusCode(403, "");
|
||||
}
|
||||
|
||||
Slot? slot = await this.getSlotFromBody();
|
||||
if (slot == null) return this.BadRequest(); // if the level cant be parsed then it obviously cant be uploaded
|
||||
|
||||
|
@ -60,6 +55,10 @@ public class PublishController : ControllerBase
|
|||
if (oldSlot == null) return this.NotFound();
|
||||
if (oldSlot.CreatorId != user.UserId) return this.BadRequest();
|
||||
}
|
||||
else if (user.GetUsedSlotsForGame(gameToken.GameVersion, database) > ServerSettings.Instance.EntitledSlots)
|
||||
{
|
||||
return this.StatusCode(403, "");
|
||||
}
|
||||
|
||||
slot.ResourceCollection += "," + slot.IconHash; // tells LBP to upload icon after we process resources here
|
||||
|
||||
|
@ -84,9 +83,6 @@ public class PublishController : ControllerBase
|
|||
// ReSharper disable once PossibleInvalidOperationException
|
||||
User user = userAndToken.Value.Item1;
|
||||
GameToken gameToken = userAndToken.Value.Item2;
|
||||
|
||||
if (user.UsedSlots >= ServerSettings.Instance.EntitledSlots) return this.BadRequest();
|
||||
|
||||
Slot? slot = await this.getSlotFromBody();
|
||||
if (slot?.Location == null) return this.BadRequest();
|
||||
|
||||
|
@ -141,6 +137,11 @@ public class PublishController : ControllerBase
|
|||
return this.Ok(oldSlot.Serialize(gameToken.GameVersion));
|
||||
}
|
||||
|
||||
if (user.GetUsedSlotsForGame(gameToken.GameVersion, database) > ServerSettings.Instance.EntitledSlots)
|
||||
{
|
||||
return this.StatusCode(403, "");
|
||||
}
|
||||
|
||||
//TODO: parse location in body
|
||||
Location l = new()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue