diff --git a/Agent/Services/AppLauncher.cs b/Agent/Services/AppLauncher.cs index 44b0001c..509de9f9 100644 --- a/Agent/Services/AppLauncher.cs +++ b/Agent/Services/AppLauncher.cs @@ -184,10 +184,7 @@ namespace Remotely.Agent.Services var whoSplit = whoLine.Split(' ', StringSplitOptions.RemoveEmptyEntries); username = whoSplit[0]; display = whoSplit.Last().Trim('(').Trim(')'); - if (string.IsNullOrWhiteSpace(xauthority)) - { - xauthority = $"/home/{username}/.Xauthority"; - } + xauthority = $"/home/{username}/.Xauthority"; args = $"-u {username} {args}"; } diff --git a/Server/Services/RemoteControlSessionRecorder.cs b/Server/Services/RemoteControlSessionRecorder.cs index 13a6f572..93f63198 100644 --- a/Server/Services/RemoteControlSessionRecorder.cs +++ b/Server/Services/RemoteControlSessionRecorder.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Hosting; using Remotely.Server.Data; using Remotely.Server.Models; +using Remotely.Shared.Services; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -62,7 +63,20 @@ namespace Remotely.Server.Services var ffmpegProc = new Process(); SessionStates[frame.ViewerID].FfmpegProcess = ffmpegProc; - ffmpegProc.StartInfo.FileName = "ffmpeg.exe"; + switch (OSUtils.Platform) + { + case Shared.Enums.Platform.Windows: + ffmpegProc.StartInfo.FileName = "ffmpeg.exe"; + break; + case Shared.Enums.Platform.Linux: + ffmpegProc.StartInfo.FileName = "ffmpeg"; + break; + case Shared.Enums.Platform.OSX: + case Shared.Enums.Platform.Unknown: + default: + return; + } + ffmpegProc.StartInfo.Arguments = $"-y -f image2pipe -i pipe:.jpg -r 5 \"{saveFile}\""; ffmpegProc.StartInfo.UseShellExecute = false; ffmpegProc.StartInfo.RedirectStandardInput = true; diff --git a/Shared/Enums/Platform.cs b/Shared/Enums/Platform.cs new file mode 100644 index 00000000..84010dba --- /dev/null +++ b/Shared/Enums/Platform.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Remotely.Shared.Enums +{ + public enum Platform + { + Windows, + Linux, + OSX, + Unknown + } +} diff --git a/Shared/Services/DeviceInformation.cs b/Shared/Services/DeviceInformation.cs index f3377d35..a6e038da 100644 --- a/Shared/Services/DeviceInformation.cs +++ b/Shared/Services/DeviceInformation.cs @@ -16,8 +16,6 @@ namespace Remotely.Shared.Services { public static async Task Create(string deviceID, string orgID) { - OSPlatform platform = OSUtils.GetPlatform(); - DriveInfo systemDrive; if (OSUtils.IsWindows) @@ -40,7 +38,7 @@ namespace Remotely.Shared.Services { ID = deviceID, DeviceName = Environment.MachineName, - Platform = platform.ToString(), + Platform = OSUtils.Platform.ToString(), ProcessorCount = Environment.ProcessorCount, OSArchitecture = RuntimeInformation.OSArchitecture, OSDescription = RuntimeInformation.OSDescription, diff --git a/Shared/Services/OSUtils.cs b/Shared/Services/OSUtils.cs index 01c7dd2b..ee586348 100644 --- a/Shared/Services/OSUtils.cs +++ b/Shared/Services/OSUtils.cs @@ -1,4 +1,5 @@ -using System; +using Remotely.Shared.Enums; +using System; using System.Diagnostics; using System.Runtime.InteropServices; @@ -56,23 +57,26 @@ namespace Remotely.Shared.Services } } - public static OSPlatform GetPlatform() + public static Platform Platform { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + get { - return OSPlatform.Windows; - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - return OSPlatform.Linux; - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - return OSPlatform.OSX; - } - else - { - return OSPlatform.Create("Unknown"); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return Platform.Windows; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + return Platform.Linux; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + return Platform.OSX; + } + else + { + return Platform.Unknown; + } } } @@ -92,5 +96,6 @@ namespace Remotely.Shared.Services return proc.StandardOutput.ReadToEnd(); } + } }