1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 01:37:31 +08:00

Merge pull request #18978 from peppy/send-beatmap-hash-to-server

Send beatmap hash to server on solo score request
This commit is contained in:
Dan Balasescu 2022-07-03 13:18:17 +09:00 committed by GitHub
commit 1ccfd69690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -6,6 +6,7 @@
using System.Globalization;
using System.Net.Http;
using osu.Framework.IO.Network;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.Rooms;
@ -13,13 +14,13 @@ namespace osu.Game.Online.Solo
{
public class CreateSoloScoreRequest : APIRequest<APIScoreToken>
{
private readonly int beatmapId;
private readonly BeatmapInfo beatmapInfo;
private readonly int rulesetId;
private readonly string versionHash;
public CreateSoloScoreRequest(int beatmapId, int rulesetId, string versionHash)
public CreateSoloScoreRequest(BeatmapInfo beatmapInfo, int rulesetId, string versionHash)
{
this.beatmapId = beatmapId;
this.beatmapInfo = beatmapInfo;
this.rulesetId = rulesetId;
this.versionHash = versionHash;
}
@ -29,10 +30,11 @@ namespace osu.Game.Online.Solo
var req = base.CreateWebRequest();
req.Method = HttpMethod.Post;
req.AddParameter("version_hash", versionHash);
req.AddParameter("beatmap_hash", beatmapInfo.MD5Hash);
req.AddParameter("ruleset_id", rulesetId.ToString(CultureInfo.InvariantCulture));
return req;
}
protected override string Target => $@"beatmaps/{beatmapId}/solo/scores";
protected override string Target => $@"beatmaps/{beatmapInfo.OnlineID}/solo/scores";
}
}

View File

@ -37,7 +37,7 @@ namespace osu.Game.Screens.Play
if (!Ruleset.Value.IsLegacyRuleset())
return null;
return new CreateSoloScoreRequest(beatmapId, rulesetId, Game.VersionHash);
return new CreateSoloScoreRequest(Beatmap.Value.BeatmapInfo, rulesetId, Game.VersionHash);
}
protected override bool HandleTokenRetrievalFailure(Exception exception) => false;