diff --git a/Agent/Services/CpuUtilizationSampler.cs b/Agent/Services/CpuUtilizationSampler.cs index 4f2b488c8..23f298f58 100644 --- a/Agent/Services/CpuUtilizationSampler.cs +++ b/Agent/Services/CpuUtilizationSampler.cs @@ -17,6 +17,7 @@ public interface ICpuUtilizationSampler : IHostedService internal class CpuUtilizationSampler : BackgroundService, ICpuUtilizationSampler { + private readonly HashSet _ignoredProcesses = new(); private readonly ILogger _logger; private double _currentUtilization; @@ -47,7 +48,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) } } - private static async Task GetCpuUtilization(CancellationToken cancelToken) + private async Task GetCpuUtilization(CancellationToken cancelToken) { double totalUtilization = 0; var utilizations = new Dictionary>(); @@ -60,14 +61,24 @@ private static async Task GetCpuUtilization(CancellationToken cancelToke return 0; } + try { + // Processes in other sessions (e.g. session 0) will be inaccessible + // when debugging in a non-privileged process. This prevents errors + // from clogging up the output window. + if (_ignoredProcesses.Contains(proc.Id)) + { + continue; + } + var startTime = DateTimeOffset.Now; var startCpuUsage = proc.TotalProcessorTime; utilizations.Add(proc.Id, new Tuple(startTime, startCpuUsage)); } catch { + _ignoredProcesses.Add(proc.Id); continue; } } diff --git a/Desktop.Linux/Properties/launchSettings.json b/Desktop.Linux/Properties/launchSettings.json index cd94c5492..594c0ebb3 100644 --- a/Desktop.Linux/Properties/launchSettings.json +++ b/Desktop.Linux/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "Desktop.Linux": { "commandName": "Project", - "commandLineArgs": "-m Attended -s some-session-id -a vERyLonGAndCOMpleXKeY -o Immense -r Han" + "commandLineArgs": "-m Attended -h https://localhost:5001" } } } \ No newline at end of file diff --git a/Desktop.Win/Properties/launchSettings.json b/Desktop.Win/Properties/launchSettings.json index 7490b9ee2..d8c1fbf51 100644 --- a/Desktop.Win/Properties/launchSettings.json +++ b/Desktop.Win/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "Desktop.Win": { "commandName": "Project", - "commandLineArgs": "-m Attended -s some-session-id -a vERyLonGAndCOMpleXKeY -o Immense -r Han" + "commandLineArgs": "-m Attended -h https://localhost:5001" } } } \ No newline at end of file diff --git a/README.md b/README.md index 7c94ef502..66dfbfcff 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,14 @@ To avoid injection attacks, ASP.NET Core defaults to only accepting forwarded he - Data for Remotely will be saved in `/var/www/remotely/` within two files: appsettings.json and Remotely.db. - These files will persist through teardown and setup of new Remotely containers. - If upgrading from a non-Docker version of Remotely, overwrite these files with the ones from your previous installation. + - In that case, please note that you may need to change _SQLite_ parameter in your non-Docker appsettings.json. You may have something like: + ``` + "SQLite": "DataSource=Remotely.db", + ``` + but this should be changed to reflect the new Remotely.db location (relative to the container): + ``` + "SQLite": "DataSource=/remotely-data/Remotely.db", + ``` - Use Caddy as a reverse proxy if you want to expose the site to the internet. - If this is the first run, create your account by clicking the `Register` button on the main page. - This account will be both the server admin and organization admin. diff --git a/Remotely.sln b/Remotely.sln index b1d00fd80..d6f72cb50 100644 --- a/Remotely.sln +++ b/Remotely.sln @@ -73,7 +73,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Immense.RemoteControl.Share EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Immense.RemoteControl.Desktop", "submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop\Immense.RemoteControl.Desktop.csproj", "{034984DC-4B47-42E9-8648-F258C40C7926}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Immense.RemoteControl.Desktop.Native", "submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.Native\Immense.RemoteControl.Desktop.Native.csproj", "{7A8378BC-8169-4A33-93C6-47C699C5E74D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Immense.RemoteControl.Desktop.Native", "submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.Native\Immense.RemoteControl.Desktop.Native.csproj", "{7A8378BC-8169-4A33-93C6-47C699C5E74D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{E4D83C37-8B98-44FB-898B-9AA1BB223C66}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -305,6 +307,7 @@ Global {FEF0D431-EB2F-4C08-A125-8DF59AFDA525} = {48C738FB-359E-43DB-B338-FD7CB1CCF6A8} {034984DC-4B47-42E9-8648-F258C40C7926} = {48C738FB-359E-43DB-B338-FD7CB1CCF6A8} {7A8378BC-8169-4A33-93C6-47C699C5E74D} = {48C738FB-359E-43DB-B338-FD7CB1CCF6A8} + {E4D83C37-8B98-44FB-898B-9AA1BB223C66} = {48C738FB-359E-43DB-B338-FD7CB1CCF6A8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EAE10B28-119B-437C-9E68-06F0EE3F968A} diff --git a/Remotely.sln.startup.json b/Remotely.sln.startup.json index 6c33f5d7e..09e8fc189 100644 --- a/Remotely.sln.startup.json +++ b/Remotely.sln.startup.json @@ -74,6 +74,17 @@ "ProfileName": "Agent" } } + }, + "Server+Desktop": { + "Projects": { + "Server\\Server.csproj": { + "ProfileName": "Server" + }, + "Desktop.Win": { + "ProfileName": "Desktop.Win" + } + } } + } } diff --git a/Server/API/RemoteControlController.cs b/Server/API/RemoteControlController.cs index a93dcb04a..1f82b5de3 100644 --- a/Server/API/RemoteControlController.cs +++ b/Server/API/RemoteControlController.cs @@ -151,7 +151,8 @@ await _serviceHub.Clients.Client(serviceConnectionId).SendAsync("RemoteControl", accessKey, HttpContext.Connection.Id, string.Empty, - orgName); + orgName, + orgID); var waitResult = await session.WaitForSessionReady(TimeSpan.FromSeconds(30)); if (!waitResult) diff --git a/Server/Components/Scripts/RunScript.razor b/Server/Components/Scripts/RunScript.razor index 5838fe681..1cffdfdba 100644 --- a/Server/Components/Scripts/RunScript.razor +++ b/Server/Components/Scripts/RunScript.razor @@ -15,7 +15,7 @@ Show only mine - Show only mine - Show only mine - ChildItems { get; } = new(); public SavedScript Script { get; init; } } diff --git a/Server/Data/AppDb.cs b/Server/Data/AppDb.cs index 7a9e65a9b..9062bc3d1 100644 --- a/Server/Data/AppDb.cs +++ b/Server/Data/AppDb.cs @@ -41,7 +41,7 @@ public class AppDb : IdentityDbContext protected override void OnConfiguring(DbContextOptionsBuilder options) { options.ConfigureWarnings(x => x.Ignore(RelationalEventId.MultipleCollectionIncludeWarning)); - options.LogTo((message) => System.Diagnostics.Debug.Write(message)); + //options.LogTo((message) => System.Diagnostics.Debug.Write(message)); } protected override void OnModelCreating(ModelBuilder builder) diff --git a/Server/Pages/ScriptsPage.razor b/Server/Pages/ScriptsPage.razor index aa09be595..885f5e4a8 100644 --- a/Server/Pages/ScriptsPage.razor +++ b/Server/Pages/ScriptsPage.razor @@ -32,7 +32,9 @@ @code { - private IEnumerable? _filteredScriptNodes; + private readonly List _treeNodes = new(); + private IEnumerable _allScripts = Enumerable.Empty(); + private bool _showOnlyMyScripts = true; [Parameter] @@ -43,34 +45,24 @@ get => _showOnlyMyScripts; set { - _filteredScriptNodes = null; _showOnlyMyScripts = value; + _treeNodes.Clear(); } } - public List TreeNodes { get; } = new(); - public IEnumerable FilteredScriptNodes + public IEnumerable TreeNodes { get { - if (_filteredScriptNodes?.Any() == true) + if (_treeNodes?.Any() == true) { - return _filteredScriptNodes; + return _treeNodes; } - if (ShowOnlyMyScripts) - { - _filteredScriptNodes = TreeNodes.Where(x => - x.Script.CreatorId == User.Id); - } - else - { - _filteredScriptNodes = TreeNodes.Where(x => - x.Script.IsPublic || x.Script.CreatorId == User.Id); - } + RefreshTreeNodes(); - return _filteredScriptNodes; + return _treeNodes; } } @@ -85,31 +77,9 @@ public async Task RefreshScripts() { - TreeNodes.Clear(); - _filteredScriptNodes = null; - - var allScripts = await DataService.GetSavedScriptsWithoutContent(User.Id, User.OrganizationID); - - foreach (var script in allScripts) - { - var root = BuildFolderPath(script.FolderPath); - root.Add(new ScriptTreeNode() - { - Name = script.Name, - Script = script, - ItemType = TreeItemType.Item - }); - } + _treeNodes.Clear(); - TreeNodes.Sort((a, b) => - { - if (a.ItemType != b.ItemType) - { - return Comparer.Default.Compare(a.ItemType, b.ItemType); - } - - return Comparer.Default.Compare(a.Name, b.Name); - }); + _allScripts = await DataService.GetSavedScriptsWithoutContent(User.Id, User.OrganizationID); } protected override async Task OnInitializedAsync() @@ -119,13 +89,14 @@ } - private List BuildFolderPath(string folderPath) + private void CreateTreeNode(SavedScript script) { - var root = TreeNodes; + var root = _treeNodes; + ScriptTreeNode? targetParent = null; - if (!string.IsNullOrWhiteSpace(folderPath)) + if (!string.IsNullOrWhiteSpace(script.FolderPath)) { - var paths = folderPath.Split("/", StringSplitOptions.RemoveEmptyEntries); + var paths = script.FolderPath.Split("/", StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < paths.Length; i++) { var existingParent = root.Find(x => x.Name == paths[i]); @@ -135,18 +106,58 @@ var newItem = new ScriptTreeNode() { Name = paths[i], - ItemType = TreeItemType.Folder + ItemType = TreeItemType.Folder, + ParentNode = existingParent }; root.Add(newItem); root = newItem.ChildItems; + targetParent = newItem; } else { root = existingParent.ChildItems; + targetParent = existingParent; } } } - return root; + var scriptNode = new ScriptTreeNode() + { + Name = script.Name, + Script = script, + ItemType = TreeItemType.Item, + ParentNode = targetParent + }; + + root.Add(scriptNode); + } + + private void RefreshTreeNodes() + { + _treeNodes.Clear(); + + foreach (var script in _allScripts) + { + var showScript = ShowOnlyMyScripts ? + script.CreatorId == User.Id : + script.CreatorId == User.Id || script.IsPublic; + + if (!showScript) + { + continue; + } + + CreateTreeNode(script); + } + + _treeNodes.Sort((a, b) => + { + if (a.ItemType != b.ItemType) + { + return Comparer.Default.Compare(a.ItemType, b.ItemType); + } + + return Comparer.Default.Compare(a.Name, b.Name); + }); } } diff --git a/Server/Program.cs b/Server/Program.cs index f05ae677a..5305c55b5 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -165,6 +165,7 @@ services.AddSignalR(options => { options.EnableDetailedErrors = builder.Environment.IsDevelopment(); + options.MaximumParallelInvocationsPerClient = 5; options.MaximumReceiveMessageSize = 100_000; }) .AddJsonProtocol(options => diff --git a/Server/Services/RcImplementations/ViewerAuthorizer.cs b/Server/Services/RcImplementations/ViewerAuthorizer.cs index 0fbd986a1..58fc889ce 100644 --- a/Server/Services/RcImplementations/ViewerAuthorizer.cs +++ b/Server/Services/RcImplementations/ViewerAuthorizer.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Caching.Memory; using Remotely.Shared.Utilities; using System; +using System.Threading.Tasks; namespace Remotely.Server.Services.RcImplementations { @@ -20,25 +21,25 @@ public ViewerAuthorizer(IApplicationConfig appConfig, IOtpProvider otpProvider) public string UnauthorizedRedirectUrl { get; } = "/Identity/Account/Login"; - public bool IsAuthorized(AuthorizationFilterContext context) + public Task IsAuthorized(AuthorizationFilterContext context) { if (!_appConfig.RemoteControlRequiresAuthentication) { - return true; + return Task.FromResult(true); } - if (context.HttpContext.User.Identity.IsAuthenticated) + if (context.HttpContext.User.Identity?.IsAuthenticated == true) { - return true; + return Task.FromResult(true); } if (context.HttpContext.Request.Query.TryGetValue("otp", out var otp) && _otpProvider.Exists($"{otp}")) { - return true; + return Task.FromResult(true); } - return false; + return Task.FromResult(false); } } } diff --git a/Server/Services/RcImplementations/ViewerPageDataProvider.cs b/Server/Services/RcImplementations/ViewerPageDataProvider.cs index 049b5e983..9db7d3e81 100644 --- a/Server/Services/RcImplementations/ViewerPageDataProvider.cs +++ b/Server/Services/RcImplementations/ViewerPageDataProvider.cs @@ -20,53 +20,52 @@ public ViewerPageDataProvider(IDataService dataService, IApplicationConfig appCo _appConfig = appConfig; } - public Task GetFaviconUrl(ViewerModel viewerModel) + public Task GetFaviconUrl(PageModel viewerModel) { return Task.FromResult("/_content/Immense.RemoteControl.Server/favicon.ico"); } - public Task GetPageDescription(ViewerModel viewerModel) + public async Task GetLogoUrl(PageModel viewerModel) { - return Task.FromResult("Open-source remote support tools."); - } - - public Task GetPageTitle(PageModel pageModel) - { - return Task.FromResult("Remotely Remote Control"); + return await GetTheme(viewerModel) == ViewerPageTheme.Dark ? + "/images/viewer/remotely-logo-dark.svg" : + "/images/viewer/remotely-logo-light.svg"; } - public Task GetProductName(PageModel pageModel) + public Task GetPageDescription(PageModel viewerModel) { - return Task.FromResult("Remotely"); + return Task.FromResult("Open-source remote support tools."); } - public Task GetProductSubtitle(PageModel pageModel) + public Task GetPageTitle(PageModel pageModel) { - return Task.FromResult("Remote Control"); + return Task.FromResult("Remotely Remote Control"); } public Task GetTheme(PageModel pageModel) { - if (pageModel.User.Identity.IsAuthenticated) - { - var user = _dataService.GetUserByNameWithOrg(pageModel.User.Identity.Name); + // TODO: Implement light theme in new viewer design. + return Task.FromResult(ViewerPageTheme.Dark); + //if (pageModel.User.Identity.IsAuthenticated) + //{ + // var user = _dataService.GetUserByNameWithOrg(pageModel.User.Identity.Name); - var userTheme = user.UserOptions.Theme switch - { - Theme.Light => ViewerPageTheme.Light, - Theme.Dark => ViewerPageTheme.Dark, - _ => ViewerPageTheme.Dark - }; - return Task.FromResult(userTheme); - } + // var userTheme = user.UserOptions.Theme switch + // { + // Theme.Light => ViewerPageTheme.Light, + // Theme.Dark => ViewerPageTheme.Dark, + // _ => ViewerPageTheme.Dark + // }; + // return Task.FromResult(userTheme); + //} - var appTheme = _appConfig.Theme switch - { - Theme.Light => ViewerPageTheme.Light, - Theme.Dark => ViewerPageTheme.Dark, - _ => ViewerPageTheme.Dark - }; - return Task.FromResult(appTheme); + //var appTheme = _appConfig.Theme switch + //{ + // Theme.Light => ViewerPageTheme.Light, + // Theme.Dark => ViewerPageTheme.Dark, + // _ => ViewerPageTheme.Dark + //}; + //return Task.FromResult(appTheme); } public Task GetUserDisplayName(PageModel pageModel) diff --git a/Server/wwwroot/images/viewer/remotely-logo-dark.svg b/Server/wwwroot/images/viewer/remotely-logo-dark.svg new file mode 100644 index 000000000..147025a32 --- /dev/null +++ b/Server/wwwroot/images/viewer/remotely-logo-dark.svg @@ -0,0 +1,54 @@ + + + + + + + + Remotely + + diff --git a/Server/wwwroot/images/viewer/remotely-logo-light.svg b/Server/wwwroot/images/viewer/remotely-logo-light.svg new file mode 100644 index 000000000..4f4af8be7 --- /dev/null +++ b/Server/wwwroot/images/viewer/remotely-logo-light.svg @@ -0,0 +1,54 @@ + + + + + + + + Remotely + + diff --git a/Shared/Enums/BaseDtoType.cs b/Shared/Enums/BaseDtoType.cs deleted file mode 100644 index 8c0117968..000000000 --- a/Shared/Enums/BaseDtoType.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Runtime.Serialization; - -namespace Remotely.Shared.Enums -{ - [DataContract] - public enum BaseDtoType - { - [EnumMember(Value = "CaptureFrame")] - CaptureFrame = 0, - [EnumMember(Value = "ScreenData")] - ScreenData = 1, - [EnumMember(Value = "ScreenSize")] - ScreenSize = 2, - [EnumMember(Value = "ClipboardText")] - ClipboardText = 4, - [EnumMember(Value = "AudioSample")] - AudioSample = 5, - [EnumMember(Value = "CursorChange")] - CursorChange = 6, - [EnumMember(Value = "SelectScreen")] - SelectScreen = 7, - [EnumMember(Value = "MouseMove")] - MouseMove = 8, - [EnumMember(Value = "MouseDown")] - MouseDown = 9, - [EnumMember(Value = "MouseUp")] - MouseUp = 10, - [EnumMember(Value = "Tap")] - Tap = 11, - [EnumMember(Value = "MouseWheel")] - MouseWheel = 12, - [EnumMember(Value = "KeyDown")] - KeyDown = 13, - [EnumMember(Value = "KeyUp")] - KeyUp = 14, - [EnumMember(Value = "CtrlAltDel")] - CtrlAltDel = 15, - [EnumMember(Value = "ToggleAudio")] - ToggleAudio = 17, - [EnumMember(Value = "ToggleBlockInput")] - ToggleBlockInput = 18, - [EnumMember(Value = "ClipboardTransfer")] - ClipboardTransfer = 19, - [EnumMember(Value = "KeyPress")] - KeyPress = 20, - [EnumMember(Value = "File")] - File = 22, - [EnumMember(Value = "WindowsSessions")] - WindowsSessions = 23, - [EnumMember(Value = "SetKeyStatesUp")] - SetKeyStatesUp = 24, - [EnumMember(Value = "FrameReceived")] - FrameReceived = 25, - [EnumMember(Value = "OpenFileTransferWindow")] - OpenFileTransferWindow = 27 - } -} diff --git a/Shared/Models/RemoteControlDtos/AudioSampleDto.cs b/Shared/Models/RemoteControlDtos/AudioSampleDto.cs deleted file mode 100644 index 57301378b..000000000 --- a/Shared/Models/RemoteControlDtos/AudioSampleDto.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class AudioSampleDto : BaseDto - { - public AudioSampleDto(byte[] buffer) - { - Buffer = buffer; - } - - [DataMember(Name = "Buffer")] - public byte[] Buffer { get; } - - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.AudioSample; - - } -} diff --git a/Shared/Models/RemoteControlDtos/BaseDto.cs b/Shared/Models/RemoteControlDtos/BaseDto.cs deleted file mode 100644 index c8f25133c..000000000 --- a/Shared/Models/RemoteControlDtos/BaseDto.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class BaseDto - { - [DataMember(Name = "DtoType")] - public virtual BaseDtoType DtoType { get; init; } - } -} diff --git a/Shared/Models/RemoteControlDtos/CaptureFrameDto.cs b/Shared/Models/RemoteControlDtos/CaptureFrameDto.cs deleted file mode 100644 index 003160d05..000000000 --- a/Shared/Models/RemoteControlDtos/CaptureFrameDto.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Remotely.Shared.Enums; -using System; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class CaptureFrameDto : BaseDto - { - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.CaptureFrame; - - [DataMember(Name = "EndOfFrame")] - public bool EndOfFrame { get; init; } - - [DataMember(Name = "Height")] - public int Height { get; init; } - - [DataMember(Name = "ImageBytes")] - public byte[] ImageBytes { get; init; } - - [DataMember(Name = "Left")] - public int Left { get; init; } - [DataMember(Name = "Top")] - public int Top { get; init; } - [DataMember(Name = "Width")] - public int Width { get; init; } - - [DataMember(Name = "Sequence")] - public long Sequence { get; init; } - } -} diff --git a/Shared/Models/RemoteControlDtos/ClipboardTextDto.cs b/Shared/Models/RemoteControlDtos/ClipboardTextDto.cs deleted file mode 100644 index 6fa4743d5..000000000 --- a/Shared/Models/RemoteControlDtos/ClipboardTextDto.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class ClipboardTextDto : BaseDto - { - public ClipboardTextDto(string clipboardText) - { - ClipboardText = clipboardText; - } - - [DataMember(Name = "ClipboardText")] - public string ClipboardText { get; } - - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.ClipboardText; - } -} diff --git a/Shared/Models/RemoteControlDtos/ClipboardTransferDto.cs b/Shared/Models/RemoteControlDtos/ClipboardTransferDto.cs deleted file mode 100644 index 05981b8f5..000000000 --- a/Shared/Models/RemoteControlDtos/ClipboardTransferDto.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class ClipboardTransferDto : BaseDto - { - - [DataMember(Name = "Text")] - public string Text { get; set; } - - [DataMember(Name = "TypeText")] - public bool TypeText { get; set; } - - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.ClipboardTransfer; - } -} diff --git a/Shared/Models/RemoteControlDtos/CursorChangeDto.cs b/Shared/Models/RemoteControlDtos/CursorChangeDto.cs deleted file mode 100644 index df66c95fa..000000000 --- a/Shared/Models/RemoteControlDtos/CursorChangeDto.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class CursorChangeDto : BaseDto - { - public CursorChangeDto(byte[] imageBytes, int hotSpotX, int hotSpotY, string cssOverride) - { - ImageBytes = imageBytes; - HotSpotX = hotSpotX; - HotSpotY = hotSpotY; - CssOverride = cssOverride; - } - - [DataMember(Name = "CssOverride")] - public string CssOverride { get; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.CursorChange; - - [DataMember(Name = "HotSpotX")] - public int HotSpotX { get; } - - [DataMember(Name = "HotSpotY")] - public int HotSpotY { get; } - - [DataMember(Name = "ImageBytes")] - public byte[] ImageBytes { get; } - } -} diff --git a/Shared/Models/RemoteControlDtos/FileDto.cs b/Shared/Models/RemoteControlDtos/FileDto.cs deleted file mode 100644 index e3ba4c284..000000000 --- a/Shared/Models/RemoteControlDtos/FileDto.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - - [DataContract] - public class FileDto : BaseDto - { - [DataMember(Name = "Buffer")] - public byte[] Buffer { get; set; } - - [DataMember(Name = "FileName")] - public string FileName { get; set; } - - [DataMember(Name = "MessageId")] - public string MessageId { get; set; } - - [DataMember(Name = "EndOfFile")] - public bool EndOfFile { get; set; } - - [DataMember(Name = "StartOfFile")] - public bool StartOfFile { get; set; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.File; - } -} diff --git a/Shared/Models/RemoteControlDtos/KeyDownDto.cs b/Shared/Models/RemoteControlDtos/KeyDownDto.cs deleted file mode 100644 index 660ff705d..000000000 --- a/Shared/Models/RemoteControlDtos/KeyDownDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class KeyDownDto : BaseDto - { - [DataMember(Name = "Key")] - public string Key { get; set; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.KeyDown; - } -} diff --git a/Shared/Models/RemoteControlDtos/KeyPressDto.cs b/Shared/Models/RemoteControlDtos/KeyPressDto.cs deleted file mode 100644 index e44cb1b1b..000000000 --- a/Shared/Models/RemoteControlDtos/KeyPressDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class KeyPressDto : BaseDto - { - [DataMember(Name = "Key")] - public string Key { get; set; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.KeyPress; - } -} diff --git a/Shared/Models/RemoteControlDtos/KeyUpDto.cs b/Shared/Models/RemoteControlDtos/KeyUpDto.cs deleted file mode 100644 index c2dd48c2a..000000000 --- a/Shared/Models/RemoteControlDtos/KeyUpDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class KeyUpDto : BaseDto - { - [DataMember(Name = "Key")] - public string Key { get; set; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.KeyUp; - } -} diff --git a/Shared/Models/RemoteControlDtos/MouseDownDto.cs b/Shared/Models/RemoteControlDtos/MouseDownDto.cs deleted file mode 100644 index 913416980..000000000 --- a/Shared/Models/RemoteControlDtos/MouseDownDto.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class MouseDownDto : BaseDto - { - [DataMember(Name = "Button")] - public int Button { get; set; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.MouseDown; - - [DataMember(Name = "PercentX")] - public double PercentX { get; set; } - - [DataMember(Name = "PercentY")] - public double PercentY { get; set; } - } -} diff --git a/Shared/Models/RemoteControlDtos/MouseMoveDto.cs b/Shared/Models/RemoteControlDtos/MouseMoveDto.cs deleted file mode 100644 index 8c983c31a..000000000 --- a/Shared/Models/RemoteControlDtos/MouseMoveDto.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class MouseMoveDto : BaseDto - { - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.MouseMove; - - [DataMember(Name = "PercentX")] - public double PercentX { get; set; } - - [DataMember(Name = "PercentY")] - public double PercentY { get; set; } - } -} diff --git a/Shared/Models/RemoteControlDtos/MouseUpDto.cs b/Shared/Models/RemoteControlDtos/MouseUpDto.cs deleted file mode 100644 index 559567574..000000000 --- a/Shared/Models/RemoteControlDtos/MouseUpDto.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class MouseUpDto : BaseDto - { - [DataMember(Name = "Button")] - public int Button { get; set; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.MouseUp; - - [DataMember(Name = "PercentX")] - public double PercentX { get; set; } - - [DataMember(Name = "PercentY")] - public double PercentY { get; set; } - } -} diff --git a/Shared/Models/RemoteControlDtos/MouseWheelDto.cs b/Shared/Models/RemoteControlDtos/MouseWheelDto.cs deleted file mode 100644 index e32fa71d3..000000000 --- a/Shared/Models/RemoteControlDtos/MouseWheelDto.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class MouseWheelDto : BaseDto - { - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.MouseWheel; - - [DataMember(Name = "DeltaX")] - public double DeltaX { get; set; } - - [DataMember(Name = "DeltaY")] - public double DeltaY { get; set; } - } -} diff --git a/Shared/Models/RemoteControlDtos/ScreenDataDto.cs b/Shared/Models/RemoteControlDtos/ScreenDataDto.cs deleted file mode 100644 index 070ddd0da..000000000 --- a/Shared/Models/RemoteControlDtos/ScreenDataDto.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Remotely.Shared.Enums; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class ScreenDataDto : BaseDto - { - [DataMember(Name = "DisplayNames")] - public IEnumerable DisplayNames { get; init; } - - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.ScreenData; - - [DataMember(Name = "SelectedDisplay")] - public string SelectedDisplay { get; init; } - - [DataMember(Name = "MachineName")] - public string MachineName { get; init; } - - [DataMember(Name = "ScreenWidth")] - public int ScreenWidth { get; init; } - - [DataMember(Name = "ScreenHeight")] - public int ScreenHeight { get; init; } - } -} diff --git a/Shared/Models/RemoteControlDtos/ScreenSizeDto.cs b/Shared/Models/RemoteControlDtos/ScreenSizeDto.cs deleted file mode 100644 index 951694f40..000000000 --- a/Shared/Models/RemoteControlDtos/ScreenSizeDto.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class ScreenSizeDto : BaseDto - { - public ScreenSizeDto(int width, int height) - { - Width = width; - Height = height; - } - - [DataMember(Name = "Width")] - public int Width { get; } - - [DataMember(Name = "Height")] - public int Height { get; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.ScreenSize; - } -} diff --git a/Shared/Models/RemoteControlDtos/SelectScreenDto.cs b/Shared/Models/RemoteControlDtos/SelectScreenDto.cs deleted file mode 100644 index 1860da323..000000000 --- a/Shared/Models/RemoteControlDtos/SelectScreenDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class SelectScreenDto : BaseDto - { - [DataMember(Name = "DisplayName")] - public string DisplayName { get; set; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.SelectScreen; - } -} diff --git a/Shared/Models/RemoteControlDtos/TapDto.cs b/Shared/Models/RemoteControlDtos/TapDto.cs deleted file mode 100644 index 9bb469412..000000000 --- a/Shared/Models/RemoteControlDtos/TapDto.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class TapDto : BaseDto - { - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.Tap; - - [DataMember(Name = "PercentX")] - public double PercentX { get; set; } - - [DataMember(Name = "PercentY")] - public double PercentY { get; set; } - } -} diff --git a/Shared/Models/RemoteControlDtos/ToggleAudioDto.cs b/Shared/Models/RemoteControlDtos/ToggleAudioDto.cs deleted file mode 100644 index 38759ad7e..000000000 --- a/Shared/Models/RemoteControlDtos/ToggleAudioDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class ToggleAudioDto : BaseDto - { - [DataMember(Name = "ToggleOn")] - public bool ToggleOn { get; set; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.ToggleAudio; - } -} diff --git a/Shared/Models/RemoteControlDtos/ToggleBlockInputDto.cs b/Shared/Models/RemoteControlDtos/ToggleBlockInputDto.cs deleted file mode 100644 index 6fb7550ae..000000000 --- a/Shared/Models/RemoteControlDtos/ToggleBlockInputDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Remotely.Shared.Enums; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class ToggleBlockInputDto : BaseDto - { - [DataMember(Name = "ToggleOn")] - public bool ToggleOn { get; set; } - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.ToggleBlockInput; - } -} diff --git a/Shared/Models/RemoteControlDtos/WindowsSessionsDto.cs b/Shared/Models/RemoteControlDtos/WindowsSessionsDto.cs deleted file mode 100644 index 7ca772243..000000000 --- a/Shared/Models/RemoteControlDtos/WindowsSessionsDto.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Immense.RemoteControl.Desktop.Native.DataStructures; -using Remotely.Shared.Enums; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Remotely.Shared.Models.RemoteControlDtos -{ - [DataContract] - public class WindowsSessionsDto : BaseDto - { - public WindowsSessionsDto(List windowsSessions) - { - WindowsSessions = windowsSessions; - } - - - [DataMember(Name = "WindowsSessions")] - public List WindowsSessions { get; set; } - - - [DataMember(Name = "DtoType")] - public override BaseDtoType DtoType { get; init; } = BaseDtoType.WindowsSessions; - } -} diff --git a/Shared/Models/SentFrame.cs b/Shared/Models/SentFrame.cs deleted file mode 100644 index a969b6368..000000000 --- a/Shared/Models/SentFrame.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Remotely.Shared.Utilities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Remotely.Shared.Models -{ - public struct SentFrame - { - public SentFrame(int frameSize) - { - Timestamp = Time.Now; - FrameSize = frameSize; - } - - public DateTimeOffset Timestamp { get; } - public int FrameSize { get; } - } -} diff --git a/submodules/Immense.RemoteControl b/submodules/Immense.RemoteControl index 3ba78e9ba..51063504e 160000 --- a/submodules/Immense.RemoteControl +++ b/submodules/Immense.RemoteControl @@ -1 +1 @@ -Subproject commit 3ba78e9baaea93ece4ac77c43ce0a2138b59a063 +Subproject commit 51063504e723f2ee5a8fe4e672855d905a3f0eca