Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement design updates on Viewer page. #647

Merged
merged 49 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
74b3d84
Make StreamSignaler disposable.
bitbound May 3, 2023
e6a83b1
Change IDesktopHubConnection.Connect signature so cancellation token …
bitbound May 3, 2023
a4e6e55
Make transient IScreenCaster service disposable.
bitbound May 3, 2023
f72d6da
Add capture metrics to viewer.
bitbound May 3, 2023
1efe17d
Update submodule.
bitbound May 3, 2023
0381742
Merge master.
bitbound May 4, 2023
518c87c
Update submodule.
bitbound May 4, 2023
e94156c
Update submodule.
bitbound May 10, 2023
80d3b38
Implement changes to IViewerAuthorizer.
bitbound May 10, 2023
39f72ca
Replace redundant instances of ScreenCaptureDto in every frame chunk.
bitbound May 10, 2023
3823973
Update submodule.
bitbound May 10, 2023
2bed627
Put received chunks into temporary processor. Guard while processing.
bitbound May 11, 2023
8164bb2
Update submodule.
bitbound May 11, 2023
5ca316c
Update submodule.
bitbound May 11, 2023
50dd11d
Update submodule.
bitbound May 11, 2023
9324e6a
Quiet some of the logs.
bitbound May 12, 2023
88211dd
Remove more redundant code. Remove frame received messages (no longe…
bitbound May 12, 2023
de5f07e
Remove libraries supplied by libman.
bitbound May 12, 2023
ee3c722
Update submodule.
bitbound May 12, 2023
c96319d
Comment out debug logging from EF Core.
bitbound May 12, 2023
5631bba
Update submodule.
bitbound May 12, 2023
6f5c015
Update submodule.
bitbound May 12, 2023
30921f9
Update submodule.
bitbound May 13, 2023
a0b8176
Revert circular buffer. Use acks.
bitbound May 13, 2023
97d742a
Update submodule.
bitbound May 13, 2023
f7d8326
Update submodule.
bitbound May 13, 2023
1bdc2b4
DXGI timeout to 25.
bitbound May 13, 2023
e342cd6
Prevent publisher from overwhelming consumer bewteen receipts.
bitbound May 14, 2023
44a7db9
Refactor capture processor.
bitbound May 14, 2023
e18f539
Removed CircularBufferTests (no longer used). Removed StreamingState…
bitbound May 15, 2023
f732939
BeginScreenCastImpl no longer needs to be called in a new thread.
bitbound May 15, 2023
79d3540
Revert log level change, as it will be handled in another PR.
bitbound May 16, 2023
bea7a0c
WIP on viewer design implementation.
bitbound May 18, 2023
7e3b578
Update submodule.
bitbound May 18, 2023
95a4c75
Update connection UI.
bitbound May 18, 2023
1ec1981
WIP on implementing new viewer design.
bitbound May 18, 2023
12d3929
Update submodule.
bitbound May 18, 2023
fbf91b9
Remove font-awesome from source control.
bitbound May 19, 2023
e52343e
Git ignore font-awesome. Supply from libman.
bitbound May 19, 2023
4e331d6
Finish implementing menu buttons.
bitbound May 19, 2023
2302f26
Update submodule.
bitbound May 19, 2023
777d9b6
Update submodule.
bitbound May 19, 2023
9a0e3ff
Update submodule.
bitbound May 19, 2023
6a87a29
Update submodule.
bitbound May 19, 2023
1909925
Merge branch 'master' into jaredg-viewer-design-update
bitbound May 19, 2023
c4938d9
Update submodule.
bitbound May 19, 2023
b418621
Force dark theme until light theme is implemented on viewer.
bitbound May 19, 2023
dbc16f0
Update submodule.
bitbound May 19, 2023
9f10d68
Update submodule.
bitbound May 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Agent/Services/CpuUtilizationSampler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public interface ICpuUtilizationSampler : IHostedService

internal class CpuUtilizationSampler : BackgroundService, ICpuUtilizationSampler
{
private readonly HashSet<int> _ignoredProcesses = new();
private readonly ILogger<CpuUtilizationSampler> _logger;
private double _currentUtilization;

Expand Down Expand Up @@ -47,7 +48,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
}
}

private static async Task<double> GetCpuUtilization(CancellationToken cancelToken)
private async Task<double> GetCpuUtilization(CancellationToken cancelToken)
{
double totalUtilization = 0;
var utilizations = new Dictionary<int, Tuple<DateTimeOffset, TimeSpan>>();
Expand All @@ -60,14 +61,24 @@ private static async Task<double> 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<DateTimeOffset, TimeSpan>(startTime, startCpuUsage));
}
catch
{
_ignoredProcesses.Add(proc.Id);
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Desktop.Linux/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
2 changes: 1 addition & 1 deletion Desktop.Win/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
5 changes: 4 additions & 1 deletion Remotely.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
11 changes: 11 additions & 0 deletions Remotely.sln.startup.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@
"ProfileName": "Agent"
}
}
},
"Server+Desktop": {
"Projects": {
"Server\\Server.csproj": {
"ProfileName": "Server"
},
"Desktop.Win": {
"ProfileName": "Desktop.Win"
}
}
}

}
}
2 changes: 1 addition & 1 deletion Server/API/AgentUpdateController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class AgentUpdateController : ControllerBase
private readonly IServiceHubSessionCache _serviceSessionCache;

public AgentUpdateController(IWebHostEnvironment hostingEnv,
IDataService dataService,
IDataService dataService,
IApplicationConfig appConfig,
IServiceHubSessionCache serviceSessionCache,
IHubContext<AgentHub> agentHubContext)
Expand Down
2 changes: 1 addition & 1 deletion Server/Data/AppDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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)
Expand Down
1 change: 1 addition & 0 deletions Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
services.AddSignalR(options =>
{
options.EnableDetailedErrors = builder.Environment.IsDevelopment();
options.MaximumParallelInvocationsPerClient = 5;
options.MaximumReceiveMessageSize = 100_000;
})
.AddJsonProtocol(options =>
Expand Down
13 changes: 7 additions & 6 deletions Server/Services/RcImplementations/ViewerAuthorizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.Extensions.Caching.Memory;
using Remotely.Shared.Utilities;
using System;
using System.Threading.Tasks;

namespace Remotely.Server.Services.RcImplementations
{
Expand All @@ -20,25 +21,25 @@ public ViewerAuthorizer(IApplicationConfig appConfig, IOtpProvider otpProvider)

public string UnauthorizedRedirectUrl { get; } = "/Identity/Account/Login";

public bool IsAuthorized(AuthorizationFilterContext context)
public Task<bool> 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);
}
}
}
59 changes: 29 additions & 30 deletions Server/Services/RcImplementations/ViewerPageDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,53 +20,52 @@ public ViewerPageDataProvider(IDataService dataService, IApplicationConfig appCo
_appConfig = appConfig;
}

public Task<string> GetFaviconUrl(ViewerModel viewerModel)
public Task<string> GetFaviconUrl(PageModel viewerModel)
{
return Task.FromResult("/_content/Immense.RemoteControl.Server/favicon.ico");
}

public Task<string> GetPageDescription(ViewerModel viewerModel)
public async Task<string> GetLogoUrl(PageModel viewerModel)
{
return Task.FromResult("Open-source remote support tools.");
}

public Task<string> 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<string> GetProductName(PageModel pageModel)
public Task<string> GetPageDescription(PageModel viewerModel)
{
return Task.FromResult("Remotely");
return Task.FromResult("Open-source remote support tools.");
}

public Task<string> GetProductSubtitle(PageModel pageModel)
public Task<string> GetPageTitle(PageModel pageModel)
{
return Task.FromResult("Remote Control");
return Task.FromResult("Remotely Remote Control");
}

public Task<ViewerPageTheme> 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<string> GetUserDisplayName(PageModel pageModel)
Expand Down
54 changes: 54 additions & 0 deletions Server/wwwroot/images/viewer/remotely-logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions Server/wwwroot/images/viewer/remotely-logo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading