Fixed a bug where unattended remote control sessions were not being reconnected after unexpected disconnect.

This commit is contained in:
Jared Goodwin 2019-07-12 10:51:19 -07:00
parent 307feb2504
commit 3ed8650556
5 changed files with 8 additions and 13 deletions

View File

@ -1 +1 @@
2019.07.05.1321
2019.07.12.0945

View File

@ -38,7 +38,7 @@ namespace Remotely.Server.Data
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<IdentityUser>().ToTable("RemotelyUsers");
builder.Entity<RemotelyUser>().ToTable("RemotelyUsers");

View File

@ -13,23 +13,16 @@ namespace Remotely.Server.Data
{
public class DataService
{
public DataService(
ApplicationDbContext context,
ApplicationConfig appConfig,
UserManager<RemotelyUser> userManager
)
public DataService(ApplicationDbContext context, ApplicationConfig appConfig)
{
RemotelyContext = context;
AppConfig = appConfig;
UserManager = userManager;
}
private ApplicationConfig AppConfig { get; set; }
private ApplicationDbContext RemotelyContext { get; set; }
private UserManager<RemotelyUser> UserManager { get; set; }
public void AddOrUpdateCommandContext(CommandContext commandContext)
{
var existingContext = RemotelyContext.CommandContexts.Find(commandContext.ID);

View File

@ -192,10 +192,11 @@ namespace Remotely.Server.Services
ScreenCasterID = screenCasterID;
Mode = (RemoteControlMode)remoteControlMode;
RequesterName = requesterName;
var sessionInfo = RCDeviceSocketHub.SessionInfoList.FirstOrDefault(x => x.Value.RCSocketID == screenCasterID).Value;
if (Mode == RemoteControlMode.Unattended)
{
var serviceID = RCDeviceSocketHub.SessionInfoList.FirstOrDefault(x => x.Value.RCSocketID == screenCasterID).Value?.ServiceID;
var deviceID = DeviceSocketHub.ServiceConnections[serviceID].ID;
sessionInfo.Mode = RemoteControlMode.Unattended;
var deviceID = DeviceSocketHub.ServiceConnections[sessionInfo.ServiceID].ID;
if (Context.User.Identity.IsAuthenticated && DataService.DoesUserHaveAccessToDevice(deviceID, Context.UserIdentifier))
{
await RCDeviceHub.Clients.Client(screenCasterID).SendAsync("GetScreenCast", Context.ConnectionId, requesterName);
@ -203,6 +204,7 @@ namespace Remotely.Server.Services
}
else
{
sessionInfo.Mode = RemoteControlMode.Normal;
await Clients.Caller.SendAsync("RequestingScreenCast");
await RCDeviceHub.Clients.Client(screenCasterID).SendAsync("RequestScreenCast", Context.ConnectionId, requesterName);
}

View File

@ -139,7 +139,7 @@ namespace Remotely.Server.Services
await Task.Delay(100);
}
if (SessionInfo.Mode == Shared.Enums.RemoteControlMode.Unattended)
if (SessionInfo.Mode == Shared.Enums.RemoteControlMode.Normal)
{
await RCBrowserHub.Clients.Clients(ViewerList).SendAsync("ScreenCasterDisconnected");
}