mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Set key states up on window blur.
This commit is contained in:
parent
f59ac392f5
commit
4ded311d34
@ -339,7 +339,13 @@ namespace Remotely.ScreenCast.Core.Communication
|
||||
KeyboardMouseInput.SendMouseWheel(-(int)deltaY, viewer);
|
||||
}
|
||||
});
|
||||
|
||||
Connection.On("SetKeyStatesUp", (string viewerID) =>
|
||||
{
|
||||
if (conductor.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
KeyboardMouseInput.SetKeyStatesUp();
|
||||
}
|
||||
});
|
||||
Connection.On("ViewerDisconnected", async (string viewerID) =>
|
||||
{
|
||||
await Connection.SendAsync("ViewerDisconnected", viewerID);
|
||||
|
||||
@ -14,5 +14,6 @@ namespace Remotely.ScreenCast.Core.Interfaces
|
||||
void SendMouseWheel(int deltaY, Viewer viewer);
|
||||
void SendText(string transferText, Viewer viewer);
|
||||
void ToggleBlockInput(bool toggleOn);
|
||||
void SetKeyStatesUp();
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,17 +11,19 @@ namespace Remotely.ScreenCast.Core.Services
|
||||
public IdleTimer(Conductor conductor)
|
||||
{
|
||||
ViewerList = conductor.Viewers;
|
||||
Timer.Elapsed += Timer_Elapsed;
|
||||
}
|
||||
|
||||
public ConcurrentDictionary<string, Viewer> ViewerList { get; }
|
||||
|
||||
public DateTimeOffset ViewersLastSeen { get; private set; } = DateTimeOffset.Now;
|
||||
|
||||
private Timer Timer { get; } = new Timer(100);
|
||||
private Timer Timer { get; set; }
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Timer?.Dispose();
|
||||
Timer = new Timer(100);
|
||||
Timer.Elapsed += Timer_Elapsed;
|
||||
Timer.Start();
|
||||
}
|
||||
|
||||
|
||||
@ -61,6 +61,7 @@ namespace Remotely.ScreenCast.Core.Services
|
||||
case BinaryDtoType.ToggleBlockInput:
|
||||
case BinaryDtoType.ClipboardTransfer:
|
||||
case BinaryDtoType.KeyPress:
|
||||
case BinaryDtoType.SetKeyStatesUp:
|
||||
{
|
||||
if (!Viewer.HasControl)
|
||||
{
|
||||
@ -125,6 +126,9 @@ namespace Remotely.ScreenCast.Core.Services
|
||||
case BinaryDtoType.WindowsSessions:
|
||||
await GetWindowsSessions();
|
||||
break;
|
||||
case BinaryDtoType.SetKeyStatesUp:
|
||||
SetKeyStatesUp();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -226,6 +230,7 @@ namespace Remotely.ScreenCast.Core.Services
|
||||
var dto = MessagePackSerializer.Deserialize<QualityChangeDto>(message);
|
||||
Viewer.ImageQuality = dto.QualityLevel;
|
||||
}
|
||||
|
||||
private void SelectScreen(byte[] message)
|
||||
{
|
||||
var dto = MessagePackSerializer.Deserialize<SelectScreenDto>(message);
|
||||
@ -238,6 +243,10 @@ namespace Remotely.ScreenCast.Core.Services
|
||||
Viewer.AutoAdjustQuality = dto.IsOn;
|
||||
}
|
||||
|
||||
private void SetKeyStatesUp()
|
||||
{
|
||||
KeyboardMouseInput.SetKeyStatesUp();
|
||||
}
|
||||
private void Tap(byte[] message)
|
||||
{
|
||||
var dto = MessagePackSerializer.Deserialize<TapDto>(message);
|
||||
|
||||
@ -165,6 +165,11 @@ namespace Remotely.ScreenCast.Linux.Services
|
||||
}
|
||||
}
|
||||
|
||||
public void SetKeyStatesUp()
|
||||
{
|
||||
// Not implemented.
|
||||
}
|
||||
|
||||
public void ToggleBlockInput(bool toggleOn)
|
||||
{
|
||||
// Not implemented.
|
||||
|
||||
@ -18,47 +18,12 @@ namespace Remotely.ScreenCast.Win.Services
|
||||
|
||||
public void BeginWatching()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ClipboardWatcher?.Enabled == true)
|
||||
{
|
||||
ClipboardWatcher.Stop();
|
||||
}
|
||||
|
||||
if (Clipboard.ContainsText())
|
||||
{
|
||||
ClipboardText = Clipboard.GetText();
|
||||
ClipboardTextChanged?.Invoke(this, ClipboardText);
|
||||
}
|
||||
ClipboardWatcher = new System.Timers.Timer(500);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
ClipboardWatcher?.Dispose();
|
||||
ClipboardWatcher = new System.Timers.Timer(500);
|
||||
ClipboardWatcher.Elapsed += ClipboardWatcher_Elapsed;
|
||||
ClipboardWatcher.Start();
|
||||
}
|
||||
|
||||
private void ClipboardWatcher_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Win32Interop.SwitchToInputDesktop();
|
||||
|
||||
|
||||
if (Clipboard.ContainsText() && Clipboard.GetText() != ClipboardText)
|
||||
{
|
||||
ClipboardText = Clipboard.GetText();
|
||||
ClipboardTextChanged?.Invoke(this, ClipboardText);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
GetText();
|
||||
}
|
||||
|
||||
public void SetText(string clipboardText)
|
||||
@ -88,9 +53,36 @@ namespace Remotely.ScreenCast.Win.Services
|
||||
Logger.Write(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void StopWatching()
|
||||
{
|
||||
ClipboardWatcher?.Stop();
|
||||
}
|
||||
|
||||
private void ClipboardWatcher_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
GetText();
|
||||
}
|
||||
|
||||
private void GetText()
|
||||
{
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Win32Interop.SwitchToInputDesktop();
|
||||
|
||||
|
||||
if (Clipboard.ContainsText() && Clipboard.GetText() != ClipboardText)
|
||||
{
|
||||
ClipboardText = Clipboard.GetText();
|
||||
ClipboardTextChanged?.Invoke(this, ClipboardText);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ namespace Remotely.ScreenCast.Win.Services
|
||||
StartInputActionTask();
|
||||
}
|
||||
|
||||
private CancellationTokenSource CancelTokenSource { get; set; }
|
||||
private CancellationToken CancelToken { get; set; }
|
||||
private ConcurrentQueue<Action> InputActions { get; } = new ConcurrentQueue<Action>();
|
||||
|
||||
private Task InputActionsTask { get; set; }
|
||||
@ -179,6 +181,42 @@ namespace Remotely.ScreenCast.Win.Services
|
||||
});
|
||||
}
|
||||
|
||||
public void SetKeyStatesUp()
|
||||
{
|
||||
TryOnInputDesktop(() =>
|
||||
{
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
foreach (VirtualKey key in Enum.GetValues(typeof(VirtualKey)))
|
||||
{
|
||||
try
|
||||
{
|
||||
var state = GetKeyState(key);
|
||||
if (state == 1)
|
||||
{
|
||||
var union = new InputUnion()
|
||||
{
|
||||
ki = new KEYBDINPUT()
|
||||
{
|
||||
wVk = key,
|
||||
wScan = 0,
|
||||
time = 0,
|
||||
dwFlags = KEYEVENTF.KEYUP,
|
||||
dwExtraInfo = GetMessageExtraInfo()
|
||||
}
|
||||
};
|
||||
var input = new INPUT() { type = InputType.KEYBOARD, U = union };
|
||||
SendInput(1, new INPUT[] { input }, INPUT.Size);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
});
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
});
|
||||
}
|
||||
|
||||
public void ToggleBlockInput(bool toggleOn)
|
||||
{
|
||||
InputActions.Enqueue(() =>
|
||||
@ -192,6 +230,20 @@ namespace Remotely.ScreenCast.Win.Services
|
||||
{
|
||||
ShutdownStarted = true;
|
||||
}
|
||||
private void CheckQueue()
|
||||
{
|
||||
while (!ShutdownStarted &&
|
||||
!Environment.HasShutdownStarted &&
|
||||
!CancelToken.IsCancellationRequested)
|
||||
{
|
||||
if (InputActions.TryDequeue(out var action))
|
||||
{
|
||||
action();
|
||||
}
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
private VirtualKey ConvertJavaScriptKeyToVirtualKey(string key)
|
||||
{
|
||||
VirtualKey keyCode;
|
||||
@ -316,22 +368,12 @@ namespace Remotely.ScreenCast.Win.Services
|
||||
}
|
||||
return keyCode;
|
||||
}
|
||||
|
||||
private void StartInputActionTask()
|
||||
{
|
||||
InputActionsTask?.Dispose();
|
||||
InputActionsTask = Task.Run(CheckQueue);
|
||||
}
|
||||
private void CheckQueue()
|
||||
{
|
||||
while (!ShutdownStarted && !Environment.HasShutdownStarted)
|
||||
{
|
||||
if (InputActions.TryDequeue(out var action))
|
||||
{
|
||||
action();
|
||||
}
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
CancelTokenSource?.Cancel();
|
||||
CancelTokenSource = new CancellationTokenSource();
|
||||
CancelToken = CancelTokenSource.Token;
|
||||
InputActionsTask = Task.Run(CheckQueue, CancelTokenSource.Token);
|
||||
}
|
||||
private void TryOnInputDesktop(Action inputAction)
|
||||
{
|
||||
|
||||
@ -284,6 +284,11 @@ namespace Remotely.Server.Services
|
||||
return RCDeviceHubContext.Clients.Client(screenCasterID).SendAsync("RequestScreenCast", Context.ConnectionId, requesterName);
|
||||
}
|
||||
}
|
||||
public Task SendSetKeyStatesUp()
|
||||
{
|
||||
return RCDeviceHubContext.Clients.Client(ScreenCasterID).SendAsync("SetKeyStatesUp", Context.ConnectionId);
|
||||
}
|
||||
|
||||
public Task SendSharedFileIDs(List<string> fileIDs)
|
||||
{
|
||||
return RCDeviceHubContext.Clients.Client(ScreenCasterID).SendAsync("SharedFileIDs", fileIDs);
|
||||
|
||||
@ -24,5 +24,6 @@ export var BinaryDtoType;
|
||||
BinaryDtoType[BinaryDtoType["QualityChange"] = 21] = "QualityChange";
|
||||
BinaryDtoType[BinaryDtoType["File"] = 22] = "File";
|
||||
BinaryDtoType[BinaryDtoType["WindowsSessions"] = 23] = "WindowsSessions";
|
||||
BinaryDtoType[BinaryDtoType["SetKeyStatesUp"] = 24] = "SetKeyStatesUp";
|
||||
})(BinaryDtoType || (BinaryDtoType = {}));
|
||||
//# sourceMappingURL=BinaryDtoType.js.map
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"BinaryDtoType.js","sourceRoot":"","sources":["BinaryDtoType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAyBX;AAzBD,WAAY,aAAa;IACrB,iEAAgB,CAAA;IAChB,6DAAc,CAAA;IACd,6DAAc,CAAA;IACd,+DAAe,CAAA;IACf,mEAAiB,CAAA;IACjB,+DAAe,CAAA;IACf,iEAAgB,CAAA;IAChB,iEAAgB,CAAA;IAChB,2DAAa,CAAA;IACb,2DAAa,CAAA;IACb,wDAAY,CAAA;IACZ,gDAAQ,CAAA;IACR,8DAAe,CAAA;IACf,wDAAY,CAAA;IACZ,oDAAU,CAAA;IACV,8DAAe,CAAA;IACf,4EAAsB,CAAA;IACtB,gEAAgB,CAAA;IAChB,0EAAqB,CAAA;IACrB,4EAAsB,CAAA;IACtB,0DAAa,CAAA;IACb,oEAAkB,CAAA;IAClB,kDAAS,CAAA;IACT,wEAAoB,CAAA;AACxB,CAAC,EAzBW,aAAa,KAAb,aAAa,QAyBxB"}
|
||||
{"version":3,"file":"BinaryDtoType.js","sourceRoot":"","sources":["BinaryDtoType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aA0BX;AA1BD,WAAY,aAAa;IACrB,iEAAgB,CAAA;IAChB,6DAAc,CAAA;IACd,6DAAc,CAAA;IACd,+DAAe,CAAA;IACf,mEAAiB,CAAA;IACjB,+DAAe,CAAA;IACf,iEAAgB,CAAA;IAChB,iEAAgB,CAAA;IAChB,2DAAa,CAAA;IACb,2DAAa,CAAA;IACb,wDAAY,CAAA;IACZ,gDAAQ,CAAA;IACR,8DAAe,CAAA;IACf,wDAAY,CAAA;IACZ,oDAAU,CAAA;IACV,8DAAe,CAAA;IACf,4EAAsB,CAAA;IACtB,gEAAgB,CAAA;IAChB,0EAAqB,CAAA;IACrB,4EAAsB,CAAA;IACtB,0DAAa,CAAA;IACb,oEAAkB,CAAA;IAClB,kDAAS,CAAA;IACT,wEAAoB,CAAA;IACpB,sEAAmB,CAAA;AACvB,CAAC,EA1BW,aAAa,KAAb,aAAa,QA0BxB"}
|
||||
@ -22,5 +22,6 @@
|
||||
KeyPress = 20,
|
||||
QualityChange = 21,
|
||||
File = 22,
|
||||
WindowsSessions = 23
|
||||
WindowsSessions = 23,
|
||||
SetKeyStatesUp = 24
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
import { MainRc } from "./Main.js";
|
||||
import { CtrlAltDelDto, KeyDownDto, KeyPressDto, KeyUpDto, MouseDownDto, MouseMoveDto, MouseUpDto, MouseWheelDto, QualityChangeDto, SelectScreenDto, TapDto, AutoQualityAdjustDto, ToggleAudioDto, ToggleBlockInputDto, ClipboardTransferDto, FileDto, WindowsSessionsDto } from "./RtcDtos.js";
|
||||
import { CtrlAltDelDto, KeyDownDto, KeyPressDto, KeyUpDto, MouseDownDto, MouseMoveDto, MouseUpDto, MouseWheelDto, QualityChangeDto, SelectScreenDto, TapDto, AutoQualityAdjustDto, ToggleAudioDto, ToggleBlockInputDto, ClipboardTransferDto, FileDto, WindowsSessionsDto, GenericDto } from "./RtcDtos.js";
|
||||
import { CreateGUID, When } from "../Utilities.js";
|
||||
import { FileTransferProgress } from "./UI.js";
|
||||
import { BinaryDtoType } from "../Enums/BinaryDtoType.js";
|
||||
export class MessageSender {
|
||||
GetWindowsSessions() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new WindowsSessionsDto()), () => MainRc.RCHubConnection.GetWindowsSessions());
|
||||
@ -36,6 +37,9 @@ export class MessageSender {
|
||||
SendKeyPress(key) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyPressDto(key)), () => MainRc.RCHubConnection.SendKeyPress(key));
|
||||
}
|
||||
SendSetKeyStatesUp() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new GenericDto(BinaryDtoType.SetKeyStatesUp)), () => MainRc.RCHubConnection.SendSetKeyStatesUp());
|
||||
}
|
||||
SendCtrlAltDel() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new CtrlAltDelDto()), () => MainRc.RCHubConnection.SendCtrlAltDel());
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,142 +1,147 @@
|
||||
import { MainRc } from "./Main.js";
|
||||
import {
|
||||
CtrlAltDelDto,
|
||||
KeyDownDto,
|
||||
KeyPressDto,
|
||||
KeyUpDto,
|
||||
MouseDownDto,
|
||||
MouseMoveDto,
|
||||
MouseUpDto,
|
||||
MouseWheelDto,
|
||||
QualityChangeDto,
|
||||
SelectScreenDto,
|
||||
TapDto,
|
||||
AutoQualityAdjustDto,
|
||||
ToggleAudioDto,
|
||||
ToggleBlockInputDto,
|
||||
ClipboardTransferDto,
|
||||
FileDto,
|
||||
WindowsSessionsDto
|
||||
} from "./RtcDtos.js";
|
||||
import { CreateGUID, When } from "../Utilities.js";
|
||||
import { FileTransferProgress } from "./UI.js";
|
||||
|
||||
export class MessageSender {
|
||||
GetWindowsSessions() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new WindowsSessionsDto()),
|
||||
() => MainRc.RCHubConnection.GetWindowsSessions());
|
||||
}
|
||||
ChangeWindowsSession(sessionId: number) {
|
||||
MainRc.RCHubConnection.ChangeWindowsSession(sessionId);
|
||||
}
|
||||
SendSelectScreen(displayName: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new SelectScreenDto(displayName)),
|
||||
() => MainRc.RCHubConnection.SendSelectScreen(displayName));
|
||||
}
|
||||
SendMouseMove(percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseMoveDto(percentX, percentY)),
|
||||
() => MainRc.RCHubConnection.SendMouseMove(percentX, percentY));
|
||||
}
|
||||
SendMouseDown(button: number, percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseDownDto(button, percentX, percentY)),
|
||||
() => MainRc.RCHubConnection.SendMouseDown(button, percentX, percentY));
|
||||
}
|
||||
SendMouseUp(button: number, percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseUpDto(button, percentX, percentY)),
|
||||
() => MainRc.RCHubConnection.SendMouseUp(button, percentX, percentY));
|
||||
}
|
||||
SendTap(percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new TapDto(percentX, percentY)),
|
||||
() => MainRc.RCHubConnection.SendTap(percentX, percentY));
|
||||
}
|
||||
SendMouseWheel(deltaX: number, deltaY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseWheelDto(deltaX, deltaY)),
|
||||
() => MainRc.RCHubConnection.SendMouseWheel(deltaX, deltaY));
|
||||
}
|
||||
SendKeyDown(key: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyDownDto(key)),
|
||||
() => MainRc.RCHubConnection.SendKeyDown(key));
|
||||
}
|
||||
SendKeyUp(key: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyUpDto(key)),
|
||||
() => MainRc.RCHubConnection.SendKeyUp(key));
|
||||
}
|
||||
SendKeyPress(key: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyPressDto(key)),
|
||||
() => MainRc.RCHubConnection.SendKeyPress(key));
|
||||
}
|
||||
|
||||
SendCtrlAltDel() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new CtrlAltDelDto()),
|
||||
() => MainRc.RCHubConnection.SendCtrlAltDel());
|
||||
}
|
||||
|
||||
async SendFile(buffer: Uint8Array, fileName: string) {
|
||||
var messageId = CreateGUID();
|
||||
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new FileDto(null, fileName, messageId, false, true)),
|
||||
() => MainRc.RCHubConnection.SendFile(null, fileName, messageId, false, true));
|
||||
|
||||
for (var i = 0; i < buffer.byteLength; i += 50_000) {
|
||||
|
||||
await this.SendToAgentAsync(async () => {
|
||||
MainRc.RtcSession.SendDto(new FileDto(buffer.slice(i, i + 50_000), fileName, messageId, false, false));
|
||||
await When(() => MainRc.RtcSession.DataChannel.bufferedAmount == 0, 10);
|
||||
}, async () => {
|
||||
await MainRc.RCHubConnection.SendFile(buffer.slice(i, i + 50_000), fileName, messageId, false, false);
|
||||
});
|
||||
|
||||
if (i > 0) {
|
||||
FileTransferProgress.value = i / buffer.byteLength;
|
||||
}
|
||||
}
|
||||
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new FileDto(null, fileName, messageId, true, false)),
|
||||
() => MainRc.RCHubConnection.SendFile(null, fileName, messageId, true, false));
|
||||
}
|
||||
|
||||
SendQualityChange(qualityLevel: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new QualityChangeDto(qualityLevel)),
|
||||
() => MainRc.RCHubConnection.SendQualityChange(qualityLevel));
|
||||
}
|
||||
SendAutoQualityAdjust(isOn: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new AutoQualityAdjustDto(isOn)),
|
||||
() => MainRc.RCHubConnection.SendAutoQualityAdjust(isOn));
|
||||
}
|
||||
SendToggleAudio(toggleOn: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ToggleAudioDto(toggleOn)),
|
||||
() => MainRc.RCHubConnection.SendToggleAudio(toggleOn));
|
||||
};
|
||||
SendToggleBlockInput(toggleOn: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ToggleBlockInputDto(toggleOn)),
|
||||
() => MainRc.RCHubConnection.SendToggleBlockInput(toggleOn));
|
||||
}
|
||||
SendClipboardTransfer(text: string, typeText: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ClipboardTransferDto(text, typeText)),
|
||||
() => MainRc.RCHubConnection.SendClipboardTransfer(text, typeText));
|
||||
}
|
||||
|
||||
private IsWebRtcAvailable() {
|
||||
return MainRc.RtcSession.DataChannel && MainRc.RtcSession.DataChannel.readyState == "open";
|
||||
}
|
||||
|
||||
private SendToAgent(rtcSend: () => void, websocketSend: () => void) {
|
||||
if (MainRc.RtcSession.DataChannel && MainRc.RtcSession.DataChannel.readyState == "open") {
|
||||
rtcSend();
|
||||
}
|
||||
else if (MainRc.RCHubConnection.Connection.connectionStarted) {
|
||||
websocketSend();
|
||||
}
|
||||
}
|
||||
|
||||
private async SendToAgentAsync(rtcSend: () => Promise<any>, websocketSend: () => Promise<any>) {
|
||||
if (this.IsWebRtcAvailable()) {
|
||||
await rtcSend();
|
||||
}
|
||||
else {
|
||||
await websocketSend();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import { MainRc } from "./Main.js";
|
||||
import {
|
||||
CtrlAltDelDto,
|
||||
KeyDownDto,
|
||||
KeyPressDto,
|
||||
KeyUpDto,
|
||||
MouseDownDto,
|
||||
MouseMoveDto,
|
||||
MouseUpDto,
|
||||
MouseWheelDto,
|
||||
QualityChangeDto,
|
||||
SelectScreenDto,
|
||||
TapDto,
|
||||
AutoQualityAdjustDto,
|
||||
ToggleAudioDto,
|
||||
ToggleBlockInputDto,
|
||||
ClipboardTransferDto,
|
||||
FileDto,
|
||||
WindowsSessionsDto,
|
||||
GenericDto
|
||||
} from "./RtcDtos.js";
|
||||
import { CreateGUID, When } from "../Utilities.js";
|
||||
import { FileTransferProgress } from "./UI.js";
|
||||
import { BinaryDtoType } from "../Enums/BinaryDtoType.js";
|
||||
|
||||
export class MessageSender {
|
||||
GetWindowsSessions() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new WindowsSessionsDto()),
|
||||
() => MainRc.RCHubConnection.GetWindowsSessions());
|
||||
}
|
||||
ChangeWindowsSession(sessionId: number) {
|
||||
MainRc.RCHubConnection.ChangeWindowsSession(sessionId);
|
||||
}
|
||||
SendSelectScreen(displayName: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new SelectScreenDto(displayName)),
|
||||
() => MainRc.RCHubConnection.SendSelectScreen(displayName));
|
||||
}
|
||||
SendMouseMove(percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseMoveDto(percentX, percentY)),
|
||||
() => MainRc.RCHubConnection.SendMouseMove(percentX, percentY));
|
||||
}
|
||||
SendMouseDown(button: number, percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseDownDto(button, percentX, percentY)),
|
||||
() => MainRc.RCHubConnection.SendMouseDown(button, percentX, percentY));
|
||||
}
|
||||
SendMouseUp(button: number, percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseUpDto(button, percentX, percentY)),
|
||||
() => MainRc.RCHubConnection.SendMouseUp(button, percentX, percentY));
|
||||
}
|
||||
SendTap(percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new TapDto(percentX, percentY)),
|
||||
() => MainRc.RCHubConnection.SendTap(percentX, percentY));
|
||||
}
|
||||
SendMouseWheel(deltaX: number, deltaY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseWheelDto(deltaX, deltaY)),
|
||||
() => MainRc.RCHubConnection.SendMouseWheel(deltaX, deltaY));
|
||||
}
|
||||
SendKeyDown(key: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyDownDto(key)),
|
||||
() => MainRc.RCHubConnection.SendKeyDown(key));
|
||||
}
|
||||
SendKeyUp(key: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyUpDto(key)),
|
||||
() => MainRc.RCHubConnection.SendKeyUp(key));
|
||||
}
|
||||
SendKeyPress(key: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyPressDto(key)),
|
||||
() => MainRc.RCHubConnection.SendKeyPress(key));
|
||||
}
|
||||
SendSetKeyStatesUp() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new GenericDto(BinaryDtoType.SetKeyStatesUp)),
|
||||
() => MainRc.RCHubConnection.SendSetKeyStatesUp());
|
||||
}
|
||||
SendCtrlAltDel() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new CtrlAltDelDto()),
|
||||
() => MainRc.RCHubConnection.SendCtrlAltDel());
|
||||
}
|
||||
|
||||
async SendFile(buffer: Uint8Array, fileName: string) {
|
||||
var messageId = CreateGUID();
|
||||
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new FileDto(null, fileName, messageId, false, true)),
|
||||
() => MainRc.RCHubConnection.SendFile(null, fileName, messageId, false, true));
|
||||
|
||||
for (var i = 0; i < buffer.byteLength; i += 50_000) {
|
||||
|
||||
await this.SendToAgentAsync(async () => {
|
||||
MainRc.RtcSession.SendDto(new FileDto(buffer.slice(i, i + 50_000), fileName, messageId, false, false));
|
||||
await When(() => MainRc.RtcSession.DataChannel.bufferedAmount == 0, 10);
|
||||
}, async () => {
|
||||
await MainRc.RCHubConnection.SendFile(buffer.slice(i, i + 50_000), fileName, messageId, false, false);
|
||||
});
|
||||
|
||||
if (i > 0) {
|
||||
FileTransferProgress.value = i / buffer.byteLength;
|
||||
}
|
||||
}
|
||||
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new FileDto(null, fileName, messageId, true, false)),
|
||||
() => MainRc.RCHubConnection.SendFile(null, fileName, messageId, true, false));
|
||||
}
|
||||
|
||||
SendQualityChange(qualityLevel: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new QualityChangeDto(qualityLevel)),
|
||||
() => MainRc.RCHubConnection.SendQualityChange(qualityLevel));
|
||||
}
|
||||
SendAutoQualityAdjust(isOn: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new AutoQualityAdjustDto(isOn)),
|
||||
() => MainRc.RCHubConnection.SendAutoQualityAdjust(isOn));
|
||||
}
|
||||
SendToggleAudio(toggleOn: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ToggleAudioDto(toggleOn)),
|
||||
() => MainRc.RCHubConnection.SendToggleAudio(toggleOn));
|
||||
};
|
||||
SendToggleBlockInput(toggleOn: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ToggleBlockInputDto(toggleOn)),
|
||||
() => MainRc.RCHubConnection.SendToggleBlockInput(toggleOn));
|
||||
}
|
||||
SendClipboardTransfer(text: string, typeText: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ClipboardTransferDto(text, typeText)),
|
||||
() => MainRc.RCHubConnection.SendClipboardTransfer(text, typeText));
|
||||
}
|
||||
|
||||
private IsWebRtcAvailable() {
|
||||
return MainRc.RtcSession.DataChannel && MainRc.RtcSession.DataChannel.readyState == "open";
|
||||
}
|
||||
|
||||
private SendToAgent(rtcSend: () => void, websocketSend: () => void) {
|
||||
if (MainRc.RtcSession.DataChannel && MainRc.RtcSession.DataChannel.readyState == "open") {
|
||||
rtcSend();
|
||||
}
|
||||
else if (MainRc.RCHubConnection.Connection.connectionStarted) {
|
||||
websocketSend();
|
||||
}
|
||||
}
|
||||
|
||||
private async SendToAgentAsync(rtcSend: () => Promise<any>, websocketSend: () => Promise<any>) {
|
||||
if (this.IsWebRtcAvailable()) {
|
||||
await rtcSend();
|
||||
}
|
||||
else {
|
||||
await websocketSend();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -102,6 +102,9 @@ export class RCHubConnection {
|
||||
SendKeyPress(key) {
|
||||
this.Connection.invoke("KeyPress", key);
|
||||
}
|
||||
SendSetKeyStatesUp() {
|
||||
this.Connection.invoke("SendSetKeyStatesUp");
|
||||
}
|
||||
SendCtrlAltDel() {
|
||||
this.Connection.invoke("CtrlAltDel");
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -122,7 +122,9 @@ export class RCHubConnection {
|
||||
SendKeyPress(key: string): any {
|
||||
this.Connection.invoke("KeyPress", key);
|
||||
}
|
||||
|
||||
SendSetKeyStatesUp() {
|
||||
this.Connection.invoke("SendSetKeyStatesUp");
|
||||
}
|
||||
SendCtrlAltDel() {
|
||||
this.Connection.invoke("CtrlAltDel");
|
||||
}
|
||||
|
||||
@ -27,6 +27,12 @@ export class FileDto {
|
||||
this.StartOfFile = startOfFile;
|
||||
}
|
||||
}
|
||||
export class GenericDto {
|
||||
constructor(type) {
|
||||
this.DtoType = type;
|
||||
}
|
||||
;
|
||||
}
|
||||
export class KeyDownDto {
|
||||
constructor(key) {
|
||||
this.DtoType = BinaryDtoType.KeyDown;
|
||||
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"RtcDtos.js","sourceRoot":"","sources":["RtcDtos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAI1D,MAAM,OAAO,oBAAoB;IAC7B,YAAY,IAAa;QAKzB,YAAO,GAAkB,aAAa,CAAC,iBAAiB,CAAC;QAJrD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CAIJ;AAsBD,MAAM,OAAO,oBAAoB;IAC7B,YAAY,IAAY,EAAE,QAAgB;QAO1C,YAAO,GAAkB,aAAa,CAAC,iBAAiB,CAAC;QANrD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CAKJ;AAGD,MAAM,OAAO,aAAa;IAA1B;QACI,YAAO,GAAkB,aAAa,CAAC,UAAU,CAAC;IACtD,CAAC;CAAA;AASD,MAAM,OAAO,OAAO;IAChB,YAAY,MAAkB,EAC1B,QAAgB,EAChB,SAAiB,EACjB,SAAkB,EAClB,WAAoB;QAexB,YAAO,GAAkB,aAAa,CAAC,IAAI,CAAC;QAbxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS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class FileDto implements BinaryDto {
|
||||
DtoType: BinaryDtoType = BinaryDtoType.File;
|
||||
}
|
||||
|
||||
export class GenericDto implements BinaryDto {
|
||||
constructor(type: BinaryDtoType) {
|
||||
this.DtoType = type;
|
||||
}
|
||||
DtoType: BinaryDtoType;;
|
||||
}
|
||||
|
||||
export class KeyDownDto implements BinaryDto {
|
||||
constructor(key: string) {
|
||||
this.Key = key;
|
||||
|
||||
@ -393,6 +393,9 @@ export function ApplyInputHandlers() {
|
||||
e.preventDefault();
|
||||
MainRc.MessageSender.SendKeyUp(e.key);
|
||||
});
|
||||
window.addEventListener("blur", () => {
|
||||
MainRc.MessageSender.SendSetKeyStatesUp();
|
||||
});
|
||||
window.ondragover = function (e) {
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = "copy";
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -428,6 +428,10 @@ export function ApplyInputHandlers() {
|
||||
MainRc.MessageSender.SendKeyUp(e.key);
|
||||
});
|
||||
|
||||
window.addEventListener("blur", () => {
|
||||
MainRc.MessageSender.SendSetKeyStatesUp();
|
||||
});
|
||||
|
||||
window.ondragover = function (e) {
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = "copy";
|
||||
|
||||
@ -52,6 +52,8 @@ namespace Remotely.Shared.Enums
|
||||
[EnumMember(Value = "File")]
|
||||
File = 22,
|
||||
[EnumMember(Value = "WindowsSessions")]
|
||||
WindowsSessions = 23
|
||||
WindowsSessions = 23,
|
||||
[EnumMember(Value = "SetKeyStatesUp")]
|
||||
SetKeyStatesUp = 24
|
||||
}
|
||||
}
|
||||
|
||||
@ -1297,6 +1297,9 @@ namespace Remotely.Shared.Win32
|
||||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||
public static extern int MessageBox(IntPtr hWnd, string text, string caption, long type);
|
||||
|
||||
[DllImport("USER32.dll")]
|
||||
public static extern short GetKeyState(VirtualKey nVirtKey);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user