Skip to content

Commit

Permalink
Merged PR 5: Replace Server UI with Blazor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Goodwin authored and bitbound committed Jul 29, 2021
1 parent 928fec7 commit 8c3f997
Show file tree
Hide file tree
Showing 523 changed files with 22,197 additions and 129,901 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# changes. On the GitHub page for your repo, you'll see a message that says,
# "This branch is ## commits behind lucent-sea:master."
#
# Click the "Pull request link next to it."
# Click the "Pull request" link next to it.
#
# On the next page click the "switching the base" link. Now it's pulling from
# my repo into yours. Create and complete the pull request to update your repo.
Expand Down Expand Up @@ -114,6 +114,13 @@ jobs:
shell: powershell
run: |
.\Utilities\Publish.ps1 -CertificatePath "$env:GITHUB_WORKSPACE\GitHubActionsWorkflow.pfx" -CertificatePassword $env:PfxKey -Hostname $env:SiteUrl -CurrentVersion $env:CurrentVersion -RID linux-x64 -OutDir "$env:GITHUB_WORKSPACE\publish"
- name: Copy server install scripts
shell: powershell
run: |
Copy-Item -Path ".\Utilities\Ubuntu_Server_Install.sh" -Destination ".\publish\Ubuntu_Server_Install.sh" -Force
Copy-Item -Path ".\Utilities\CentOS_Server_Install.sh" -Destination ".\publish\CentOS_Server_Install.sh" -Force
Copy-Item -Path ".\Utilities\Install-RemotelyServer.ps1" -Destination ".\publish\Install-RemotelyServer.ps1" -Force
# Upload build artifact to be deployed from Ubuntu runner
- name: Upload build artifact
Expand Down
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -260,25 +260,28 @@ paket-files/
__pycache__/
*.pyc

/Server/wwwroot/Downloads/*.exe
/Server/wwwroot/Downloads/*.zip
/Server/wwwroot/Downloads/*.appimage
/Server/Server.db
/Server/Recordings/*
/Server/ffmpeg.exe
/Server/Properties/PublishProfiles
*.msi
/Server/wwwroot/Downloads/WinDesktop/*
/Server/CurrentVersion.txt
/Server/Server.db-shm
/Server/Server.db-wal
/Server/wwwroot/Downloads/*.exe
/Server/wwwroot/Downloads/*.zip
/Server/wwwroot/Downloads/*.appimage
/Server/wwwroot/Downloads/Remotely_Desktop
Server/wwwroot/Downloads/Win-x64/*
Server/wwwroot/Downloads/Win-x86/*
/ScreenCast.Win/Properties/launchSettings.json
/Server/wwwroot/Content/Remotely_Desktop
Server/wwwroot/Content/Win-x64/*
Server/wwwroot/Content/Win-x86/*
/Server/wwwroot/Content/*.exe
/Server/wwwroot/Content/*.zip
/Server/wwwroot/Content/*.appimage
/Server/ScaffoldingReadMe.txt
/Server/Remotely.db
/Desktop.Win.Wrapper/Remotely_Desktop.zip
/Server/Remotely.db-wal
/Server/Remotely.db-shm
/Server/wwwroot/out.js
Expand Down
2 changes: 1 addition & 1 deletion Agent.Installer.Win/Agent.Installer.Win.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Debug (
xcopy "$(TargetPath)" "$(SolutionDir)Server\wwwroot\Downloads\" /y /e /i
xcopy "$(TargetPath)" "$(SolutionDir)Server\wwwroot\Content\" /y /e /i
)</PostBuildEvent>
</PropertyGroup>
</Project>
70 changes: 49 additions & 21 deletions Agent.Installer.Win/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,63 @@
<RowDefinition/>
</Grid.RowDefinitions>

<TextBlock Grid.Column="0" Grid.Row="0" Margin="0,0,15,0" FontSize="14">
<Run>Server URL:</Run>
<Run Text="&#xE897;"
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="0">
<TextBlock FontSize="14">Server URL:</TextBlock>

<Button Grid.Column="1" Grid.Row="0"
Background="White"
FontSize="14"
Margin="5,0"
BorderThickness="0"
Padding="3"
Cursor="Hand"
Click="ShowServerUrlHelp">
<TextBlock Text="&#xE897;"
FontWeight="Bold"
FontFamily="Segoe MDL2 Assets"
Cursor="Hand"
ToolTip="This is the URL of the server that your device will connect to after Remotely is installed."></Run>
</TextBlock>
PreviewMouseUp="ShowServerUrlHelp"></TextBlock>
</Button>
</StackPanel>


<TextBox Grid.Column="1" Grid.Row="0" TextWrapping="Wrap" Text="{Binding ServerUrl}" FontSize="14" />

<TextBlock Grid.Column="0" Grid.Row="2" Margin="0,0,15,0" FontSize="14">
<Run>Organization ID:</Run>
<Run Text="&#xE897;"
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="2">
<TextBlock FontSize="14">Organization ID</TextBlock>

<Button Grid.Column="1" Grid.Row="0"
Background="White"
FontSize="14"
Margin="5,0"
BorderThickness="0"
Padding="3"
Cursor="Hand"
Click="ShowOrganizationIdHelp">
<TextBlock Text="&#xE897;"
FontWeight="Bold"
FontFamily="Segoe MDL2 Assets"
Cursor="Hand"
ToolTip="Enter the organization ID that will have access to this device."></Run>
</TextBlock>
FontFamily="Segoe MDL2 Assets"></TextBlock>
</Button>
</StackPanel>

<TextBox Grid.Column="1" Grid.Row="2" TextWrapping="Wrap" Text="{Binding OrganizationID}" FontSize="14" />

<TextBlock Grid.Column="0" Grid.Row="4" Margin="0,0,15,0" FontSize="14">
<Run>Support Shortcut:</Run>
<Run Text="&#xE897;"
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="4">
<TextBlock FontSize="14">Support Shortcut</TextBlock>

<Button Grid.Column="1" Grid.Row="0"
Background="White"
FontSize="14"
Margin="5,0"
BorderThickness="0"
Padding="3"
Cursor="Hand"
Click="ShowSupportShortcutHelp">
<TextBlock Text="&#xE897;"
FontWeight="Bold"
FontFamily="Segoe MDL2 Assets"
Cursor="Hand"
ToolTip="Create a desktop shortcut to the Get Support page for this device."></Run>
</TextBlock>
<CheckBox Grid.Column="1" Grid.Row="4" IsChecked="{Binding CreateSupportShortcut}" />
FontFamily="Segoe MDL2 Assets"></TextBlock>
</Button>
</StackPanel>
<CheckBox Grid.Column="1" Grid.Row="4" VerticalAlignment="Center" IsChecked="{Binding CreateSupportShortcut}" />

</Grid>

Expand Down
30 changes: 30 additions & 0 deletions Agent.Installer.Win/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Remotely.Agent.Installer.Win.Utilities;
using Remotely.Agent.Installer.Win.ViewModels;
using System;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Input;

namespace Remotely.Agent.Installer.Win
Expand Down Expand Up @@ -40,5 +42,33 @@ private void MinimizeButton_Click(object sender, RoutedEventArgs e)
{
this.WindowState = WindowState.Minimized;
}

private void ShowServerUrlHelp(object sender, RoutedEventArgs e)
{
MessageBox.Show(
"This is the URL of the Remotely server that you're hosting. The device will connect to this URL.",
"Server URL",
MessageBoxButton.OK,
MessageBoxImage.Information);
}

private void ShowOrganizationIdHelp(object sender, RoutedEventArgs e)
{
MessageBox.Show(
"This is your organization ID on the Remotely server. Since Remotely supports multi-tenancy, " +
"this ID needs to be provided to determine who should have access."
+ Environment.NewLine + Environment.NewLine +
"You can find this ID on the Organization tab on the web app.",
"Organization ID",
MessageBoxButton.OK,
MessageBoxImage.Information);
}
private void ShowSupportShortcutHelp(object sender, RoutedEventArgs e)
{
MessageBox.Show("If selected, the installer will create a desktop shortcut to the Get Support page for this device.",
"Support Shortcut",
MessageBoxButton.OK,
MessageBoxImage.Information);
}
}
}
4 changes: 2 additions & 2 deletions Agent.Installer.Win/Services/InstallerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private async Task DownloadRemotelyAgent(string serverUrl)
ProgressValueChanged?.Invoke(this, args.ProgressPercentage);
};

await client.DownloadFileTaskAsync($"{serverUrl}/Downloads/Remotely-Win10-{Platform}.zip", targetFile);
await client.DownloadFileTaskAsync($"{serverUrl}/Content/Remotely-Win10-{Platform}.zip", targetFile);
}
}

Expand All @@ -287,7 +287,7 @@ private async Task DownloadRemotelyAgent(string serverUrl)
await Task.Delay(10);
}

var wr = WebRequest.CreateHttp($"{serverUrl}/Downloads/Remotely-Win10-{Platform}.zip");
var wr = WebRequest.CreateHttp($"{serverUrl}/Content/Remotely-Win10-{Platform}.zip");
wr.Method = "Head";
using (var response = (HttpWebResponse)await wr.GetResponseAsync())
{
Expand Down
2 changes: 1 addition & 1 deletion Agent.Installer.Win/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private bool CheckParams()
(serverUri.Scheme != Uri.UriSchemeHttp && serverUri.Scheme != Uri.UriSchemeHttps))
{
Logger.Write("ServerUrl is not valid.");
MessageBoxEx.Show("Server URL must be a valid Uri.", "Invalid Server URL", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBoxEx.Show("Server URL must be a valid Uri (e.g. https://app.remotely.one).", "Invalid Server URL", MessageBoxButton.OK, MessageBoxImage.Error);
return false;
}

Expand Down
5 changes: 0 additions & 5 deletions Agent/Agent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.4" />
<PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="7.1.3" />
<PackageReference Include="Microsoft.PowerShell.Commands.Management" Version="7.1.3" />
<PackageReference Include="Microsoft.PowerShell.Commands.Utility" Version="7.1.3" />
<PackageReference Include="Microsoft.PowerShell.CoreCLR.Eventing" Version="7.1.3" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.1.3" />
<PackageReference Include="Microsoft.PowerShell.Security" Version="7.1.3" />
<PackageReference Include="Microsoft.WSMan.Management" Version="7.1.3" />
<PackageReference Include="Microsoft.WSMan.Runtime" Version="7.1.3" />
<PackageReference Include="System.Management.Automation" Version="7.1.3" />
Expand Down
31 changes: 31 additions & 0 deletions Agent/Extensions/PowerShellCompletionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using System.Threading.Tasks;

namespace Remotely.Agent.Extensions
{
public static class PowerShellCompletionExtensions
{
public static PwshCommandCompletion ToPwshCompletion(this CommandCompletion completion)
{
return new PwshCommandCompletion()
{
CurrentMatchIndex = completion.CurrentMatchIndex,
ReplacementIndex = completion.ReplacementIndex,
ReplacementLength = completion.ReplacementLength,
CompletionMatches = completion.CompletionMatches
.Select(x => new PwshCompletionResult(x.CompletionText,
x.ListItemText,
EnumMapper.ToEnum<PwshCompletionResultType, CompletionResultType>(x.ResultType),
x.ToolTip))
.ToList()
};

}
}
}
20 changes: 20 additions & 0 deletions Agent/Interfaces/IDeviceInformationService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Remotely.Shared.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Remotely.Agent.Interfaces
{
public interface IDeviceInformationService
{
Task<Device> CreateDevice(string deviceId, string orgId);
Device GetDeviceBase(string deviceID, string orgID);
(double usedStorage, double totalStorage) GetSystemDriveInfo();
(double usedGB, double totalGB) GetMemoryInGB();
string GetAgentVersion();
List<Drive> GetAllDrives();
Task<double> GetCpuUtilization();
}
}
9 changes: 4 additions & 5 deletions Agent/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,23 @@ private static void BuildServices()
});
serviceCollection.AddSingleton<AgentSocket>();
serviceCollection.AddScoped<ChatClientService>();
serviceCollection.AddTransient<Bash>();
serviceCollection.AddTransient<CMD>();
serviceCollection.AddTransient<PSCore>();
serviceCollection.AddTransient<WindowsPS>();
serviceCollection.AddTransient<ExternalScriptingShell>();
serviceCollection.AddScoped<ConfigService>();
serviceCollection.AddScoped<Uninstaller>();
serviceCollection.AddScoped<ScriptRunner>();
serviceCollection.AddScoped<CommandExecutor>();
serviceCollection.AddScoped<ScriptExecutor>();

if (EnvironmentHelper.IsWindows)
{
serviceCollection.AddScoped<IAppLauncher, AppLauncherWin>();
serviceCollection.AddSingleton<IUpdater, UpdaterWin>();
serviceCollection.AddSingleton<IDeviceInformationService, DeviceInformationServiceWin>();
}
else if (EnvironmentHelper.IsLinux)
{
serviceCollection.AddScoped<IAppLauncher, AppLauncherLinux>();
serviceCollection.AddSingleton<IUpdater, UpdaterLinux>();
serviceCollection.AddSingleton<IDeviceInformationService, DeviceInformationServiceLinux>();
}
else if (EnvironmentHelper.IsMac)
{
Expand Down
Loading

0 comments on commit 8c3f997

Please sign in to comment.