mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-07 12:28:39 +00:00
Merge branch 'LBPUnion:main' into playlists
This commit is contained in:
commit
fbe203d84a
23 changed files with 484 additions and 216 deletions
|
@ -27,7 +27,7 @@ public class ClientConfigurationController : ControllerBase
|
|||
GameToken? token = await this.database.GameTokenFromRequest(this.Request);
|
||||
if (token == null) return this.StatusCode(403, "");
|
||||
|
||||
HostString hostname = this.Request.Host;
|
||||
string hostname = ServerConfiguration.Instance.GameApiExternalUrl;
|
||||
return this.Ok
|
||||
(
|
||||
"ProbabilityOfPacketDelay 0.0\nMinPacketDelayFrames 0\nMaxPacketDelayFrames 3\nProbabilityOfPacketDrop 0.0\nEnableFakeConditionsForLoopback true\nNumberOfFramesPredictionAllowedForNonLocalPlayer 1000\nEnablePrediction true\nMinPredictedFrames 0\nMaxPredictedFrames 10\nAllowGameRendCameraSplit true\nFramesBeforeAgressiveCatchup 30\nPredictionPadSides 200\nPredictionPadTop 200\nPredictionPadBottom 200\nShowErrorNumbers true\nAllowModeratedLevels false\nAllowModeratedPoppetItems false\nTIMEOUT_WAIT_FOR_JOIN_RESPONSE_FROM_PREV_PARTY_HOST 50.0\nTIMEOUT_WAIT_FOR_CHANGE_LEVEL_PARTY_HOST 30.0\nTIMEOUT_WAIT_FOR_CHANGE_LEVEL_PARTY_MEMBER 45.0\nTIMEOUT_WAIT_FOR_REQUEST_JOIN_FRIEND 15.0\nTIMEOUT_WAIT_FOR_CONNECTION_FROM_HOST 30.0\nTIMEOUT_WAIT_FOR_ROOM_ID_TO_JOIN 60.0\nTIMEOUT_WAIT_FOR_GET_NUM_PLAYERS_ONLINE 60.0\nTIMEOUT_WAIT_FOR_SIGNALLING_CONNECTIONS 120.0\nTIMEOUT_WAIT_FOR_PARTY_DATA 60.0\nTIME_TO_WAIT_FOR_LEAVE_MESSAGE_TO_COME_BACK 20.0\nTIME_TO_WAIT_FOR_FOLLOWING_REQUESTS_TO_ARRIVE 30.0\nTIMEOUT_WAIT_FOR_FINISHED_MIGRATING_HOST 30.0\nTIMEOUT_WAIT_FOR_PARTY_LEADER_FINISH_JOINING 45.0\nTIMEOUT_WAIT_FOR_QUICKPLAY_LEVEL 60.0\nTIMEOUT_WAIT_FOR_PLAYERS_TO_JOIN 30.0\nTIMEOUT_WAIT_FOR_DIVE_IN_PLAYERS 240.0\nTIMEOUT_WAIT_FOR_FIND_BEST_ROOM 60.0\nTIMEOUT_DIVE_IN_TOTAL 300.0\nTIMEOUT_WAIT_FOR_SOCKET_CONNECTION 120.0\nTIMEOUT_WAIT_FOR_REQUEST_RESOURCE_MESSAGE 120.0\nTIMEOUT_WAIT_FOR_LOCAL_CLIENT_TO_GET_RESOURCE_LIST 120.0\nTIMEOUT_WAIT_FOR_CLIENT_TO_LOAD_RESOURCES 120.0\nTIMEOUT_WAIT_FOR_LOCAL_CLIENT_TO_SAVE_GAME_STATE 30.0\nTIMEOUT_WAIT_FOR_ADD_PLAYERS_TO_TAKE 30.0\nTIMEOUT_WAIT_FOR_UPDATE_FROM_CLIENT 90.0\nTIMEOUT_WAIT_FOR_HOST_TO_GET_RESOURCE_LIST 60.0\nTIMEOUT_WAIT_FOR_HOST_TO_SAVE_GAME_STATE 60.0\nTIMEOUT_WAIT_FOR_HOST_TO_ADD_US 30.0\nTIMEOUT_WAIT_FOR_UPDATE 60.0\nTIMEOUT_WAIT_FOR_REQUEST_JOIN 50.0\nTIMEOUT_WAIT_FOR_AUTOJOIN_PRESENCE 60.0\nTIMEOUT_WAIT_FOR_AUTOJOIN_CONNECTION 120.0\nSECONDS_BETWEEN_PINS_AWARDED_UPLOADS 300.0\nEnableKeepAlive true\nAllowVoIPRecordingPlayback true\nOverheatingThresholdDisallowMidgameJoin 0.95\nMaxCatchupFrames 3\nMaxLagBeforeShowLoading 23\nMinLagBeforeHideLoading 30\nLagImprovementInflectionPoint -1.0\nFlickerThreshold 2.0\nClosedDemo2014Version 1\nClosedDemo2014Expired false\nEnablePlayedFilter true\nEnableCommunityDecorations true\nGameStateUpdateRate 10.0\nGameStateUpdateRateWithConsumers 1.0\nDisableDLCPublishCheck false\nEnableDiveIn true\nEnableHackChecks false\nAllowOnlineCreate true\n" +
|
||||
|
@ -41,6 +41,10 @@ public class ClientConfigurationController : ControllerBase
|
|||
[Produces("text/xml")]
|
||||
public IActionResult Conf() => this.Ok("<t_enable>false</t_enable>");
|
||||
|
||||
[HttpGet("ChallengeConfig.xml")]
|
||||
[Produces("text/xml")]
|
||||
public IActionResult Challenges() => this.Ok();
|
||||
|
||||
[HttpGet("farc_hashes")]
|
||||
public IActionResult FarcHashes() => this.Ok();
|
||||
|
||||
|
@ -50,7 +54,7 @@ public class ClientConfigurationController : ControllerBase
|
|||
{
|
||||
User? user = await this.database.UserFromGameRequest(this.Request);
|
||||
if (user == null) return this.StatusCode(403, "");
|
||||
|
||||
|
||||
PrivacySettings ps = new()
|
||||
{
|
||||
LevelVisibility = user.LevelVisibility.ToSerializedString(),
|
||||
|
|
|
@ -139,6 +139,7 @@ public class LoginController : ControllerBase
|
|||
{
|
||||
AuthTicket = "MM_AUTH=" + token.UserToken,
|
||||
ServerBrand = VersionHelper.EnvVer,
|
||||
TitleStorageUrl = ServerConfiguration.Instance.GameApiExternalUrl,
|
||||
}.Serialize()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -60,12 +60,12 @@ public class PublishController : ControllerBase
|
|||
Slot? oldSlot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == slot.SlotId);
|
||||
if (oldSlot == null)
|
||||
{
|
||||
Logger.Warn("Rejecting level reupload, could not find old slot", LogArea.Publish);
|
||||
Logger.Warn("Rejecting level republish, could not find old slot", LogArea.Publish);
|
||||
return this.NotFound();
|
||||
}
|
||||
if (oldSlot.CreatorId != user.UserId)
|
||||
{
|
||||
Logger.Warn("Rejecting level reupload, old slot's creator is not publishing user", LogArea.Publish);
|
||||
Logger.Warn("Rejecting level republish, old slot's creator is not publishing user", LogArea.Publish);
|
||||
return this.BadRequest();
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class PublishController : ControllerBase
|
|||
/// Endpoint actually used to publish a level
|
||||
/// </summary>
|
||||
[HttpPost("publish")]
|
||||
public async Task<IActionResult> Publish()
|
||||
public async Task<IActionResult> Publish([FromQuery] string? game)
|
||||
{
|
||||
(User, GameToken)? userAndToken = await this.database.UserAndGameTokenFromRequest(this.Request);
|
||||
|
||||
|
@ -178,6 +178,22 @@ public class PublishController : ControllerBase
|
|||
return this.BadRequest();
|
||||
}
|
||||
|
||||
// I hate lbp3
|
||||
if (game != null)
|
||||
{
|
||||
GameVersion intendedVersion = FromAbbreviation(game);
|
||||
if (intendedVersion != GameVersion.Unknown && intendedVersion != slotVersion)
|
||||
{
|
||||
// Delete the useless rootLevel that lbp3 just uploaded
|
||||
if(slotVersion == GameVersion.LittleBigPlanet3)
|
||||
FileHelper.DeleteResource(slot.RootLevel);
|
||||
|
||||
slot.GameVersion = oldSlot.GameVersion;
|
||||
slot.RootLevel = oldSlot.RootLevel;
|
||||
slot.ResourceCollection = oldSlot.ResourceCollection;
|
||||
}
|
||||
}
|
||||
|
||||
oldSlot.Location.X = slot.Location.X;
|
||||
oldSlot.Location.Y = slot.Location.Y;
|
||||
|
||||
|
@ -277,6 +293,19 @@ public class PublishController : ControllerBase
|
|||
return this.Ok();
|
||||
}
|
||||
|
||||
private static GameVersion FromAbbreviation(string abbr)
|
||||
{
|
||||
return abbr switch
|
||||
{
|
||||
"lbp1" => GameVersion.LittleBigPlanet1,
|
||||
"lbp2" => GameVersion.LittleBigPlanet2,
|
||||
"lbp3" => GameVersion.LittleBigPlanet3,
|
||||
"lbpv" => GameVersion.LittleBigPlanetVita,
|
||||
"lbppsp" => GameVersion.LittleBigPlanetPSP,
|
||||
_ => GameVersion.Unknown,
|
||||
};
|
||||
}
|
||||
|
||||
private async Task<Slot?> getSlotFromBody()
|
||||
{
|
||||
this.Request.Body.Position = 0;
|
||||
|
|
|
@ -214,8 +214,8 @@ public class ScoreController : ControllerBase
|
|||
var rankedScores = this.database.Scores
|
||||
.Where(s => s.SlotId == slotId && s.Type == type)
|
||||
.Where(s => s.ChildSlotId == 0 || s.ChildSlotId == childId)
|
||||
.Where(s => playerIds == null || playerIds.Any(id => s.PlayerIdCollection.Contains(id)))
|
||||
.AsEnumerable()
|
||||
.Where(s => playerIds == null || playerIds.Any(id => s.PlayerIdCollection.Contains(id)))
|
||||
.OrderByDescending(s => s.Points)
|
||||
.ThenBy(s => s.ScoreId)
|
||||
.ToList()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue