mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Increase require.js module timeout. Use SessionId in AppLauncher to determine start procedure.
This commit is contained in:
parent
367d6b6445
commit
9fe63da1d6
@ -4,6 +4,7 @@ using Remotely.Agent.Interfaces;
|
||||
using Remotely.Agent.Services;
|
||||
using Remotely.Shared.Utilities;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.ServiceProcess;
|
||||
using System.Threading;
|
||||
@ -87,7 +88,8 @@ namespace Remotely.Agent
|
||||
SetWorkingDirectory();
|
||||
|
||||
|
||||
if (!EnvironmentHelper.IsDebug && EnvironmentHelper.IsWindows)
|
||||
if (EnvironmentHelper.IsWindows &&
|
||||
Process.GetCurrentProcess().SessionId == 0)
|
||||
{
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
|
||||
@ -34,7 +34,7 @@ namespace Remotely.Agent.Services
|
||||
|
||||
// Start Desktop app.
|
||||
await hubConnection.SendAsync("DisplayMessage", $"Starting chat service...", "Starting chat service.", requesterID);
|
||||
if (EnvironmentHelper.IsDebug)
|
||||
if (Process.GetCurrentProcess().SessionId > 0)
|
||||
{
|
||||
return Process.Start(rcBinaryPath, $"-mode Chat -requester \"{requesterID}\" -organization \"{orgName}\"").Id;
|
||||
}
|
||||
@ -78,7 +78,7 @@ namespace Remotely.Agent.Services
|
||||
|
||||
// Start Desktop app.
|
||||
await hubConnection.SendAsync("DisplayMessage", $"Starting remote control...", "Starting remote control.", requesterID);
|
||||
if (EnvironmentHelper.IsDebug)
|
||||
if (Process.GetCurrentProcess().SessionId > 0)
|
||||
{
|
||||
// SignalR Connection IDs might start with a hyphen. We surround them
|
||||
// with quotes so the command line will be parsed correctly.
|
||||
@ -111,7 +111,7 @@ namespace Remotely.Agent.Services
|
||||
var rcBinaryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Desktop", EnvironmentHelper.DesktopExecutableFileName);
|
||||
// Start Desktop app.
|
||||
Logger.Write("Restarting screen caster.");
|
||||
if (EnvironmentHelper.IsDebug)
|
||||
if (Process.GetCurrentProcess().SessionId > 0)
|
||||
{
|
||||
// SignalR Connection IDs might start with a hyphen. We surround them
|
||||
// with quotes so the command line will be parsed correctly.
|
||||
|
||||
@ -16,9 +16,9 @@ namespace Remotely.Desktop.Core.Services
|
||||
{
|
||||
public class Viewer : IDisposable
|
||||
{
|
||||
private readonly int defaultImageQuality = 60;
|
||||
private int imageQuality;
|
||||
private DateTimeOffset lastQualityAdjustment;
|
||||
private readonly int _defaultImageQuality = 60;
|
||||
private int _imageQuality;
|
||||
private DateTimeOffset _lastQualityAdjustment;
|
||||
public Viewer(CasterSocket casterSocket,
|
||||
IScreenCapturer screenCapturer,
|
||||
IClipboardService clipboardService,
|
||||
@ -29,7 +29,7 @@ namespace Remotely.Desktop.Core.Services
|
||||
CasterSocket = casterSocket;
|
||||
WebRtcSessionFactory = webRtcSessionFactory;
|
||||
EncoderParams = new EncoderParameters();
|
||||
ImageQuality = defaultImageQuality;
|
||||
ImageQuality = _defaultImageQuality;
|
||||
ClipboardService = clipboardService;
|
||||
ClipboardService.ClipboardTextChanged += ClipboardService_ClipboardTextChanged;
|
||||
AudioCapturer = audioCapturer;
|
||||
@ -47,21 +47,21 @@ namespace Remotely.Desktop.Core.Services
|
||||
{
|
||||
get
|
||||
{
|
||||
return imageQuality;
|
||||
return _imageQuality;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (imageQuality == value)
|
||||
if (_imageQuality == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (imageQuality > 100 || imageQuality < 0)
|
||||
if (_imageQuality > 100 || _imageQuality < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
imageQuality = value;
|
||||
_imageQuality = value;
|
||||
|
||||
EncoderParams.Param[0] = new EncoderParameter(Encoder.Quality, value);
|
||||
}
|
||||
@ -250,7 +250,7 @@ namespace Remotely.Desktop.Core.Services
|
||||
Height = height,
|
||||
EndOfFrame = false,
|
||||
ImageBytes = encodedImageBytes.Skip(i).Take(50_000).ToArray(),
|
||||
ImageQuality = imageQuality
|
||||
ImageQuality = _imageQuality
|
||||
};
|
||||
|
||||
await SendToViewer(() => RtcSession.SendDto(dto),
|
||||
@ -264,7 +264,7 @@ namespace Remotely.Desktop.Core.Services
|
||||
Width = width,
|
||||
Height = height,
|
||||
EndOfFrame = true,
|
||||
ImageQuality = imageQuality
|
||||
ImageQuality = _imageQuality
|
||||
};
|
||||
|
||||
await SendToViewer(() => RtcSession.SendDto(endOfFrameDto),
|
||||
@ -301,17 +301,17 @@ namespace Remotely.Desktop.Core.Services
|
||||
|
||||
public void ThrottleIfNeeded()
|
||||
{
|
||||
if (AutoAdjustQuality && DateTimeOffset.Now - lastQualityAdjustment > TimeSpan.FromSeconds(2))
|
||||
if (AutoAdjustQuality && DateTimeOffset.Now - _lastQualityAdjustment > TimeSpan.FromSeconds(2))
|
||||
{
|
||||
lastQualityAdjustment = DateTimeOffset.Now;
|
||||
_lastQualityAdjustment = DateTimeOffset.Now;
|
||||
if (PendingSentFrames.TryPeek(out var result) && DateTimeOffset.Now - result > TimeSpan.FromMilliseconds(200))
|
||||
{
|
||||
var latency = (DateTimeOffset.Now - result).TotalMilliseconds;
|
||||
ImageQuality = (int)(200 / latency * defaultImageQuality);
|
||||
ImageQuality = (int)(200 / latency * _defaultImageQuality);
|
||||
}
|
||||
else
|
||||
else if (ImageQuality != _defaultImageQuality)
|
||||
{
|
||||
ImageQuality = defaultImageQuality;
|
||||
ImageQuality = Math.Min(_defaultImageQuality, ImageQuality + 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -94,6 +94,7 @@
|
||||
|
||||
<script>
|
||||
require.config({
|
||||
waitSeconds: 30,
|
||||
paths: {
|
||||
"App": "/out"
|
||||
}
|
||||
|
||||
@ -225,6 +225,7 @@
|
||||
|
||||
<script>
|
||||
require.config({
|
||||
waitSeconds: 30,
|
||||
paths: {
|
||||
"App": "/out"
|
||||
}
|
||||
|
||||
@ -297,6 +297,7 @@
|
||||
|
||||
<script>
|
||||
require.config({
|
||||
waitSeconds: 30,
|
||||
paths: {
|
||||
"App": "/out"
|
||||
}
|
||||
|
||||
@ -264,6 +264,7 @@
|
||||
<script src="~/lib/require.js"></script>
|
||||
<script>
|
||||
require.config({
|
||||
waitSeconds: 30,
|
||||
paths: {
|
||||
"App": "out"
|
||||
}
|
||||
|
||||
@ -75,6 +75,7 @@
|
||||
|
||||
<script>
|
||||
require.config({
|
||||
waitSeconds: 30,
|
||||
paths: {
|
||||
"App": "out"
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
<script>
|
||||
require.config({
|
||||
waitSeconds: 30,
|
||||
paths: {
|
||||
"App": "out"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user