Rebranding.

This commit is contained in:
Jared Goodwin 2019-02-25 14:03:55 -08:00
parent 58b3465739
commit 00fde9263b
97 changed files with 1811 additions and 1748 deletions

View File

@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Copyright>Copyright © 2018 Translucency Software</Copyright>
<Copyright>Copyright © 2019 Translucency Software</Copyright>
<Description>Background service that maintains a connection to the DoXM server. The service is used for remote support and maintenance by this computer's administrators.</Description>
<PackageLicenseUrl>https://doxm.app/EULA</PackageLicenseUrl>
<Authors>Jared Goodwin</Authors>

View File

@ -127,7 +127,7 @@ namespace Remotely_Agent.Services
var partialResult = new GenericCommandResult()
{
CommandContextID = LastInputID,
MachineID = Utilities.GetConnectionInfo().MachineID,
DeviceID = Utilities.GetConnectionInfo().DeviceID,
CommandType = "Bash",
StandardOutput = StandardOut,
ErrorOutput = "WARNING: The command execution froze and was forced to return before finishing. " +
@ -143,7 +143,7 @@ namespace Remotely_Agent.Services
return new GenericCommandResult()
{
CommandContextID = LastInputID,
MachineID = Utilities.GetConnectionInfo().MachineID,
DeviceID = Utilities.GetConnectionInfo().DeviceID,
CommandType = "Bash",
StandardOutput = StandardOut,
ErrorOutput = ErrorOut

View File

@ -128,7 +128,7 @@ namespace Remotely_Agent.Services
var partialResult = new GenericCommandResult()
{
CommandContextID = LastInputID,
MachineID = Utilities.GetConnectionInfo().MachineID,
DeviceID = Utilities.GetConnectionInfo().DeviceID,
CommandType = "CMD",
StandardOutput = StandardOut,
ErrorOutput = "WARNING: The command execution froze and was forced to return before finishing. " +
@ -144,7 +144,7 @@ namespace Remotely_Agent.Services
return new GenericCommandResult()
{
CommandContextID = LastInputID,
MachineID = Utilities.GetConnectionInfo().MachineID,
DeviceID = Utilities.GetConnectionInfo().DeviceID,
CommandType = "CMD",
StandardOutput = StandardOut,
ErrorOutput = ErrorOut

View File

@ -39,9 +39,9 @@ namespace Remotely_Agent.Services
await HubConnection.StartAsync();
var machine = Machine.Create(ConnectionInfo);
var device = Device.Create(ConnectionInfo);
await HubConnection.InvokeAsync("MachineCameOnline", machine);
await HubConnection.InvokeAsync("DeviceCameOnline", device);
if (string.IsNullOrWhiteSpace(ConnectionInfo.ServerVerificationToken))
{
@ -67,8 +67,8 @@ namespace Remotely_Agent.Services
public static void SendHeartbeat()
{
var currentInfo = Machine.Create(ConnectionInfo);
HubConnection.InvokeAsync("MachineHeartbeat", currentInfo);
var currentInfo = Device.Create(ConnectionInfo);
HubConnection.InvokeAsync("DeviceHeartbeat", currentInfo);
}
private static async Task ExecuteCommand(string mode, string command, string commandID, string senderConnectionID)
@ -153,7 +153,7 @@ namespace Remotely_Agent.Services
catch (Exception ex)
{
Logger.Write(ex);
await HubConnection.InvokeAsync("DisplayConsoleMessage", $"There was an error executing the command. It has been logged on the client machine.", senderConnectionID);
await HubConnection.InvokeAsync("DisplayConsoleMessage", $"There was an error executing the command. It has been logged on the client device.", senderConnectionID);
}
}
@ -305,7 +305,7 @@ namespace Remotely_Agent.Services
var result = Win32Interop.OpenInteractiveProcess(filePath + $" -mode unattended -requester {requesterID} -serviceid {serviceID} -hostname {Utilities.GetConnectionInfo().Host.Split("//").Last()}", "default", true, out procInfo);
if (!result)
{
await hubConnection.InvokeAsync("DisplayConsoleMessage", "Remote control failed to download or start on target machine.", requesterID);
await hubConnection.InvokeAsync("DisplayConsoleMessage", "Remote control failed to start on target device.", requesterID);
}
}
@ -320,7 +320,7 @@ namespace Remotely_Agent.Services
}
catch
{
await hubConnection.InvokeAsync("DisplayConsoleMessage", "Remote control failed to download or start on target machine.", requesterID);
await hubConnection.InvokeAsync("DisplayConsoleMessage", "Remote control failed to start on target device.", requesterID);
throw;
}
});

View File

@ -78,7 +78,7 @@ namespace Remotely_Agent.Services
return new PSCoreCommandResult()
{
CommandContextID = commandID,
MachineID = Utilities.GetConnectionInfo().MachineID,
DeviceID = Utilities.GetConnectionInfo().DeviceID,
DebugOutput = debugOut,
ErrorOutput = errorOut,
VerboseOutput = verboseOut,

View File

@ -54,7 +54,7 @@ namespace Remotely_Agent.Services
var wc = new WebClient();
var latestVersion = wc.DownloadString(Utilities.GetConnectionInfo().Host + $"/API/CoreVersion/{platform}");
var thisVersion = FileVersionInfo.GetVersionInfo("Remote_Agent.dll").FileVersion.ToString();
var thisVersion = FileVersionInfo.GetVersionInfo("Remotely_Agent.dll").FileVersion.ToString();
if (thisVersion != latestVersion)
{
Logger.Write($"Service Updater: Downloading update. Current Version: {thisVersion}. Latest Version: {latestVersion}.");

View File

@ -125,7 +125,7 @@ namespace Remotely_Agent.Services
var partialResult = new GenericCommandResult()
{
CommandContextID = LastInputID,
MachineID = Utilities.GetConnectionInfo().MachineID,
DeviceID = Utilities.GetConnectionInfo().DeviceID,
CommandType = "WinPS",
StandardOutput = StandardOut,
ErrorOutput = "WARNING: The command execution froze and was forced to return before finishing. " +
@ -141,7 +141,7 @@ namespace Remotely_Agent.Services
return new GenericCommandResult()
{
CommandContextID = LastInputID,
MachineID = Utilities.GetConnectionInfo().MachineID,
DeviceID = Utilities.GetConnectionInfo().DeviceID,
CommandType = "WinPS",
StandardOutput = StandardOut,
ErrorOutput = ErrorOut

View File

@ -14,12 +14,12 @@ namespace Remotely_Library.Models
public string CommandText { get; set; }
public string SenderUserID { get; set; }
public string SenderConnectionID { get; set; }
public string[] TargetMachineIDs { get; set; }
public string[] TargetDeviceIDs { get; set; }
public List<PSCoreCommandResult> PSCoreResults { get; set; } = new List<PSCoreCommandResult>();
public List<GenericCommandResult> CommandResults { get; set; } = new List<GenericCommandResult>();
public DateTime TimeStamp { get; set; } = DateTime.Now;
[IgnoreDataMember]
public Organization Organization { get; set; }
public virtual Organization Organization { get; set; }
public string OrganizationID { get; set; }
}
}

View File

@ -4,7 +4,7 @@
CommandText: string;
SenderUserID: string;
SenderConnectionID: string;
TargetMachineIDs: string[];
TargetDeviceIDs: string[];
PSCoreResults: any[];
CommandResults: any[];
TimeStamp: Date;

View File

@ -6,7 +6,7 @@ namespace Remotely_Library.Models
{
public class ConnectionInfo
{
public string MachineID { get; set; } = Guid.NewGuid().ToString();
public string DeviceID { get; set; } = Guid.NewGuid().ToString();
private string host;
public string Host
{

View File

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
namespace Remotely_Library.Models
{
public class Machine
public class Device
{
public string CurrentUser { get; set; }
public virtual List<Drive> Drives { get; set; }
@ -29,7 +29,7 @@ namespace Remotely_Library.Models
public DateTime LastOnline { get; set; }
public string MachineName { get; set; }
public string DeviceName { get; set; }
public virtual Organization Organization { get; set; }
public string OrganizationID { get; set; }
@ -37,7 +37,7 @@ namespace Remotely_Library.Models
public string OSDescription { get; set; }
public List<PermissionGroup> PermissionGroups { get; set; } = new List<PermissionGroup>();
public virtual List<PermissionGroup> PermissionGroups { get; set; } = new List<PermissionGroup>();
public string Platform { get; set; }
public int ProcessorCount { get; set; }
@ -47,7 +47,7 @@ namespace Remotely_Library.Models
public double TotalMemory { get; set; }
public double TotalStorage { get; set; }
public static Machine Create(ConnectionInfo connectionInfo)
public static Device Create(ConnectionInfo connectionInfo)
{
OSPlatform platform = OSUtils.GetPlatform();
DriveInfo systemDrive;
@ -67,10 +67,10 @@ namespace Remotely_Library.Models
x.RootDirectory.FullName == Path.GetPathRoot(Environment.CurrentDirectory));
}
var machine = new Machine()
var device = new Device()
{
ID = connectionInfo.MachineID,
MachineName = Environment.MachineName,
ID = connectionInfo.DeviceID,
DeviceName = Environment.MachineName,
Platform = platform.ToString(),
ProcessorCount = Environment.ProcessorCount,
OSArchitecture = RuntimeInformation.OSArchitecture,
@ -92,9 +92,9 @@ namespace Remotely_Library.Models
if (systemDrive != null && systemDrive.TotalSize > 0 && systemDrive.TotalFreeSpace > 0)
{
machine.TotalStorage = Math.Round((double)(systemDrive.TotalSize / 1024 / 1024 / 1024), 2);
device.TotalStorage = Math.Round((double)(systemDrive.TotalSize / 1024 / 1024 / 1024), 2);
var freeStorage = Math.Round((double)(systemDrive.TotalFreeSpace / 1024 / 1024 / 1024), 2);
machine.FreeStorage = freeStorage / machine.TotalStorage;
device.FreeStorage = freeStorage / device.TotalStorage;
}
Tuple<double, double> totalMemory = new Tuple<double, double>(0, 0);
@ -110,15 +110,15 @@ namespace Remotely_Library.Models
if (totalMemory.Item2 > 0)
{
machine.FreeMemory = totalMemory.Item1 / totalMemory.Item2;
device.FreeMemory = totalMemory.Item1 / totalMemory.Item2;
}
else
{
machine.FreeMemory = 0;
device.FreeMemory = 0;
}
machine.TotalMemory = totalMemory.Item2;
device.TotalMemory = totalMemory.Item2;
return machine;
return device;
}

View File

@ -17,6 +17,6 @@ namespace Remotely_Library.Models
public double FreeSpace { get; internal set; }
public double TotalSize { get; internal set; }
public string VolumeLabel { get; internal set; }
public string MachineID { get; set; }
public string DeviceID { get; set; }
}
}

View File

@ -17,7 +17,7 @@ namespace Remotely_Library.Models
public string OrganizationID { get; set; }
public DateTime TimeStamp { get; set; } = DateTime.Now;
[JsonIgnore]
public Organization Organization { get; set; }
public virtual Organization Organization { get; set; }
}
public enum EventTypes
{

View File

@ -6,7 +6,7 @@ namespace Remotely_Library.Models
{
public class GenericCommandResult
{
public string MachineID { get; set; }
public string DeviceID { get; set; }
public string CommandContextID { get; set; }
public string CommandType { get; set; }
public string StandardOutput { get; set; }

View File

@ -1,5 +1,5 @@
interface GenericCommandResult {
MachineID: string;
DeviceID: string;
CommandContextID: string;
CommandType: string;
StandardOutput: string;

View File

@ -12,6 +12,6 @@ namespace Remotely_Library.Models
public string InvitedUser { get; set; }
public bool IsAdmin { get; set; }
public DateTime DateSent { get; set; }
public Organization Organization { get; set; }
public virtual Organization Organization { get; set; }
}
}

View File

@ -1,32 +0,0 @@
interface Machine {
Drives: any[];
ID: string;
Is64Bit: boolean;
IsOnline: boolean;
LastOnline: Date;
MachineName: string;
OrganizationID: string;
Organization: {
ID: string;
OrganizationName: string;
RemotelyUsers: any[];
Machines: server.Machine[];
CommandContexts: any[];
EventLogs: any[];
PermissionGroups: any[];
InviteLinks: any[];
SharedFiles: any[];
};
OSArchitecture: any;
OSDescription: string;
Platform: string;
ProcessorCount: number;
TotalMemory: number;
FreeStorage: number;
TotalStorage: number;
FreeMemory: number;
CurrentUser: string;
PermissionGroups: any[];
Tags: string;
ServerVerificationToken: string;
}

View File

@ -12,12 +12,12 @@ namespace Remotely_Library.Models
[StringLength(25)]
public string OrganizationName { get; set; }
public List<RemotelyUser> RemotelyUsers { get; set; }
public List<Machine> Machines { get; set; }
public List<CommandContext> CommandContexts { get; set; }
public List<EventLog> EventLogs { get; set; }
public List<PermissionGroup> PermissionGroups { get; set; } = new List<PermissionGroup>();
public List<InviteLink> InviteLinks { get; set; }
public List<SharedFile> SharedFiles { get; set; }
public virtual List<RemotelyUser> RemotelyUsers { get; set; }
public virtual List<Device> Devices { get; set; }
public virtual List<CommandContext> CommandContexts { get; set; }
public virtual List<EventLog> EventLogs { get; set; }
public virtual List<PermissionGroup> PermissionGroups { get; set; } = new List<PermissionGroup>();
public virtual List<InviteLink> InviteLinks { get; set; }
public virtual List<SharedFile> SharedFiles { get; set; }
}
}

View File

@ -8,7 +8,7 @@ namespace Remotely_Library.Models
public class PSCoreCommandResult
{
public string CommandContextID { get; set; }
public string MachineID { get; set; }
public string DeviceID { get; set; }
public List<string> VerboseOutput { get; set; }
public List<string> DebugOutput { get; set; }
public List<string> ErrorOutput { get; set; }

View File

@ -1,6 +1,6 @@
interface PSCoreCommandResult {
CommandContextID: string;
MachineID: string;
DeviceID: string;
VerboseOutput: string[];
DebugOutput: string[];
ErrorOutput: string[];

View File

@ -12,6 +12,8 @@ namespace Remotely_Library.Models
public string ID { get; set; } = Guid.NewGuid().ToString();
[StringLength(100)]
public string Name { get; set; }
public Organization Organization { get; set; }
}
public virtual Organization Organization { get; set; }
public virtual List<Device> Devices { get; set; }
public virtual List<RemotelyUser> RemotelyUsers { get; set; }
}
}

View File

@ -14,12 +14,12 @@ namespace Remotely_Library.Models
UserOptions = new RemotelyUserOptions();
Organization = new Organization();
}
public RemotelyUserOptions UserOptions { get; set; }
public virtual RemotelyUserOptions UserOptions { get; set; }
public Organization Organization { get; set; }
public virtual Organization Organization { get; set; }
public string OrganizationID { get; set; }
public List<PermissionGroup> PermissionGroups { get; set; } = new List<PermissionGroup>();
public virtual List<PermissionGroup> PermissionGroups { get; set; } = new List<PermissionGroup>();
public bool IsAdministrator { get; set; } = true;
}

View File

@ -13,6 +13,6 @@ namespace Remotely_Library.Models
public string ContentType { get; set; }
public byte[] FileContents { get; set; }
public DateTime Timestamp { get; set; } = DateTime.Now;
public Organization Organization { get; set; }
public virtual Organization Organization { get; set; }
}
}

View File

@ -6,8 +6,8 @@
</PropertyGroup>
<ItemGroup>
<None Include="Models\Machine.d.ts">
<DependentUpon>Machine.cs</DependentUpon>
<None Include="Models\Device.d.ts">
<DependentUpon>Device.cs</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</None>
@ -39,7 +39,7 @@
<LastGenOutput>GenericCommandResult.cs.d.ts</LastGenOutput>
<Generator>DtsGenerator</Generator>
</Compile>
<Compile Update="Models\Machine.cs">
<Compile Update="Models\Device.cs">
<LastGenOutput>Machine.cs.d.ts</LastGenOutput>
<Generator>DtsGenerator</Generator>
</Compile>

View File

@ -73,20 +73,6 @@ namespace Remotely_ScreenCast.Capture
desktopName = Win32Interop.GetCurrentDesktop();
}
public async void BeginCapturing(string participantID)
{
CursorIconWatcher.Current.OnChange += CursorIcon_OnChange;
while (IsCapturing)
{
Capture();
await Task.Delay(PauseForMilliseconds);
PauseForMilliseconds = 1;
}
CursorIconWatcher.Current.OnChange -= CursorIcon_OnChange;
}
private void CursorIcon_OnChange(object sender, int e)
{
//AditClient.SocketMessageHandler.SendIconUpdate(e);

View File

@ -19,10 +19,6 @@ namespace Remotely_ScreenCast.Capture
{
public class DXCapture : ICapturer
{
public DXCapture()
{
Init();
}
public Bitmap PreviousFrame { get; set; }
public Bitmap CurrentFrame { get; set; }
public Size CurrentScreenSize
@ -64,7 +60,7 @@ namespace Remotely_ScreenCast.Capture
NeedsInit = true;
}
}
public bool NeedsInit { get; set; }
public bool NeedsInit { get; set; } = true;
private string desktopName;
private Factory1 factory;
@ -102,7 +98,10 @@ namespace Remotely_ScreenCast.Capture
var newHeight = output.Description.DesktopBounds.Bottom - output.Description.DesktopBounds.Top;
if (newWidth != width || newHeight != height)
{
ScreenChanged(this, new Size(newWidth, newHeight));
if (ScreenChanged != null)
{
ScreenChanged(this, new Size(newWidth, newHeight));
}
}
width = newWidth;
height = newHeight;

View File

@ -34,6 +34,7 @@ namespace Remotely_ScreenCast
static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
var argDict = ProcessArgs(args);
Mode = argDict["mode"];
RequesterID = argDict["requester"];
@ -52,8 +53,9 @@ namespace Remotely_ScreenCast
Capturer = new DXCapture();
CaptureMode = CaptureMode.DirectX;
}
catch
catch (Exception ex)
{
Logger.Write(ex);
Capturer = new BitBltCapture();
CaptureMode = CaptureMode.BitBtl;
}
@ -63,11 +65,13 @@ namespace Remotely_ScreenCast
MessageHandlers.ApplyConnectionHandlers(Connection, OutgoingMessages, Capturer);
OutgoingMessages.NotifyRequesterUnattendedReady(RequesterID).Wait();
Console.ReadKey();
}
internal static void BeginCapturing()
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Logger.Write((Exception)e.ExceptionObject);
}
private static async void HandleScreenChanged(object sender, Size size)

View File

@ -14,8 +14,8 @@ namespace Remotely_ScreenCapture.Sockets
public class MessageHandlers
{
public static void ApplyConnectionHandlers(HubConnection hubConnection,
OutgoingMessages outgoingMessages,
ICapturer capturer)
OutgoingMessages outgoingMessages,
ICapturer capturer)
{
hubConnection.Closed += (ex) =>
{

View File

@ -32,7 +32,7 @@ namespace Remotely_ScreenCapture.Sockets
public async Task NotifyRequesterUnattendedReady(string requesterID)
{
await Connection.SendAsync("UnattendedSessionReady", requesterID);
await Connection.SendAsync("NotifyRequesterUnattendedReady", requesterID);
}
}
}

View File

@ -81,11 +81,11 @@ namespace Remotely_Server.API
}
// GET api/<controller>/5
[HttpGet("PSCoreResult/{commandID}/{machineID}")]
[HttpGet("PSCoreResult/{commandID}/{deviceID}")]
[Authorize]
public PSCoreCommandResult PSCoreResult(string commandID, string machineID)
public PSCoreCommandResult PSCoreResult(string commandID, string deviceID)
{
return DataService.GetCommandContext(commandID, User.Identity.Name).PSCoreResults.Find(x => x.MachineID == machineID);
return DataService.GetCommandContext(commandID, User.Identity.Name).PSCoreResults.Find(x => x.DeviceID == deviceID);
}
// POST api/<controller>

View File

@ -15,10 +15,10 @@ namespace Remotely_Server.API
[Authorize]
[ApiController]
[Route("api/[controller]")]
public class MachinesController : Controller
public class DevicesController : Controller
{
public MachinesController(DataService dataService, UserManager<RemotelyUser> userManager)
public DevicesController(DataService dataService, UserManager<RemotelyUser> userManager)
{
this.DataService = dataService;
this.UserManager = userManager;
@ -28,19 +28,19 @@ namespace Remotely_Server.API
// GET: api/<controller>
[HttpGet]
public async Task<IEnumerable<Machine>> Get()
public async Task<IEnumerable<Device>> Get()
{
var user = await UserManager.GetUserAsync(User);
var machines = DataService.GetAllMachines(user.Id);
return machines;
var devices = DataService.GetAllDevicesForUser(user.Id);
return devices;
}
// GET api/<controller>/5
[HttpGet("{id}")]
public async Task<Machine> Get(string id)
public async Task<Device> Get(string id)
{
var user = await UserManager.GetUserAsync(User);
return DataService.GetMachine(user.Id, id);
return DataService.GetDeviceForUser(user.Id, id);
}
}
}

View File

@ -4,8 +4,8 @@
ViewData["Title"] = "Forgot your password?";
}
<h2>@ViewData["Title"]</h2>
<h4>Enter your email.</h4>
<h3>@ViewData["Title"]</h3>
<h5>Enter your email.</h5>
<hr />
<div class="row">
<div class="col-md-4">

View File

@ -6,12 +6,12 @@
ViewData["Title"] = "Log in";
}
<h2>@ViewData["Title"]</h2>
<h3>@ViewData["Title"]</h3>
<div class="row">
<div class="col-md-4">
<section>
<form method="post">
<h4>Use your Remotely account to log in.</h4>
<h5>Use your Remotely account to log in.</h5>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">

View File

@ -78,8 +78,8 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h5 class="modal-title">Command Mode Shortcuts</h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body">
<p>

View File

@ -3,10 +3,10 @@
Layout = "/Pages/Shared/_Layout.cshtml";
}
<h2>Manage your account</h2>
<h3>Manage your account</h3>
<div>
<h4>Change your account settings</h4>
<h5>Change your account settings</h5>
<hr />
<div class="row">
<div class="col-md-3">

View File

@ -5,14 +5,14 @@
ViewData["Title"] = "Register";
}
<h2>@ViewData["Title"]</h2>
<h3>@ViewData["Title"]</h3>
<div class="row">
@if (AppConfig.AllowSelfRegistration)
{
<div class="col-md-4">
<form asp-route-returnUrl="@Model.ReturnUrl" method="post">
<h4>Create a new account.</h4>
<h5>Create a new account.</h5>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
@ -37,7 +37,7 @@
else
{
<div class="col-sm-12">
<h4>Self-registration is disabled.</h4>
<h5>Self-registration is disabled.</h5>
</div>
}

View File

@ -20,7 +20,7 @@ namespace Remotely_Server.Data
public DbSet<Drive> Drives { get; set; }
public DbSet<Machine> Machines { get; set; }
public DbSet<Device> Devices { get; set; }
public DbSet<Organization> Organizations { get; set; }
@ -34,7 +34,7 @@ namespace Remotely_Server.Data
public DbSet<PermissionGroup> PermissionGroups { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
@ -42,7 +42,7 @@ namespace Remotely_Server.Data
builder.Entity<RemotelyUser>().ToTable("RemotelyUsers");
builder.Entity<Organization>()
.HasMany(x => x.Machines)
.HasMany(x => x.Devices)
.WithOne(x=>x.Organization);
builder.Entity<Organization>()
.HasMany(x => x.RemotelyUsers)
@ -65,7 +65,7 @@ namespace Remotely_Server.Data
builder.Entity<CommandContext>()
.Property(x=>x.TargetMachineIDs)
.Property(x=>x.TargetDeviceIDs)
.HasConversion(
x => JsonConvert.SerializeObject(x),
x => JsonConvert.DeserializeObject<string[]>(x));
@ -80,28 +80,25 @@ namespace Remotely_Server.Data
x => JsonConvert.SerializeObject(x),
x => JsonConvert.DeserializeObject<List<GenericCommandResult>>(x));
builder.Entity<RemotelyUser>()
.Property(x => x.UserOptions)
.HasConversion(
x => JsonConvert.SerializeObject(x),
x => JsonConvert.DeserializeObject<Remotely_Library.Models.RemotelyUserOptions>(x));
builder.Entity<RemotelyUser>()
.Property(x => x.PermissionGroups)
.HasConversion(
x => JsonConvert.SerializeObject(x),
x => JsonConvert.DeserializeObject<List<PermissionGroup>>(x)
);
builder.Entity<RemotelyUser>()
builder.Entity<RemotelyUser>()
.HasMany(x => x.PermissionGroups);
builder.Entity<Device>()
.HasMany(x => x.PermissionGroups);
builder.Entity<PermissionGroup>()
.HasMany(x => x.RemotelyUsers);
builder.Entity<PermissionGroup>()
.HasMany(x => x.Devices);
builder.Entity<RemotelyUser>()
.HasOne(x => x.Organization);
builder.Entity<Machine>()
builder.Entity<Device>()
.HasMany(x => x.Drives);
builder.Entity<RemotelyUser>()
.Property(x => x.PermissionGroups)
.HasConversion(
x => JsonConvert.SerializeObject(x),
x => JsonConvert.DeserializeObject<List<PermissionGroup>>(x)
);
}
}
}

View File

@ -46,27 +46,27 @@ namespace Remotely_Server.Data
RemotelyContext.SaveChanges();
}
public bool AddOrUpdateMachine(Machine machine)
public bool AddOrUpdateDevice(Device device)
{
var existingMachine = RemotelyContext.Machines.Find(machine.ID);
if (existingMachine != null)
var existingDevice = RemotelyContext.Devices.Find(device.ID);
if (existingDevice != null)
{
machine.ServerVerificationToken = existingMachine.ServerVerificationToken;
RemotelyContext.Entry(existingMachine).CurrentValues.SetValues(machine);
device.ServerVerificationToken = existingDevice.ServerVerificationToken;
RemotelyContext.Entry(existingDevice).CurrentValues.SetValues(device);
}
else
{
if (!RemotelyContext.Organizations.Any(x => x.ID == machine.OrganizationID))
if (!RemotelyContext.Organizations.Any(x => x.ID == device.OrganizationID))
{
WriteEvent(new EventLog()
{
EventType = EventTypes.Info,
Message = $"Unable to add machine {machine.MachineName} because organization {machine.OrganizationID} does not exist.",
Source = "DataService.AddOrUpdateMachine"
Message = $"Unable to add device {device.DeviceName} because organization {device.OrganizationID} does not exist.",
Source = "DataService.AddOrUpdateDevice"
});
return false;
}
RemotelyContext.Machines.Add(machine);
RemotelyContext.Devices.Add(device);
}
RemotelyContext.SaveChanges();
return true;
@ -78,7 +78,7 @@ namespace Remotely_Server.Data
.Include(x => x.RemotelyUsers)
.Include(x => x.CommandContexts)
.Include(x => x.InviteLinks)
.Include(x => x.Machines)
.Include(x => x.Devices)
.Include(x => x.SharedFiles)
.Include(x => x.PermissionGroups)
.Where(x => x.RemotelyUsers.Count == 0);
@ -99,66 +99,57 @@ namespace Remotely_Server.Data
return RemotelyContext.Users.Any(x => x.UserName == userName);
}
public bool DoesUserHaveAccessToMachine(string machineID, RemotelyUser remotelyUser)
public bool DoesUserHaveAccessToDevice(string deviceID, RemotelyUser remotelyUser)
{
return RemotelyContext.Machines.Any(x =>
return RemotelyContext.Devices.Any(x =>
x.OrganizationID == remotelyUser.OrganizationID &&
(
x.PermissionGroups.Count == 0 ||
x.PermissionGroups.Any(y => remotelyUser.PermissionGroups.Any(z => z.ID == y.ID))
) &&
x.ID == machineID);
x.ID == deviceID);
}
public string[] FilterMachineIDsByUserPermission(string[] machineIDs, RemotelyUser remotelyUser)
public string[] FilterDeviceIDsByUserPermission(string[] deviceIDs, RemotelyUser remotelyUser)
{
return RemotelyContext.Machines.Where(x =>
return RemotelyContext.Devices.Where(x =>
x.OrganizationID == remotelyUser.OrganizationID &&
(
x.PermissionGroups.Count == 0 ||
x.PermissionGroups.Any(y => remotelyUser.PermissionGroups.Any(z => z.ID == y.ID))
) &&
machineIDs.Contains(x.ID))
deviceIDs.Contains(x.ID))
.Select(x => x.ID)
.ToArray();
}
public IEnumerable<CommandContext> GetAllCommandContexts(string userName)
{
var orgID = GetUserByName(userName).OrganizationID;
var orgID = GetUserByName(userName).OrganizationID;
return RemotelyContext.CommandContexts.Where(x => x.OrganizationID == orgID);
}
public IEnumerable<Machine> GetAllMachines(string userID)
public IEnumerable<Device> GetAllDevicesForUser(string userID)
{
var orgID = GetUserByID(userID).OrganizationID;
var user = RemotelyContext.Users
.Include(x => x.PermissionGroups)
.FirstOrDefault(x => x.Id == userID);
var machines = RemotelyContext.Machines
.Include(x => x.Drives)
.Where(x => x.OrganizationID == orgID)
.Select(x=> new Machine()
{
CurrentUser = x.CurrentUser,
Drives = x.Drives,
FreeMemory = x.FreeMemory,
FreeStorage = x.FreeStorage,
ID = x.ID,
Is64Bit = x.Is64Bit,
IsOnline = x.IsOnline,
LastOnline = x.LastOnline,
MachineName = x.MachineName,
OrganizationID = x.OrganizationID,
OSArchitecture = x.OSArchitecture,
OSDescription = x.OSDescription,
PermissionGroups = x.PermissionGroups,
Platform = x.Platform,
ProcessorCount = x.ProcessorCount,
Tags = x.Tags,
TotalMemory = x.TotalMemory,
TotalStorage = x.TotalStorage
});
var result = RemotelyContext.Devices
.Include(x => x.PermissionGroups)
.Include(x => x.Drives)
.Where(x => x.OrganizationID == user.OrganizationID);
return machines;
if (user.IsAdministrator)
{
return result;
}
else
{
return result.Where(x =>
x.PermissionGroups.Count == 0 ||
x.PermissionGroups.Any(y => user.PermissionGroups.Any(z => z.ID == y.ID)));
}
}
@ -194,33 +185,27 @@ namespace Remotely_Server.Data
return AppConfig.DefaultPrompt;
}
public Machine GetMachine(string userID, string machineID)
public Device GetDeviceForUser(string userID, string deviceID)
{
var orgID = GetUserByID(userID).OrganizationID;
var user = RemotelyContext.Users
.Include(x => x.PermissionGroups)
.FirstOrDefault(x => x.Id == userID);
return RemotelyContext.Machines
.Where(x => x.OrganizationID == orgID && x.ID == machineID)
.Select(x => new Machine()
{
CurrentUser = x.CurrentUser,
Drives = x.Drives,
FreeMemory = x.FreeMemory,
FreeStorage = x.FreeStorage,
ID = x.ID,
Is64Bit = x.Is64Bit,
IsOnline = x.IsOnline,
LastOnline = x.LastOnline,
MachineName = x.MachineName,
OrganizationID = x.OrganizationID,
OSArchitecture = x.OSArchitecture,
OSDescription = x.OSDescription,
PermissionGroups = x.PermissionGroups,
Platform = x.Platform,
ProcessorCount = x.ProcessorCount,
Tags = x.Tags,
TotalMemory = x.TotalMemory,
TotalStorage = x.TotalStorage
}).FirstOrDefault();
var result = RemotelyContext.Devices
.Include(x => x.PermissionGroups)
.Include(x => x.Drives)
.Where(x =>
x.OrganizationID == user.OrganizationID &&
x.ID == deviceID);
if (!user.IsAdministrator)
{
result = result.Where(x =>
x.PermissionGroups.Count == 0 ||
x.PermissionGroups.Any(y => user.PermissionGroups.Any(z => z.ID == y.ID)));
}
return result.FirstOrDefault();
}
public RemotelyUser GetUserByID(string userID)
@ -245,37 +230,37 @@ namespace Remotely_Server.Data
.FirstOrDefault(x => x.UserName == userName);
}
public void MachineDisconnected(string machineID)
public void DeviceDisconnected(string deviceID)
{
var machine = RemotelyContext.Machines.Find(machineID);
if (machine != null)
var device = RemotelyContext.Devices.Find(deviceID);
if (device != null)
{
machine.LastOnline = DateTime.Now;
machine.IsOnline = false;
device.LastOnline = DateTime.Now;
device.IsOnline = false;
RemotelyContext.SaveChanges();
}
}
public void RemoveMachines(string[] machineIDs)
public void RemoveDevices(string[] deviceIDs)
{
var machines = RemotelyContext.Machines
var devices = RemotelyContext.Devices
.Include(x => x.Drives)
.Where(x => machineIDs.Contains(x.ID));
foreach (var machine in machines)
.Where(x => deviceIDs.Contains(x.ID));
foreach (var device in devices)
{
if (machine?.Drives?.Count > 0)
if (device?.Drives?.Count > 0)
{
RemotelyContext.Drives.RemoveRange(machine.Drives);
RemotelyContext.Drives.RemoveRange(device.Drives);
}
RemotelyContext.Machines.Remove(machine);
RemotelyContext.Devices.Remove(device);
}
RemotelyContext.SaveChanges();
}
public void SetAllMachinesNotOnline()
public void SetAllDevicesNotOnline()
{
RemotelyContext.Machines.ForEachAsync(x =>
RemotelyContext.Devices.ForEachAsync(x =>
{
x.IsOnline = false;
});
@ -350,26 +335,26 @@ namespace Remotely_Server.Data
return Tuple.Create(true, newPermission.ID);
}
internal void AddPermissionToMachines(string userID, string[] machineIDs, string groupName)
internal void AddPermissionToDevices(string userID, string[] deviceIDs, string groupName)
{
var user = RemotelyContext.Users
.Include(x => x.Organization)
.Include(x => x.Organization)
.ThenInclude(x => x.Machines)
.ThenInclude(x => x.Devices)
.FirstOrDefault(x => x.Id == userID);
var group = user.Organization.PermissionGroups.FirstOrDefault(x => x.Name.ToLower() == groupName.ToLower());
foreach (var machineID in machineIDs)
foreach (var deviceID in deviceIDs)
{
if (user.Organization.Machines.Exists(x => x.ID == machineID))
if (user.Organization.Devices.Exists(x => x.ID == deviceID))
{
var machine = RemotelyContext.Machines
var device = RemotelyContext.Devices
.Include(x => x.PermissionGroups)
.FirstOrDefault(x => x.ID == machineID);
if (!machine.PermissionGroups.Exists(x => x.ID == group.ID))
.FirstOrDefault(x => x.ID == deviceID);
if (!device.PermissionGroups.Exists(x => x.ID == group.ID))
{
machine.PermissionGroups.Add(group);
RemotelyContext.Entry(machine).State = EntityState.Modified;
device.PermissionGroups.Add(group);
RemotelyContext.Entry(device).State = EntityState.Modified;
}
}
}
@ -383,7 +368,8 @@ namespace Remotely_Server.Data
.FirstOrDefault(x => x.UserName == requesterUserName);
var user = RemotelyContext.Users
.FirstOrDefault(x => x.OrganizationID == requester.OrganizationID && x.Id == targetUserID);
.Include(x => x.PermissionGroups)
.FirstOrDefault(x => x.OrganizationID == requester.OrganizationID && x.Id == targetUserID);
if (user.PermissionGroups.Exists(x => x.ID == permissionID))
{
@ -394,7 +380,6 @@ namespace Remotely_Server.Data
.Include(x => x.Organization)
.Where(x => x.Organization.ID == requester.Organization.ID);
user.PermissionGroups.Add(permissions.FirstOrDefault(x => x.ID == permissionID));
RemotelyContext.Entry(user).State = EntityState.Modified;
RemotelyContext.SaveChanges();
return Tuple.Create(true, "");
}
@ -454,7 +439,7 @@ namespace Remotely_Server.Data
RemotelyContext.Remove(x);
});
RemotelyContext.Machines
RemotelyContext.Devices
.Where(x => DateTime.Now - x.LastOnline > TimeSpan.FromDays(AppConfig.DataRetentionInDays))
.ForEachAsync(x =>
{
@ -542,6 +527,7 @@ namespace Remotely_Server.Data
var targetUser = RemotelyContext.Users
.Include(x => x.Organization)
.ThenInclude(x => x.RemotelyUsers)
.ThenInclude(x => x.PermissionGroups)
.FirstOrDefault(x => x.UserName == requesterUserName)
.Organization
.RemotelyUsers
@ -566,6 +552,7 @@ namespace Remotely_Server.Data
var user = RemotelyContext.Users
.Include(x => x.Organization)
.Include(x => x.PermissionGroups)
.FirstOrDefault(x => x.UserName == userName);
user.Organization = invite.Organization;
@ -594,23 +581,23 @@ namespace Remotely_Server.Data
RemotelyContext.SaveChanges();
}
internal void RemovePermissionFromMachines(string userID, string[] machineIDs, string groupName)
internal void RemovePermissionFromDevices(string userID, string[] deviceIDs, string groupName)
{
var user = RemotelyContext.Users
.Include(x => x.Organization)
.ThenInclude(x => x.Machines)
.ThenInclude(x => x.Devices)
.FirstOrDefault(x => x.Id == userID);
var group = user.Organization.PermissionGroups.FirstOrDefault(x => x.Name.ToLower() == groupName.ToLower());
foreach (var machineID in machineIDs)
foreach (var deviceID in deviceIDs)
{
if (user.Organization.Machines.Exists(x => x.ID == machineID))
if (user.Organization.Devices.Exists(x => x.ID == deviceID))
{
var machine = RemotelyContext.Machines
var device = RemotelyContext.Devices
.Include(x => x.PermissionGroups)
.FirstOrDefault(x => x.ID == machineID);
machine.PermissionGroups.RemoveAll(x => x.ID == group.ID);
RemotelyContext.Entry(machine).State = EntityState.Modified;
.FirstOrDefault(x => x.ID == deviceID);
device.PermissionGroups.RemoveAll(x => x.ID == group.ID);
RemotelyContext.Entry(device).State = EntityState.Modified;
}
}
RemotelyContext.SaveChanges();
@ -620,6 +607,7 @@ namespace Remotely_Server.Data
var requester = RemotelyContext.Users
.Include(x => x.Organization)
.ThenInclude(x => x.RemotelyUsers)
.ThenInclude(x => x.PermissionGroups)
.FirstOrDefault(x => x.UserName == requesterUserName);
var target = requester.Organization.RemotelyUsers.FirstOrDefault(x => x.Id == targetUserID);
@ -628,12 +616,12 @@ namespace Remotely_Server.Data
RemotelyContext.SaveChanges();
}
internal void SetServerVerificationToken(string machineID, string verificationToken)
internal void SetServerVerificationToken(string deviceID, string verificationToken)
{
var machine = RemotelyContext.Machines.Find(machineID);
if (machine != null)
var device = RemotelyContext.Devices.Find(deviceID);
if (device != null)
{
machine.ServerVerificationToken = verificationToken;
device.ServerVerificationToken = verificationToken;
RemotelyContext.SaveChanges();
}
}
@ -648,9 +636,9 @@ namespace Remotely_Server.Data
RemotelyContext.SaveChanges();
}
internal void UpdateTags(string machineID, string tag)
internal void UpdateTags(string deviceID, string tag)
{
RemotelyContext.Machines.Find(machineID).Tags = tag;
RemotelyContext.Devices.Find(deviceID).Tags = tag;
RemotelyContext.SaveChanges();
}

View File

@ -1,256 +1,22 @@
// <auto-generated />
using System;
using Remotely_Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Remotely_Server.Data;
namespace Remotely_Server.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190118025611_Initial")]
[Migration("20190225192927_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.1-servicing-10028")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Library.Models.CommandContext", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandMode");
b.Property<string>("CommandResults");
b.Property<string>("CommandText");
b.Property<string>("OrganizationID");
b.Property<string>("PSCoreResults");
b.Property<string>("SenderConnectionID");
b.Property<string>("SenderUserID");
b.Property<string>("TargetMachineIDs");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("CommandContexts");
});
modelBuilder.Entity("Library.Models.RemotelyUserOptions", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandModeShortcutBash")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutCMD")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutRemotely")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutPSCore")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutWinPS")
.HasMaxLength(10);
b.Property<string>("ConsolePrompt")
.HasMaxLength(5);
b.HasKey("ID");
b.ToTable("RemotelyUserOptions");
});
modelBuilder.Entity("Library.Models.Drive", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("DriveFormat");
b.Property<int>("DriveType");
b.Property<double>("FreeSpace");
b.Property<string>("MachineID");
b.Property<string>("Name");
b.Property<string>("RootDirectory");
b.Property<double>("TotalSize");
b.Property<string>("VolumeLabel");
b.HasKey("ID");
b.HasIndex("MachineID");
b.ToTable("Drives");
});
modelBuilder.Entity("Library.Models.EventLog", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("EventType");
b.Property<string>("Message");
b.Property<string>("OrganizationID");
b.Property<string>("Source");
b.Property<string>("StackTrace");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("EventLogs");
});
modelBuilder.Entity("Library.Models.InviteLink", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateSent");
b.Property<string>("InvitedUser");
b.Property<bool>("IsAdmin");
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("InviteLinks");
});
modelBuilder.Entity("Library.Models.Machine", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CurrentUser");
b.Property<double>("FreeMemory");
b.Property<double>("FreeStorage");
b.Property<bool>("Is64Bit");
b.Property<bool>("IsOnline");
b.Property<DateTime>("LastOnline");
b.Property<string>("MachineName");
b.Property<int>("OSArchitecture");
b.Property<string>("OSDescription");
b.Property<string>("OrganizationID");
b.Property<string>("Platform");
b.Property<int>("ProcessorCount");
b.Property<string>("ServerVerificationToken");
b.Property<string>("Tags")
.HasMaxLength(200);
b.Property<double>("TotalMemory");
b.Property<double>("TotalStorage");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("Machines");
});
modelBuilder.Entity("Library.Models.Organization", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("OrganizationName")
.HasMaxLength(25);
b.HasKey("ID");
b.ToTable("Organizations");
});
modelBuilder.Entity("Library.Models.PermissionGroup", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("MachineID");
b.Property<string>("Name")
.HasMaxLength(100);
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("MachineID");
b.HasIndex("OrganizationID");
b.ToTable("PermissionGroups");
});
modelBuilder.Entity("Library.Models.SharedFile", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("ContentType");
b.Property<byte[]>("FileContents");
b.Property<string>("FileName");
b.Property<string>("OrganizationID");
b.Property<DateTime>("Timestamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("SharedFiles");
});
.HasAnnotation("ProductVersion", "2.2.2-servicing-10034");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
@ -270,8 +36,7 @@ namespace Remotely_Server.Migrations
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
@ -279,8 +44,7 @@ namespace Remotely_Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
@ -344,8 +108,7 @@ namespace Remotely_Server.Migrations
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
.HasName("UserNameIndex");
b.ToTable("RemotelyUsers");
@ -355,8 +118,7 @@ namespace Remotely_Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
@ -422,7 +184,246 @@ namespace Remotely_Server.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Library.Models.RemotelyUser", b =>
modelBuilder.Entity("Remotely_Library.Models.CommandContext", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandMode");
b.Property<string>("CommandResults");
b.Property<string>("CommandText");
b.Property<string>("OrganizationID");
b.Property<string>("PSCoreResults");
b.Property<string>("SenderConnectionID");
b.Property<string>("SenderUserID");
b.Property<string>("TargetDeviceIDs");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("CommandContexts");
});
modelBuilder.Entity("Remotely_Library.Models.Device", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CurrentUser");
b.Property<string>("DeviceName");
b.Property<double>("FreeMemory");
b.Property<double>("FreeStorage");
b.Property<bool>("Is64Bit");
b.Property<bool>("IsOnline");
b.Property<DateTime>("LastOnline");
b.Property<int>("OSArchitecture");
b.Property<string>("OSDescription");
b.Property<string>("OrganizationID");
b.Property<string>("PermissionGroupID");
b.Property<string>("Platform");
b.Property<int>("ProcessorCount");
b.Property<string>("ServerVerificationToken");
b.Property<string>("Tags")
.HasMaxLength(200);
b.Property<double>("TotalMemory");
b.Property<double>("TotalStorage");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.HasIndex("PermissionGroupID");
b.ToTable("Devices");
});
modelBuilder.Entity("Remotely_Library.Models.Drive", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("DeviceID");
b.Property<string>("DriveFormat");
b.Property<int>("DriveType");
b.Property<double>("FreeSpace");
b.Property<string>("Name");
b.Property<string>("RootDirectory");
b.Property<double>("TotalSize");
b.Property<string>("VolumeLabel");
b.HasKey("ID");
b.HasIndex("DeviceID");
b.ToTable("Drives");
});
modelBuilder.Entity("Remotely_Library.Models.EventLog", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("EventType");
b.Property<string>("Message");
b.Property<string>("OrganizationID");
b.Property<string>("Source");
b.Property<string>("StackTrace");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("EventLogs");
});
modelBuilder.Entity("Remotely_Library.Models.InviteLink", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateSent");
b.Property<string>("InvitedUser");
b.Property<bool>("IsAdmin");
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("InviteLinks");
});
modelBuilder.Entity("Remotely_Library.Models.Organization", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("OrganizationName")
.HasMaxLength(25);
b.HasKey("ID");
b.ToTable("Organizations");
});
modelBuilder.Entity("Remotely_Library.Models.PermissionGroup", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("DeviceID");
b.Property<string>("Name")
.HasMaxLength(100);
b.Property<string>("OrganizationID");
b.Property<string>("RemotelyUserId");
b.HasKey("ID");
b.HasIndex("DeviceID");
b.HasIndex("OrganizationID");
b.HasIndex("RemotelyUserId");
b.ToTable("PermissionGroups");
});
modelBuilder.Entity("Remotely_Library.Models.RemotelyUserOptions", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandModeShortcutBash")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutCMD")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutPSCore")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutRemotely")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutWinPS")
.HasMaxLength(10);
b.Property<string>("ConsolePrompt")
.HasMaxLength(5);
b.HasKey("ID");
b.ToTable("RemotelyUserOptions");
});
modelBuilder.Entity("Remotely_Library.Models.SharedFile", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("ContentType");
b.Property<byte[]>("FileContents");
b.Property<string>("FileName");
b.Property<string>("OrganizationID");
b.Property<DateTime>("Timestamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("SharedFiles");
});
modelBuilder.Entity("Remotely_Library.Models.RemotelyUser", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
@ -430,70 +431,21 @@ namespace Remotely_Server.Migrations
b.Property<string>("OrganizationID");
b.Property<string>("PermissionGroups");
b.Property<string>("PermissionGroupID");
b.Property<string>("UserOptions");
b.Property<string>("UserOptionsID");
b.HasIndex("OrganizationID");
b.HasIndex("PermissionGroupID");
b.HasIndex("UserOptionsID");
b.ToTable("RemotelyUsers");
b.HasDiscriminator().HasValue("RemotelyUser");
});
modelBuilder.Entity("Library.Models.CommandContext", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("CommandContexts")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.Drive", b =>
{
b.HasOne("Library.Models.Machine")
.WithMany("Drives")
.HasForeignKey("MachineID");
});
modelBuilder.Entity("Library.Models.EventLog", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("EventLogs")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.InviteLink", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("InviteLinks")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.Machine", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("Machines")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.PermissionGroup", b =>
{
b.HasOne("Library.Models.Machine")
.WithMany("PermissionGroups")
.HasForeignKey("MachineID");
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("PermissionGroups")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.SharedFile", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("SharedFiles")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
@ -539,11 +491,80 @@ namespace Remotely_Server.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Library.Models.RemotelyUser", b =>
modelBuilder.Entity("Remotely_Library.Models.CommandContext", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("CommandContexts")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Library.Models.Device", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("Devices")
.HasForeignKey("OrganizationID");
b.HasOne("Remotely_Library.Models.PermissionGroup")
.WithMany("Devices")
.HasForeignKey("PermissionGroupID");
});
modelBuilder.Entity("Remotely_Library.Models.Drive", b =>
{
b.HasOne("Remotely_Library.Models.Device")
.WithMany("Drives")
.HasForeignKey("DeviceID");
});
modelBuilder.Entity("Remotely_Library.Models.EventLog", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("EventLogs")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Library.Models.InviteLink", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("InviteLinks")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Library.Models.PermissionGroup", b =>
{
b.HasOne("Remotely_Library.Models.Device")
.WithMany("PermissionGroups")
.HasForeignKey("DeviceID");
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("PermissionGroups")
.HasForeignKey("OrganizationID");
b.HasOne("Remotely_Library.Models.RemotelyUser")
.WithMany("PermissionGroups")
.HasForeignKey("RemotelyUserId");
});
modelBuilder.Entity("Remotely_Library.Models.SharedFile", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("SharedFiles")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Library.Models.RemotelyUser", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("RemotelyUsers")
.HasForeignKey("OrganizationID");
b.HasOne("Remotely_Library.Models.PermissionGroup")
.WithMany("RemotelyUsers")
.HasForeignKey("PermissionGroupID");
b.HasOne("Remotely_Library.Models.RemotelyUserOptions", "UserOptions")
.WithMany()
.HasForeignKey("UserOptionsID");
});
#pragma warning restore 612, 618
}

View File

@ -1,5 +1,4 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Remotely_Server.Migrations
@ -22,6 +21,18 @@ namespace Remotely_Server.Migrations
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Organizations",
columns: table => new
{
ID = table.Column<string>(nullable: false),
OrganizationName = table.Column<string>(maxLength: 25, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Organizations", x => x.ID);
});
migrationBuilder.CreateTable(
name: "RemotelyUserOptions",
columns: table => new
@ -39,24 +50,12 @@ namespace Remotely_Server.Migrations
table.PrimaryKey("PK_RemotelyUserOptions", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Organizations",
columns: table => new
{
ID = table.Column<string>(nullable: false),
OrganizationName = table.Column<string>(maxLength: 25, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Organizations", x => x.ID);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
.Annotation("Sqlite:Autoincrement", true),
RoleId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true)
@ -81,7 +80,7 @@ namespace Remotely_Server.Migrations
CommandText = table.Column<string>(nullable: true),
SenderUserID = table.Column<string>(nullable: true),
SenderConnectionID = table.Column<string>(nullable: true),
TargetMachineIDs = table.Column<string>(nullable: true),
TargetDeviceIDs = table.Column<string>(nullable: true),
PSCoreResults = table.Column<string>(nullable: true),
CommandResults = table.Column<string>(nullable: true),
TimeStamp = table.Column<DateTime>(nullable: false),
@ -98,42 +97,6 @@ namespace Remotely_Server.Migrations
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "RemotelyUsers",
columns: table => new
{
Id = table.Column<string>(nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
PasswordHash = table.Column<string>(nullable: true),
SecurityStamp = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
TwoFactorEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
LockoutEnabled = table.Column<bool>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false),
Discriminator = table.Column<string>(nullable: false),
UserOptions = table.Column<string>(nullable: true),
OrganizationID = table.Column<string>(nullable: true),
PermissionGroups = table.Column<string>(nullable: true),
IsAdministrator = table.Column<bool>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RemotelyUsers", x => x.Id);
table.ForeignKey(
name: "FK_RemotelyUsers_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "EventLogs",
columns: table => new
@ -178,39 +141,6 @@ namespace Remotely_Server.Migrations
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Machines",
columns: table => new
{
ID = table.Column<string>(nullable: false),
Is64Bit = table.Column<bool>(nullable: false),
IsOnline = table.Column<bool>(nullable: false),
LastOnline = table.Column<DateTime>(nullable: false),
MachineName = table.Column<string>(nullable: true),
OrganizationID = table.Column<string>(nullable: true),
OSArchitecture = table.Column<int>(nullable: false),
OSDescription = table.Column<string>(nullable: true),
Platform = table.Column<string>(nullable: true),
ProcessorCount = table.Column<int>(nullable: false),
TotalMemory = table.Column<double>(nullable: false),
FreeStorage = table.Column<double>(nullable: false),
TotalStorage = table.Column<double>(nullable: false),
FreeMemory = table.Column<double>(nullable: false),
CurrentUser = table.Column<string>(nullable: true),
Tags = table.Column<string>(maxLength: 200, nullable: true),
ServerVerificationToken = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Machines", x => x.ID);
table.ForeignKey(
name: "FK_Machines_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "SharedFiles",
columns: table => new
@ -233,12 +163,158 @@ namespace Remotely_Server.Migrations
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
RoleId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Drives",
columns: table => new
{
ID = table.Column<string>(nullable: false),
DriveType = table.Column<int>(nullable: false),
RootDirectory = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
DriveFormat = table.Column<string>(nullable: true),
FreeSpace = table.Column<double>(nullable: false),
TotalSize = table.Column<double>(nullable: false),
VolumeLabel = table.Column<string>(nullable: true),
DeviceID = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Drives", x => x.ID);
});
migrationBuilder.CreateTable(
name: "PermissionGroups",
columns: table => new
{
ID = table.Column<string>(nullable: false),
Name = table.Column<string>(maxLength: 100, nullable: true),
OrganizationID = table.Column<string>(nullable: true),
DeviceID = table.Column<string>(nullable: true),
RemotelyUserId = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PermissionGroups", x => x.ID);
table.ForeignKey(
name: "FK_PermissionGroups_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Devices",
columns: table => new
{
ID = table.Column<string>(nullable: false),
CurrentUser = table.Column<string>(nullable: true),
FreeMemory = table.Column<double>(nullable: false),
FreeStorage = table.Column<double>(nullable: false),
Is64Bit = table.Column<bool>(nullable: false),
IsOnline = table.Column<bool>(nullable: false),
LastOnline = table.Column<DateTime>(nullable: false),
DeviceName = table.Column<string>(nullable: true),
OrganizationID = table.Column<string>(nullable: true),
OSArchitecture = table.Column<int>(nullable: false),
OSDescription = table.Column<string>(nullable: true),
Platform = table.Column<string>(nullable: true),
ProcessorCount = table.Column<int>(nullable: false),
ServerVerificationToken = table.Column<string>(nullable: true),
Tags = table.Column<string>(maxLength: 200, nullable: true),
TotalMemory = table.Column<double>(nullable: false),
TotalStorage = table.Column<double>(nullable: false),
PermissionGroupID = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Devices", x => x.ID);
table.ForeignKey(
name: "FK_Devices_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Devices_PermissionGroups_PermissionGroupID",
column: x => x.PermissionGroupID,
principalTable: "PermissionGroups",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "RemotelyUsers",
columns: table => new
{
Id = table.Column<string>(nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
PasswordHash = table.Column<string>(nullable: true),
SecurityStamp = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
TwoFactorEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
LockoutEnabled = table.Column<bool>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false),
Discriminator = table.Column<string>(nullable: false),
UserOptionsID = table.Column<string>(nullable: true),
OrganizationID = table.Column<string>(nullable: true),
IsAdministrator = table.Column<bool>(nullable: true),
PermissionGroupID = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RemotelyUsers", x => x.Id);
table.ForeignKey(
name: "FK_RemotelyUsers_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_RemotelyUsers_PermissionGroups_PermissionGroupID",
column: x => x.PermissionGroupID,
principalTable: "PermissionGroups",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_RemotelyUsers_RemotelyUserOptions_UserOptionsID",
column: x => x.UserOptionsID,
principalTable: "RemotelyUserOptions",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
.Annotation("Sqlite:Autoincrement", true),
UserId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true)
@ -274,30 +350,6 @@ namespace Remotely_Server.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
RoleId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AspNetUserRoles_RemotelyUsers_UserId",
column: x => x.UserId,
principalTable: "RemotelyUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
@ -318,57 +370,6 @@ namespace Remotely_Server.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Drives",
columns: table => new
{
ID = table.Column<string>(nullable: false),
DriveType = table.Column<int>(nullable: false),
RootDirectory = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
DriveFormat = table.Column<string>(nullable: true),
FreeSpace = table.Column<double>(nullable: false),
TotalSize = table.Column<double>(nullable: false),
VolumeLabel = table.Column<string>(nullable: true),
MachineID = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Drives", x => x.ID);
table.ForeignKey(
name: "FK_Drives_Machines_MachineID",
column: x => x.MachineID,
principalTable: "Machines",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "PermissionGroups",
columns: table => new
{
ID = table.Column<string>(nullable: false),
Name = table.Column<string>(maxLength: 100, nullable: true),
OrganizationID = table.Column<string>(nullable: true),
MachineID = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PermissionGroups", x => x.ID);
table.ForeignKey(
name: "FK_PermissionGroups_Machines_MachineID",
column: x => x.MachineID,
principalTable: "Machines",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_PermissionGroups_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
@ -378,8 +379,7 @@ namespace Remotely_Server.Migrations
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true,
filter: "[NormalizedName] IS NOT NULL");
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
@ -402,26 +402,19 @@ namespace Remotely_Server.Migrations
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "IX_RemotelyUsers_OrganizationID",
table: "RemotelyUsers",
name: "IX_Devices_OrganizationID",
table: "Devices",
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "RemotelyUsers",
column: "NormalizedEmail");
name: "IX_Devices_PermissionGroupID",
table: "Devices",
column: "PermissionGroupID");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "RemotelyUsers",
column: "NormalizedUserName",
unique: true,
filter: "[NormalizedUserName] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Drives_MachineID",
name: "IX_Drives_DeviceID",
table: "Drives",
column: "MachineID");
column: "DeviceID");
migrationBuilder.CreateIndex(
name: "IX_EventLogs_OrganizationID",
@ -434,28 +427,102 @@ namespace Remotely_Server.Migrations
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "IX_Machines_OrganizationID",
table: "Machines",
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "IX_PermissionGroups_MachineID",
name: "IX_PermissionGroups_DeviceID",
table: "PermissionGroups",
column: "MachineID");
column: "DeviceID");
migrationBuilder.CreateIndex(
name: "IX_PermissionGroups_OrganizationID",
table: "PermissionGroups",
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "IX_PermissionGroups_RemotelyUserId",
table: "PermissionGroups",
column: "RemotelyUserId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "RemotelyUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "RemotelyUsers",
column: "NormalizedUserName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RemotelyUsers_OrganizationID",
table: "RemotelyUsers",
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "IX_RemotelyUsers_PermissionGroupID",
table: "RemotelyUsers",
column: "PermissionGroupID");
migrationBuilder.CreateIndex(
name: "IX_RemotelyUsers_UserOptionsID",
table: "RemotelyUsers",
column: "UserOptionsID");
migrationBuilder.CreateIndex(
name: "IX_SharedFiles_OrganizationID",
table: "SharedFiles",
column: "OrganizationID");
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserRoles_RemotelyUsers_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "RemotelyUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Drives_Devices_DeviceID",
table: "Drives",
column: "DeviceID",
principalTable: "Devices",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PermissionGroups_RemotelyUsers_RemotelyUserId",
table: "PermissionGroups",
column: "RemotelyUserId",
principalTable: "RemotelyUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PermissionGroups_Devices_DeviceID",
table: "PermissionGroups",
column: "DeviceID",
principalTable: "Devices",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PermissionGroups_RemotelyUsers_RemotelyUserId",
table: "PermissionGroups");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Organizations_OrganizationID",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_PermissionGroups_Organizations_OrganizationID",
table: "PermissionGroups");
migrationBuilder.DropForeignKey(
name: "FK_Devices_PermissionGroups_PermissionGroupID",
table: "Devices");
migrationBuilder.DropTable(
name: "AspNetRoleClaims");
@ -474,9 +541,6 @@ namespace Remotely_Server.Migrations
migrationBuilder.DropTable(
name: "CommandContexts");
migrationBuilder.DropTable(
name: "RemotelyUserOptions");
migrationBuilder.DropTable(
name: "Drives");
@ -486,9 +550,6 @@ namespace Remotely_Server.Migrations
migrationBuilder.DropTable(
name: "InviteLinks");
migrationBuilder.DropTable(
name: "PermissionGroups");
migrationBuilder.DropTable(
name: "SharedFiles");
@ -499,10 +560,16 @@ namespace Remotely_Server.Migrations
name: "RemotelyUsers");
migrationBuilder.DropTable(
name: "Machines");
name: "RemotelyUserOptions");
migrationBuilder.DropTable(
name: "Organizations");
migrationBuilder.DropTable(
name: "PermissionGroups");
migrationBuilder.DropTable(
name: "Devices");
}
}
}

View File

@ -1,10 +1,9 @@
// <auto-generated />
using System;
using Remotely_Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Remotely_Server.Data;
namespace Remotely_Server.Migrations
{
@ -15,240 +14,7 @@ namespace Remotely_Server.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.1-servicing-10028")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Library.Models.CommandContext", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandMode");
b.Property<string>("CommandResults");
b.Property<string>("CommandText");
b.Property<string>("OrganizationID");
b.Property<string>("PSCoreResults");
b.Property<string>("SenderConnectionID");
b.Property<string>("SenderUserID");
b.Property<string>("TargetMachineIDs");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("CommandContexts");
});
modelBuilder.Entity("Library.Models.RemotelyUserOptions", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandModeShortcutBash")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutCMD")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutRemotely")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutPSCore")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutWinPS")
.HasMaxLength(10);
b.Property<string>("ConsolePrompt")
.HasMaxLength(5);
b.HasKey("ID");
b.ToTable("RemotelyUserOptions");
});
modelBuilder.Entity("Library.Models.Drive", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("DriveFormat");
b.Property<int>("DriveType");
b.Property<double>("FreeSpace");
b.Property<string>("MachineID");
b.Property<string>("Name");
b.Property<string>("RootDirectory");
b.Property<double>("TotalSize");
b.Property<string>("VolumeLabel");
b.HasKey("ID");
b.HasIndex("MachineID");
b.ToTable("Drives");
});
modelBuilder.Entity("Library.Models.EventLog", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("EventType");
b.Property<string>("Message");
b.Property<string>("OrganizationID");
b.Property<string>("Source");
b.Property<string>("StackTrace");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("EventLogs");
});
modelBuilder.Entity("Library.Models.InviteLink", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateSent");
b.Property<string>("InvitedUser");
b.Property<bool>("IsAdmin");
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("InviteLinks");
});
modelBuilder.Entity("Library.Models.Machine", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CurrentUser");
b.Property<double>("FreeMemory");
b.Property<double>("FreeStorage");
b.Property<bool>("Is64Bit");
b.Property<bool>("IsOnline");
b.Property<DateTime>("LastOnline");
b.Property<string>("MachineName");
b.Property<int>("OSArchitecture");
b.Property<string>("OSDescription");
b.Property<string>("OrganizationID");
b.Property<string>("Platform");
b.Property<int>("ProcessorCount");
b.Property<string>("ServerVerificationToken");
b.Property<string>("Tags")
.HasMaxLength(200);
b.Property<double>("TotalMemory");
b.Property<double>("TotalStorage");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("Machines");
});
modelBuilder.Entity("Library.Models.Organization", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("OrganizationName")
.HasMaxLength(25);
b.HasKey("ID");
b.ToTable("Organizations");
});
modelBuilder.Entity("Library.Models.PermissionGroup", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("MachineID");
b.Property<string>("Name")
.HasMaxLength(100);
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("MachineID");
b.HasIndex("OrganizationID");
b.ToTable("PermissionGroups");
});
modelBuilder.Entity("Library.Models.SharedFile", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("ContentType");
b.Property<byte[]>("FileContents");
b.Property<string>("FileName");
b.Property<string>("OrganizationID");
b.Property<DateTime>("Timestamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("SharedFiles");
});
.HasAnnotation("ProductVersion", "2.2.2-servicing-10034");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
@ -268,8 +34,7 @@ namespace Remotely_Server.Migrations
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
@ -277,8 +42,7 @@ namespace Remotely_Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
@ -342,8 +106,7 @@ namespace Remotely_Server.Migrations
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
.HasName("UserNameIndex");
b.ToTable("RemotelyUsers");
@ -353,8 +116,7 @@ namespace Remotely_Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
@ -420,7 +182,246 @@ namespace Remotely_Server.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Library.Models.RemotelyUser", b =>
modelBuilder.Entity("Remotely_Library.Models.CommandContext", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandMode");
b.Property<string>("CommandResults");
b.Property<string>("CommandText");
b.Property<string>("OrganizationID");
b.Property<string>("PSCoreResults");
b.Property<string>("SenderConnectionID");
b.Property<string>("SenderUserID");
b.Property<string>("TargetDeviceIDs");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("CommandContexts");
});
modelBuilder.Entity("Remotely_Library.Models.Device", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CurrentUser");
b.Property<string>("DeviceName");
b.Property<double>("FreeMemory");
b.Property<double>("FreeStorage");
b.Property<bool>("Is64Bit");
b.Property<bool>("IsOnline");
b.Property<DateTime>("LastOnline");
b.Property<int>("OSArchitecture");
b.Property<string>("OSDescription");
b.Property<string>("OrganizationID");
b.Property<string>("PermissionGroupID");
b.Property<string>("Platform");
b.Property<int>("ProcessorCount");
b.Property<string>("ServerVerificationToken");
b.Property<string>("Tags")
.HasMaxLength(200);
b.Property<double>("TotalMemory");
b.Property<double>("TotalStorage");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.HasIndex("PermissionGroupID");
b.ToTable("Devices");
});
modelBuilder.Entity("Remotely_Library.Models.Drive", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("DeviceID");
b.Property<string>("DriveFormat");
b.Property<int>("DriveType");
b.Property<double>("FreeSpace");
b.Property<string>("Name");
b.Property<string>("RootDirectory");
b.Property<double>("TotalSize");
b.Property<string>("VolumeLabel");
b.HasKey("ID");
b.HasIndex("DeviceID");
b.ToTable("Drives");
});
modelBuilder.Entity("Remotely_Library.Models.EventLog", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("EventType");
b.Property<string>("Message");
b.Property<string>("OrganizationID");
b.Property<string>("Source");
b.Property<string>("StackTrace");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("EventLogs");
});
modelBuilder.Entity("Remotely_Library.Models.InviteLink", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateSent");
b.Property<string>("InvitedUser");
b.Property<bool>("IsAdmin");
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("InviteLinks");
});
modelBuilder.Entity("Remotely_Library.Models.Organization", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("OrganizationName")
.HasMaxLength(25);
b.HasKey("ID");
b.ToTable("Organizations");
});
modelBuilder.Entity("Remotely_Library.Models.PermissionGroup", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("DeviceID");
b.Property<string>("Name")
.HasMaxLength(100);
b.Property<string>("OrganizationID");
b.Property<string>("RemotelyUserId");
b.HasKey("ID");
b.HasIndex("DeviceID");
b.HasIndex("OrganizationID");
b.HasIndex("RemotelyUserId");
b.ToTable("PermissionGroups");
});
modelBuilder.Entity("Remotely_Library.Models.RemotelyUserOptions", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandModeShortcutBash")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutCMD")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutPSCore")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutRemotely")
.HasMaxLength(10);
b.Property<string>("CommandModeShortcutWinPS")
.HasMaxLength(10);
b.Property<string>("ConsolePrompt")
.HasMaxLength(5);
b.HasKey("ID");
b.ToTable("RemotelyUserOptions");
});
modelBuilder.Entity("Remotely_Library.Models.SharedFile", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("ContentType");
b.Property<byte[]>("FileContents");
b.Property<string>("FileName");
b.Property<string>("OrganizationID");
b.Property<DateTime>("Timestamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("SharedFiles");
});
modelBuilder.Entity("Remotely_Library.Models.RemotelyUser", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
@ -428,70 +429,21 @@ namespace Remotely_Server.Migrations
b.Property<string>("OrganizationID");
b.Property<string>("PermissionGroups");
b.Property<string>("PermissionGroupID");
b.Property<string>("UserOptions");
b.Property<string>("UserOptionsID");
b.HasIndex("OrganizationID");
b.HasIndex("PermissionGroupID");
b.HasIndex("UserOptionsID");
b.ToTable("RemotelyUsers");
b.HasDiscriminator().HasValue("RemotelyUser");
});
modelBuilder.Entity("Library.Models.CommandContext", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("CommandContexts")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.Drive", b =>
{
b.HasOne("Library.Models.Machine")
.WithMany("Drives")
.HasForeignKey("MachineID");
});
modelBuilder.Entity("Library.Models.EventLog", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("EventLogs")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.InviteLink", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("InviteLinks")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.Machine", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("Machines")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.PermissionGroup", b =>
{
b.HasOne("Library.Models.Machine")
.WithMany("PermissionGroups")
.HasForeignKey("MachineID");
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("PermissionGroups")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Library.Models.SharedFile", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
.WithMany("SharedFiles")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
@ -537,11 +489,80 @@ namespace Remotely_Server.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Library.Models.RemotelyUser", b =>
modelBuilder.Entity("Remotely_Library.Models.CommandContext", b =>
{
b.HasOne("Library.Models.Organization", "Organization")
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("CommandContexts")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Library.Models.Device", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("Devices")
.HasForeignKey("OrganizationID");
b.HasOne("Remotely_Library.Models.PermissionGroup")
.WithMany("Devices")
.HasForeignKey("PermissionGroupID");
});
modelBuilder.Entity("Remotely_Library.Models.Drive", b =>
{
b.HasOne("Remotely_Library.Models.Device")
.WithMany("Drives")
.HasForeignKey("DeviceID");
});
modelBuilder.Entity("Remotely_Library.Models.EventLog", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("EventLogs")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Library.Models.InviteLink", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("InviteLinks")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Library.Models.PermissionGroup", b =>
{
b.HasOne("Remotely_Library.Models.Device")
.WithMany("PermissionGroups")
.HasForeignKey("DeviceID");
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("PermissionGroups")
.HasForeignKey("OrganizationID");
b.HasOne("Remotely_Library.Models.RemotelyUser")
.WithMany("PermissionGroups")
.HasForeignKey("RemotelyUserId");
});
modelBuilder.Entity("Remotely_Library.Models.SharedFile", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("SharedFiles")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Library.Models.RemotelyUser", b =>
{
b.HasOne("Remotely_Library.Models.Organization", "Organization")
.WithMany("RemotelyUsers")
.HasForeignKey("OrganizationID");
b.HasOne("Remotely_Library.Models.PermissionGroup")
.WithMany("RemotelyUsers")
.HasForeignKey("PermissionGroupID");
b.HasOne("Remotely_Library.Models.RemotelyUserOptions", "UserOptions")
.WithMany()
.HasForeignKey("UserOptionsID");
});
#pragma warning restore 612, 618
}

View File

@ -159,7 +159,7 @@
<div class="modal-body">
<p>
By default, the install scripts will download the client files from the server before installing them.
This is fine for one or two machines, but it wouldn't be ideal to have a large number of computers
This is fine for one or two devices, but it wouldn't be ideal to have a large number of computers
downloading over the WAN simultaneously.
<br /><br />
To reduce bandwidth usage, you can download separately the ZIP file containing the client files and put

View File

@ -30,7 +30,7 @@
as the original password used to create the account. The password itself cannot be
retrieved, though.
<br /><br />
You can learn more about Identity on <a href="https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-2.1">Microsoft Docs.</a>
You can learn more about Identity on <a href="https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-2.2">Microsoft Docs.</a>
<br /><br />
Data pertaining to computers using the Remotely service is only kept for three months, then it
is permanently deleted. No information about the computers, commands sent, or results are

View File

@ -80,7 +80,7 @@
</div>
<div class="center-aligned">
<video id="screenViewer" hidden="hidden" muted></video>
<canvas id="screenViewer" hidden="hidden"></canvas>
<input id="fileTransferInput" hidden="hidden" type="file" />
<input id="touchKeyboardInput" type="text" />
</div>

View File

@ -1,16 +1,16 @@
<div id="dataGridFrame" class="tab-pane fade">
<div id="machineGridWrapper">
<div id="deviceGridWrapper">
<div id="gridControlsWrapper">
<button id="startRemoteControlButton" class="btn btn-xs btn-secondary">Remote Control</button>
<button id="toggleAllMachines" class="btn btn-xs btn-secondary">Select All</button>
<button id="toggleAllDevices" class="btn btn-xs btn-secondary">Select All</button>
<span>Filter:</span>
<input id="gridFilter" />
</div>
<table id="machineGrid" class="table table-responsive table-hover table-striped">
<table id="deviceGrid" class="table table-responsive table-hover table-striped">
<thead>
<tr>
<th>Online</th>
<th>Machine Name</th>
<th>Device Name</th>
<th>Current User</th>
<th>Last Online</th>
<th>Platform</th>

View File

@ -51,26 +51,26 @@
</div>
<div class="col-sm-6">
<span>
Machines Selected:
Devices Selected:
</span>
<span id="machinesSelectedSpan" class="console-status-value">
<span id="devicesSelectedSpan" class="console-status-value">
0
</span>
</div>
<div class="clearfix"></div>
<div class="col-sm-6">
<span>
Online Machines:
Online Devices:
</span>
<span id="onlineMachinesSpan" class="console-status-value">
<span id="onlineDevicesSpan" class="console-status-value">
0
</span>
</div>
<div class="col-sm-6">
<span>
Total Machines:
Total Devices:
</span>
<span id="totalMachinesSpan" class="console-status-value">
<span id="totalDevicesSpan" class="console-status-value">
0
</span>
</div>

View File

@ -33,8 +33,8 @@
<Content Remove="wwwroot\scripts\Models\CommandContext.ts" />
<Content Remove="wwwroot\scripts\Models\CommandLineParameter.ts" />
<Content Remove="wwwroot\scripts\Models\ConsoleCommand.ts" />
<Content Remove="wwwroot\scripts\Models\Device.ts" />
<Content Remove="wwwroot\scripts\Models\GenericCommandResult.ts" />
<Content Remove="wwwroot\scripts\Models\Machine.ts" />
<Content Remove="wwwroot\scripts\Models\Parameter.ts" />
<Content Remove="wwwroot\scripts\Models\UserOptions.ts" />
<Content Remove="wwwroot\scripts\Pages\OrganizationManagement.ts" />
@ -1661,7 +1661,7 @@
<TypeScriptCompile Include="wwwroot\scripts\Models\CommandLineParameter.ts" />
<TypeScriptCompile Include="wwwroot\scripts\Models\ConsoleCommand.ts" />
<TypeScriptCompile Include="wwwroot\scripts\Models\UserOptions.ts" />
<TypeScriptCompile Include="wwwroot\scripts\Models\Machine.ts" />
<TypeScriptCompile Include="wwwroot\scripts\Models\Device.ts" />
<TypeScriptCompile Include="wwwroot\scripts\Models\Parameter.ts" />
<TypeScriptCompile Include="wwwroot\scripts\Pages\OrganizationManagement.ts" />
<TypeScriptCompile Include="wwwroot\scripts\RemoteControl\RemoteControl.ts" />

View File

@ -32,8 +32,9 @@ namespace Remotely_Server.Services
AppConfig = appConfig;
}
private DataService DataService { get; }
private IHubContext<DeviceSocketHub> DeviceHub { get; }
private ApplicationConfig AppConfig { get; }
private DataService DataService { get; }
private IHubContext<DeviceSocketHub> DeviceHub { get; }
private RemotelyUser RemotelyUser
{
get
@ -46,125 +47,124 @@ namespace Remotely_Server.Services
}
}
private SignInManager<RemotelyUser> SignInManager { get; }
private ApplicationConfig AppConfig { get; }
public async Task AddGroup(string[] machineIDs, string groupName)
public async Task AddGroup(string[] deviceIDs, string groupName)
{
groupName = groupName.Trim();
machineIDs = DataService.FilterMachineIDsByUserPermission(machineIDs, RemotelyUser);
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
if (!DataService.DoesGroupExist(RemotelyUser.Id, groupName))
{
await Clients.Caller.SendAsync("DisplayConsoleMessage", "Permission group does not exist.");
return;
}
DataService.AddPermissionToMachines(RemotelyUser.Id, machineIDs, groupName);
DataService.AddPermissionToDevices(RemotelyUser.Id, deviceIDs, groupName);
await Clients.Caller.SendAsync("DisplayConsoleMessage", "Group added.");
}
public async Task RemoveGroup(string[] machineIDs, string groupName)
{
public async Task DeployScript(string fileID, string mode, string[] deviceIDs)
{
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
var connections = GetActiveClientConnections(deviceIDs);
var commandContext = new CommandContext()
{
CommandMode = mode,
CommandText = Encoding.UTF8.GetString(DataService.GetSharedFiled(fileID).FileContents),
SenderConnectionID = Context.ConnectionId,
SenderUserID = Context.UserIdentifier,
TargetDeviceIDs = connections.Select(x => x.Value.ID).ToArray(),
OrganizationID = RemotelyUser.OrganizationID
};
DataService.AddOrUpdateCommandContext(commandContext);
await Clients.Caller.SendAsync("CommandContextCreated", commandContext);
foreach (var connection in connections)
{
await DeviceHub.Clients.Client(connection.Key).SendAsync("DeployScript", mode, fileID, commandContext.ID, Context.ConnectionId);
}
}
public async Task ExecuteCommandOnClient(string mode, string command, string[] deviceIDs)
{
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
var connections = GetActiveClientConnections(deviceIDs);
var commandContext = new CommandContext()
{
CommandMode = mode,
CommandText = command,
SenderConnectionID = Context.ConnectionId,
SenderUserID = Context.UserIdentifier,
TargetDeviceIDs = connections.Select(x => x.Value.ID).ToArray(),
OrganizationID = RemotelyUser.Organization.ID
};
DataService.AddOrUpdateCommandContext(commandContext);
await Clients.Caller.SendAsync("CommandContextCreated", commandContext);
foreach (var connection in connections)
{
await DeviceHub.Clients.Client(connection.Key).SendAsync("ExecuteCommand", mode, command, commandContext.ID, Context.ConnectionId);
}
}
public override async Task OnConnectedAsync()
{
RemotelyUser = DataService.GetUserByID(Context?.UserIdentifier);
if (IsConnectionValid()?.Result == false)
{
return;
}
await Groups.AddToGroupAsync(Context.ConnectionId, RemotelyUser.Organization.ID);
await Clients.Caller.SendAsync("UserOptions", RemotelyUser.UserOptions);
if (AppConfig.ShowMessageOfTheDay)
{
try
{
var wc = new WebClient();
var message = await wc.DownloadStringTaskAsync(new Uri("https://remotely.lucency.co/api/messageoftheday"));
await Clients.Caller.SendAsync("DisplayConsoleHTML", message);
}
catch { }
}
await base.OnConnectedAsync();
}
public override async Task OnDisconnectedAsync(Exception exception)
{
await Groups.RemoveFromGroupAsync(Context.ConnectionId, RemotelyUser.Organization.ID);
await base.OnDisconnectedAsync(exception);
}
public async Task RemoteControl(string deviceID)
{
if (DataService.DoesUserHaveAccessToDevice(deviceID, RemotelyUser))
{
var targetDevice = DeviceSocketHub.ServiceConnections.FirstOrDefault(x => x.Value.ID == deviceID);
var currentUsers = RCBrowserSocketHub.OrganizationConnectionList.Count(x => x.Value.OrganizationID == RemotelyUser.OrganizationID);
if (currentUsers >= AppConfig.RemoteControlSessionLimit)
{
await Clients.Caller.SendAsync("DisplayConsoleMessage", $"There are already the maximum amount of active remote control sessions for your organization.");
return;
}
await this.Clients.Caller.SendAsync("ServiceID", targetDevice.Key);
await DeviceHub.Clients.Client(targetDevice.Key).SendAsync("RemoteControl", Context.ConnectionId, targetDevice.Key);
}
}
public async Task RemoveGroup(string[] deviceIDs, string groupName)
{
groupName = groupName.Trim();
machineIDs = DataService.FilterMachineIDsByUserPermission(machineIDs, RemotelyUser);
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
if (!DataService.DoesGroupExist(RemotelyUser.Id, groupName))
{
await Clients.Caller.SendAsync("DisplayConsoleMessage", "Permission group does not exist.");
return;
}
DataService.RemovePermissionFromMachines(RemotelyUser.Id, machineIDs, groupName);
DataService.RemovePermissionFromDevices(RemotelyUser.Id, deviceIDs, groupName);
await Clients.Caller.SendAsync("DisplayConsoleMessage", "Group removed.");
}
public async Task DeployScript(string fileID, string mode, string[] machineIDs)
public async Task RemoveDevices(string[] deviceIDs)
{
machineIDs = DataService.FilterMachineIDsByUserPermission(machineIDs, RemotelyUser);
var connections = GetActiveClientConnections(machineIDs);
var commandContext = new CommandContext()
{
CommandMode = mode,
CommandText = Encoding.UTF8.GetString(DataService.GetSharedFiled(fileID).FileContents),
SenderConnectionID = Context.ConnectionId,
SenderUserID = Context.UserIdentifier,
TargetMachineIDs = connections.Select(x => x.Value.ID).ToArray(),
OrganizationID = RemotelyUser.OrganizationID
};
DataService.AddOrUpdateCommandContext(commandContext);
await Clients.Caller.SendAsync("CommandContextCreated", commandContext);
foreach (var connection in connections)
{
await DeviceHub.Clients.Client(connection.Key).SendAsync("DeployScript", mode, fileID, commandContext.ID, Context.ConnectionId);
}
var filterDevices = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
DataService.RemoveDevices(filterDevices);
await Clients.Caller.SendAsync("RefreshDeviceList");
}
public async Task ExecuteCommandOnClient(string mode, string command, string[] machineIDs)
{
machineIDs = DataService.FilterMachineIDsByUserPermission(machineIDs, RemotelyUser);
var connections = GetActiveClientConnections(machineIDs);
var commandContext = new CommandContext()
{
CommandMode = mode,
CommandText = command,
SenderConnectionID = Context.ConnectionId,
SenderUserID = Context.UserIdentifier,
TargetMachineIDs = connections.Select(x => x.Value.ID).ToArray(),
OrganizationID = RemotelyUser.Organization.ID
};
DataService.AddOrUpdateCommandContext(commandContext);
await Clients.Caller.SendAsync("CommandContextCreated", commandContext);
foreach (var connection in connections)
{
await DeviceHub.Clients.Client(connection.Key).SendAsync("ExecuteCommand", mode, command, commandContext.ID, Context.ConnectionId);
}
}
public override async Task OnConnectedAsync()
{
RemotelyUser = DataService.GetUserByID(Context?.UserIdentifier);
if (IsConnectionValid()?.Result == false)
{
return;
}
await Groups.AddToGroupAsync(Context.ConnectionId, RemotelyUser.Organization.ID);
await Clients.Caller.SendAsync("UserOptions", RemotelyUser.UserOptions);
if (AppConfig.ShowMessageOfTheDay)
{
try
{
var wc = new WebClient();
var message = await wc.DownloadStringTaskAsync(new Uri("https://remotely.lucency.co/api/messageoftheday"));
await Clients.Caller.SendAsync("DisplayConsoleHTML", message);
}
catch { }
}
await base.OnConnectedAsync();
}
public override async Task OnDisconnectedAsync(Exception exception)
{
await Groups.RemoveFromGroupAsync(Context.ConnectionId, RemotelyUser.Organization.ID);
await base.OnDisconnectedAsync(exception);
}
public async Task RemoteControl(string machineID)
{
if (DataService.DoesUserHaveAccessToMachine(machineID, RemotelyUser))
{
var targetMachine = DeviceSocketHub.ServiceConnections.FirstOrDefault(x => x.Value.ID == machineID);
var currentUsers = RCBrowserSocketHub.OrganizationConnectionList.Count(x => x.Value.OrganizationID == RemotelyUser.OrganizationID);
if (currentUsers >= AppConfig.RemoteControlSessionLimit)
{
await Clients.Caller.SendAsync("DisplayConsoleMessage", $"There are already the maximum amount of active remote control sessions for your organization.");
return;
}
await this.Clients.Caller.SendAsync("ServiceID", targetMachine.Key);
await DeviceHub.Clients.Client(targetMachine.Key).SendAsync("RemoteControl", Context.ConnectionId, targetMachine.Key);
}
}
public async Task RemoveMachines(string[] machineIDs)
{
var filterMachines = DataService.FilterMachineIDsByUserPermission(machineIDs, RemotelyUser);
DataService.RemoveMachines(filterMachines);
await Clients.Caller.SendAsync("RefreshMachineList");
}
public async Task TransferFiles(List<string> fileIDs, string transferID, string[] machineIDs)
public async Task TransferFiles(List<string> fileIDs, string transferID, string[] deviceIDs)
{
DataService.WriteEvent(new EventLog()
{
@ -173,43 +173,43 @@ namespace Remotely_Server.Services
TimeStamp = DateTime.Now,
OrganizationID = RemotelyUser.OrganizationID
});
machineIDs = DataService.FilterMachineIDsByUserPermission(machineIDs, RemotelyUser);
var connections = GetActiveClientConnections(machineIDs);
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
var connections = GetActiveClientConnections(deviceIDs);
foreach (var connection in connections)
{
await DeviceHub.Clients.Client(connection.Key).SendAsync("TransferFiles", transferID, fileIDs, Context.ConnectionId);
}
}
public async Task UninstallClients(string[] machineIDs)
public async Task UninstallClients(string[] deviceIDs)
{
machineIDs = DataService.FilterMachineIDsByUserPermission(machineIDs, RemotelyUser);
var connections = GetActiveClientConnections(machineIDs);
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
var connections = GetActiveClientConnections(deviceIDs);
foreach (var connection in connections)
{
await DeviceHub.Clients.Client(connection.Key).SendAsync("UninstallClient");
}
DataService.RemoveMachines(machineIDs);
await Clients.Caller.SendAsync("RefreshMachineList");
DataService.RemoveDevices(deviceIDs);
await Clients.Caller.SendAsync("RefreshDeviceList");
}
public async Task UpdateTags(string machineID, string tag)
public async Task UpdateTags(string deviceID, string tag)
{
if (DataService.DoesUserHaveAccessToMachine(machineID, RemotelyUser))
if (DataService.DoesUserHaveAccessToDevice(deviceID, RemotelyUser))
{
if (tag.Length > 200)
{
await Clients.Caller.SendAsync("DisplayConsoleMessage", $"Tag must be 200 characters or less. Supplied length is {tag.Length}.");
return;
}
DataService.UpdateTags(machineID, tag);
DataService.UpdateTags(deviceID, tag);
await Clients.Caller.SendAsync("DisplayConsoleMessage", "Tag updated successfully.");
}
}
private IEnumerable<KeyValuePair<string, Machine>> GetActiveClientConnections(string[] machineIDs)
private IEnumerable<KeyValuePair<string, Device>> GetActiveClientConnections(string[] deviceIDs)
{
return DeviceSocketHub.ServiceConnections.Where(x =>
x.Value.OrganizationID == RemotelyUser.Organization.ID &&
machineIDs.Contains(x.Value.ID)
deviceIDs.Contains(x.Value.ID)
);
}
private async Task<bool> IsConnectionValid()

View File

@ -20,25 +20,109 @@ namespace Remotely_Server.Services
DataService = dataService;
BrowserHub = browserHub;
}
private DataService DataService { get; }
private IHubContext<BrowserSocketHub> BrowserHub { get; }
public static ConcurrentDictionary<string, Machine> ServiceConnections { get; set; } = new ConcurrentDictionary<string, Machine>();
public override Task OnConnectedAsync()
{
public static ConcurrentDictionary<string, Device> ServiceConnections { get; set; } = new ConcurrentDictionary<string, Device>();
private IHubContext<BrowserSocketHub> BrowserHub { get; }
private DataService DataService { get; }
private Device Device
{
get
{
return this.Context.Items["Device"] as Device;
}
set
{
this.Context.Items["Device"] = value;
}
}
public async void BashResultViaAjax(string commandID)
{
var commandContext = DataService.GetCommandContext(commandID);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("BashResultViaAjax", commandID, Device.ID);
}
public async void CMDResultViaAjax(string commandID)
{
var commandContext = DataService.GetCommandContext(commandID);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("CMDResultViaAjax", commandID, Device.ID);
}
public async Task CommandResult(GenericCommandResult result)
{
result.DeviceID = Device.ID;
var commandContext = DataService.GetCommandContext(result.CommandContextID);
commandContext.CommandResults.Add(result);
DataService.AddOrUpdateCommandContext(commandContext);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("CommandResult", result);
}
public async Task DisplayConsoleMessage(string message, string requesterID)
{
await BrowserHub.Clients.Client(requesterID).SendAsync("DisplayConsoleMessage", message);
}
public async Task DeviceCameOnline(Device device)
{
if (ServiceConnections.Any(x => x.Value.ID == device.ID))
{
DataService.WriteEvent(new EventLog()
{
EventType = EventTypes.Info,
OrganizationID = Device.OrganizationID,
Message = $"Device connection for {device.DeviceName} was denied because it is already connected."
});
Context.Abort();
return;
}
device.IsOnline = true;
device.LastOnline = DateTime.Now;
Device = device;
if (DataService.AddOrUpdateDevice(device))
{
var failCount = 0;
while (!ServiceConnections.TryAdd(Context.ConnectionId, device))
{
if (failCount > 3)
{
Context.Abort();
return;
}
failCount++;
await Task.Delay(1000);
}
await this.Groups.AddToGroupAsync(this.Context.ConnectionId, device.OrganizationID);
await BrowserHub.Clients.Group(Device.OrganizationID).SendAsync("DeviceCameOnline", Device);
}
else
{
// Organization wasn't found.
await Clients.Caller.SendAsync("UninstallClient");
}
}
public async Task DeviceHeartbeat(Device device)
{
device.IsOnline = true;
device.LastOnline = DateTime.Now;
Device = device;
DataService.AddOrUpdateDevice(device);
await BrowserHub.Clients.Group(Device.OrganizationID).SendAsync("DeviceHeartbeat", Device);
}
public override Task OnConnectedAsync()
{
return base.OnConnectedAsync();
}
public override async Task OnDisconnectedAsync(Exception exception)
{
if (Machine != null)
if (Device != null)
{
DataService.MachineDisconnected(Machine.ID);
await this.Groups.RemoveFromGroupAsync(this.Context.ConnectionId, Machine.OrganizationID);
Machine.IsOnline = false;
await BrowserHub.Clients.Group(Machine.OrganizationID).SendAsync("MachineWentOffline", Machine);
while (!ServiceConnections.TryRemove(Context.ConnectionId, out var machine))
DataService.DeviceDisconnected(Device.ID);
await this.Groups.RemoveFromGroupAsync(this.Context.ConnectionId, Device.OrganizationID);
Device.IsOnline = false;
await BrowserHub.Clients.Group(Device.OrganizationID).SendAsync("DeviceWentOffline", Device);
while (!ServiceConnections.TryRemove(Context.ConnectionId, out var device))
{
await Task.Delay(1000);
}
@ -46,120 +130,38 @@ namespace Remotely_Server.Services
await base.OnDisconnectedAsync(exception);
}
public async Task MachineCameOnline(Machine machine)
{
if (ServiceConnections.Any(x=>x.Value.ID == machine.ID))
{
DataService.WriteEvent(new EventLog()
{
EventType = EventTypes.Info,
OrganizationID = Machine.OrganizationID,
Message = $"Machine connection for {machine.MachineName} was denied because it is already connected."
});
Context.Abort();
return;
}
machine.IsOnline = true;
machine.LastOnline = DateTime.Now;
Machine = machine;
if (DataService.AddOrUpdateMachine(machine))
{
var failCount = 0;
while (!ServiceConnections.TryAdd(Context.ConnectionId, machine))
{
if (failCount > 3)
{
Context.Abort();
return;
}
failCount++;
await Task.Delay(1000);
}
await this.Groups.AddToGroupAsync(this.Context.ConnectionId, machine.OrganizationID);
await BrowserHub.Clients.Group(Machine.OrganizationID).SendAsync("MachineCameOnline", Machine);
}
else
{
// Organization wasn't found.
await Clients.Caller.SendAsync("UninstallClient");
}
}
public async Task MachineHeartbeat(Machine machine)
{
machine.IsOnline = true;
machine.LastOnline = DateTime.Now;
Machine = machine;
DataService.AddOrUpdateMachine(machine);
await BrowserHub.Clients.Group(Machine.OrganizationID).SendAsync("MachineHeartbeat", Machine);
}
public async Task PSCoreResult(PSCoreCommandResult result)
{
result.MachineID = Machine.ID;
result.DeviceID = Device.ID;
var commandContext = DataService.GetCommandContext(result.CommandContextID);
commandContext.PSCoreResults.Add(result);
DataService.AddOrUpdateCommandContext(commandContext);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("PSCoreResult", result);
}
public async Task CommandResult(GenericCommandResult result)
{
result.MachineID = Machine.ID;
var commandContext = DataService.GetCommandContext(result.CommandContextID);
commandContext.CommandResults.Add(result);
DataService.AddOrUpdateCommandContext(commandContext);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("CommandResult", result);
}
public async Task DisplayConsoleMessage(string message, string requesterID)
{
await BrowserHub.Clients.Client(requesterID).SendAsync("DisplayConsoleMessage", message);
}
public async Task SendServerVerificationToken()
{
await Clients.Caller.SendAsync("ServerVerificationToken", Machine.ServerVerificationToken);
public async void PSCoreResultViaAjax(string commandID)
{
var commandContext = DataService.GetCommandContext(commandID);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("PSCoreResultViaAjax", commandID, Device.ID);
}
public async Task SendServerVerificationToken()
{
await Clients.Caller.SendAsync("ServerVerificationToken", Device.ServerVerificationToken);
}
public void SetServerVerificationToken(string verificationToken)
{
Machine.ServerVerificationToken = verificationToken;
DataService.SetServerVerificationToken(Machine.ID, verificationToken);
Device.ServerVerificationToken = verificationToken;
DataService.SetServerVerificationToken(Device.ID, verificationToken);
}
public async void TransferCompleted(string transferID, string requesterID)
{
await BrowserHub.Clients.Client(requesterID).SendAsync("TransferCompleted", transferID);
}
public async void PSCoreResultViaAjax(string commandID)
{
var commandContext = DataService.GetCommandContext(commandID);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("PSCoreResultViaAjax", commandID, Machine.ID);
}
public async void CMDResultViaAjax(string commandID)
{
var commandContext = DataService.GetCommandContext(commandID);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("CMDResultViaAjax", commandID, Machine.ID);
}
public async void WinPSResultViaAjax(string commandID)
{
var commandContext = DataService.GetCommandContext(commandID);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("WinPSResultViaAjax", commandID, Machine.ID);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("WinPSResultViaAjax", commandID, Device.ID);
}
public async void BashResultViaAjax(string commandID)
{
var commandContext = DataService.GetCommandContext(commandID);
await BrowserHub.Clients.Client(commandContext.SenderConnectionID).SendAsync("BashResultViaAjax", commandID, Machine.ID);
}
private Machine Machine
{
get
{
return this.Context.Items["Machine"] as Machine;
}
set
{
this.Context.Items["Machine"] = value;
}
}
}
}

View File

@ -55,14 +55,12 @@ namespace Remotely_Server.Services
{
await RCBrowserHub.Clients.Client(rcBrowserHubConnectionID).SendAsync("ScreenCount", primaryScreenIndex, screenCount);
}
public async Task SendScreenSize(int width, int height, string rcBrowserHubConnectionID)
{
await RCBrowserHub.Clients.Client(rcBrowserHubConnectionID).SendAsync("ScreenSize", width, height);
}
public async Task SendScreenCapture(byte[] captureBytes, string rcBrowserHubConnectionID)
{
await RCBrowserHub.Clients.Client(rcBrowserHubConnectionID).SendAsync("ScreenCapture", captureBytes, rcBrowserHubConnectionID);
await RCBrowserHub.Clients.Client(rcBrowserHubConnectionID).SendAsync("ScreenCapture", captureBytes);
}
public async Task NotifyRequesterUnattendedReady(string browserHubConnectionID)
{
await BrowserHub.Clients.Client(browserHubConnectionID).SendAsync("UnattendedSessionReady", Context.ConnectionId);

View File

@ -136,11 +136,19 @@ namespace Remotely_Server
options.ApplicationMaxBufferSize = 500000;
options.TransportMaxBufferSize = 500000;
});
routes.MapHub<RCDeviceSocketHub>("/RCDeviceHub");
routes.MapHub<RCBrowserSocketHub>("/RCBrowserHub");
routes.MapHub<RCDeviceSocketHub>("/RCDeviceHub", options =>
{
options.ApplicationMaxBufferSize = 1000000;
options.TransportMaxBufferSize = 1000000;
});
routes.MapHub<RCBrowserSocketHub>("/RCBrowserHub", options =>
{
options.ApplicationMaxBufferSize = 1000000;
options.TransportMaxBufferSize = 1000000;
});
});
app.UseMvcWithDefaultRoute();
dataService.SetAllMachinesNotOnline();
dataService.SetAllDevicesNotOnline();
dataService.CleanupEmptyOrganizations();
dataService.CleanupOldRecords();
}

View File

@ -29,7 +29,7 @@ chmod +x ./Remotely_Agent
cat > ./ConnectionInfo.json << EOL
{
"MachineID":"$GUID",
"DeviceID":"$GUID",
"Host":"$HostName",
"OrganizationID": "$Organization",
"ServerVerificationToken":""

View File

@ -35,7 +35,7 @@ function Is-Administrator() {
function Run-StartupChecks {
if ([System.Environment]::Is64BitOperatingSystem -eq $false){
Write-Log -Message "This script is for 64-bit operating systems. Use the x86 (32-bit) install script on this machine."
Write-Log -Message "This script is for 64-bit operating systems. Use the x86 (32-bit) install script on this device."
Do-Exit
}
if ([System.Environment]::Is64BitProcess -eq $false) {
@ -83,7 +83,7 @@ function Install-Remotely {
if ($ConnectionInfo -eq $null) {
$ConnectionInfo = @{
MachineID = (New-Guid).ToString();
DeviceID = (New-Guid).ToString();
Host = $HostName;
OrganizationID = $Organization;
ServerVerificationToken = "";

View File

@ -35,7 +35,7 @@ function Is-Administrator() {
function Run-StartupChecks {
if ([System.Environment]::Is64BitOperatingSystem -eq $true){
Write-Log -Message "This script is for 32-bit operating systems. Use the x64 (64-bit) install script on this machine."
Write-Log -Message "This script is for 32-bit operating systems. Use the x64 (64-bit) install script on this device."
Do-Exit
}
@ -80,7 +80,7 @@ function Install-Remotely {
if ($ConnectionInfo -eq $null) {
$ConnectionInfo = @{
MachineID = (New-Guid).ToString();
DeviceID = (New-Guid).ToString();
Host = $HostName;
OrganizationID = $Organization;
ServerVerificationToken = "";

View File

@ -75,14 +75,10 @@ button.navbar-toggler:hover {
.echo-input {
color:gray;
}
.machine-tag {
.device-tag {
color: black;
}
.console-output table.console-machine-table {
color: limegreen;
}
#commandCompletionDiv {
color: white;
background-color: rgb(25, 25, 25);

View File

@ -42,16 +42,16 @@ function applyMessageHandlers(hubConnection) {
hubConnection.on("LockedOut", (args) => {
location.assign("/Identity/Account/Lockout");
});
hubConnection.on("MachineCameOnline", (machine) => {
DataGrid.AddOrUpdateMachine(machine);
hubConnection.on("DeviceCameOnline", (device) => {
DataGrid.AddOrUpdateDevice(device);
});
hubConnection.on("MachineWentOffline", (machine) => {
DataGrid.AddOrUpdateMachine(machine);
hubConnection.on("DeviceWentOffline", (device) => {
DataGrid.AddOrUpdateDevice(device);
});
hubConnection.on("MachineHeartbeat", (machine) => {
DataGrid.AddOrUpdateMachine(machine);
hubConnection.on("DeviceHeartbeat", (device) => {
DataGrid.AddOrUpdateDevice(device);
});
hubConnection.on("RefreshMachineList", () => {
hubConnection.on("RefreshDeviceList", () => {
DataGrid.RefreshGrid();
});
hubConnection.on("PSCoreResult", (result) => {
@ -73,8 +73,8 @@ function applyMessageHandlers(hubConnection) {
var count = parseInt(completedWrapper.innerHTML);
completedWrapper.innerHTML = (count + 1).toString();
});
hubConnection.on("PSCoreResultViaAjax", (commandID, machineID) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${machineID}`;
hubConnection.on("PSCoreResultViaAjax", (commandID, deviceID) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${deviceID}`;
var xhr = new XMLHttpRequest();
xhr.open("get", targetURL);
xhr.onload = function () {
@ -85,8 +85,8 @@ function applyMessageHandlers(hubConnection) {
};
xhr.send();
});
hubConnection.on("WinPSResultViaAjax", (commandID, machineID) => {
var targetURL = `${location.origin}/API/Commands/WinPSResult/${commandID}/${machineID}`;
hubConnection.on("WinPSResultViaAjax", (commandID, deviceID) => {
var targetURL = `${location.origin}/API/Commands/WinPSResult/${commandID}/${deviceID}`;
var xhr = new XMLHttpRequest();
xhr.open("get", targetURL);
xhr.onload = function () {
@ -97,8 +97,8 @@ function applyMessageHandlers(hubConnection) {
};
xhr.send();
});
hubConnection.on("CMDResultViaAjax", (commandID, machineID) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${machineID}`;
hubConnection.on("CMDResultViaAjax", (commandID, deviceID) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${deviceID}`;
var xhr = new XMLHttpRequest();
xhr.open("get", targetURL);
xhr.onload = function () {
@ -109,8 +109,8 @@ function applyMessageHandlers(hubConnection) {
};
xhr.send();
});
hubConnection.on("BashResultViaAjax", (commandID, machineID) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${machineID}`;
hubConnection.on("BashResultViaAjax", (commandID, deviceID) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${deviceID}`;
var xhr = new XMLHttpRequest();
xhr.open("get", targetURL);
xhr.onload = function () {

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
import * as UI from "./UI.js";
import * as DataGrid from "./DataGrid.js";
import { Machine } from "./Models/Machine.js";
import { Device } from "./Models/Device.js";
import { PSCoreCommandResult } from "./Models/PSCoreCommandResult.js";
import { GenericCommandResult } from "./Models/GenericCommandResult.js";
import { CommandContext } from "./Models/CommandContext.js";
@ -53,17 +53,17 @@ function applyMessageHandlers(hubConnection) {
location.assign("/Identity/Account/Lockout");
});
hubConnection.on("MachineCameOnline", (machine:Machine) => {
DataGrid.AddOrUpdateMachine(machine);
hubConnection.on("DeviceCameOnline", (device:Device) => {
DataGrid.AddOrUpdateDevice(device);
});
hubConnection.on("MachineWentOffline", (machine: Machine) => {
DataGrid.AddOrUpdateMachine(machine);
hubConnection.on("DeviceWentOffline", (device: Device) => {
DataGrid.AddOrUpdateDevice(device);
});
hubConnection.on("MachineHeartbeat", (machine: Machine) => {
DataGrid.AddOrUpdateMachine(machine);
hubConnection.on("DeviceHeartbeat", (device: Device) => {
DataGrid.AddOrUpdateDevice(device);
});
hubConnection.on("RefreshMachineList", () => {
hubConnection.on("RefreshDeviceList", () => {
DataGrid.RefreshGrid();
});
@ -86,8 +86,8 @@ function applyMessageHandlers(hubConnection) {
var count = parseInt(completedWrapper.innerHTML);
completedWrapper.innerHTML = (count + 1).toString();
})
hubConnection.on("PSCoreResultViaAjax", (commandID: string, machineID: string) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${machineID}`;
hubConnection.on("PSCoreResultViaAjax", (commandID: string, deviceID: string) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${deviceID}`;
var xhr = new XMLHttpRequest();
xhr.open("get", targetURL);
xhr.onload = function () {
@ -98,8 +98,8 @@ function applyMessageHandlers(hubConnection) {
};
xhr.send();
});
hubConnection.on("WinPSResultViaAjax", (commandID: string, machineID: string) => {
var targetURL = `${location.origin}/API/Commands/WinPSResult/${commandID}/${machineID}`;
hubConnection.on("WinPSResultViaAjax", (commandID: string, deviceID: string) => {
var targetURL = `${location.origin}/API/Commands/WinPSResult/${commandID}/${deviceID}`;
var xhr = new XMLHttpRequest();
xhr.open("get", targetURL);
xhr.onload = function () {
@ -110,8 +110,8 @@ function applyMessageHandlers(hubConnection) {
};
xhr.send();
});
hubConnection.on("CMDResultViaAjax", (commandID: string, machineID: string) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${machineID}`;
hubConnection.on("CMDResultViaAjax", (commandID: string, deviceID: string) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${deviceID}`;
var xhr = new XMLHttpRequest();
xhr.open("get", targetURL);
xhr.onload = function () {
@ -122,8 +122,8 @@ function applyMessageHandlers(hubConnection) {
};
xhr.send();
});
hubConnection.on("BashResultViaAjax", (commandID: string, machineID: string) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${machineID}`;
hubConnection.on("BashResultViaAjax", (commandID: string, deviceID: string) => {
var targetURL = `${location.origin}/API/Commands/PSCoreResult/${commandID}/${deviceID}`;
var xhr = new XMLHttpRequest();
xhr.open("get", targetURL);
xhr.onload = function () {

View File

@ -124,7 +124,7 @@ export function PositionCommandCompletionWindow() {
var computedStyle = window.getComputedStyle(UI.ConsoleTextArea);
UI.MeasurementContext.font = computedStyle.fontSize + " " + computedStyle.fontFamily;
var width = UI.MeasurementContext.measureText(UI.ConsoleTextArea.value).width;
UI.CommandCompletionDiv.style.marginLeft = String(width) + "px";
UI.CommandCompletionDiv.style.marginLeft = String(width + 10) + "px";
var wrapper = document.querySelector("#commandCompletionWrapper");
var inputRect = UI.ConsoleTextArea.getBoundingClientRect();
wrapper.style.left = String(inputRect.left) + "px";

File diff suppressed because one or more lines are too long

View File

@ -142,7 +142,7 @@ export function PositionCommandCompletionWindow() {
var computedStyle = window.getComputedStyle(UI.ConsoleTextArea);
UI.MeasurementContext.font = computedStyle.fontSize + " " + computedStyle.fontFamily;
var width = UI.MeasurementContext.measureText(UI.ConsoleTextArea.value).width;
UI.CommandCompletionDiv.style.marginLeft = String(width) + "px";
UI.CommandCompletionDiv.style.marginLeft = String(width + 10) + "px";
var wrapper = document.querySelector("#commandCompletionWrapper") as HTMLDivElement;
var inputRect = UI.ConsoleTextArea.getBoundingClientRect();

View File

@ -33,7 +33,7 @@ export function EvaluateCurrentCommandText() {
switch (UI.CommandModeSelect.value) {
case "PSCore":
case "WinPS":
case "Remotely":
case "Web":
var parameters = ExtractParameters(UI.ConsoleTextArea.value);
DisplayParameterCompletions(matchingCommands[0], parameters, relevantText);
break;
@ -132,23 +132,23 @@ export function ProcessCommand() {
case "WinPS":
case "CMD":
case "Bash":
var allMachines = Main.DataGrid.GetSelectedMachines();
var windowsMachines = allMachines.filter(x => x.Platform.toLowerCase() == "windows");
var linuxMachines = allMachines.filter(x => x.Platform.toLowerCase() == "linux");
if (commandMode == "CMD" && linuxMachines.length > 0) {
UI.AddConsoleOutput("Linux machines will be excluded from CMD command.");
allMachines = windowsMachines;
var allDevices = Main.DataGrid.GetSelectedDevices();
var windowsDevices = allDevices.filter(x => x.Platform.toLowerCase() == "windows");
var linuxDevices = allDevices.filter(x => x.Platform.toLowerCase() == "linux");
if (commandMode == "CMD" && linuxDevices.length > 0) {
UI.AddConsoleOutput("Linux devices will be excluded from CMD command.");
allDevices = windowsDevices;
}
if (commandMode == "Bash" && windowsMachines.length > 0) {
UI.AddConsoleOutput("Windows machines will be excluded from Bash command.");
allMachines = linuxMachines;
if (commandMode == "Bash" && windowsDevices.length > 0) {
UI.AddConsoleOutput("Windows devices will be excluded from Bash command.");
allDevices = linuxDevices;
}
if (allMachines.length == 0) {
UI.AddConsoleOutput("At least one machine must be selected to send commands.");
if (allDevices.length == 0) {
UI.AddConsoleOutput("At least one device must be selected to send commands.");
return;
}
var machineIDs = allMachines.map(value => value.ID);
Connection.invoke("ExecuteCommandOnClient", commandMode, commandText, machineIDs);
var deviceIDs = allDevices.map(value => value.ID);
Connection.invoke("ExecuteCommandOnClient", commandMode, commandText, deviceIDs);
break;
default:
break;

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,7 @@ export function EvaluateCurrentCommandText() {
switch (UI.CommandModeSelect.value) {
case "PSCore":
case "WinPS":
case "Remotely":
case "Web":
var parameters = ExtractParameters(UI.ConsoleTextArea.value);
DisplayParameterCompletions(matchingCommands[0], parameters, relevantText);
break;
@ -141,25 +141,25 @@ export function ProcessCommand() {
case "WinPS":
case "CMD":
case "Bash":
var allMachines = Main.DataGrid.GetSelectedMachines();
var windowsMachines = allMachines.filter(x => x.Platform.toLowerCase() == "windows");
var linuxMachines = allMachines.filter(x => x.Platform.toLowerCase() == "linux");
var allDevices = Main.DataGrid.GetSelectedDevices();
var windowsDevices = allDevices.filter(x => x.Platform.toLowerCase() == "windows");
var linuxDevices = allDevices.filter(x => x.Platform.toLowerCase() == "linux");
if (commandMode == "CMD" && linuxMachines.length > 0) {
UI.AddConsoleOutput("Linux machines will be excluded from CMD command.");
allMachines = windowsMachines;
if (commandMode == "CMD" && linuxDevices.length > 0) {
UI.AddConsoleOutput("Linux devices will be excluded from CMD command.");
allDevices = windowsDevices;
}
if (commandMode == "Bash" && windowsMachines.length > 0) {
UI.AddConsoleOutput("Windows machines will be excluded from Bash command.");
allMachines = linuxMachines;
if (commandMode == "Bash" && windowsDevices.length > 0) {
UI.AddConsoleOutput("Windows devices will be excluded from Bash command.");
allDevices = linuxDevices;
}
if (allMachines.length == 0) {
UI.AddConsoleOutput("At least one machine must be selected to send commands.");
if (allDevices.length == 0) {
UI.AddConsoleOutput("At least one device must be selected to send commands.");
return;
}
var machineIDs = allMachines.map(value => value.ID);
Connection.invoke("ExecuteCommandOnClient", commandMode, commandText, machineIDs );
var deviceIDs = allDevices.map(value => value.ID);
Connection.invoke("ExecuteCommandOnClient", commandMode, commandText, deviceIDs );
break;
default:
break;

View File

@ -5,14 +5,14 @@ import * as BrowserSockets from "../BrowserSockets.js";
import { Main } from "../Main.js";
import * as DataGrid from "../DataGrid.js";
import { AddConsoleOutput } from "../UI.js";
import { GetSelectedMachines } from "../DataGrid.js";
import { GetSelectedDevices } from "../DataGrid.js";
var commands = [
new ConsoleCommand("AddGroup", [
new Parameter("group", "The group name to add.", "String")
], "Adds a permission group to the selected computer(s).", "AddGroup -group Lab Machines", "", (parameters, paramDictionary) => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
], "Adds a permission group to the selected computer(s).", "AddGroup -group Lab Devices", "", (parameters, paramDictionary) => {
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
}
;
@ -20,21 +20,21 @@ var commands = [
AddConsoleOutput("A group name is required.");
return;
}
BrowserSockets.Connection.invoke("AddGroup", selectedMachines.map(x => x.ID), paramDictionary["group"]);
BrowserSockets.Connection.invoke("AddGroup", selectedDevices.map(x => x.ID), paramDictionary["group"]);
}),
new ConsoleCommand("DeployScript", [
new Parameter("pscore", "Indicates that script should be run with PowerShell Core.", "Switch"),
new Parameter("winps", "Indicates that script should be run with Windows PowerShell.", "Switch"),
new Parameter("cmd", "Indicates that script should be run with Windows CMD.", "Switch"),
new Parameter("bash", "Indicates that script should be run with Bash.", "Switch")
], "Deploy and run a script on the selected machine(s). Note: Only one switch argument can be used.", "deployscript -pscore", "", (parameters, parameterDict) => {
], "Deploy and run a script on the selected device(s). Note: Only one switch argument can be used.", "deployscript -pscore", "", (parameters, parameterDict) => {
if (parameters.length != 1) {
AddConsoleOutput("There should be exactly 1 argument to indicate the script type.");
return;
}
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
}
var fileInput = document.createElement("input");
@ -43,7 +43,7 @@ var commands = [
document.body.appendChild(fileInput);
fileInput.onchange = () => {
uploadFiles(fileInput.files).then(value => {
BrowserSockets.Connection.invoke("DeployScript", value[0], parameters[0].Name, selectedMachines.map(x => x.ID));
BrowserSockets.Connection.invoke("DeployScript", value[0], parameters[0].Name, selectedDevices.map(x => x.ID));
fileInput.remove();
});
};
@ -51,10 +51,10 @@ var commands = [
}),
new ConsoleCommand("RemoveGroup", [
new Parameter("group", "The group name to remove.", "String")
], "Removes a permission group to the selected computer(s).", "RemoveGroup -group Lab Machines", "", (parameters, paramDictionary) => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
], "Removes a permission group to the selected computer(s).", "RemoveGroup -group Lab Devices", "", (parameters, paramDictionary) => {
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
}
;
@ -62,7 +62,7 @@ var commands = [
AddConsoleOutput("A group name is required.");
return;
}
BrowserSockets.Connection.invoke("RemoveGroup", selectedMachines.map(x => x.ID), paramDictionary["group"]);
BrowserSockets.Connection.invoke("RemoveGroup", selectedDevices.map(x => x.ID), paramDictionary["group"]);
}),
new ConsoleCommand("Clear", [], "Clears the output window of text.", "clear", "", (parameters, paramDictionary) => { UI.ConsoleOutputDiv.innerHTML = ""; }),
new ConsoleCommand("Connect", [], "Connect or reconnect to the server.", "connect", "", (parameters, paramDictionary) => { BrowserSockets.Connect(); }),
@ -107,23 +107,23 @@ var commands = [
UI.AddConsoleHTML(outputText);
}
}),
new ConsoleCommand("List", [], "Displays a list of the currently-selected machines.", "list", "", () => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
UI.AddConsoleOutput("No machines selected.");
new ConsoleCommand("List", [], "Displays a list of the currently-selected devices.", "list", "", () => {
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
UI.AddConsoleOutput("No devices are selected.");
return;
}
var output = `<div>Selected Machines:</div>
<table class="console-machine-table table table-responsive">
var output = `<div>Selected Devices:</div>
<table class="console-device-table table table-responsive">
<thead><tr>
<th>Online</th><th>Machine Name</th><th>Current User</th><th>Last Online</th><th>Platform</th><th>OS Description</th><th>Free Storage</th><th>Total Storage (GB)</th><th>Free Memory</th><th>Total Memory (GB)</th><th>Tags</th>
<th>Online</th><th>Device Name</th><th>Current User</th><th>Last Online</th><th>Platform</th><th>OS Description</th><th>Free Storage</th><th>Total Storage (GB)</th><th>Free Memory</th><th>Total Memory (GB)</th><th>Tags</th>
</tr></thead>`;
var machineList = selectedMachines.map(x => {
var deviceList = selectedDevices.map(x => {
return `<tr>
<td>${String(x.IsOnline)
.replace("true", "<span class='fa fa-check-circle'></span>")
.replace("false", "<span class='fa fa-times'></span>")}</td>
<td>${x.MachineName}</td>
<td>${x.DeviceName}</td>
<td>${x.CurrentUser}</td>
<td>${new Date(x.LastOnline).toLocaleString()}</td>
<td>${x.Platform}</td>
@ -135,29 +135,29 @@ var commands = [
<td>${x.Tags}</td>
</tr>`;
});
output += machineList.join("");
output += deviceList.join("");
UI.AddConsoleOutput(output);
}),
new ConsoleCommand("Remove", [], "Removes the selected machines from the database. (Note: This does not attempt to uninstall the client. Use Uninstall.)", "remove", "", (parameters) => {
var machines = DataGrid.GetSelectedMachines();
if (machines.length == 0) {
UI.AddConsoleOutput("No machines selected.");
new ConsoleCommand("Remove", [], "Removes the selected devices from the database. (Note: This does not attempt to uninstall the client. Use Uninstall.)", "remove", "", (parameters) => {
var devices = DataGrid.GetSelectedDevices();
if (devices.length == 0) {
UI.AddConsoleOutput("No devices are selected.");
}
else {
BrowserSockets.Connection.invoke("RemoveMachines", machines.map(x => x.ID));
BrowserSockets.Connection.invoke("RemoveDevices", devices.map(x => x.ID));
}
}),
new ConsoleCommand("Select", [
new Parameter("all", "If specified, all machines will be selected.", "Switch"),
new Parameter("none", "If specified, no machines will be selected.", "Switch"),
new Parameter("online", "If specified, selects the machines that are currently online.", "Switch"),
new Parameter("all", "If specified, all devices will be selected.", "Switch"),
new Parameter("none", "If specified, no devices will be selected.", "Switch"),
new Parameter("online", "If specified, selects the devices that are currently online.", "Switch"),
new Parameter("filter", "A comma-separated list of search filters (spaces are optional). See the help article for more details.", "String"),
new Parameter("append", "If specified, selected machines will be added list of computers already selected (if any).", "Switch"),
], "Selects machines based on a supplied filter.", "select -filter isonline=true, machinename*Rig, freestorage<50", `The filter contains a comma-separated list of fields to search, and machines that match all filters will be selected.
new Parameter("append", "If specified, selected devices will be added list of computers already selected (if any).", "Switch"),
], "Selects devices based on a supplied filter.", "select -filter isonline=true, devicename*Rig, freestorage<50", `The filter contains a comma-separated list of fields to search, and devices that match all filters will be selected.
There are multiple operator types, and they can be used on any of the fields on the grid (plus some extra hidden ones).<br><br>
Operators:<br>
<ul style="list-style:none">
<li>=&nbsp;&nbsp;&nbsp; Exactly equal to. "machinename=myrig" would match "MyRig", but not "MyRig2"</li>
<li>=&nbsp;&nbsp;&nbsp; Exactly equal to. "devicename=myrig" would match "MyRig", but not "MyRig2"</li>
<li>*&nbsp;&nbsp;&nbsp; Like. "currentuser*bus" would match "Business" and "A_Busy_User"</li>
<li>!=&nbsp;&nbsp; Not equal to. "currentuser!=jon" would match every user except "Jon"</li>
<li>!*&nbsp;&nbsp; Not like. "currentuser!*jon" would match "Jon", "Jonathan", and "SuperJon"</li>
@ -168,7 +168,7 @@ var commands = [
Fields:<br>
<ul style="list-style:none">
<li>IsOnline (true or false)</li>
<li>MachineName (text)</li>
<li>DeviceName (text)</li>
<li>CurrentUser (text)</li>
<li>LastOnline (date or date+time</li>
<li>Is64Bit (true or false)</li>
@ -184,19 +184,19 @@ var commands = [
Main.DataGrid.DataSource.forEach(x => {
document.getElementById(x.ID).classList.add("row-selected");
});
UI.AddConsoleOutput(`${GetSelectedMachines().length} machines selected.`);
UI.AddConsoleOutput(`${GetSelectedDevices().length} devices selected.`);
}
if (typeof paramDictionary["none"] != "undefined") {
Main.UI.MachineGrid.querySelectorAll(".row-selected").forEach(x => {
Main.UI.DeviceGrid.querySelectorAll(".row-selected").forEach(x => {
x.classList.remove("row-selected");
});
UI.AddConsoleOutput(`${GetSelectedMachines().length} machines selected.`);
UI.AddConsoleOutput(`${GetSelectedDevices().length} devices selected.`);
}
if (typeof paramDictionary["online"] != "undefined") {
Main.DataGrid.DataSource.filter(x => x.IsOnline).forEach(x => {
document.getElementById(x.ID).classList.add("row-selected");
});
UI.AddConsoleOutput(`${GetSelectedMachines().length} machines selected.`);
UI.AddConsoleOutput(`${GetSelectedDevices().length} devices selected.`);
}
if (typeof paramDictionary["filter"] != "undefined") {
try {
@ -260,62 +260,62 @@ var commands = [
}
lambda = lambda.slice(0, lambda.lastIndexOf(" &&"));
if (paramDictionary["append"] != "true") {
Main.UI.MachineGrid.querySelectorAll(".row-selected").forEach(x => {
Main.UI.DeviceGrid.querySelectorAll(".row-selected").forEach(x => {
x.classList.remove("row-selected");
});
}
var selectedMachines = Main.DataGrid.DataSource.filter(x => eval(lambda));
selectedMachines.forEach(x => {
var selectedDevices = Main.DataGrid.DataSource.filter(x => eval(lambda));
selectedDevices.forEach(x => {
document.getElementById(x.ID).classList.add("row-selected");
});
UI.AddConsoleOutput(`${GetSelectedMachines().length} machines selected.`);
UI.AddConsoleOutput(`${GetSelectedDevices().length} devices selected.`);
}
Main.DataGrid.UpdateMachineCounts();
Main.DataGrid.UpdateDeviceCounts();
}),
new ConsoleCommand("RemoteControl", [], "Connect to a computer with Remotely Remote Control.", "list", "", () => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
UI.AddConsoleOutput("You must select a machine first.");
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
UI.AddConsoleOutput("You must select a device first.");
return;
}
if (selectedMachines.length > 1) {
UI.AddConsoleOutput("You can only initiate remote control on one machine at a time.");
if (selectedDevices.length > 1) {
UI.AddConsoleOutput("You can only initiate remote control on one device at a time.");
return;
}
UI.AddConsoleOutput("Launching remote control on client machine...");
BrowserSockets.Connection.invoke("RemoteControl", selectedMachines[0].ID);
UI.AddConsoleOutput("Launching remote control on client device...");
BrowserSockets.Connection.invoke("RemoteControl", selectedDevices[0].ID);
}),
new ConsoleCommand("Uninstall", [], "Uninstalls the Remotely client from the selected machines. Warning: This can't be undone from the web portal. You would need to redeploy the client.", "uninstall", "", (parameters, parameterDict) => {
var selectedMachines = DataGrid.GetSelectedMachines();
BrowserSockets.Connection.invoke("UninstallClients", selectedMachines.map(x => x.ID));
new ConsoleCommand("Uninstall", [], "Uninstalls the Remotely client from the selected devices. Warning: This can't be undone from the web portal. You would need to redeploy the client.", "uninstall", "", (parameters, parameterDict) => {
var selectedDevices = DataGrid.GetSelectedDevices();
BrowserSockets.Connection.invoke("UninstallClients", selectedDevices.map(x => x.ID));
}),
new ConsoleCommand("SetTags", [
new Parameter("Tags", "The tags to set for the machine. Max length is 200 characters.", "String"),
new Parameter("Tags", "The tags to set for the device. Max length is 200 characters.", "String"),
new Parameter("Append", "Append the tags to any existing ones.", "Switch")
], "Set the tag/description for the selected machines. Max length is 200 characters.", "SetTags -tags John's computer, Portland office, desktop", "", (parameters, parameterDict) => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
], "Set the tag/description for the selected devices. Max length is 200 characters.", "SetTags -tags John's computer, Portland office, desktop", "", (parameters, parameterDict) => {
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
}
selectedMachines.forEach(x => {
selectedDevices.forEach(x => {
if (typeof parameterDict["append"] != 'undefined') {
var separator = x.Tags.trim().endsWith(",") ? " " : ", ";
parameterDict["tags"] = x.Tags.trim() + separator + parameterDict["tags"];
}
DataGrid.DataSource.find(y => y.ID == x.ID).Tags = parameterDict["tags"];
document.getElementById(x.ID).querySelector(".machine-tag").value = parameterDict["tags"];
document.getElementById(x.ID).querySelector(".device-tag").value = parameterDict["tags"];
BrowserSockets.Connection.invoke("UpdateTags", x.ID, parameterDict["tags"]);
});
}),
new ConsoleCommand("TransferFiles", [], "Transfer file(s) to the selected machines.", "transferfiles", "", (parameters, parameterDict) => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
new ConsoleCommand("TransferFiles", [], "Transfer file(s) to the selected devices.", "transferfiles", "", (parameters, parameterDict) => {
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
}
var transferID = Main.Utilities.CreateGUID();
UI.AddTransferHarness(transferID, selectedMachines.length);
UI.AddTransferHarness(transferID, selectedDevices.length);
var fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.hidden = true;
@ -323,7 +323,7 @@ var commands = [
document.body.appendChild(fileInput);
fileInput.onchange = () => {
uploadFiles(fileInput.files).then(value => {
BrowserSockets.Connection.invoke("TransferFiles", value, transferID, selectedMachines.map(x => x.ID));
BrowserSockets.Connection.invoke("TransferFiles", value, transferID, selectedDevices.map(x => x.ID));
fileInput.remove();
});
};

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,13 @@
import { ConsoleCommand } from "../Models/ConsoleCommand.js"
import { Parameter } from "../Models/Parameter.js";
import { Machine } from "../Models/Machine.js";
import { Device } from "../Models/Device.js";
import * as UI from "../UI.js";
import * as BrowserSockets from "../BrowserSockets.js";
import { CommandLineParameter } from "../Models/CommandLineParameter.js";
import { Main } from "../Main.js";
import * as DataGrid from "../DataGrid.js";
import { AddConsoleHTML, AddConsoleOutput } from "../UI.js";
import { GetSelectedMachines } from "../DataGrid.js";
import { GetSelectedDevices } from "../DataGrid.js";
var commands: Array<ConsoleCommand> = [
@ -17,19 +17,19 @@ var commands: Array<ConsoleCommand> = [
new Parameter("group", "The group name to add.", "String")
],
"Adds a permission group to the selected computer(s).",
"AddGroup -group Lab Machines",
"AddGroup -group Lab Devices",
"",
(parameters, paramDictionary) => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
};
if (!paramDictionary["group"]) {
AddConsoleOutput("A group name is required.");
return;
}
BrowserSockets.Connection.invoke("AddGroup", selectedMachines.map(x=>x.ID), paramDictionary["group"]);
BrowserSockets.Connection.invoke("AddGroup", selectedDevices.map(x=>x.ID), paramDictionary["group"]);
}
),
new ConsoleCommand(
@ -40,7 +40,7 @@ var commands: Array<ConsoleCommand> = [
new Parameter("cmd", "Indicates that script should be run with Windows CMD.", "Switch"),
new Parameter("bash", "Indicates that script should be run with Bash.", "Switch")
],
"Deploy and run a script on the selected machine(s). Note: Only one switch argument can be used.",
"Deploy and run a script on the selected device(s). Note: Only one switch argument can be used.",
"deployscript -pscore",
"",
(parameters, parameterDict) => {
@ -48,9 +48,9 @@ var commands: Array<ConsoleCommand> = [
AddConsoleOutput("There should be exactly 1 argument to indicate the script type.");
return;
}
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
}
var fileInput = document.createElement("input");
@ -59,7 +59,7 @@ var commands: Array<ConsoleCommand> = [
document.body.appendChild(fileInput);
fileInput.onchange = () => {
uploadFiles(fileInput.files).then(value => {
BrowserSockets.Connection.invoke("DeployScript", value[0], parameters[0].Name, selectedMachines.map(x => x.ID));
BrowserSockets.Connection.invoke("DeployScript", value[0], parameters[0].Name, selectedDevices.map(x => x.ID));
fileInput.remove();
});
}
@ -72,19 +72,19 @@ var commands: Array<ConsoleCommand> = [
new Parameter("group", "The group name to remove.", "String")
],
"Removes a permission group to the selected computer(s).",
"RemoveGroup -group Lab Machines",
"RemoveGroup -group Lab Devices",
"",
(parameters, paramDictionary) => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
};
if (!paramDictionary["group"]) {
AddConsoleOutput("A group name is required.");
return;
}
BrowserSockets.Connection.invoke("RemoveGroup", selectedMachines.map(x => x.ID), paramDictionary["group"]);
BrowserSockets.Connection.invoke("RemoveGroup", selectedDevices.map(x => x.ID), paramDictionary["group"]);
}
),
new ConsoleCommand(
@ -181,28 +181,28 @@ var commands: Array<ConsoleCommand> = [
new ConsoleCommand(
"List",
[],
"Displays a list of the currently-selected machines.",
"Displays a list of the currently-selected devices.",
"list",
"",
() => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedMachines.length == 0) {
UI.AddConsoleOutput("No machines selected.");
if (selectedDevices.length == 0) {
UI.AddConsoleOutput("No devices are selected.");
return;
}
var output = `<div>Selected Machines:</div>
<table class="console-machine-table table table-responsive">
var output = `<div>Selected Devices:</div>
<table class="console-device-table table table-responsive">
<thead><tr>
<th>Online</th><th>Machine Name</th><th>Current User</th><th>Last Online</th><th>Platform</th><th>OS Description</th><th>Free Storage</th><th>Total Storage (GB)</th><th>Free Memory</th><th>Total Memory (GB)</th><th>Tags</th>
<th>Online</th><th>Device Name</th><th>Current User</th><th>Last Online</th><th>Platform</th><th>OS Description</th><th>Free Storage</th><th>Total Storage (GB)</th><th>Free Memory</th><th>Total Memory (GB)</th><th>Tags</th>
</tr></thead>`;
var machineList = selectedMachines.map(x => {
var deviceList = selectedDevices.map(x => {
return `<tr>
<td>${String(x.IsOnline)
.replace("true", "<span class='fa fa-check-circle'></span>")
.replace("false", "<span class='fa fa-times'></span>")}</td>
<td>${x.MachineName}</td>
<td>${x.DeviceName}</td>
<td>${x.CurrentUser}</td>
<td>${new Date(x.LastOnline).toLocaleString()}</td>
<td>${x.Platform}</td>
@ -214,7 +214,7 @@ var commands: Array<ConsoleCommand> = [
<td>${x.Tags}</td>
</tr>`
});
output += machineList.join("");
output += deviceList.join("");
UI.AddConsoleOutput(output);
}
),
@ -223,35 +223,35 @@ var commands: Array<ConsoleCommand> = [
[
],
"Removes the selected machines from the database. (Note: This does not attempt to uninstall the client. Use Uninstall.)",
"Removes the selected devices from the database. (Note: This does not attempt to uninstall the client. Use Uninstall.)",
"remove",
"",
(parameters) => {
var machines = DataGrid.GetSelectedMachines();
if (machines.length == 0) {
UI.AddConsoleOutput("No machines selected.");
var devices = DataGrid.GetSelectedDevices();
if (devices.length == 0) {
UI.AddConsoleOutput("No devices are selected.");
}
else {
BrowserSockets.Connection.invoke("RemoveMachines", machines.map(x=>x.ID));
BrowserSockets.Connection.invoke("RemoveDevices", devices.map(x=>x.ID));
}
}
),
new ConsoleCommand(
"Select",
[
new Parameter("all", "If specified, all machines will be selected.", "Switch"),
new Parameter("none", "If specified, no machines will be selected.", "Switch"),
new Parameter("online", "If specified, selects the machines that are currently online.", "Switch"),
new Parameter("all", "If specified, all devices will be selected.", "Switch"),
new Parameter("none", "If specified, no devices will be selected.", "Switch"),
new Parameter("online", "If specified, selects the devices that are currently online.", "Switch"),
new Parameter("filter", "A comma-separated list of search filters (spaces are optional). See the help article for more details.", "String"),
new Parameter("append", "If specified, selected machines will be added list of computers already selected (if any).", "Switch"),
new Parameter("append", "If specified, selected devices will be added list of computers already selected (if any).", "Switch"),
],
"Selects machines based on a supplied filter.",
"select -filter isonline=true, machinename*Rig, freestorage<50",
`The filter contains a comma-separated list of fields to search, and machines that match all filters will be selected.
"Selects devices based on a supplied filter.",
"select -filter isonline=true, devicename*Rig, freestorage<50",
`The filter contains a comma-separated list of fields to search, and devices that match all filters will be selected.
There are multiple operator types, and they can be used on any of the fields on the grid (plus some extra hidden ones).<br><br>
Operators:<br>
<ul style="list-style:none">
<li>=&nbsp;&nbsp;&nbsp; Exactly equal to. "machinename=myrig" would match "MyRig", but not "MyRig2"</li>
<li>=&nbsp;&nbsp;&nbsp; Exactly equal to. "devicename=myrig" would match "MyRig", but not "MyRig2"</li>
<li>*&nbsp;&nbsp;&nbsp; Like. "currentuser*bus" would match "Business" and "A_Busy_User"</li>
<li>!=&nbsp;&nbsp; Not equal to. "currentuser!=jon" would match every user except "Jon"</li>
<li>!*&nbsp;&nbsp; Not like. "currentuser!*jon" would match "Jon", "Jonathan", and "SuperJon"</li>
@ -262,7 +262,7 @@ var commands: Array<ConsoleCommand> = [
Fields:<br>
<ul style="list-style:none">
<li>IsOnline (true or false)</li>
<li>MachineName (text)</li>
<li>DeviceName (text)</li>
<li>CurrentUser (text)</li>
<li>LastOnline (date or date+time</li>
<li>Is64Bit (true or false)</li>
@ -280,19 +280,19 @@ var commands: Array<ConsoleCommand> = [
Main.DataGrid.DataSource.forEach(x => {
document.getElementById(x.ID).classList.add("row-selected");
})
UI.AddConsoleOutput(`${GetSelectedMachines().length} machines selected.`);
UI.AddConsoleOutput(`${GetSelectedDevices().length} devices selected.`);
}
if (typeof paramDictionary["none"] != "undefined") {
Main.UI.MachineGrid.querySelectorAll(".row-selected").forEach(x => {
Main.UI.DeviceGrid.querySelectorAll(".row-selected").forEach(x => {
x.classList.remove("row-selected");
});
UI.AddConsoleOutput(`${GetSelectedMachines().length} machines selected.`);
UI.AddConsoleOutput(`${GetSelectedDevices().length} devices selected.`);
}
if (typeof paramDictionary["online"] != "undefined") {
Main.DataGrid.DataSource.filter(x => x.IsOnline).forEach(x => {
document.getElementById(x.ID).classList.add("row-selected");
});
UI.AddConsoleOutput(`${GetSelectedMachines().length} machines selected.`);
UI.AddConsoleOutput(`${GetSelectedDevices().length} devices selected.`);
}
if (typeof paramDictionary["filter"] != "undefined") {
try {
@ -358,18 +358,18 @@ var commands: Array<ConsoleCommand> = [
}
lambda = lambda.slice(0, lambda.lastIndexOf(" &&"));
if (paramDictionary["append"] != "true") {
Main.UI.MachineGrid.querySelectorAll(".row-selected").forEach(x => {
Main.UI.DeviceGrid.querySelectorAll(".row-selected").forEach(x => {
x.classList.remove("row-selected");
});
}
var selectedMachines = Main.DataGrid.DataSource.filter(x => eval(lambda));
selectedMachines.forEach(x => {
var selectedDevices = Main.DataGrid.DataSource.filter(x => eval(lambda));
selectedDevices.forEach(x => {
document.getElementById(x.ID).classList.add("row-selected");
});
UI.AddConsoleOutput(`${GetSelectedMachines().length} machines selected.`);
UI.AddConsoleOutput(`${GetSelectedDevices().length} devices selected.`);
}
Main.DataGrid.UpdateMachineCounts();
Main.DataGrid.UpdateDeviceCounts();
}
),
new ConsoleCommand(
@ -379,51 +379,51 @@ var commands: Array<ConsoleCommand> = [
"list",
"",
() => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
UI.AddConsoleOutput("You must select a machine first.");
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
UI.AddConsoleOutput("You must select a device first.");
return;
}
if (selectedMachines.length > 1) {
UI.AddConsoleOutput("You can only initiate remote control on one machine at a time.");
if (selectedDevices.length > 1) {
UI.AddConsoleOutput("You can only initiate remote control on one device at a time.");
return;
}
UI.AddConsoleOutput("Launching remote control on client machine...");
BrowserSockets.Connection.invoke("RemoteControl", selectedMachines[0].ID);
UI.AddConsoleOutput("Launching remote control on client device...");
BrowserSockets.Connection.invoke("RemoteControl", selectedDevices[0].ID);
}
),
new ConsoleCommand("Uninstall",
[],
"Uninstalls the Remotely client from the selected machines. Warning: This can't be undone from the web portal. You would need to redeploy the client.",
"Uninstalls the Remotely client from the selected devices. Warning: This can't be undone from the web portal. You would need to redeploy the client.",
"uninstall",
"",
(parameters, parameterDict) => {
var selectedMachines = DataGrid.GetSelectedMachines();
BrowserSockets.Connection.invoke("UninstallClients", selectedMachines.map(x=>x.ID));
var selectedDevices = DataGrid.GetSelectedDevices();
BrowserSockets.Connection.invoke("UninstallClients", selectedDevices.map(x=>x.ID));
}
),
new ConsoleCommand(
"SetTags",
[
new Parameter("Tags", "The tags to set for the machine. Max length is 200 characters.", "String"),
new Parameter("Tags", "The tags to set for the device. Max length is 200 characters.", "String"),
new Parameter("Append", "Append the tags to any existing ones.", "Switch")
],
"Set the tag/description for the selected machines. Max length is 200 characters.",
"Set the tag/description for the selected devices. Max length is 200 characters.",
"SetTags -tags John's computer, Portland office, desktop",
"",
(parameters, parameterDict) => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
}
selectedMachines.forEach(x => {
selectedDevices.forEach(x => {
if (typeof parameterDict["append"] != 'undefined') {
var separator = x.Tags.trim().endsWith(",") ? " " : ", ";
parameterDict["tags"] = x.Tags.trim() + separator + parameterDict["tags"]
}
DataGrid.DataSource.find(y => y.ID == x.ID).Tags = parameterDict["tags"];
(document.getElementById(x.ID).querySelector(".machine-tag") as HTMLInputElement).value = parameterDict["tags"];
(document.getElementById(x.ID).querySelector(".device-tag") as HTMLInputElement).value = parameterDict["tags"];
BrowserSockets.Connection.invoke("UpdateTags", x.ID, parameterDict["tags"]);
});
}
@ -432,17 +432,17 @@ var commands: Array<ConsoleCommand> = [
"TransferFiles",
[
],
"Transfer file(s) to the selected machines.",
"Transfer file(s) to the selected devices.",
"transferfiles",
"",
(parameters, parameterDict) => {
var selectedMachines = Main.DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
AddConsoleOutput("No machines are selected.");
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
}
var transferID = Main.Utilities.CreateGUID();
UI.AddTransferHarness(transferID, selectedMachines.length);
UI.AddTransferHarness(transferID, selectedDevices.length);
var fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.hidden = true;
@ -450,7 +450,7 @@ var commands: Array<ConsoleCommand> = [
document.body.appendChild(fileInput);
fileInput.onchange = () => {
uploadFiles(fileInput.files).then(value => {
BrowserSockets.Connection.invoke("TransferFiles", value, transferID, selectedMachines.map(x => x.ID));
BrowserSockets.Connection.invoke("TransferFiles", value, transferID, selectedDevices.map(x => x.ID));
fileInput.remove();
});
}

View File

@ -1,110 +1,110 @@
import * as UI from "./UI.js";
import { Main } from "./Main.js";
import { MachineGrid } from "./UI.js";
import { DeviceGrid } from "./UI.js";
import * as BrowserSockets from "./BrowserSockets.js";
export var DataSource = new Array();
export function AddOrUpdateMachines(machines) {
machines.forEach(x => {
AddOrUpdateMachine(x);
export function AddOrUpdateDevices(devices) {
devices.forEach(x => {
AddOrUpdateDevice(x);
});
}
export function AddOrUpdateMachine(machine) {
var existingIndex = DataSource.findIndex(x => x.ID == machine.ID);
export function AddOrUpdateDevice(device) {
var existingIndex = DataSource.findIndex(x => x.ID == device.ID);
if (existingIndex > -1) {
DataSource[existingIndex] = machine;
DataSource[existingIndex] = device;
}
else {
DataSource.push(machine);
DataSource.push(device);
}
var tableBody = document.querySelector("#" + Main.UI.MachineGrid.id + " tbody");
var recordRow = document.getElementById(machine.ID);
var tableBody = document.querySelector("#" + Main.UI.DeviceGrid.id + " tbody");
var recordRow = document.getElementById(device.ID);
if (recordRow == null) {
recordRow = document.createElement("tr");
recordRow.classList.add("record-row");
recordRow.id = machine.ID;
recordRow.id = device.ID;
tableBody.appendChild(recordRow);
recordRow.addEventListener("click", (e) => {
e.currentTarget.classList.toggle("row-selected");
UpdateMachineCounts();
UpdateDeviceCounts();
});
}
recordRow.innerHTML = `
<td>${String(machine.IsOnline)
<td>${String(device.IsOnline)
.replace("true", "<span class='fa fa-check-circle'></span>")
.replace("false", "<span class='fa fa-times'></span>")}</td>
<td>${machine.MachineName}</td>
<td>${machine.CurrentUser}</td>
<td>${new Date(machine.LastOnline).toLocaleString()}</td>
<td>${machine.Platform}</td>
<td>${machine.OSDescription}</td>
<td>${Math.round(machine.FreeStorage * 100)}%</td>
<td>${machine.TotalStorage.toLocaleString()}</td>
<td>${Math.round(machine.FreeMemory * 100)}%</td>
<td>${machine.TotalMemory.toLocaleString()}</td>
<td><input type="text" class="machine-tag" value="${machine.Tags}" /></td>`;
recordRow.querySelector(".machine-tag").onchange = (ev) => {
<td>${device.DeviceName}</td>
<td>${device.CurrentUser}</td>
<td>${new Date(device.LastOnline).toLocaleString()}</td>
<td>${device.Platform}</td>
<td>${device.OSDescription}</td>
<td>${Math.round(device.FreeStorage * 100)}%</td>
<td>${device.TotalStorage.toLocaleString()}</td>
<td>${Math.round(device.FreeMemory * 100)}%</td>
<td>${device.TotalMemory.toLocaleString()}</td>
<td><input type="text" class="device-tag" value="${device.Tags}" /></td>`;
recordRow.querySelector(".device-tag").onchange = (ev) => {
var newTag = ev.currentTarget.value;
DataSource.find(x => x.ID == machine.ID).Tags = newTag;
BrowserSockets.Connection.invoke("UpdateTags", machine.ID, newTag);
DataSource.find(x => x.ID == device.ID).Tags = newTag;
BrowserSockets.Connection.invoke("UpdateTags", device.ID, newTag);
};
UpdateMachineCounts();
UpdateDeviceCounts();
}
export function GetSelectedMachines() {
var machines = new Array();
MachineGrid.querySelectorAll(".row-selected").forEach(row => {
machines.push(DataSource.find(x => x.ID == row.id));
export function GetSelectedDevices() {
var devices = new Array();
DeviceGrid.querySelectorAll(".row-selected").forEach(row => {
devices.push(DataSource.find(x => x.ID == row.id));
});
return machines;
return devices;
}
;
export function ClearAllData() {
DataSource.splice(0, DataSource.length);
UI.MachineGrid.querySelectorAll(".record-row").forEach(row => {
UI.DeviceGrid.querySelectorAll(".record-row").forEach(row => {
row.remove();
});
UpdateMachineCounts();
UpdateDeviceCounts();
}
export function RefreshGrid() {
ClearAllData();
var xhr = new XMLHttpRequest();
xhr.open("get", "/API/Machines");
xhr.open("get", "/API/Devices");
xhr.onerror = () => {
UI.ShowModal("Request Failure", "Failed to retrieve machine data. Please refresh your connection or contact support.");
UI.ShowModal("Request Failure", "Failed to retrieve device data. Please refresh your connection or contact support.");
};
xhr.onload = (e) => {
if (xhr.status == 200) {
var machines = JSON.parse(xhr.responseText);
if (machines.length == 0) {
UI.AddConsoleOutput("It looks like you don't have the Remotely service installed on any machines. You can get the install script from the Client Downloads page.");
var devices = JSON.parse(xhr.responseText);
if (devices.length == 0) {
UI.AddConsoleOutput("It looks like you don't have the Remotely service installed on any devices. You can get the install script from the Client Downloads page.");
}
else {
}
AddOrUpdateMachines(machines);
AddOrUpdateDevices(devices);
}
else {
UI.ShowModal("Request Failure", "Failed to retrieve machine data. Please refresh your connection or contact support.");
UI.ShowModal("Request Failure", "Failed to retrieve device data. Please refresh your connection or contact support.");
}
};
xhr.send();
}
export function ToggleSelectAll() {
var currentlySelected = MachineGrid.querySelectorAll(".row-selected:not(.hidden)");
var currentlySelected = DeviceGrid.querySelectorAll(".row-selected:not(.hidden)");
if (currentlySelected.length > 0) {
currentlySelected.forEach(elem => {
elem.classList.remove("row-selected");
});
}
else {
MachineGrid.querySelectorAll(".record-row:not(.hidden)").forEach(elem => {
DeviceGrid.querySelectorAll(".record-row:not(.hidden)").forEach(elem => {
elem.classList.add("row-selected");
});
}
UpdateMachineCounts();
UpdateDeviceCounts();
}
export function UpdateMachineCounts() {
UI.MachinesSelectedCount.innerText = UI.MachineGrid.querySelectorAll(".row-selected").length.toString();
UI.OnlineMachinesCount.innerText = DataSource.filter(x => x.IsOnline).length.toString();
UI.TotalMachinesCount.innerText = DataSource.length.toString();
export function UpdateDeviceCounts() {
UI.DevicesSelectedCount.innerText = UI.DeviceGrid.querySelectorAll(".row-selected").length.toString();
UI.OnlineDevicesCount.innerText = DataSource.filter(x => x.IsOnline).length.toString();
UI.TotalDevicesCount.innerText = DataSource.length.toString();
if (DataSource.some(x => x.IsOnline == false &&
document.getElementById(x.ID).classList.contains("row-selected"))) {
UI.AddConsoleOutput(`Your selection contains offline computers. Your commands will only be sent to those that are online.`);

View File

@ -1 +1 @@
{"version":3,"file":"DataGrid.js","sourceRoot":"","sources":["DataGrid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAEtD,MAAM,CAAC,IAAI,UAAU,GAAmB,IAAI,KAAK,EAAW,CAAC;AAE7D,MAAM,UAAU,mBAAmB,CAAC,QAAwB;IACxD,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACjB,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACP,CAAC;AACD,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IAC/C,IAAI,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CA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AAI,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;KACN;SACI;QACD,UAAU,CAAC,gBAAgB,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACvC,CAAC,CAAC,CAAA;KACL;IACD,kBAAkB,EAAE,CAAC;AACzB,CAAC;AACD,MAAM,UAAU,kBAAkB;IAC9B,EAAE,CAAC,oBAAoB,CAAC,SAAS,GAAG,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IACtG,EAAE,CAAC,kBAAkB,CAAC,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IACvF,EAAE,CAAC,iBAAiB,CAAC,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC9D,IACI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CACpB,CAAC,CAAC,QAAQ,IAAI,KAAK;QACnB,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,EACnE;QACE,EAAE,CAAC,gBAAgB,CAAC,uGAAuG,CAAC,CAAC;KAChI;AACL,CAAC"}

View File

@ -1,116 +1,116 @@
import * as UI from "./UI.js";
import { Machine } from "./Models/Machine.js";
import { Device } from "./Models/Device.js";
import { Main } from "./Main.js";
import { MachineGrid } from "./UI.js";
import { DeviceGrid } from "./UI.js";
import * as BrowserSockets from "./BrowserSockets.js";
export var DataSource: Array<Machine> = new Array<Machine>();
export var DataSource: Array<Device> = new Array<Device>();
export function AddOrUpdateMachines(machines: Array<Machine>) {
machines.forEach(x => {
AddOrUpdateMachine(x);
export function AddOrUpdateDevices(devices: Array<Device>) {
devices.forEach(x => {
AddOrUpdateDevice(x);
});
}
export function AddOrUpdateMachine(machine: Machine) {
var existingIndex = DataSource.findIndex(x => x.ID == machine.ID);
export function AddOrUpdateDevice(device: Device) {
var existingIndex = DataSource.findIndex(x => x.ID == device.ID);
if (existingIndex > -1) {
DataSource[existingIndex] = machine;
DataSource[existingIndex] = device;
}
else {
DataSource.push(machine);
DataSource.push(device);
}
var tableBody = document.querySelector("#" + Main.UI.MachineGrid.id + " tbody");
var recordRow = document.getElementById(machine.ID);
var tableBody = document.querySelector("#" + Main.UI.DeviceGrid.id + " tbody");
var recordRow = document.getElementById(device.ID);
if (recordRow == null) {
recordRow = document.createElement("tr");
recordRow.classList.add("record-row");
recordRow.id = machine.ID;
recordRow.id = device.ID;
tableBody.appendChild(recordRow);
recordRow.addEventListener("click", (e) => {
(e.currentTarget as HTMLElement).classList.toggle("row-selected");
UpdateMachineCounts();
UpdateDeviceCounts();
});
}
recordRow.innerHTML = `
<td>${String(machine.IsOnline)
<td>${String(device.IsOnline)
.replace("true", "<span class='fa fa-check-circle'></span>")
.replace("false", "<span class='fa fa-times'></span>")}</td>
<td>${machine.MachineName}</td>
<td>${machine.CurrentUser}</td>
<td>${new Date(machine.LastOnline).toLocaleString()}</td>
<td>${machine.Platform}</td>
<td>${machine.OSDescription}</td>
<td>${Math.round(machine.FreeStorage * 100)}%</td>
<td>${machine.TotalStorage.toLocaleString()}</td>
<td>${Math.round(machine.FreeMemory * 100)}%</td>
<td>${machine.TotalMemory.toLocaleString()}</td>
<td><input type="text" class="machine-tag" value="${machine.Tags}" /></td>`;
<td>${device.DeviceName}</td>
<td>${device.CurrentUser}</td>
<td>${new Date(device.LastOnline).toLocaleString()}</td>
<td>${device.Platform}</td>
<td>${device.OSDescription}</td>
<td>${Math.round(device.FreeStorage * 100)}%</td>
<td>${device.TotalStorage.toLocaleString()}</td>
<td>${Math.round(device.FreeMemory * 100)}%</td>
<td>${device.TotalMemory.toLocaleString()}</td>
<td><input type="text" class="device-tag" value="${device.Tags}" /></td>`;
(recordRow.querySelector(".machine-tag") as HTMLInputElement).onchange = (ev) => {
(recordRow.querySelector(".device-tag") as HTMLInputElement).onchange = (ev) => {
var newTag = (ev.currentTarget as HTMLInputElement).value;
DataSource.find(x => x.ID == machine.ID).Tags = newTag;
BrowserSockets.Connection.invoke("UpdateTags", machine.ID, newTag);
DataSource.find(x => x.ID == device.ID).Tags = newTag;
BrowserSockets.Connection.invoke("UpdateTags", device.ID, newTag);
};
UpdateMachineCounts();
UpdateDeviceCounts();
}
export function GetSelectedMachines(): Machine[] {
var machines = new Array<Machine>();
MachineGrid.querySelectorAll(".row-selected").forEach(row => {
machines.push(DataSource.find(x => x.ID == row.id));
export function GetSelectedDevices(): Device[] {
var devices = new Array<Device>();
DeviceGrid.querySelectorAll(".row-selected").forEach(row => {
devices.push(DataSource.find(x => x.ID == row.id));
});
return machines;
return devices;
};
export function ClearAllData() {
DataSource.splice(0, DataSource.length);
UI.MachineGrid.querySelectorAll(".record-row").forEach(row => {
UI.DeviceGrid.querySelectorAll(".record-row").forEach(row => {
row.remove();
});
UpdateMachineCounts();
UpdateDeviceCounts();
}
export function RefreshGrid() {
ClearAllData();
var xhr = new XMLHttpRequest();
xhr.open("get", "/API/Machines");
xhr.open("get", "/API/Devices");
xhr.onerror = () => {
UI.ShowModal("Request Failure", "Failed to retrieve machine data. Please refresh your connection or contact support.");
UI.ShowModal("Request Failure", "Failed to retrieve device data. Please refresh your connection or contact support.");
};
xhr.onload = (e) => {
if (xhr.status == 200) {
var machines = JSON.parse(xhr.responseText);
if (machines.length == 0) {
UI.AddConsoleOutput("It looks like you don't have the Remotely service installed on any machines. You can get the install script from the Client Downloads page.");
var devices = JSON.parse(xhr.responseText);
if (devices.length == 0) {
UI.AddConsoleOutput("It looks like you don't have the Remotely service installed on any devices. You can get the install script from the Client Downloads page.");
}
else {
}
AddOrUpdateMachines(machines);
AddOrUpdateDevices(devices);
}
else {
UI.ShowModal("Request Failure", "Failed to retrieve machine data. Please refresh your connection or contact support.");
UI.ShowModal("Request Failure", "Failed to retrieve device data. Please refresh your connection or contact support.");
}
}
xhr.send();
}
export function ToggleSelectAll() {
var currentlySelected = MachineGrid.querySelectorAll(".row-selected:not(.hidden)");
var currentlySelected = DeviceGrid.querySelectorAll(".row-selected:not(.hidden)");
if (currentlySelected.length > 0) {
currentlySelected.forEach(elem => {
elem.classList.remove("row-selected");
});
}
else {
MachineGrid.querySelectorAll(".record-row:not(.hidden)").forEach(elem => {
DeviceGrid.querySelectorAll(".record-row:not(.hidden)").forEach(elem => {
elem.classList.add("row-selected");
})
}
UpdateMachineCounts();
UpdateDeviceCounts();
}
export function UpdateMachineCounts() {
UI.MachinesSelectedCount.innerText = UI.MachineGrid.querySelectorAll(".row-selected").length.toString();
UI.OnlineMachinesCount.innerText = DataSource.filter(x => x.IsOnline).length.toString();
UI.TotalMachinesCount.innerText = DataSource.length.toString();
export function UpdateDeviceCounts() {
UI.DevicesSelectedCount.innerText = UI.DeviceGrid.querySelectorAll(".row-selected").length.toString();
UI.OnlineDevicesCount.innerText = DataSource.filter(x => x.IsOnline).length.toString();
UI.TotalDevicesCount.innerText = DataSource.length.toString();
if (
DataSource.some(x =>
x.IsOnline == false &&

View File

@ -10,7 +10,7 @@ export function ApplyInputEventHandlers() {
keyDownOnInputTextArea();
inputOnCommandTextArea();
inputOnFilterTextBox();
clickToggleAllMachines();
clickToggleAllDevices();
clickStartRemoteControlButton();
window.addEventListener("resize", ev => {
PositionCommandCompletionWindow();
@ -139,7 +139,7 @@ function inputOnCommandTextArea() {
function inputOnFilterTextBox() {
document.querySelector("#gridFilter").addEventListener("input", (e) => {
var currentText = e.currentTarget.value.toLowerCase();
UI.MachineGrid.querySelectorAll("tbody tr").forEach((row) => {
UI.DeviceGrid.querySelectorAll("tbody tr").forEach((row) => {
if (row.innerHTML.toLowerCase().indexOf(currentText) == -1) {
row.classList.add("hidden");
}
@ -149,19 +149,19 @@ function inputOnFilterTextBox() {
});
});
}
function clickToggleAllMachines() {
document.getElementById("toggleAllMachines").addEventListener("click", function (e) {
function clickToggleAllDevices() {
document.getElementById("toggleAllDevices").addEventListener("click", function (e) {
DataGrid.ToggleSelectAll();
});
}
function clickStartRemoteControlButton() {
document.getElementById("startRemoteControlButton").addEventListener("click", function (e) {
var selectedMachines = DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
UI.FloatMessage("You must select a machine first.");
var selectedDevices = DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
UI.FloatMessage("You must select a device first.");
}
else if (selectedMachines.length > 1) {
UI.FloatMessage("You must select only one machine to control.");
else if (selectedDevices.length > 1) {
UI.FloatMessage("You must select only one device to control.");
}
else {
UI.FloatMessage("Starting remote control...");

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@ export function ApplyInputEventHandlers() {
keyDownOnInputTextArea();
inputOnCommandTextArea();
inputOnFilterTextBox();
clickToggleAllMachines();
clickToggleAllDevices();
clickStartRemoteControlButton();
window.addEventListener("resize", ev => {
@ -146,7 +146,7 @@ function inputOnCommandTextArea() {
function inputOnFilterTextBox() {
document.querySelector("#gridFilter").addEventListener("input", (e) => {
var currentText = (e.currentTarget as HTMLInputElement).value.toLowerCase();
UI.MachineGrid.querySelectorAll("tbody tr").forEach((row: HTMLTableRowElement) => {
UI.DeviceGrid.querySelectorAll("tbody tr").forEach((row: HTMLTableRowElement) => {
if (row.innerHTML.toLowerCase().indexOf(currentText) == -1) {
row.classList.add("hidden");
}
@ -156,20 +156,20 @@ function inputOnFilterTextBox() {
})
})
}
function clickToggleAllMachines() {
document.getElementById("toggleAllMachines").addEventListener("click", function (e) {
function clickToggleAllDevices() {
document.getElementById("toggleAllDevices").addEventListener("click", function (e) {
DataGrid.ToggleSelectAll();
})
}
function clickStartRemoteControlButton() {
document.getElementById("startRemoteControlButton").addEventListener("click", function (e) {
var selectedMachines = DataGrid.GetSelectedMachines();
if (selectedMachines.length == 0) {
UI.FloatMessage("You must select a machine first.");
var selectedDevices = DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
UI.FloatMessage("You must select a device first.");
}
else if (selectedMachines.length > 1) {
UI.FloatMessage("You must select only one machine to control.");
else if (selectedDevices.length > 1) {
UI.FloatMessage("You must select only one device to control.");
}
else {
UI.FloatMessage("Starting remote control...");

View File

@ -4,7 +4,7 @@ export interface CommandContext {
CommandText: string;
SenderUserID: string;
SenderConnectionID: string;
TargetMachineIDs: string[];
TargetDeviceIDs: string[];
PSCoreResults: any[];
CMDResults: any[];
WinPSResults: any[];

View File

@ -0,0 +1 @@
//# sourceMappingURL=Device.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Device.js","sourceRoot":"","sources":["Device.ts"],"names":[],"mappings":""}

View File

@ -1,10 +1,10 @@
export interface Machine {
export interface Device {
Drives: any[];
ID: string;
Is64Bit: boolean;
IsOnline: boolean;
LastOnline: Date;
MachineName: string;
DeviceName: string;
OrganizationID: string;
OSArchitecture: any;
OSDescription: string;

View File

@ -1,5 +1,5 @@
export interface GenericCommandResult {
MachineID: string;
DeviceID: string;
CommandContextID: string;
CommandType: string;
StandardOutput: string;

View File

@ -1 +0,0 @@
//# sourceMappingURL=Machine.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Machine.js","sourceRoot":"","sources":["Machine.ts"],"names":[],"mappings":""}

View File

@ -1,5 +1,5 @@
export interface PSCoreCommandResult {
MachineID: string;
DeviceID: string;
CommandContextID: string;
VerboseOutput: string[];
DebugOutput: string[];

View File

@ -5,11 +5,11 @@ export class BrowserRTC {
Init() {
this.PeerConnection = new RTCPeerConnection(this.IceConfiguration);
UI.ScreenViewer.onloadedmetadata = (ev) => {
UI.ScreenViewer.play();
//UI.ScreenViewer.play();
};
this.PeerConnection.ontrack = (event) => {
event.streams.forEach(x => {
UI.ScreenViewer.srcObject = x;
//UI.ScreenViewer.srcObject = x;
});
};
this.PeerConnection.onconnectionstatechange = function (ev) {
@ -19,7 +19,7 @@ export class BrowserRTC {
case "failed":
UI.ConnectBox.style.removeProperty("display");
UI.ConnectButton.removeAttribute("disabled");
UI.ScreenViewer.srcObject = null;
//UI.ScreenViewer.srcObject = null;
UI.StatusMessage.innerHTML = "Connection closed.";
break;
default:
@ -33,7 +33,7 @@ export class BrowserRTC {
case "failed":
UI.ConnectBox.style.removeProperty("display");
UI.ConnectButton.removeAttribute("disabled");
UI.ScreenViewer.srcObject = null;
UI.Screen2DContext.clearRect(0, 0, UI.ScreenViewer.width, UI.ScreenViewer.height);
UI.StatusMessage.innerHTML = "Connection closed.";
break;
default:

View File

@ -1 +1 @@
{"version":3,"file":"BrowserRTC.js","sourceRoot":"","sources":["BrowserRTC.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,OAAO,UAAU;IAGnB,IAAI;QACA,IAAI,CAAC,cAAc,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnE,EAAE,CAAC,YAAY,CAAC,gBAAgB,GAAG,CAAC,EAAE,EAAE,EAAE;YACtC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAC3B,CAAC,CAAA;QACD,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACtB,EAAE,CAAC,YAAY,CAAC,SAAS,GAAG,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QACF,IAAI,CAAC,cAAc,CAAC,uBAAuB,GAAG,UAAU,EAAE;YACtD,QAAQ,IAAI,CAAC,eAAe,EAAE;gBAC1B,KAAK,QAAQ,CAAC;gBACd,KAAK,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,GAAG,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QACzD,CAAC,CAAC,CAAA;IACN,CAAC;CACJ"}

View File

@ -10,11 +10,11 @@ export class BrowserRTC {
Init() {
this.PeerConnection = new RTCPeerConnection(this.IceConfiguration);
UI.ScreenViewer.onloadedmetadata = (ev) => {
UI.ScreenViewer.play();
//UI.ScreenViewer.play();
}
this.PeerConnection.ontrack = (event) => {
event.streams.forEach(x => {
UI.ScreenViewer.srcObject = x;
//UI.ScreenViewer.srcObject = x;
});
};
this.PeerConnection.onconnectionstatechange = function (ev) {
@ -24,7 +24,7 @@ export class BrowserRTC {
case "failed":
UI.ConnectBox.style.removeProperty("display");
UI.ConnectButton.removeAttribute("disabled");
UI.ScreenViewer.srcObject = null;
//UI.ScreenViewer.srcObject = null;
UI.StatusMessage.innerHTML = "Connection closed.";
break;
default:
@ -38,7 +38,7 @@ export class BrowserRTC {
case "failed":
UI.ConnectBox.style.removeProperty("display");
UI.ConnectButton.removeAttribute("disabled");
UI.ScreenViewer.srcObject = null;
UI.Screen2DContext.clearRect(0, 0, UI.ScreenViewer.width, UI.ScreenViewer.height);
UI.StatusMessage.innerHTML = "Connection closed.";
break;
default:

View File

@ -13,6 +13,10 @@ export class RCBrowserSockets {
console.log("Connection closed.");
}).then(() => {
this.SendScreenCastRequestToDevice();
UI.ConnectButton.removeAttribute("disabled");
UI.ConnectBox.style.display = "none";
UI.ScreenViewer.removeAttribute("hidden");
UI.StatusMessage.innerHTML = "";
});
this.Connection.closedCallbacks.push((ev) => {
console.log("Connection closed.");
@ -77,21 +81,6 @@ export class RCBrowserSockets {
this.Connection.invoke("SendSharedFileIDs", JSON.parse(fileIDs));
}
ApplyMessageHandlers(hubConnection) {
hubConnection.on("IceConfiguration", (iceConfiguration) => {
RemoteControl.BrowserRTC.IceConfiguration = iceConfiguration;
RemoteControl.BrowserRTC.Init();
this.SendScreenCastRequestToDevice();
});
hubConnection.on("RTCSession", (description) => {
UI.ConnectButton.removeAttribute("disabled");
UI.ConnectBox.style.display = "none";
UI.ScreenViewer.removeAttribute("hidden");
UI.StatusMessage.innerHTML = "";
RemoteControl.BrowserRTC.ReceiveRTCSession(description);
});
hubConnection.on("IceCandidate", (candidate) => {
RemoteControl.BrowserRTC.ReceiveCandidate(candidate);
});
hubConnection.on("ScreenCount", (primaryScreenIndex, screenCount) => {
document.querySelector("#screenSelectBar").innerHTML = "";
for (let i = 0; i < screenCount; i++) {
@ -111,6 +100,23 @@ export class RCBrowserSockets {
};
}
});
hubConnection.on("ScreenSize", (width, height) => {
console.log("Screen size received. Width " + width + ". Height " + height);
UI.ScreenViewer.width = width;
UI.ScreenViewer.height = height;
});
hubConnection.on("ScreenCapture", (buffer) => {
window["test"] = buffer;
window["test2"] = atob(buffer);
//UI.Screen2DContext.putImageData(new ImageData(array, UI.ScreenViewer.width, UI.ScreenViewer.height), 0, 0);
//var url = window.URL.createObjectURL(new Blob([buffer]));
//var img = document.createElement("img");
//img.onload = function () {
// UI.Screen2DContext.drawImage(img, 0, 0, UI.ScreenViewer.width, UI.ScreenViewer.height);
// window.URL.revokeObjectURL(url);
//};
//img.src = url;
});
hubConnection.on("ConnectionFailed", () => {
UI.ConnectButton.removeAttribute("disabled");
UI.StatusMessage.innerHTML = "Connection failed or was denied.";

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,10 @@ export class RCBrowserSockets {
console.log("Connection closed.");
}).then(() => {
this.SendScreenCastRequestToDevice();
UI.ConnectButton.removeAttribute("disabled");
UI.ConnectBox.style.display = "none";
UI.ScreenViewer.removeAttribute("hidden");
UI.StatusMessage.innerHTML = "";
})
this.Connection.closedCallbacks.push((ev) => {
console.log("Connection closed.");
@ -86,21 +90,6 @@ export class RCBrowserSockets {
this.Connection.invoke("SendSharedFileIDs", JSON.parse(fileIDs));
}
private ApplyMessageHandlers(hubConnection) {
hubConnection.on("IceConfiguration", (iceConfiguration: any) => {
RemoteControl.BrowserRTC.IceConfiguration = iceConfiguration;
RemoteControl.BrowserRTC.Init();
this.SendScreenCastRequestToDevice();
});
hubConnection.on("RTCSession", (description: RTCSessionDescription) => {
UI.ConnectButton.removeAttribute("disabled");
UI.ConnectBox.style.display = "none";
UI.ScreenViewer.removeAttribute("hidden");
UI.StatusMessage.innerHTML = "";
RemoteControl.BrowserRTC.ReceiveRTCSession(description);
});
hubConnection.on("IceCandidate", (candidate: RTCIceCandidate) => {
RemoteControl.BrowserRTC.ReceiveCandidate(candidate);
});
hubConnection.on("ScreenCount", (primaryScreenIndex: number, screenCount: number) => {
document.querySelector("#screenSelectBar").innerHTML = "";
for (let i = 0; i < screenCount; i++) {
@ -120,7 +109,21 @@ export class RCBrowserSockets {
};
}
});
hubConnection.on("ScreenSize", (width: number, height: number) => {
console.log("Screen size received. Width " + width + ". Height " + height);
UI.ScreenViewer.width = width;
UI.ScreenViewer.height = height;
});
hubConnection.on("ScreenCapture", (buffer) => {
UI.Screen2DContext.putImageData(new ImageData(, UI.ScreenViewer.width, UI.ScreenViewer.height), 0, 0);
//var url = window.URL.createObjectURL(new Blob([buffer]));
//var img = document.createElement("img");
//img.onload = function () {
// UI.Screen2DContext.drawImage(img, 0, 0, UI.ScreenViewer.width, UI.ScreenViewer.height);
// window.URL.revokeObjectURL(url);
//};
//img.src = url;
});
hubConnection.on("ConnectionFailed", () => {
UI.ConnectButton.removeAttribute("disabled");
UI.StatusMessage.innerHTML = "Connection failed or was denied.";

View File

@ -6,6 +6,7 @@ export var ConnectButton = document.querySelector("#connectButton");
export var RequesterNameInput = document.querySelector("#nameInput");
export var StatusMessage = document.querySelector("#statusMessage");
export var ScreenViewer = document.querySelector("#screenViewer");
export var Screen2DContext = ScreenViewer.getContext("2d");
export var HorizontalBars = document.querySelectorAll(".horizontal-button-bar");
export var ConnectBox = document.getElementById("connectBox");
export var ScreenSelectBar = document.querySelector("#screenSelectBar");
@ -240,9 +241,6 @@ export function ApplyInputHandlers(sockets, rtc) {
var key = e.key.toLowerCase();
sockets.SendKeyUp(key);
});
window.addEventListener("click", function (e) {
ScreenViewer.muted = false;
});
window.ondragover = function (e) {
e.preventDefault();
e.dataTransfer.dropEffect = "copy";

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,8 @@ export var SessionIDInput = document.querySelector("#sessionIDInput") as HTMLInp
export var ConnectButton = document.querySelector("#connectButton") as HTMLButtonElement;
export var RequesterNameInput = document.querySelector("#nameInput") as HTMLInputElement;
export var StatusMessage = document.querySelector("#statusMessage") as HTMLDivElement;
export var ScreenViewer = document.querySelector("#screenViewer") as HTMLVideoElement;
export var ScreenViewer = document.querySelector("#screenViewer") as HTMLCanvasElement;
export var Screen2DContext = ScreenViewer.getContext("2d");
export var HorizontalBars = document.querySelectorAll(".horizontal-button-bar");
export var ConnectBox = document.getElementById("connectBox") as HTMLDivElement;
export var ScreenSelectBar = document.querySelector("#screenSelectBar") as HTMLDivElement;
@ -255,9 +256,7 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets, rtc: BrowserRTC) {
var key = e.key.toLowerCase();
sockets.SendKeyUp(key);
});
window.addEventListener("click", function (e) {
ScreenViewer.muted = false;
});
window.ondragover = function (e) {
e.preventDefault();
e.dataTransfer.dropEffect = "copy";

View File

@ -1,14 +1,14 @@
import * as DataGrid from "./DataGrid.js";
import { TabContentWrapper } from "./UI.js";
export function CreateCommandHarness(context) {
var collapseClass = context.TargetMachineIDs.length > 1 ? "collapse" : "collapse in";
var collapseClass = context.TargetDeviceIDs.length > 1 ? "collapse" : "collapse in";
var commandHarness = document.createElement("div");
commandHarness.id = context.ID;
commandHarness.classList.add("command-harness");
commandHarness.innerHTML = `
<div class="command-harness-title">
Command Type: ${context.CommandMode} |
Total Machines: <span id="${context.ID}-totalmachines">${context.TargetMachineIDs.length}</span> |
Total Devices: <span id="${context.ID}-totaldevices">${context.TargetDeviceIDs.length}</span> |
Completed: <span id="${context.ID}-completed">0%</span> |
Errors: <span id="${context.ID}-errors">0</span> |
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${context.ID}-results">View</button>
@ -20,18 +20,18 @@ export function CreateCommandHarness(context) {
return commandHarness;
}
export function AddPSCoreResultsHarness(result) {
var machineName = DataGrid.DataSource.find(x => x.ID == result.MachineID).MachineName;
var deviceName = DataGrid.DataSource.find(x => x.ID == result.DeviceID).DeviceName;
var resultsWrapper = document.getElementById(result.CommandContextID + "-results");
var totalMachines = parseInt(document.getElementById(result.CommandContextID + "-totalmachines").innerText);
var collapseClass = totalMachines > 1 ? "collapse" : "collapse in";
var totalDevices = parseInt(document.getElementById(result.CommandContextID + "-totaldevices").innerText);
var collapseClass = totalDevices > 1 ? "collapse" : "collapse in";
var resultDiv = document.createElement("div");
resultDiv.innerHTML = `
<div class="result-header">
Machine: ${machineName} |
Device: ${deviceName} |
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes" : "No"} |
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.MachineID}-result">View</button>
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
</div>
<div id="${result.CommandContextID + result.MachineID}-result" class="command-result-output ${collapseClass}">
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
<div>Host Output:<br>${result.HostOutput.replace(/\n/g, "<br>").replace(/ /g, "&nbsp;")}</div>
<div>Debug Output:<br>${result.DebugOutput.join("<br>").replace(/ /g, "&nbsp;")}</div>
<div>Verbose Output:<br>${result.VerboseOutput.join("<br>").replace(/ /g, "&nbsp;")}</div>
@ -48,18 +48,18 @@ export function AddPSCoreResultsHarness(result) {
TabContentWrapper.scrollTop = TabContentWrapper.scrollHeight;
}
export function AddCommandResultsHarness(result) {
var machineName = DataGrid.DataSource.find(x => x.ID == result.MachineID).MachineName;
var deviceName = DataGrid.DataSource.find(x => x.ID == result.DeviceID).DeviceName;
var resultsWrapper = document.getElementById(result.CommandContextID + "-results");
var totalMachines = parseInt(document.getElementById(result.CommandContextID + "-totalmachines").innerText);
var collapseClass = totalMachines > 1 ? "collapse" : "collapse in";
var totalDevices = parseInt(document.getElementById(result.CommandContextID + "-totaldevices").innerText);
var collapseClass = totalDevices > 1 ? "collapse" : "collapse in";
var resultDiv = document.createElement("div");
resultDiv.innerHTML = `
<div class="result-header">
Machine: ${machineName} |
Device: ${deviceName} |
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes" : "No"} |
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.MachineID}-result">View</button>
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
</div>
<div id="${result.CommandContextID + result.MachineID}-result" class="command-result-output ${collapseClass}">
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
<div>Standard Output:<br>${result.StandardOutput.replace(/\n/g, "<br>").replace(/ /g, "&nbsp;")}</div>
<div>Error Output:<br>${result.ErrorOutput.replace(/\n/g, "<br>").replace(/ /g, "&nbsp;")}</div>
</div>`;
@ -73,8 +73,8 @@ export function AddCommandResultsHarness(result) {
TabContentWrapper.scrollTop = TabContentWrapper.scrollHeight;
}
export function UpdateResultsCount(commandContextID) {
var totalMachines = parseInt(document.getElementById(commandContextID + "-totalmachines").innerText);
var percentComplete = Math.round(document.getElementById(commandContextID + "-results").children.length / totalMachines * 100);
var totalDevices = parseInt(document.getElementById(commandContextID + "-totaldevices").innerText);
var percentComplete = Math.round(document.getElementById(commandContextID + "-results").children.length / totalDevices * 100);
document.getElementById(commandContextID + "-completed").innerText = String(percentComplete) + "%";
}
//# sourceMappingURL=ResultsParser.js.map

View File

@ -1 +1 @@
{"version":3,"file":"ResultsParser.js","sourceRoot":"","sources":["ResultsParser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAoB,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Aa,CAAC,CAAC;KAC/C;IACD,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACtC,iBAAiB,CAAC,SAAS,GAAG,iBAAiB,CAAC,YAAY,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,gBAAuB;IACtD,IAAI,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,gBAAgB,GAAG,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC;IACnG,IAAI,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,gBAAgB,GAAG,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,YAAY,GAAG,GAAG,CAAC,CAAC;IAC9H,QAAQ,CAAC,cAAc,CAAC,gBAAgB,GAAG,YAAY,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC;AACvG,CAAC"}

View File

@ -5,14 +5,14 @@ import { GenericCommandResult } from "./Models/GenericCommandResult.js";
import { ConsoleOutputDiv, TabContentWrapper } from "./UI.js";
export function CreateCommandHarness(context: CommandContext): HTMLDivElement {
var collapseClass = context.TargetMachineIDs.length > 1 ? "collapse" : "collapse in";
var collapseClass = context.TargetDeviceIDs.length > 1 ? "collapse" : "collapse in";
var commandHarness = document.createElement("div");
commandHarness.id = context.ID;
commandHarness.classList.add("command-harness");
commandHarness.innerHTML = `
<div class="command-harness-title">
Command Type: ${context.CommandMode} |
Total Machines: <span id="${context.ID}-totalmachines">${context.TargetMachineIDs.length}</span> |
Total Devices: <span id="${context.ID}-totaldevices">${context.TargetDeviceIDs.length}</span> |
Completed: <span id="${context.ID}-completed">0%</span> |
Errors: <span id="${context.ID}-errors">0</span> |
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${context.ID}-results">View</button>
@ -25,19 +25,19 @@ export function CreateCommandHarness(context: CommandContext): HTMLDivElement {
}
export function AddPSCoreResultsHarness(result: PSCoreCommandResult) {
var machineName = DataGrid.DataSource.find(x => x.ID == result.MachineID).MachineName;
var deviceName = DataGrid.DataSource.find(x => x.ID == result.DeviceID).DeviceName;
var resultsWrapper = document.getElementById(result.CommandContextID + "-results");
var totalMachines = parseInt(document.getElementById(result.CommandContextID + "-totalmachines").innerText);
var collapseClass = totalMachines > 1 ? "collapse" : "collapse in";
var totalDevices = parseInt(document.getElementById(result.CommandContextID + "-totaldevices").innerText);
var collapseClass = totalDevices > 1 ? "collapse" : "collapse in";
var resultDiv = document.createElement("div");
resultDiv.innerHTML = `
<div class="result-header">
Machine: ${machineName} |
Device: ${deviceName} |
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes": "No"} |
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.MachineID}-result">View</button>
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
</div>
<div id="${result.CommandContextID + result.MachineID}-result" class="command-result-output ${collapseClass}">
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
<div>Host Output:<br>${result.HostOutput.replace(/\n/g, "<br>").replace(/ /g, "&nbsp;")}</div>
<div>Debug Output:<br>${result.DebugOutput.join("<br>").replace(/ /g, "&nbsp;")}</div>
<div>Verbose Output:<br>${result.VerboseOutput.join("<br>").replace(/ /g, "&nbsp;")}</div>
@ -54,19 +54,19 @@ export function AddPSCoreResultsHarness(result: PSCoreCommandResult) {
TabContentWrapper.scrollTop = TabContentWrapper.scrollHeight;
}
export function AddCommandResultsHarness(result: GenericCommandResult) {
var machineName = DataGrid.DataSource.find(x => x.ID == result.MachineID).MachineName;
var deviceName = DataGrid.DataSource.find(x => x.ID == result.DeviceID).DeviceName;
var resultsWrapper = document.getElementById(result.CommandContextID + "-results");
var totalMachines = parseInt(document.getElementById(result.CommandContextID + "-totalmachines").innerText);
var collapseClass = totalMachines > 1 ? "collapse" : "collapse in";
var totalDevices = parseInt(document.getElementById(result.CommandContextID + "-totaldevices").innerText);
var collapseClass = totalDevices > 1 ? "collapse" : "collapse in";
var resultDiv = document.createElement("div");
resultDiv.innerHTML = `
<div class="result-header">
Machine: ${machineName} |
Device: ${deviceName} |
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes" : "No"} |
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.MachineID}-result">View</button>
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
</div>
<div id="${result.CommandContextID + result.MachineID}-result" class="command-result-output ${collapseClass}">
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
<div>Standard Output:<br>${result.StandardOutput.replace(/\n/g, "<br>").replace(/ /g, "&nbsp;")}</div>
<div>Error Output:<br>${result.ErrorOutput.replace(/\n/g, "<br>").replace(/ /g, "&nbsp;")}</div>
</div>`;
@ -81,7 +81,7 @@ export function AddCommandResultsHarness(result: GenericCommandResult) {
}
export function UpdateResultsCount(commandContextID:string) {
var totalMachines = parseInt(document.getElementById(commandContextID + "-totalmachines").innerText);
var percentComplete = Math.round(document.getElementById(commandContextID + "-results").children.length / totalMachines * 100);
var totalDevices = parseInt(document.getElementById(commandContextID + "-totaldevices").innerText);
var percentComplete = Math.round(document.getElementById(commandContextID + "-results").children.length / totalDevices * 100);
document.getElementById(commandContextID + "-completed").innerText = String(percentComplete) + "%";
}

View File

@ -1,15 +1,15 @@
import { UserSettings } from "./UserSettings.js";
import * as Utilities from "./Utilities.js";
import { GetSelectedMachines } from "./DataGrid.js";
import { GetSelectedDevices } from "./DataGrid.js";
export var CommandCompletionDiv = document.querySelector("#commandCompletionDiv");
export var CommandInfoDiv = document.querySelector("#commandInfoDiv");
export var CommandModeSelect = document.querySelector("#commandModeSelect");
export var ConsoleOutputDiv = document.querySelector("#consoleOutputDiv");
export var ConsoleTextArea = document.querySelector("#consoleTextArea");
export var MachineGrid = document.querySelector("#machineGrid");
export var MachinesSelectedCount = document.querySelector("#machinesSelectedSpan");
export var OnlineMachinesCount = document.querySelector("#onlineMachinesSpan");
export var TotalMachinesCount = document.querySelector("#totalMachinesSpan");
export var DeviceGrid = document.querySelector("#deviceGrid");
export var DevicesSelectedCount = document.querySelector("#devicesSelectedSpan");
export var OnlineDevicesCount = document.querySelector("#onlineDevicesSpan");
export var TotalDevicesCount = document.querySelector("#totalDevicesSpan");
export var MeasurementCanvas = document.createElement("canvas");
export var MeasurementContext = MeasurementCanvas.getContext("2d");
export var TabContentWrapper = document.getElementById("tabContentWrapper");
@ -33,15 +33,15 @@ export function AddConsoleHTML(html) {
ConsoleOutputDiv.appendChild(contentWrapper);
TabContentWrapper.scrollTop = TabContentWrapper.scrollHeight;
}
export function AddTransferHarness(transferID, totalMachines) {
GetSelectedMachines();
export function AddTransferHarness(transferID, totalDevices) {
GetSelectedDevices();
var transferHarness = document.createElement("div");
transferHarness.id = transferID;
transferHarness.classList.add("command-harness");
transferHarness.innerHTML = `
<div class="command-harness-title">
File Transfer Status |
Total Machines: ${totalMachines} |
Total Devices: ${totalDevices} |
Completed: <span id="${transferID}-completed">0</span>
</div>`;
AddConsoleHTML(transferHarness.outerHTML);

View File

@ -1 +1 @@
{"version":3,"file":"UI.js","sourceRoot":"","sources":["UI.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAY5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,MAAM,CAAC,IAAI,oBAAoB,GAAG,QAAQ,CAAC,aAAa,CAAC,uBAAuB,CAAmB,CAAC;AACpG,MAAM,CAAC,IAAI,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,iBAAiB,CAAmB,CAAC;AACxF,MAAM,CAAC,IAAI,iBAAiB,GAAG,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAsB,CAAC;AACjG,MAAM,CAAC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,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC/C,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,EAAE;QACxC,IAAI;YACA,IAAI,iBAAiB,EAAE;gBACnB,iBAAiB,EAAE,CAAC;aACvB;SACJ;gBACO;YACH,EAAE,CAAC,aAA6B,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;SAC5D;IACL,CAAC,CAAC,CAAC;IACH,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;AAChC,CAAC;AAAA,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,YAA8B;IACxD,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,EAAE;QAC/B,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC;YACvB,QAAQ,EAAE,kHAAkH;YAC5H,KAAK,EAAE,YAAY,CAAC,iBAAiB;SACxC,CAAC,CAAC;QACH,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC;KAChB;SACI;QACD,OAAO,IAAI,CAAC;KACf;AACL,CAAC"}

View File

@ -12,7 +12,7 @@ import { CommandContext } from "./Models/CommandContext.js";
import * as DataGrid from "./DataGrid.js";
import { CreateCommandHarness, AddPSCoreResultsHarness, UpdateResultsCount, AddCommandResultsHarness } from "./ResultsParser.js";
import { GenericCommandResult } from "./Models/GenericCommandResult.js";
import { GetSelectedMachines } from "./DataGrid.js";
import { GetSelectedDevices } from "./DataGrid.js";
export var CommandCompletionDiv = document.querySelector("#commandCompletionDiv") as HTMLDivElement;
@ -20,10 +20,10 @@ export var CommandInfoDiv = document.querySelector("#commandInfoDiv") as HTMLDiv
export var CommandModeSelect = document.querySelector("#commandModeSelect") as HTMLSelectElement;
export var ConsoleOutputDiv = document.querySelector("#consoleOutputDiv") as HTMLDivElement;
export var ConsoleTextArea = document.querySelector("#consoleTextArea") as HTMLTextAreaElement;
export var MachineGrid = document.querySelector("#machineGrid") as HTMLTableElement;
export var MachinesSelectedCount = document.querySelector("#machinesSelectedSpan") as HTMLSpanElement;
export var OnlineMachinesCount = document.querySelector("#onlineMachinesSpan") as HTMLSpanElement;
export var TotalMachinesCount = document.querySelector("#totalMachinesSpan") as HTMLSpanElement;
export var DeviceGrid = document.querySelector("#deviceGrid") as HTMLTableElement;
export var DevicesSelectedCount = document.querySelector("#devicesSelectedSpan") as HTMLSpanElement;
export var OnlineDevicesCount = document.querySelector("#onlineDevicesSpan") as HTMLSpanElement;
export var TotalDevicesCount = document.querySelector("#totalDevicesSpan") as HTMLSpanElement;
export var MeasurementCanvas = document.createElement("canvas");
export var MeasurementContext = MeasurementCanvas.getContext("2d");
export var TabContentWrapper = document.getElementById("tabContentWrapper") as HTMLDivElement;
@ -55,15 +55,15 @@ export function AddConsoleHTML(html: string) {
TabContentWrapper.scrollTop = TabContentWrapper.scrollHeight;
}
export function AddTransferHarness(transferID: string, totalMachines:number) {
GetSelectedMachines()
export function AddTransferHarness(transferID: string, totalDevices:number) {
GetSelectedDevices()
var transferHarness = document.createElement("div");
transferHarness.id = transferID;
transferHarness.classList.add("command-harness");
transferHarness.innerHTML = `
<div class="command-harness-title">
File Transfer Status |
Total Machines: ${totalMachines} |
Total Devices: ${totalDevices} |
Completed: <span id="${transferID}-completed">0</span>
</div>`;
AddConsoleHTML(transferHarness.outerHTML);