Fix publishing, default to LBP1 on connect, fix LBP1 not connecting

This commit is contained in:
jvyden 2021-11-04 15:30:58 -04:00
parent 582d2e2de0
commit fd6367feca
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
5 changed files with 12 additions and 6 deletions

View file

@ -89,6 +89,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=brun/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ezoiar/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=farc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=friendscores/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kettu/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lbpme/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=LBPU/@EntryIndexedValue">True</s:Boolean>

View file

@ -22,8 +22,10 @@ namespace LBPUnion.ProjectLighthouse.Controllers
}
[HttpPost]
public async Task<IActionResult> Login([FromQuery] string titleId)
public async Task<IActionResult> Login([FromQuery] string? titleId)
{
titleId ??= "";
string body = await new StreamReader(this.Request.Body).ReadToEndAsync();
LoginData? loginData;

View file

@ -60,7 +60,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
// User user = await this.database.UserFromRequest(this.Request);
(User, Token)? userAndToken = await this.database.UserAndTokenFromRequest(this.Request);
if (userAndToken != null) return this.StatusCode(403, "");
if (userAndToken == null) return this.StatusCode(403, "");
// ReSharper disable once PossibleInvalidOperationException
User user = userAndToken.Value.Item1;

View file

@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@ -30,7 +31,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
string bodyString = await new StreamReader(this.Request.Body).ReadToEndAsync();
XmlSerializer serializer = new(typeof(Score));
Score score = (Score)serializer.Deserialize(new StringReader(bodyString));
Score? score = (Score?)serializer.Deserialize(new StringReader(bodyString));
if (score == null) return this.BadRequest();
score.SlotId = id;
@ -58,7 +59,9 @@ namespace LBPUnion.ProjectLighthouse.Controllers
public async Task<IActionResult> TopScores(int slotId, int type, [FromQuery] int pageStart, [FromQuery] int pageSize)
{
// Get username
User user = await this.database.UserFromRequest(this.Request);
User? user = await this.database.UserFromRequest(this.Request);
if (user == null) return this.StatusCode(403, "");
// This is hella ugly but it technically assigns the proper rank to a score
// var needed for Anonymous type returned from SELECT
@ -67,7 +70,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
.ToList()
.Select
(
(Score s, int rank) => new
(s, rank) => new
{
Score = s,
Rank = rank + 1,

View file

@ -82,7 +82,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers
if (LittleBigPlanet2TitleIds.Contains(titleId)) return GameVersion.LittleBigPlanet2;
if (LittleBigPlanet3TitleIds.Contains(titleId)) return GameVersion.LittleBigPlanet3;
return GameVersion.Unknown;
return GameVersion.LittleBigPlanet1;
}
}
}