Exemple #1
0
        public async Task <IActionResult> GetReplay(
            [FromQuery(Name = "c")] int replayId,
            [FromQuery(Name = "m")] PlayMode mode,
            [FromQuery(Name = "u")] string userName,
            [FromQuery(Name = "h")] string pass,
            [FromServices] SoraDbContext ctx
            )
        {
            var user = await DbUser.GetDbUser(ctx, userName);

            if (user == null)
            {
                return(Ok("err: pass"));
            }

            if (!user.IsPassword(pass))
            {
                return(Ok("err: pass"));
            }

            var s = await DbScore.GetScore(ctx, replayId);

            if (s == null)
            {
                return(NotFound());
            }

            return(File(System.IO.File.OpenRead("data/replays/" + s.ReplayMd5), "binary/octet-stream", s.ReplayMd5));
        }
Exemple #2
0
        public async Task<IActionResult> GetReplay(
            [FromQuery(Name = "c")] int replayId,
            [FromQuery(Name = "m")] PlayMode mode,
            [FromQuery(Name = "u")] string userName,
            [FromQuery(Name = "h")] string pass
        )
        {
            var user = await DbUser.GetDbUser(_ctx, userName);
            if (user == null)
                return Ok("err: pass");

            if (!user.IsPassword(pass))
                return Ok("err: pass");

            var s = await DbScore.GetScore(_ctx, replayId);
            if (s == null)
                return NotFound();

            return File(System.IO.File.OpenRead("data/replays/" + s.ReplayMd5), "binary/octet-stream", s.ReplayMd5);
        }