-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ubuntu desktop app requires sudo but will install dependencies. Creat…
…ed config service to replace static class.
- Loading branch information
Showing
19 changed files
with
186 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Remotely.Shared.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Remotely.Desktop.Core.Interfaces | ||
{ | ||
public interface IConfigService | ||
{ | ||
DesktopAppConfig GetConfig(); | ||
void Save(DesktopAppConfig config); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Desktop.Linux/X11Interop/LibXtst.cs → Desktop.Linux/Native/LibXtst.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Remotely.Desktop.Linux.Native | ||
{ | ||
public class Libc | ||
{ | ||
[DllImport("libc", SetLastError = true)] | ||
public static extern uint geteuid(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Remotely.Desktop.Core.Interfaces; | ||
using Remotely.Shared.Models; | ||
using Remotely.Shared.Utilities; | ||
using System; | ||
using System.IO; | ||
using System.Text.Json; | ||
|
||
namespace Remotely.Desktop.Linux.Services | ||
{ | ||
public class ConfigServiceLinux : IConfigService | ||
{ | ||
private static string _configFile => Path.Combine(_configFolder, "Config.json"); | ||
private static string _configFolder => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "remotely.json"); | ||
|
||
public DesktopAppConfig GetConfig() | ||
{ | ||
var config = new DesktopAppConfig(); | ||
|
||
if (string.IsNullOrWhiteSpace(config.Host) && | ||
File.Exists(_configFile)) | ||
{ | ||
try | ||
{ | ||
config = JsonSerializer.Deserialize<DesktopAppConfig>(File.ReadAllText(_configFile)); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Logger.Write(ex); | ||
} | ||
} | ||
|
||
return config; | ||
} | ||
|
||
public void Save(DesktopAppConfig config) | ||
{ | ||
try | ||
{ | ||
Directory.CreateDirectory(_configFolder); | ||
File.WriteAllText(_configFile, JsonSerializer.Serialize(config)); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Logger.Write(ex); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.