示例#1
0
        public async Task <ActionResult <string> > Post(string patchId)
        {
            var creatorIp = HttpContext.Connection.RemoteIpAddress.ToString();

            if (CreatorManager.UserHasHitCreateCap(_context, _cache, creatorIp))
            {
                return(StatusCode(403));
            }
            if (PatchManager.PatchExists(_context, patchId))
            {
                return(Conflict());
            }

            await PatchManager.ClearOutOldReservedPatches(_context, _cache);

            return(await PatchManager.ReservePatch(_context, creatorIp, patchId));
        }
示例#2
0
        public async Task <ActionResult <string> > Patch(PatchPatchRequestDto requestDto) // lol
        {
            var creatorIp = HttpContext.Connection.RemoteIpAddress.ToString();

            if (!PatchManager.PatchExists(_context, requestDto.PatchId))
            {
                return(NotFound());
            }
            if (CreatorManager.UserHasHitCreateCap(_context, _cache, creatorIp))
            {
                return(StatusCode(403));
            }
            if (!PatchManager.PatchMatchesCreator(_context, _cache, requestDto.PatchId, creatorIp))
            {
                return(StatusCode(403));
            }

            await PatchManager.ClearOutOldReservedPatches(_context, _cache);

            return(await PatchManager.CompletePatch(_context, _cache, requestDto.PatchId, requestDto.ImageMini, requestDto.Image));
        }