Fix launcher breaking on login/register
This commit is contained in:
@@ -1,28 +1,51 @@
|
||||
using Core.DI;
|
||||
using Core.Annotations;
|
||||
using Core.DI;
|
||||
using Core.Models.Enums;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Servers;
|
||||
using Core.Services;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
public class SaveCallbacks : OnLoad, OnUpdate
|
||||
{
|
||||
private CoreConfig _coreConfig;
|
||||
protected SaveServer _saveServer;
|
||||
protected CoreConfig _coreConfig;
|
||||
protected BackupService _backupService;
|
||||
|
||||
public SaveCallbacks()
|
||||
public SaveCallbacks(
|
||||
SaveServer saveServer,
|
||||
ConfigServer configServer,
|
||||
BackupService backupService
|
||||
)
|
||||
{
|
||||
_saveServer = saveServer;
|
||||
_coreConfig = configServer.GetConfig<CoreConfig>(ConfigTypes.CORE);
|
||||
_backupService = backupService;
|
||||
}
|
||||
|
||||
public async Task OnLoad()
|
||||
public Task OnLoad()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_backupService.InitAsync();
|
||||
_saveServer.Load();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task<bool> OnUpdate(long SecondsSinceLastRun)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (SecondsSinceLastRun > _coreConfig.ProfileSaveIntervalInSeconds)
|
||||
{
|
||||
_saveServer.Save();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public string GetRoute()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return "spt-save";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class LauncherController
|
||||
return _saveServer.GetProfiles().TryGetValue(sessionId, out var profile) ? profile.ProfileInfo : null;
|
||||
}
|
||||
|
||||
public string Login(LoginRequestData info)
|
||||
public string? Login(LoginRequestData info)
|
||||
{
|
||||
foreach (var sessionID in _saveServer.GetProfiles()) {
|
||||
var account = _saveServer.GetProfile(sessionID.Key).ProfileInfo;
|
||||
@@ -111,7 +111,7 @@ public class LauncherController
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
return null;
|
||||
}
|
||||
|
||||
public string Register(RegisterData info)
|
||||
|
||||
Reference in New Issue
Block a user