mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
Merge branch 'december-2020-12-18' of https://github.com/DorkSquadRR/DorkNet into december-2020-12-18
This commit is contained in:
@@ -201,12 +201,12 @@ public class AccountApiController(
|
||||
|
||||
[HttpPost("api/account/v1/profileimage")]
|
||||
[HttpPost("api/account/me/profileimage")]
|
||||
[HttpPost("account/me/profileimage")]
|
||||
[HttpPost("profileimage")]
|
||||
[HttpPost("account/me/profileimage", Order = 10)]
|
||||
[HttpPost("profileimage", Order = 10)]
|
||||
[HttpPut("api/account/v1/profileimage")]
|
||||
[HttpPut("api/account/me/profileimage")]
|
||||
[HttpPut("account/me/profileimage")]
|
||||
[HttpPut("profileimage")]
|
||||
[HttpPut("account/me/profileimage", Order = 10)]
|
||||
[HttpPut("profileimage", Order = 10)]
|
||||
[Consumes("application/x-www-form-urlencoded", "multipart/form-data", "application/json")]
|
||||
public async Task<IActionResult> SetProfileImage(
|
||||
[FromForm(Name = "imageName")] string? imageName,
|
||||
|
||||
@@ -41,9 +41,9 @@ public class PageviewController(ILogger<PageviewController> logger) : Controller
|
||||
/// intentionally return an empty url + a 1-hour freshness — the
|
||||
/// private server has no in-app deep-link system, so there's
|
||||
/// nothing to navigate to and no reason to be polled more often.</summary>
|
||||
[HttpPost("pageview/consume")]
|
||||
[HttpPost("pageview/consume", Order = 10)]
|
||||
[HttpPost("/pageview/consume")]
|
||||
[HttpGet("pageview/consume")]
|
||||
[HttpGet("pageview/consume", Order = 10)]
|
||||
[HttpGet("/pageview/consume")]
|
||||
public IActionResult Consume()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ public class AuthAccountController(DorkNetDbContext db) : ControllerBase
|
||||
/// <c>ExpectPrimitiveResponse<bool></c> so the body must be
|
||||
/// the literal JSON <c>true</c> or <c>false</c>.</summary>
|
||||
[HttpGet("/account/me/haspassword")]
|
||||
[HttpGet("/api/platformlogin/haspassword")]
|
||||
[HttpGet("/api/platformlogin/haspassword", Order = 10)]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> HasPassword()
|
||||
{
|
||||
@@ -40,8 +40,8 @@ public class AuthAccountController(DorkNetDbContext db) : ControllerBase
|
||||
/// one; first-time creation skips that check. Form-encoded body.</summary>
|
||||
[HttpPost("/account/me/changepassword")]
|
||||
[HttpPost("/account/me/createpassword")]
|
||||
[HttpPost("/api/platformlogin/password")]
|
||||
[HttpPut("/api/platformlogin/password")]
|
||||
[HttpPost("/api/platformlogin/password", Order = 10)]
|
||||
[HttpPut("/api/platformlogin/password", Order = 10)]
|
||||
[Consumes("application/x-www-form-urlencoded", "multipart/form-data")]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> ChangePassword(
|
||||
@@ -76,7 +76,7 @@ public class AuthAccountController(DorkNetDbContext db) : ControllerBase
|
||||
/// account from the admin tab and the user re-creates it via
|
||||
/// changepassword on next login. Anonymous calls 401.</summary>
|
||||
[HttpPost("/account/me/resetpassword")]
|
||||
[HttpPost("/api/platformlogin/resetpassword")]
|
||||
[HttpPost("/api/platformlogin/resetpassword", Order = 10)]
|
||||
[Authorize]
|
||||
[AdminOnly]
|
||||
public async Task<IActionResult> AdminResetPassword(
|
||||
|
||||
@@ -46,6 +46,12 @@ public class VersionCheckController(
|
||||
private const int VersionStatus_ValidForMenu = 1;
|
||||
private const int VersionStatus_UpdateRequired = 2;
|
||||
|
||||
private static readonly IReadOnlyDictionary<string, string> BuiltInBuildIdToVersionKey =
|
||||
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["20201210"] = "december_2020_12_18",
|
||||
};
|
||||
|
||||
[HttpGet("/api/versioncheck/v4")]
|
||||
[HttpGet("/api/versioncheck/v3")]
|
||||
[HttpGet("/api/versioncheck/v2")]
|
||||
@@ -66,9 +72,17 @@ public class VersionCheckController(
|
||||
// }
|
||||
// Mapping ABSENT → unknown build → UpdateRequired.
|
||||
var mapSection = config.GetSection("DorkNet:BuildIdToVersionKey");
|
||||
string? versionKey = !string.IsNullOrWhiteSpace(buildId)
|
||||
? mapSection[buildId]
|
||||
: null;
|
||||
string? versionKey = null;
|
||||
if (!string.IsNullOrWhiteSpace(buildId))
|
||||
{
|
||||
var normalizedBuildId = buildId.Trim();
|
||||
versionKey = mapSection[normalizedBuildId];
|
||||
if (string.IsNullOrWhiteSpace(versionKey)
|
||||
&& BuiltInBuildIdToVersionKey.TryGetValue(normalizedBuildId, out var builtInVersionKey))
|
||||
{
|
||||
versionKey = builtInVersionKey;
|
||||
}
|
||||
}
|
||||
|
||||
bool allowed = versionKey is not null && registry.IsSupported(versionKey);
|
||||
var status = allowed ? VersionStatus_ValidForPlay : VersionStatus_UpdateRequired;
|
||||
|
||||
@@ -668,11 +668,14 @@ public class ClubsController(ClubService clubs) : ControllerBase
|
||||
[HttpPost("/members/bulk")]
|
||||
public async Task<IActionResult> MembersBulk()
|
||||
{
|
||||
var form = Request.HasFormContentType ? Request.Form : null;
|
||||
if (!long.TryParse(Request.Query["clubId"].ToString(), out var clubId)
|
||||
&& !long.TryParse(Request.Form["clubId"].ToString(), out clubId))
|
||||
&& (form is null || !long.TryParse(form["clubId"].ToString(), out clubId)))
|
||||
return BadRequest(new { error = "missing_club_id" });
|
||||
|
||||
var idsRaw = Request.Query["playerIds"].Concat(Request.Form["playerIds"]);
|
||||
var idsRaw = form is null
|
||||
? Request.Query["playerIds"].AsEnumerable()
|
||||
: Request.Query["playerIds"].Concat(form["playerIds"]);
|
||||
var ids = idsRaw
|
||||
.SelectMany(v => (v ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
|
||||
.Select(s => long.TryParse(s, out var n) ? n : 0)
|
||||
|
||||
@@ -220,9 +220,12 @@ public class MatchPlayerController(
|
||||
var playerId = TryGetCurrentPlayerId();
|
||||
if (playerId == 0) return Ok();
|
||||
|
||||
var form = Request.Form;
|
||||
var regions = form["region"].ToArray();
|
||||
var pings = form["ping"].ToArray();
|
||||
var regions = Request.HasFormContentType
|
||||
? Request.Form["region"].ToArray()
|
||||
: Request.Query["region"].ToArray();
|
||||
var pings = Request.HasFormContentType
|
||||
? Request.Form["ping"].ToArray()
|
||||
: Request.Query["ping"].ToArray();
|
||||
var pairs = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||
for (var i = 0; i < Math.Min(regions.Length, pings.Length); i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user