mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-13 22:04:15 +01:00
prepare for Admin stuff
This commit is contained in:
parent
95f7e5f867
commit
ce9bfad97b
1 changed files with 7 additions and 2 deletions
|
|
@ -38,6 +38,7 @@ namespace MareSynchronos.WebAPI
|
||||||
private CancellationTokenSource? _uploadCancellationTokenSource;
|
private CancellationTokenSource? _uploadCancellationTokenSource;
|
||||||
|
|
||||||
private HubConnection? _userHub;
|
private HubConnection? _userHub;
|
||||||
|
public bool IsAdmin { private set; get; }
|
||||||
|
|
||||||
public ApiController(Configuration pluginConfiguration, DalamudUtil dalamudUtil)
|
public ApiController(Configuration pluginConfiguration, DalamudUtil dalamudUtil)
|
||||||
{
|
{
|
||||||
|
|
@ -137,7 +138,9 @@ namespace MareSynchronos.WebAPI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UID = await _heartbeatHub.InvokeAsync<string>("Heartbeat", token);
|
var userDto = await _heartbeatHub.InvokeAsync<UserDto>("Heartbeat", token);
|
||||||
|
UID = userDto.UID;
|
||||||
|
IsAdmin = userDto.IsAdmin;
|
||||||
if (!string.IsNullOrEmpty(UID) && !token.IsCancellationRequested) // user is authorized
|
if (!string.IsNullOrEmpty(UID) && !token.IsCancellationRequested) // user is authorized
|
||||||
{
|
{
|
||||||
Logger.Debug("Initializing data");
|
Logger.Debug("Initializing data");
|
||||||
|
|
@ -212,7 +215,9 @@ namespace MareSynchronos.WebAPI
|
||||||
{
|
{
|
||||||
Logger.Debug("Connection restored");
|
Logger.Debug("Connection restored");
|
||||||
OnlineUsers = _userHub!.InvokeAsync<int>("GetOnlineUsers").Result;
|
OnlineUsers = _userHub!.InvokeAsync<int>("GetOnlineUsers").Result;
|
||||||
UID = _heartbeatHub!.InvokeAsync<string>("Heartbeat").Result;
|
var userDto = _heartbeatHub!.InvokeAsync<UserDto>("Heartbeat").Result;
|
||||||
|
IsAdmin = userDto.IsAdmin;
|
||||||
|
UID = userDto.UID;
|
||||||
Connected?.Invoke(this, EventArgs.Empty);
|
Connected?.Invoke(this, EventArgs.Empty);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue