Add data annotation to Invite. Normalize username in user query. Force exit in ShutdownServiceWin (WebRTC is still preventing the process from closing sometimes).

This commit is contained in:
Jared 2020-11-15 10:46:32 -08:00 committed by Jared Goodwin
parent 4962e83d50
commit e63715aaa6
4 changed files with 20 additions and 7 deletions

View File

@ -6,6 +6,7 @@ using Remotely.Shared.Utilities;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
namespace Remotely.Desktop.Win.Services
{
@ -17,12 +18,12 @@ namespace Remotely.Desktop.Win.Services
var casterSocket = ServiceContainer.Instance.GetRequiredService<CasterSocket>();
await casterSocket.DisconnectAllViewers();
await casterSocket.Disconnect();
System.Windows.Forms.Application.Exit();
App.Current.Dispatcher.Invoke(() =>
Application.Current.Dispatcher.Invoke(() =>
{
App.Current.Shutdown();
Application.Current.Shutdown();
});
System.Windows.Forms.Application.Exit();
Environment.Exit(0);
}
}
}

View File

@ -99,6 +99,11 @@ namespace Remotely.Server.Hubs
public Task SendDtoToClient(byte[] baseDto)
{
if (string.IsNullOrWhiteSpace(ScreenCasterID))
{
return Task.CompletedTask;
}
return CasterHubContext.Clients.Client(ScreenCasterID).SendAsync("SendDtoToClient", baseDto, Context.ConnectionId);
}
@ -109,7 +114,7 @@ namespace Remotely.Server.Hubs
public override Task OnDisconnectedAsync(Exception exception)
{
if (ScreenCasterID != null)
if (!string.IsNullOrWhiteSpace(ScreenCasterID))
{
CasterHubContext.Clients.Client(ScreenCasterID).SendAsync("ViewerDisconnected", Context.ConnectionId);
}
@ -129,6 +134,11 @@ namespace Remotely.Server.Hubs
public async Task SendScreenCastRequestToDevice(string screenCasterID, string requesterName, int remoteControlMode, string otp)
{
if (string.IsNullOrWhiteSpace(screenCasterID))
{
return;
}
if ((RemoteControlMode)remoteControlMode == RemoteControlMode.Normal)
{
if (!CasterHub.SessionInfoList.Any(x => x.Value.AttendedSessionID == screenCasterID))

View File

@ -486,11 +486,11 @@ namespace Remotely.Server.Services
public bool DoesUserExist(string userName)
{
if (userName == null)
if (string.IsNullOrWhiteSpace(userName))
{
return false;
}
return RemotelyContext.Users.Any(x => x.UserName == userName);
return RemotelyContext.Users.Any(x => x.UserName.Trim().ToLower() == userName.Trim().ToLower());
}
public bool DoesUserHaveAccessToDevice(string deviceID, RemotelyUser remotelyUser)

View File

@ -1,4 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Remotely.Shared.ViewModels.Organization
{
@ -7,6 +8,7 @@ namespace Remotely.Shared.ViewModels.Organization
public string ID { get; set; }
public bool IsAdmin { get; set; }
public DateTimeOffset DateSent { get; set; }
[EmailAddress]
public string InvitedUser { get; set; }
}
}