mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Add WebRTC DTOs.
This commit is contained in:
parent
6f50fe6cbd
commit
d284988985
@ -10,7 +10,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<PublishDir>..\Server\wwwroot\Downloads\Win-x64\</PublishDir>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<SelfContained>true</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>False</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
|
||||
@ -45,9 +45,7 @@
|
||||
<Content Remove="wwwroot\scripts\Models\GenericCommandResult.ts" />
|
||||
<Content Remove="wwwroot\scripts\Models\Parameter.ts" />
|
||||
<Content Remove="wwwroot\scripts\Models\Point.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\RtcDtos\ClipboardTextDto.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\RtcDtos\MachineNameDto.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\RtcDtos\ScreenDataDto.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\MessageSender.ts" />
|
||||
<Content Remove="wwwroot\scripts\Models\UserOptions.ts" />
|
||||
<Content Remove="wwwroot\scripts\Pages\ApiTokens.ts" />
|
||||
<Content Remove="wwwroot\scripts\Pages\IndexNotLoggedIn.ts" />
|
||||
@ -55,7 +53,6 @@
|
||||
<Content Remove="wwwroot\scripts\Pages\ServerConfig.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\ClipboardWatcher.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\Main.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\RtcDtos\ScreenSizeDto.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\RtcMessageHandler.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\RtcSession.ts" />
|
||||
<Content Remove="wwwroot\scripts\RemoteControl\UI.ts" />
|
||||
@ -156,18 +153,9 @@
|
||||
<TypeScriptCompile Include="wwwroot\scripts\CommandProcessor.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\Models\CommandLineParameter.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\Models\ConsoleCommand.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\RemoteControl\DynamicDto.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\Enums\DynamicDtoType.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\RemoteControl\RtcDtos\CaptureFrameDto.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\RemoteControl\MessageSender.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\Models\Point.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\RemoteControl\RtcDtos\ClipboardTextDto.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\RemoteControl\RtcDtos\MachineNameDto.ts">
|
||||
<SubType>Code</SubType>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="wwwroot\scripts\RemoteControl\RtcDtos\ScreenSizeDto.ts">
|
||||
<SubType>Code</SubType>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="wwwroot\scripts\RemoteControl\RtcDtos\ScreenDataDto.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\Models\UserOptions.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\Models\Device.ts" />
|
||||
<TypeScriptCompile Include="wwwroot\scripts\Models\Parameter.ts" />
|
||||
|
||||
26
Server/wwwroot/scripts/Enums/BinaryDtoType.js
Normal file
26
Server/wwwroot/scripts/Enums/BinaryDtoType.js
Normal file
@ -0,0 +1,26 @@
|
||||
export var BinaryDtoType;
|
||||
(function (BinaryDtoType) {
|
||||
BinaryDtoType[BinaryDtoType["CaptureFrame"] = 0] = "CaptureFrame";
|
||||
BinaryDtoType[BinaryDtoType["ScreenData"] = 1] = "ScreenData";
|
||||
BinaryDtoType[BinaryDtoType["ScreenSize"] = 2] = "ScreenSize";
|
||||
BinaryDtoType[BinaryDtoType["MachineName"] = 3] = "MachineName";
|
||||
BinaryDtoType[BinaryDtoType["ClipboardText"] = 4] = "ClipboardText";
|
||||
BinaryDtoType[BinaryDtoType["AudioSample"] = 5] = "AudioSample";
|
||||
BinaryDtoType[BinaryDtoType["CursorChange"] = 6] = "CursorChange";
|
||||
BinaryDtoType[BinaryDtoType["SelectScreen"] = 7] = "SelectScreen";
|
||||
BinaryDtoType[BinaryDtoType["MouseMove"] = 8] = "MouseMove";
|
||||
BinaryDtoType[BinaryDtoType["MouseDown"] = 9] = "MouseDown";
|
||||
BinaryDtoType[BinaryDtoType["MouseUp"] = 10] = "MouseUp";
|
||||
BinaryDtoType[BinaryDtoType["Tap"] = 11] = "Tap";
|
||||
BinaryDtoType[BinaryDtoType["MouseWheel"] = 12] = "MouseWheel";
|
||||
BinaryDtoType[BinaryDtoType["KeyDown"] = 13] = "KeyDown";
|
||||
BinaryDtoType[BinaryDtoType["KeyUp"] = 14] = "KeyUp";
|
||||
BinaryDtoType[BinaryDtoType["CtrlAltDel"] = 15] = "CtrlAltDel";
|
||||
BinaryDtoType[BinaryDtoType["AutoQualityAdjust"] = 16] = "AutoQualityAdjust";
|
||||
BinaryDtoType[BinaryDtoType["ToggleAudio"] = 17] = "ToggleAudio";
|
||||
BinaryDtoType[BinaryDtoType["ToggleBlockInput"] = 18] = "ToggleBlockInput";
|
||||
BinaryDtoType[BinaryDtoType["ClipboardTransfer"] = 19] = "ClipboardTransfer";
|
||||
BinaryDtoType[BinaryDtoType["KeyPress"] = 20] = "KeyPress";
|
||||
BinaryDtoType[BinaryDtoType["QualityChange"] = 21] = "QualityChange";
|
||||
})(BinaryDtoType || (BinaryDtoType = {}));
|
||||
//# sourceMappingURL=BinaryDtoType.js.map
|
||||
1
Server/wwwroot/scripts/Enums/BinaryDtoType.js.map
Normal file
1
Server/wwwroot/scripts/Enums/BinaryDtoType.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"BinaryDtoType.js","sourceRoot":"","sources":["BinaryDtoType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAuBX;AAvBD,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;AACtB,CAAC,EAvBW,aAAa,KAAb,aAAa,QAuBxB"}
|
||||
24
Server/wwwroot/scripts/Enums/BinaryDtoType.ts
Normal file
24
Server/wwwroot/scripts/Enums/BinaryDtoType.ts
Normal file
@ -0,0 +1,24 @@
|
||||
export enum BinaryDtoType {
|
||||
CaptureFrame = 0,
|
||||
ScreenData = 1,
|
||||
ScreenSize = 2,
|
||||
MachineName = 3,
|
||||
ClipboardText = 4,
|
||||
AudioSample = 5,
|
||||
CursorChange = 6,
|
||||
SelectScreen = 7,
|
||||
MouseMove = 8,
|
||||
MouseDown = 9,
|
||||
MouseUp = 10,
|
||||
Tap = 11,
|
||||
MouseWheel = 12,
|
||||
KeyDown = 13,
|
||||
KeyUp = 14,
|
||||
CtrlAltDel = 15,
|
||||
AutoQualityAdjust = 16,
|
||||
ToggleAudio = 17,
|
||||
ToggleBlockInput = 18,
|
||||
ClipboardTransfer = 19,
|
||||
KeyPress = 20,
|
||||
QualityChange = 21
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
export var DynamicDtoType;
|
||||
(function (DynamicDtoType) {
|
||||
DynamicDtoType[DynamicDtoType["CaptureFrame"] = 0] = "CaptureFrame";
|
||||
DynamicDtoType[DynamicDtoType["ScreenData"] = 1] = "ScreenData";
|
||||
DynamicDtoType[DynamicDtoType["ScreenSize"] = 2] = "ScreenSize";
|
||||
DynamicDtoType[DynamicDtoType["MachineName"] = 3] = "MachineName";
|
||||
DynamicDtoType[DynamicDtoType["ClipboardText"] = 4] = "ClipboardText";
|
||||
})(DynamicDtoType || (DynamicDtoType = {}));
|
||||
//# sourceMappingURL=DynamicDtoType.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"DynamicDtoType.js","sourceRoot":"","sources":["DynamicDtoType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACtB,mEAAgB,CAAA;IAChB,+DAAc,CAAA;IACd,+DAAc,CAAA;IACd,iEAAe,CAAA;IACf,qEAAa,CAAA;AACjB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB"}
|
||||
@ -1,7 +0,0 @@
|
||||
export enum DynamicDtoType {
|
||||
CaptureFrame = 0,
|
||||
ScreenData = 1,
|
||||
ScreenSize = 2,
|
||||
MachineName = 3,
|
||||
ClipboardText
|
||||
}
|
||||
1
Server/wwwroot/scripts/RemoteControl/BinaryDto.js
Normal file
1
Server/wwwroot/scripts/RemoteControl/BinaryDto.js
Normal file
@ -0,0 +1 @@
|
||||
//# sourceMappingURL=BinaryDto.js.map
|
||||
1
Server/wwwroot/scripts/RemoteControl/BinaryDto.js.map
Normal file
1
Server/wwwroot/scripts/RemoteControl/BinaryDto.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"BinaryDto.js","sourceRoot":"","sources":["BinaryDto.ts"],"names":[],"mappings":""}
|
||||
5
Server/wwwroot/scripts/RemoteControl/BinaryDto.ts
Normal file
5
Server/wwwroot/scripts/RemoteControl/BinaryDto.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { BinaryDtoType } from "../Enums/BinaryDtoType.js";
|
||||
|
||||
export interface BinaryDto {
|
||||
DtoType: BinaryDtoType
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
import { ClipboardTransferTextArea } from "./UI.js";
|
||||
import { Remotely } from "./Main.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
export class ClipboardWatcher {
|
||||
WatchClipboard() {
|
||||
navigator.clipboard.readText().then(currentText => {
|
||||
@ -15,7 +15,7 @@ export class ClipboardWatcher {
|
||||
if (this.LastClipboardText != newText) {
|
||||
this.LastClipboardText = newText;
|
||||
ClipboardTransferTextArea.value = newText;
|
||||
Remotely.RCBrowserSockets.SendClipboardTransfer(newText, false);
|
||||
MainRc.RCBrowserSockets.SendClipboardTransfer(newText, false);
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"ClipboardWatcher.js","sourceRoot":"","sources":["ClipboardWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,OAAO,gBAAgB;IAKzB,cAAc;QACV,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YAC9C,IAAI,CAAC,iBAAiB,GAAG,WAAW,CAAC;YAErC,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE;gBACnC,IAAI,IAAI,CAAC,eAAe,EAAE;oBACtB,OAAO;iBACV;gBACD,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE;oBACtB,OAAO;iBACV;gBAED,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,E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I,CAAC,iBAAiB,IAAI,OAAO,EAAE;wBACnC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC;wBACjC,yBAAyB,CAAC,KAAK,GAAG,OAAO,CAAC;wBAC1C,MAAM,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;qBACjE;gBACL,CAAC,CAAC,CAAA;YACN,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,CAAC,CAAC,CAAC;IACP,CAAC;IAED,gBAAgB,CAAC,IAAY;QACzB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,yBAAyB,CAAC,KAAK,GAAG,IAAI,CAAC;QACvC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;CACJ"}
|
||||
@ -1,5 +1,5 @@
|
||||
import { ClipboardTransferTextArea } from "./UI.js";
|
||||
import { Remotely } from "./Main.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
|
||||
export class ClipboardWatcher {
|
||||
ClipboardTimer: number;
|
||||
@ -22,7 +22,7 @@ export class ClipboardWatcher {
|
||||
if (this.LastClipboardText != newText) {
|
||||
this.LastClipboardText = newText;
|
||||
ClipboardTransferTextArea.value = newText;
|
||||
Remotely.RCBrowserSockets.SendClipboardTransfer(newText, false);
|
||||
MainRc.RCBrowserSockets.SendClipboardTransfer(newText, false);
|
||||
}
|
||||
})
|
||||
}, 100);
|
||||
|
||||
@ -1 +0,0 @@
|
||||
//# sourceMappingURL=DynamicDto.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"DynamicDto.js","sourceRoot":"","sources":["DynamicDto.ts"],"names":[],"mappings":""}
|
||||
@ -1,5 +0,0 @@
|
||||
import { DynamicDtoType } from "../Enums/DynamicDtoType.js";
|
||||
|
||||
export interface DynamicDto {
|
||||
DtoType: DynamicDtoType
|
||||
}
|
||||
@ -6,7 +6,7 @@ import { RemoteControlMode } from "../Enums/RemoteControlMode.js";
|
||||
import { ClipboardWatcher } from "./ClipboardWatcher.js";
|
||||
import { RtcMessageHandler } from "./RtcMessageHandler.js";
|
||||
var queryString = Utilities.ParseSearchString();
|
||||
export const Remotely = {
|
||||
export const MainRc = {
|
||||
ClipboardWatcher: new ClipboardWatcher(),
|
||||
Debug: false,
|
||||
RCBrowserSockets: new RCBrowserSockets(),
|
||||
@ -17,11 +17,11 @@ export const Remotely = {
|
||||
RequesterName: queryString["requesterName"] ? decodeURIComponent(queryString["requesterName"]) : "",
|
||||
Mode: RemoteControlMode.None,
|
||||
Init: () => {
|
||||
UI.ApplyInputHandlers(Remotely.RCBrowserSockets);
|
||||
UI.ApplyInputHandlers(MainRc.RCBrowserSockets);
|
||||
if (queryString["clientID"]) {
|
||||
Remotely.Mode = RemoteControlMode.Unattended;
|
||||
MainRc.Mode = RemoteControlMode.Unattended;
|
||||
UI.ConnectBox.style.display = "none";
|
||||
Remotely.RCBrowserSockets.Connect();
|
||||
MainRc.RCBrowserSockets.Connect();
|
||||
}
|
||||
else if (queryString["sessionID"]) {
|
||||
UI.SessionIDInput.value = decodeURIComponent(queryString["sessionID"]);
|
||||
@ -33,12 +33,12 @@ export const Remotely = {
|
||||
},
|
||||
ConnectToClient: () => {
|
||||
UI.ConnectButton.disabled = true;
|
||||
Remotely.ClientID = UI.SessionIDInput.value.split(" ").join("");
|
||||
Remotely.RequesterName = UI.RequesterNameInput.value;
|
||||
Remotely.Mode = RemoteControlMode.Normal;
|
||||
Remotely.RCBrowserSockets.Connect();
|
||||
MainRc.ClientID = UI.SessionIDInput.value.split(" ").join("");
|
||||
MainRc.RequesterName = UI.RequesterNameInput.value;
|
||||
MainRc.Mode = RemoteControlMode.Normal;
|
||||
MainRc.RCBrowserSockets.Connect();
|
||||
UI.StatusMessage.innerHTML = "Sending connection request...";
|
||||
}
|
||||
};
|
||||
window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AAU,CAAC;YAC3C,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YACrC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;SACrC;aACI,IAAI,WAAW,CAAC,WAAW,CAAC,EAAE;YAC/B,EAAE,CAAC,cAAc,CAAC,KAAK,GAAG,kBAAkB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;YACvE,IAAI,WAAW,CAAC,eAAe,CAAC,EAAE;gBAC9B,EAAE,CAAC,kBAAkB,CAAC,KAAK,GAAG,kBAAkB,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC;gBAC/E,IAAI,CAAC,eAAe,EAAE,CAAC;aAC1B;SACJ;IACL,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QAClB,EAAE,CAAC,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC;QACjC,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9D,MAAM,CAAC,aAAa,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC;QACnD,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC,MAAM,CAAC;QACvC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAClC,EAAE,CAAC,aAAa,CAAC,SAAS,GAAG,+BAA+B,CAAC;IACjE,CAAC;CACJ,CAAA;AAED,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC"}
|
||||
@ -9,7 +9,7 @@ import { RtcMessageHandler } from "./RtcMessageHandler.js";
|
||||
|
||||
var queryString = Utilities.ParseSearchString();
|
||||
|
||||
export const Remotely = {
|
||||
export const MainRc = {
|
||||
ClipboardWatcher: new ClipboardWatcher(),
|
||||
Debug: false,
|
||||
RCBrowserSockets: new RCBrowserSockets(),
|
||||
@ -21,12 +21,12 @@ export const Remotely = {
|
||||
Mode: RemoteControlMode.None,
|
||||
|
||||
Init: () => {
|
||||
UI.ApplyInputHandlers(Remotely.RCBrowserSockets);
|
||||
UI.ApplyInputHandlers(MainRc.RCBrowserSockets);
|
||||
|
||||
if (queryString["clientID"]) {
|
||||
Remotely.Mode = RemoteControlMode.Unattended;
|
||||
MainRc.Mode = RemoteControlMode.Unattended;
|
||||
UI.ConnectBox.style.display = "none";
|
||||
Remotely.RCBrowserSockets.Connect();
|
||||
MainRc.RCBrowserSockets.Connect();
|
||||
}
|
||||
else if (queryString["sessionID"]) {
|
||||
UI.SessionIDInput.value = decodeURIComponent(queryString["sessionID"]);
|
||||
@ -38,12 +38,12 @@ export const Remotely = {
|
||||
},
|
||||
ConnectToClient: () => {
|
||||
UI.ConnectButton.disabled = true;
|
||||
Remotely.ClientID = UI.SessionIDInput.value.split(" ").join("");
|
||||
Remotely.RequesterName = UI.RequesterNameInput.value;
|
||||
Remotely.Mode = RemoteControlMode.Normal;
|
||||
Remotely.RCBrowserSockets.Connect();
|
||||
MainRc.ClientID = UI.SessionIDInput.value.split(" ").join("");
|
||||
MainRc.RequesterName = UI.RequesterNameInput.value;
|
||||
MainRc.Mode = RemoteControlMode.Normal;
|
||||
MainRc.RCBrowserSockets.Connect();
|
||||
UI.StatusMessage.innerHTML = "Sending connection request...";
|
||||
}
|
||||
}
|
||||
|
||||
window["Remotely"] = Remotely;
|
||||
window["Remotely"] = MainRc;
|
||||
59
Server/wwwroot/scripts/RemoteControl/MessageSender.js
Normal file
59
Server/wwwroot/scripts/RemoteControl/MessageSender.js
Normal file
@ -0,0 +1,59 @@
|
||||
import { MainRc } from "./Main.js";
|
||||
import { CtrlAltDelDto, KeyDownDto, KeyPressDto, KeyUpDto, MouseDownDto, MouseMoveDto, MouseUpDto, MouseWheelDto, QualityChangeDto, SelectScreenDto, TapDto, AutoQualityAdjustDto, ToggleAudioDto, ToggleBlockInputDto, ClipboardTransferDto } from "./RtcDtos.js";
|
||||
export class MessageSender {
|
||||
SendSelectScreen(displayName) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new SelectScreenDto(displayName)), () => MainRc.RCBrowserSockets.SendSelectScreen(displayName));
|
||||
}
|
||||
SendMouseMove(percentX, percentY) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseMoveDto(percentX, percentY)), () => MainRc.RCBrowserSockets.SendMouseMove(percentX, percentY));
|
||||
}
|
||||
SendMouseDown(button, percentX, percentY) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseDownDto(button, percentX, percentY)), () => MainRc.RCBrowserSockets.SendMouseDown(button, percentX, percentY));
|
||||
}
|
||||
SendMouseUp(button, percentX, percentY) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseUpDto(button, percentX, percentY)), () => MainRc.RCBrowserSockets.SendMouseUp(button, percentX, percentY));
|
||||
}
|
||||
SendTap(percentX, percentY) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new TapDto(percentX, percentY)), () => MainRc.RCBrowserSockets.SendTap(percentX, percentY));
|
||||
}
|
||||
SendMouseWheel(deltaX, deltaY) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseWheelDto(deltaX, deltaY)), () => MainRc.RCBrowserSockets.SendMouseWheel(deltaX, deltaY));
|
||||
}
|
||||
SendKeyDown(key) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyDownDto(key)), () => MainRc.RCBrowserSockets.SendKeyDown(key));
|
||||
}
|
||||
SendKeyUp(key) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyUpDto(key)), () => MainRc.RCBrowserSockets.SendKeyUp(key));
|
||||
}
|
||||
SendKeyPress(key) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyPressDto(key)), () => MainRc.RCBrowserSockets.SendKeyPress(key));
|
||||
}
|
||||
SendCtrlAltDel() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new CtrlAltDelDto()), () => MainRc.RCBrowserSockets.SendCtrlAltDel());
|
||||
}
|
||||
SendQualityChange(qualityLevel) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new QualityChangeDto(qualityLevel)), () => MainRc.RCBrowserSockets.SendQualityChange(qualityLevel));
|
||||
}
|
||||
SendAutoQualityAdjust(isOn) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new AutoQualityAdjustDto(isOn)), () => MainRc.RCBrowserSockets.SendAutoQualityAdjust(isOn));
|
||||
}
|
||||
SendToggleAudio(toggleOn) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ToggleAudioDto(toggleOn)), () => MainRc.RCBrowserSockets.SendToggleAudio(toggleOn));
|
||||
}
|
||||
;
|
||||
SendToggleBlockInput(toggleOn) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ToggleBlockInputDto(toggleOn)), () => MainRc.RCBrowserSockets.SendToggleBlockInput(toggleOn));
|
||||
}
|
||||
SendClipboardTransfer(text, typeText) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ClipboardTransferDto(text, typeText)), () => MainRc.RCBrowserSockets.SendClipboardTransfer(text, typeText));
|
||||
}
|
||||
SendToAgent(rtcSend, websocketSend) {
|
||||
if (MainRc.RtcSession.DataChannel && MainRc.RtcSession.DataChannel.readyState == "open") {
|
||||
rtcSend();
|
||||
}
|
||||
else {
|
||||
websocketSend();
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=MessageSender.js.map
|
||||
@ -0,0 +1 @@
|
||||
{"version":3,"file":"MessageSender.js","sourceRoot":"","sources":["MessageSender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACH,aAAa,EACb,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,M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AAC,EAC/E,GAAG,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtE,CAAC;IACD,qBAAqB,CAAC,IAAY,EAAE,QAAiB;QACjD,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,EACtF,GAAG,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7E,CAAC;IAEO,WAAW,CAAC,OAAmB,EAAE,aAAyB;QAC9D,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,IAAI,MAAM,EAAE;YACrF,OAAO,EAAE,CAAC;SACb;aACI;YACD,aAAa,EAAE,CAAC;SACnB;IACL,CAAC;CACJ"}
|
||||
92
Server/wwwroot/scripts/RemoteControl/MessageSender.ts
Normal file
92
Server/wwwroot/scripts/RemoteControl/MessageSender.ts
Normal file
@ -0,0 +1,92 @@
|
||||
import { MainRc } from "./Main.js";
|
||||
import {
|
||||
CtrlAltDelDto,
|
||||
KeyDownDto,
|
||||
KeyPressDto,
|
||||
KeyUpDto,
|
||||
MouseDownDto,
|
||||
MouseMoveDto,
|
||||
MouseUpDto,
|
||||
MouseWheelDto,
|
||||
QualityChangeDto,
|
||||
SelectScreenDto,
|
||||
TapDto,
|
||||
AutoQualityAdjustDto,
|
||||
ToggleAudioDto,
|
||||
ToggleBlockInputDto,
|
||||
ClipboardTransferDto
|
||||
} from "./RtcDtos.js";
|
||||
|
||||
export class MessageSender {
|
||||
SendSelectScreen(displayName: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new SelectScreenDto(displayName)),
|
||||
() => MainRc.RCBrowserSockets.SendSelectScreen(displayName));
|
||||
}
|
||||
SendMouseMove(percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseMoveDto(percentX, percentY)),
|
||||
() => MainRc.RCBrowserSockets.SendMouseMove(percentX, percentY));
|
||||
}
|
||||
SendMouseDown(button: number, percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseDownDto(button, percentX, percentY)),
|
||||
() => MainRc.RCBrowserSockets.SendMouseDown(button, percentX, percentY));
|
||||
}
|
||||
SendMouseUp(button: number, percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseUpDto(button, percentX, percentY)),
|
||||
() => MainRc.RCBrowserSockets.SendMouseUp(button, percentX, percentY));
|
||||
}
|
||||
SendTap(percentX: number, percentY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new TapDto(percentX, percentY)),
|
||||
() => MainRc.RCBrowserSockets.SendTap(percentX, percentY));
|
||||
}
|
||||
SendMouseWheel(deltaX: number, deltaY: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new MouseWheelDto(deltaX, deltaY)),
|
||||
() => MainRc.RCBrowserSockets.SendMouseWheel(deltaX, deltaY));
|
||||
}
|
||||
SendKeyDown(key: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyDownDto(key)),
|
||||
() => MainRc.RCBrowserSockets.SendKeyDown(key));
|
||||
}
|
||||
SendKeyUp(key: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyUpDto(key)),
|
||||
() => MainRc.RCBrowserSockets.SendKeyUp(key));
|
||||
}
|
||||
SendKeyPress(key: string) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new KeyPressDto(key)),
|
||||
() => MainRc.RCBrowserSockets.SendKeyPress(key));
|
||||
}
|
||||
|
||||
SendCtrlAltDel() {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new CtrlAltDelDto()),
|
||||
() => MainRc.RCBrowserSockets.SendCtrlAltDel());
|
||||
}
|
||||
|
||||
SendQualityChange(qualityLevel: number) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new QualityChangeDto(qualityLevel)),
|
||||
() => MainRc.RCBrowserSockets.SendQualityChange(qualityLevel));
|
||||
}
|
||||
SendAutoQualityAdjust(isOn: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new AutoQualityAdjustDto(isOn)),
|
||||
() => MainRc.RCBrowserSockets.SendAutoQualityAdjust(isOn));
|
||||
}
|
||||
SendToggleAudio(toggleOn: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ToggleAudioDto(toggleOn)),
|
||||
() => MainRc.RCBrowserSockets.SendToggleAudio(toggleOn));
|
||||
};
|
||||
SendToggleBlockInput(toggleOn: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ToggleBlockInputDto(toggleOn)),
|
||||
() => MainRc.RCBrowserSockets.SendToggleBlockInput(toggleOn));
|
||||
}
|
||||
SendClipboardTransfer(text: string, typeText: boolean) {
|
||||
this.SendToAgent(() => MainRc.RtcSession.SendDto(new ClipboardTransferDto(text, typeText)),
|
||||
() => MainRc.RCBrowserSockets.SendClipboardTransfer(text, typeText));
|
||||
}
|
||||
|
||||
private SendToAgent(rtcSend: () => void, websocketSend: () => void) {
|
||||
if (MainRc.RtcSession.DataChannel && MainRc.RtcSession.DataChannel.readyState == "open") {
|
||||
rtcSend();
|
||||
}
|
||||
else {
|
||||
websocketSend();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
import * as Utilities from "../Utilities.js";
|
||||
import * as UI from "./UI.js";
|
||||
import { Remotely } from "./Main.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
import { Sound } from "../Sound.js";
|
||||
import { PopupMessage } from "../UI.js";
|
||||
var signalR = window["signalR"];
|
||||
@ -34,7 +33,7 @@ export class RCBrowserSockets {
|
||||
UI.ScreenViewer.setAttribute("hidden", "hidden");
|
||||
UI.ConnectBox.style.removeProperty("display");
|
||||
});
|
||||
Remotely.ClipboardWatcher.WatchClipboard();
|
||||
MainRc.ClipboardWatcher.WatchClipboard();
|
||||
}
|
||||
;
|
||||
SendIceCandidate(candidate) {
|
||||
@ -49,7 +48,7 @@ export class RCBrowserSockets {
|
||||
this.Connection.invoke("SendRtcAnswerToAgent", sessionDescription.sdp);
|
||||
}
|
||||
SendScreenCastRequestToDevice() {
|
||||
this.Connection.invoke("SendScreenCastRequestToDevice", Remotely.ClientID, Remotely.RequesterName, Remotely.Mode);
|
||||
this.Connection.invoke("SendScreenCastRequestToDevice", MainRc.ClientID, MainRc.RequesterName, MainRc.Mode);
|
||||
}
|
||||
SendFrameReceived(bytesReceived) {
|
||||
this.Connection.invoke("SendFrameReceived", bytesReceived);
|
||||
@ -117,7 +116,7 @@ export class RCBrowserSockets {
|
||||
}
|
||||
ApplyMessageHandlers(hubConnection) {
|
||||
hubConnection.on("ClipboardTextChanged", (clipboardText) => {
|
||||
Remotely.ClipboardWatcher.SetClipboardText(clipboardText);
|
||||
MainRc.ClipboardWatcher.SetClipboardText(clipboardText);
|
||||
PopupMessage("Clipboard updated.");
|
||||
});
|
||||
hubConnection.on("ScreenData", (selectedDisplay, displayNames) => {
|
||||
@ -139,7 +138,7 @@ export class RCBrowserSockets {
|
||||
window.URL.revokeObjectURL(url);
|
||||
};
|
||||
img.src = url;
|
||||
if (Remotely.Debug) {
|
||||
if (MainRc.Debug) {
|
||||
this.FpsStack.push(Date.now());
|
||||
while (Date.now() - this.FpsStack[0] > 1000) {
|
||||
this.FpsStack.shift();
|
||||
@ -175,7 +174,7 @@ export class RCBrowserSockets {
|
||||
document.title = `${machineName} - Remotely Session`;
|
||||
});
|
||||
hubConnection.on("RelaunchedScreenCasterReady", (newClientID) => {
|
||||
Remotely.ClientID = newClientID;
|
||||
MainRc.ClientID = newClientID;
|
||||
this.Connection.stop();
|
||||
this.Connect();
|
||||
});
|
||||
@ -183,28 +182,19 @@ export class RCBrowserSockets {
|
||||
UI.ShowMessage("Reconnecting...");
|
||||
});
|
||||
hubConnection.on("CursorChange", (cursor) => {
|
||||
if (cursor.CssOverride) {
|
||||
UI.ScreenViewer.style.cursor = cursor.CssOverride;
|
||||
}
|
||||
else if (cursor.ImageBytes.byteLength == 0) {
|
||||
UI.ScreenViewer.style.cursor = "default";
|
||||
}
|
||||
else {
|
||||
var base64 = Utilities.ConvertUInt8ArrayToBase64(cursor.ImageBytes);
|
||||
UI.ScreenViewer.style.cursor = `url('data:image/png;base64,${base64}') ${cursor.HotSpot.X} ${cursor.HotSpot.Y}, default`;
|
||||
}
|
||||
UI.UpdateCursor(cursor);
|
||||
});
|
||||
hubConnection.on("RequestingScreenCast", () => {
|
||||
UI.ShowMessage("Requesting remote control...");
|
||||
});
|
||||
hubConnection.on("ReceiveRtcOffer", async (sdp) => {
|
||||
console.log("Rtc offer SDP received.");
|
||||
Remotely.RtcSession.Init();
|
||||
await Remotely.RtcSession.ReceiveRtcOffer(sdp);
|
||||
MainRc.RtcSession.Init();
|
||||
await MainRc.RtcSession.ReceiveRtcOffer(sdp);
|
||||
});
|
||||
hubConnection.on("ReceiveIceCandidate", (candidate, sdpMlineIndex, sdpMid) => {
|
||||
console.log("Ice candidate received.");
|
||||
Remotely.RtcSession.ReceiveCandidate({
|
||||
MainRc.RtcSession.ReceiveCandidate({
|
||||
candidate: candidate,
|
||||
sdpMLineIndex: sdpMlineIndex,
|
||||
sdpMid: sdpMid
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
import * as Utilities from "../Utilities.js";
|
||||
import * as UI from "./UI.js";
|
||||
import { Remotely } from "./Main.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
import { CursorInfo } from "../Models/CursorInfo.js";
|
||||
import { Sound } from "../Sound.js";
|
||||
import { PopupMessage } from "../UI.js";
|
||||
@ -46,7 +46,7 @@ export class RCBrowserSockets {
|
||||
UI.ConnectBox.style.removeProperty("display");
|
||||
});
|
||||
|
||||
Remotely.ClipboardWatcher.WatchClipboard();
|
||||
MainRc.ClipboardWatcher.WatchClipboard();
|
||||
};
|
||||
|
||||
SendIceCandidate(candidate: RTCIceCandidate) {
|
||||
@ -63,7 +63,7 @@ export class RCBrowserSockets {
|
||||
|
||||
|
||||
SendScreenCastRequestToDevice() {
|
||||
this.Connection.invoke("SendScreenCastRequestToDevice", Remotely.ClientID, Remotely.RequesterName, Remotely.Mode);
|
||||
this.Connection.invoke("SendScreenCastRequestToDevice", MainRc.ClientID, MainRc.RequesterName, MainRc.Mode);
|
||||
}
|
||||
SendFrameReceived(bytesReceived: number) {
|
||||
this.Connection.invoke("SendFrameReceived", bytesReceived);
|
||||
@ -131,7 +131,7 @@ export class RCBrowserSockets {
|
||||
}
|
||||
private ApplyMessageHandlers(hubConnection) {
|
||||
hubConnection.on("ClipboardTextChanged", (clipboardText: string) => {
|
||||
Remotely.ClipboardWatcher.SetClipboardText(clipboardText);
|
||||
MainRc.ClipboardWatcher.SetClipboardText(clipboardText);
|
||||
PopupMessage("Clipboard updated.");
|
||||
});
|
||||
hubConnection.on("ScreenData", (selectedDisplay: string, displayNames: string[]) => {
|
||||
@ -156,7 +156,7 @@ export class RCBrowserSockets {
|
||||
};
|
||||
img.src = url;
|
||||
|
||||
if (Remotely.Debug) {
|
||||
if (MainRc.Debug) {
|
||||
this.FpsStack.push(Date.now());
|
||||
while (Date.now() - this.FpsStack[0] > 1000) {
|
||||
this.FpsStack.shift();
|
||||
@ -192,7 +192,7 @@ export class RCBrowserSockets {
|
||||
document.title = `${machineName} - Remotely Session`;
|
||||
});
|
||||
hubConnection.on("RelaunchedScreenCasterReady", (newClientID: string) => {
|
||||
Remotely.ClientID = newClientID;
|
||||
MainRc.ClientID = newClientID;
|
||||
this.Connection.stop();
|
||||
this.Connect();
|
||||
});
|
||||
@ -202,16 +202,7 @@ export class RCBrowserSockets {
|
||||
});
|
||||
|
||||
hubConnection.on("CursorChange", (cursor: CursorInfo) => {
|
||||
if (cursor.CssOverride) {
|
||||
UI.ScreenViewer.style.cursor = cursor.CssOverride;
|
||||
}
|
||||
else if (cursor.ImageBytes.byteLength == 0) {
|
||||
UI.ScreenViewer.style.cursor = "default";
|
||||
}
|
||||
else {
|
||||
var base64 = Utilities.ConvertUInt8ArrayToBase64(cursor.ImageBytes);
|
||||
UI.ScreenViewer.style.cursor = `url('data:image/png;base64,${base64}') ${cursor.HotSpot.X} ${cursor.HotSpot.Y}, default`;
|
||||
}
|
||||
UI.UpdateCursor(cursor);
|
||||
});
|
||||
|
||||
hubConnection.on("RequestingScreenCast", () => {
|
||||
@ -221,13 +212,13 @@ export class RCBrowserSockets {
|
||||
|
||||
hubConnection.on("ReceiveRtcOffer", async (sdp: string) => {
|
||||
console.log("Rtc offer SDP received.");
|
||||
Remotely.RtcSession.Init();
|
||||
await Remotely.RtcSession.ReceiveRtcOffer(sdp);
|
||||
MainRc.RtcSession.Init();
|
||||
await MainRc.RtcSession.ReceiveRtcOffer(sdp);
|
||||
|
||||
});
|
||||
hubConnection.on("ReceiveIceCandidate", (candidate: string, sdpMlineIndex: number, sdpMid: string) => {
|
||||
console.log("Ice candidate received.");
|
||||
Remotely.RtcSession.ReceiveCandidate({
|
||||
MainRc.RtcSession.ReceiveCandidate({
|
||||
candidate: candidate,
|
||||
sdpMLineIndex: sdpMlineIndex,
|
||||
sdpMid: sdpMid
|
||||
|
||||
99
Server/wwwroot/scripts/RemoteControl/RtcDtos.js
Normal file
99
Server/wwwroot/scripts/RemoteControl/RtcDtos.js
Normal file
@ -0,0 +1,99 @@
|
||||
import { BinaryDtoType } from "../Enums/BinaryDtoType.js";
|
||||
export class AutoQualityAdjustDto {
|
||||
constructor(isOn) {
|
||||
this.DtoType = BinaryDtoType.AutoQualityAdjust;
|
||||
this.IsOn = isOn;
|
||||
}
|
||||
}
|
||||
export class ClipboardTransferDto {
|
||||
constructor(text, typeText) {
|
||||
this.DtoType = BinaryDtoType.ClipboardTransfer;
|
||||
this.Text = text;
|
||||
this.TypeText = typeText;
|
||||
}
|
||||
}
|
||||
export class CtrlAltDelDto {
|
||||
constructor() {
|
||||
this.DtoType = BinaryDtoType.CtrlAltDel;
|
||||
}
|
||||
}
|
||||
export class KeyDownDto {
|
||||
constructor(key) {
|
||||
this.DtoType = BinaryDtoType.KeyDown;
|
||||
this.Key = key;
|
||||
}
|
||||
}
|
||||
export class KeyPressDto {
|
||||
constructor(key) {
|
||||
this.DtoType = BinaryDtoType.KeyPress;
|
||||
this.Key = key;
|
||||
}
|
||||
}
|
||||
export class KeyUpDto {
|
||||
constructor(key) {
|
||||
this.DtoType = BinaryDtoType.KeyUp;
|
||||
this.Key = key;
|
||||
}
|
||||
}
|
||||
export class MouseDownDto {
|
||||
constructor(button, percentX, percentY) {
|
||||
this.DtoType = BinaryDtoType.MouseDown;
|
||||
this.Button = button;
|
||||
this.PercentX = percentX;
|
||||
this.PercentY = percentY;
|
||||
}
|
||||
}
|
||||
export class MouseMoveDto {
|
||||
constructor(percentX, percentY) {
|
||||
this.DtoType = BinaryDtoType.MouseMove;
|
||||
this.PercentX = percentX;
|
||||
this.PercentY = percentY;
|
||||
}
|
||||
}
|
||||
export class MouseUpDto {
|
||||
constructor(button, percentX, percentY) {
|
||||
this.DtoType = BinaryDtoType.MouseUp;
|
||||
this.Button = button;
|
||||
this.PercentX = percentX;
|
||||
this.PercentY = percentY;
|
||||
}
|
||||
}
|
||||
export class MouseWheelDto {
|
||||
constructor(deltaX, deltaY) {
|
||||
this.DtoType = BinaryDtoType.MouseWheel;
|
||||
this.DeltaX = deltaX;
|
||||
this.DetlaY = deltaY;
|
||||
}
|
||||
}
|
||||
export class QualityChangeDto {
|
||||
constructor(qualityLevel) {
|
||||
this.DtoType = BinaryDtoType.QualityChange;
|
||||
this.QualityLevel = qualityLevel;
|
||||
}
|
||||
}
|
||||
export class SelectScreenDto {
|
||||
constructor(displayName) {
|
||||
this.DtoType = BinaryDtoType.SelectScreen;
|
||||
this.DisplayName = displayName;
|
||||
}
|
||||
}
|
||||
export class TapDto {
|
||||
constructor(percentX, percentY) {
|
||||
this.DtoType = BinaryDtoType.Tap;
|
||||
this.PercentX = percentX;
|
||||
this.PercentY = percentY;
|
||||
}
|
||||
}
|
||||
export class ToggleAudioDto {
|
||||
constructor(toggleOn) {
|
||||
this.DtoType = BinaryDtoType.ToggleAudio;
|
||||
this.ToggleOn = toggleOn;
|
||||
}
|
||||
}
|
||||
export class ToggleBlockInputDto {
|
||||
constructor(toggleOn) {
|
||||
this.DtoType = BinaryDtoType.ToggleBlockInput;
|
||||
this.ToggleOn = toggleOn;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=RtcDtos.js.map
|
||||
1
Server/wwwroot/scripts/RemoteControl/RtcDtos.js.map
Normal file
1
Server/wwwroot/scripts/RemoteControl/RtcDtos.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"RtcDtos.js","sourceRoot":"","sources":["RtcDtos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,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;AAMD,MAAM,OAAO,UAAU;IACnB,YAAY,GAAW;QAKvB,YAAO,GAAkB,aAAa,CAAC,OAAO,CAAC;QAJ3C,IA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C;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CAKJ;AAED,MAAM,OAAO,gBAAgB;IACzB,YAAY,YAAoB;QAKhC,YAAO,GAAkB,aAAa,CAAC,aAAa,CAAC;QAJjD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;CAIJ;AAYD,MAAM,OAAO,eAAe;IACxB,YAAY,WAAmB;QAK/B,YAAO,GAAkB,aAAa,CAAC,YAAY,CAAC;QAJhD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CAIJ;AAED,MAAM,OAAO,MAAM;IACf,YAAY,QAAgB,EAAE,QAAgB;QAO9C,YAAO,GAAkB,aAAa,CAAC,GAAG,CAAC;QANvC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CAKJ;AAED,MAAM,OAAO,cAAc;IACvB,YAAY,QAAiB;QAK7B,YAAO,GAAkB,aAAa,CAAC,WAAW,CAAC;QAJ/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CAIJ;AAED,MAAM,OAAO,mBAAmB;IAC5B,YAAY,QAAiB;QAK7B,YAAO,GAAkB,aAAa,CAAC,gBAAgB,CAAC;QAJpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CAIJ"}
|
||||
188
Server/wwwroot/scripts/RemoteControl/RtcDtos.ts
Normal file
188
Server/wwwroot/scripts/RemoteControl/RtcDtos.ts
Normal file
@ -0,0 +1,188 @@
|
||||
import { BinaryDto } from "./BinaryDto.js";
|
||||
import { BinaryDtoType } from "../Enums/BinaryDtoType.js";
|
||||
import { CursorInfo } from "../Models/CursorInfo.js";
|
||||
|
||||
export class AutoQualityAdjustDto implements BinaryDto {
|
||||
constructor(isOn: boolean) {
|
||||
this.IsOn = isOn;
|
||||
}
|
||||
|
||||
IsOn: boolean;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.AutoQualityAdjust;
|
||||
}
|
||||
|
||||
|
||||
export interface AudioSampleDto extends BinaryDto {
|
||||
Buffer: Uint8Array;
|
||||
}
|
||||
|
||||
export interface CaptureFrameDto extends BinaryDto {
|
||||
EndOfFrame: boolean;
|
||||
Left: number;
|
||||
Top: number;
|
||||
Width: number;
|
||||
Height: number;
|
||||
ImageBytes: Uint8Array;
|
||||
ImageQuality: number;
|
||||
}
|
||||
|
||||
export interface ClipboardTextDto extends BinaryDto {
|
||||
ClipboardText: string;
|
||||
}
|
||||
|
||||
|
||||
export class ClipboardTransferDto implements BinaryDto {
|
||||
constructor(text: string, typeText:boolean) {
|
||||
this.Text = text;
|
||||
this.TypeText = typeText;
|
||||
}
|
||||
|
||||
Text: string;
|
||||
TypeText: boolean;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.ClipboardTransfer;
|
||||
}
|
||||
|
||||
|
||||
export class CtrlAltDelDto implements BinaryDto {
|
||||
DtoType: BinaryDtoType = BinaryDtoType.CtrlAltDel;
|
||||
}
|
||||
|
||||
export interface CursorChangeDto extends BinaryDto {
|
||||
CursorInfo: CursorInfo;
|
||||
}
|
||||
|
||||
export class KeyDownDto implements BinaryDto {
|
||||
constructor(key: string) {
|
||||
this.Key = key;
|
||||
}
|
||||
|
||||
Key: string;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.KeyDown;
|
||||
}
|
||||
|
||||
export class KeyPressDto implements BinaryDto {
|
||||
constructor(key: string) {
|
||||
this.Key = key;
|
||||
}
|
||||
|
||||
Key: string;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.KeyPress;
|
||||
}
|
||||
|
||||
export class KeyUpDto implements BinaryDto {
|
||||
constructor(key: string) {
|
||||
this.Key = key;
|
||||
}
|
||||
|
||||
Key: string;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.KeyUp;
|
||||
}
|
||||
|
||||
export interface MachineNameDto extends BinaryDto {
|
||||
MachineName: string;
|
||||
}
|
||||
|
||||
export class MouseDownDto implements BinaryDto {
|
||||
constructor(button: number, percentX: number, percentY: number) {
|
||||
this.Button = button;
|
||||
this.PercentX = percentX;
|
||||
this.PercentY = percentY;
|
||||
}
|
||||
|
||||
Button: number;
|
||||
PercentX: number;
|
||||
PercentY: number;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.MouseDown;
|
||||
}
|
||||
|
||||
export class MouseMoveDto implements BinaryDto {
|
||||
constructor(percentX: number, percentY: number) {
|
||||
this.PercentX = percentX;
|
||||
this.PercentY = percentY;
|
||||
}
|
||||
|
||||
PercentX: number;
|
||||
PercentY: number;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.MouseMove;
|
||||
}
|
||||
|
||||
export class MouseUpDto implements BinaryDto {
|
||||
constructor(button: number, percentX: number, percentY: number) {
|
||||
this.Button = button;
|
||||
this.PercentX = percentX;
|
||||
this.PercentY = percentY;
|
||||
}
|
||||
|
||||
Button: number;
|
||||
PercentX: number;
|
||||
PercentY: number;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.MouseUp;
|
||||
}
|
||||
|
||||
export class MouseWheelDto implements BinaryDto {
|
||||
constructor(deltaX: number, deltaY: number) {
|
||||
this.DeltaX = deltaX;
|
||||
this.DetlaY = deltaY;
|
||||
}
|
||||
|
||||
DeltaX: number;
|
||||
DetlaY: number;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.MouseWheel;
|
||||
}
|
||||
|
||||
export class QualityChangeDto implements BinaryDto {
|
||||
constructor(qualityLevel: number) {
|
||||
this.QualityLevel = qualityLevel;
|
||||
}
|
||||
|
||||
QualityLevel: number;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.QualityChange;
|
||||
}
|
||||
|
||||
export interface ScreenDataDto extends BinaryDto {
|
||||
DisplayNames: string[];
|
||||
SelectedScreen: string;
|
||||
}
|
||||
|
||||
export interface ScreenSizeDto extends BinaryDto {
|
||||
Width: number;
|
||||
Height: number;
|
||||
}
|
||||
|
||||
export class SelectScreenDto implements BinaryDto {
|
||||
constructor(displayName: string) {
|
||||
this.DisplayName = displayName;
|
||||
}
|
||||
|
||||
DisplayName: string;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.SelectScreen;
|
||||
}
|
||||
|
||||
export class TapDto implements BinaryDto {
|
||||
constructor(percentX: number, percentY: number) {
|
||||
this.PercentX = percentX;
|
||||
this.PercentY = percentY;
|
||||
}
|
||||
|
||||
PercentX: number;
|
||||
PercentY: number;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.Tap;
|
||||
}
|
||||
|
||||
export class ToggleAudioDto implements BinaryDto {
|
||||
constructor(toggleOn: boolean) {
|
||||
this.ToggleOn = toggleOn;
|
||||
}
|
||||
|
||||
ToggleOn: boolean;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.ToggleAudio;
|
||||
}
|
||||
|
||||
export class ToggleBlockInputDto implements BinaryDto {
|
||||
constructor(toggleOn: boolean) {
|
||||
this.ToggleOn = toggleOn;
|
||||
}
|
||||
|
||||
ToggleOn: boolean;
|
||||
DtoType: BinaryDtoType = BinaryDtoType.ToggleBlockInput;
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
//# sourceMappingURL=CaptureFrameDto.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"CaptureFrameDto.js","sourceRoot":"","sources":["CaptureFrameDto.ts"],"names":[],"mappings":""}
|
||||
@ -1,11 +0,0 @@
|
||||
import { DynamicDto } from "../DynamicDto.js";
|
||||
|
||||
export interface CaptureFrameDto extends DynamicDto {
|
||||
EndOfFrame: boolean;
|
||||
Left: number;
|
||||
Top: number;
|
||||
Width: number;
|
||||
Height: number;
|
||||
ImageBytes: Uint8Array;
|
||||
ImageQuality: number;
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
//# sourceMappingURL=ClipboardTextDto.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"ClipboardTextDto.js","sourceRoot":"","sources":["ClipboardTextDto.ts"],"names":[],"mappings":""}
|
||||
@ -1,5 +0,0 @@
|
||||
import { DynamicDto } from "../DynamicDto.js";
|
||||
|
||||
export interface ClipboardTextDto extends DynamicDto {
|
||||
ClipboardText: string;
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
//# sourceMappingURL=MachineNameDto.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"MachineNameDto.js","sourceRoot":"","sources":["MachineNameDto.ts"],"names":[],"mappings":""}
|
||||
@ -1,5 +0,0 @@
|
||||
import { DynamicDto } from "../DynamicDto.js";
|
||||
|
||||
export interface MachineNameDto extends DynamicDto {
|
||||
MachineName: string;
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
//# sourceMappingURL=ScreenDataDto.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"ScreenDataDto.js","sourceRoot":"","sources":["ScreenDataDto.ts"],"names":[],"mappings":""}
|
||||
@ -1,6 +0,0 @@
|
||||
import { DynamicDto } from "../DynamicDto.js";
|
||||
|
||||
export interface ScreenDataDto extends DynamicDto {
|
||||
DisplayNames: string[];
|
||||
SelectedScreen: string;
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
//# sourceMappingURL=ScreenSizeDto.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"ScreenSizeDto.js","sourceRoot":"","sources":["ScreenSizeDto.ts"],"names":[],"mappings":""}
|
||||
@ -1,6 +0,0 @@
|
||||
import { DynamicDto } from "../DynamicDto.js";
|
||||
|
||||
export interface ScreenSizeDto extends DynamicDto {
|
||||
Width: number;
|
||||
Height: number;
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
import * as UI from "./UI.js";
|
||||
import { DynamicDtoType } from "../Enums/DynamicDtoType.js";
|
||||
import { Remotely } from "./Main.js";
|
||||
import { BinaryDtoType } from "../Enums/BinaryDtoType.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
import { PopupMessage } from "../UI.js";
|
||||
import { Sound } from "../Sound.js";
|
||||
export class RtcMessageHandler {
|
||||
constructor() {
|
||||
this.FpsStack = [];
|
||||
@ -11,37 +12,35 @@ export class RtcMessageHandler {
|
||||
ParseBinaryMessage(data) {
|
||||
var model = this.MessagePack.decode(data);
|
||||
switch (model.DtoType) {
|
||||
case DynamicDtoType.CaptureFrame:
|
||||
this.ProcessCaptureFrame(model);
|
||||
case BinaryDtoType.AudioSample:
|
||||
this.HandleAudioSample(model);
|
||||
break;
|
||||
case DynamicDtoType.MachineName:
|
||||
this.ProcessMachineName(model);
|
||||
case BinaryDtoType.CaptureFrame:
|
||||
this.HandleCaptureFrame(model);
|
||||
break;
|
||||
case DynamicDtoType.ScreenData:
|
||||
this.ProcessScreenData(model);
|
||||
case BinaryDtoType.ClipboardText:
|
||||
this.HandleClipboardText(model);
|
||||
break;
|
||||
case DynamicDtoType.ScreenSize:
|
||||
this.ProcessScreenSize(model);
|
||||
case BinaryDtoType.CursorChange:
|
||||
this.HandleCursorChange(model);
|
||||
break;
|
||||
case BinaryDtoType.MachineName:
|
||||
this.HandleMachineName(model);
|
||||
break;
|
||||
case BinaryDtoType.ScreenData:
|
||||
this.HandleScreenData(model);
|
||||
break;
|
||||
case BinaryDtoType.ScreenSize:
|
||||
this.HandleScreenSize(model);
|
||||
break;
|
||||
case DynamicDtoType.ClipboardText:
|
||||
this.ProcessClipboardText(model);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ProcessClipboardText(clipboardText) {
|
||||
Remotely.ClipboardWatcher.SetClipboardText(clipboardText.ClipboardText);
|
||||
PopupMessage("Clipboard updated.");
|
||||
HandleAudioSample(audioSample) {
|
||||
Sound.Play(audioSample.Buffer);
|
||||
}
|
||||
ProcessMachineName(machineNameDto) {
|
||||
document.title = `${machineNameDto.MachineName} - Remotely Session`;
|
||||
}
|
||||
ProcessScreenData(screenDataDto) {
|
||||
UI.UpdateDisplays(screenDataDto.SelectedScreen, screenDataDto.DisplayNames);
|
||||
}
|
||||
ProcessScreenSize(screenSizeDto) {
|
||||
UI.SetScreenSize(screenSizeDto.Width, screenSizeDto.Height);
|
||||
}
|
||||
ProcessCaptureFrame(captureFrame) {
|
||||
HandleCaptureFrame(captureFrame) {
|
||||
if (UI.AutoQualityAdjustCheckBox.checked &&
|
||||
Number(UI.QualitySlider.value) != captureFrame.ImageQuality) {
|
||||
UI.QualitySlider.value = String(captureFrame.ImageQuality);
|
||||
@ -55,7 +54,7 @@ export class RtcMessageHandler {
|
||||
};
|
||||
img.src = url;
|
||||
this.PartialCaptureFrames = [];
|
||||
if (Remotely.Debug) {
|
||||
if (MainRc.Debug) {
|
||||
this.FpsStack.push(Date.now());
|
||||
while (Date.now() - this.FpsStack[0] > 1000) {
|
||||
this.FpsStack.shift();
|
||||
@ -67,5 +66,21 @@ export class RtcMessageHandler {
|
||||
this.PartialCaptureFrames.push(captureFrame.ImageBytes);
|
||||
}
|
||||
}
|
||||
HandleClipboardText(clipboardText) {
|
||||
MainRc.ClipboardWatcher.SetClipboardText(clipboardText.ClipboardText);
|
||||
PopupMessage("Clipboard updated.");
|
||||
}
|
||||
HandleCursorChange(cursorChange) {
|
||||
UI.UpdateCursor(cursorChange.CursorInfo);
|
||||
}
|
||||
HandleMachineName(machineNameDto) {
|
||||
document.title = `${machineNameDto.MachineName} - Remotely Session`;
|
||||
}
|
||||
HandleScreenData(screenDataDto) {
|
||||
UI.UpdateDisplays(screenDataDto.SelectedScreen, screenDataDto.DisplayNames);
|
||||
}
|
||||
HandleScreenSize(screenSizeDto) {
|
||||
UI.SetScreenSize(screenSizeDto.Width, screenSizeDto.Height);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=RtcMessageHandler.js.map
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"RtcMessageHandler.js","sourceRoot":"","sources":["RtcMessageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,QAAQ,EAAE,MA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from "../Enums/DynamicDtoType.js";
|
||||
import { DynamicDto } from "./DynamicDto.js";
|
||||
import { Remotely } from "./Main.js";
|
||||
import { CaptureFrameDto } from "./RtcDtos/CaptureFrameDto.js";
|
||||
import { MachineNameDto } from "./RtcDtos/MachineNameDto.js";
|
||||
import { ScreenDataDto } from "./RtcDtos/ScreenDataDto.js";
|
||||
import { ScreenSizeDto } from "./RtcDtos/ScreenSizeDto.js";
|
||||
import { ClipboardTextDto } from "./RtcDtos/ClipboardTextDto.js";
|
||||
import { BinaryDtoType } from "../Enums/BinaryDtoType.js";
|
||||
import { BinaryDto } from "./BinaryDto.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
import { PopupMessage } from "../UI.js";
|
||||
import { Sound } from "../Sound.js";
|
||||
import {
|
||||
AudioSampleDto,
|
||||
CaptureFrameDto,
|
||||
ClipboardTextDto,
|
||||
CursorChangeDto,
|
||||
MachineNameDto,
|
||||
ScreenDataDto,
|
||||
ScreenSizeDto
|
||||
} from "./RtcDtos.js";
|
||||
|
||||
|
||||
export class RtcMessageHandler {
|
||||
FpsStack: Array<number> = [];
|
||||
MessagePack: any = window['MessagePack'];
|
||||
PartialCaptureFrames: Uint8Array[] = [];
|
||||
ParseBinaryMessage(data: ArrayBuffer) {
|
||||
var model = this.MessagePack.decode(data) as DynamicDto;
|
||||
var model = this.MessagePack.decode(data) as BinaryDto;
|
||||
switch (model.DtoType) {
|
||||
case DynamicDtoType.CaptureFrame:
|
||||
this.ProcessCaptureFrame(model as unknown as CaptureFrameDto);
|
||||
case BinaryDtoType.AudioSample:
|
||||
this.HandleAudioSample(model as unknown as AudioSampleDto);
|
||||
break;
|
||||
case DynamicDtoType.MachineName:
|
||||
this.ProcessMachineName(model as unknown as MachineNameDto);
|
||||
case BinaryDtoType.CaptureFrame:
|
||||
this.HandleCaptureFrame(model as unknown as CaptureFrameDto);
|
||||
break;
|
||||
case DynamicDtoType.ScreenData:
|
||||
this.ProcessScreenData(model as unknown as ScreenDataDto);
|
||||
case BinaryDtoType.ClipboardText:
|
||||
this.HandleClipboardText(model as unknown as ClipboardTextDto);
|
||||
break;
|
||||
case DynamicDtoType.ScreenSize:
|
||||
this.ProcessScreenSize(model as unknown as ScreenSizeDto)
|
||||
case BinaryDtoType.CursorChange:
|
||||
this.HandleCursorChange(model as unknown as CursorChangeDto);
|
||||
break;
|
||||
case BinaryDtoType.MachineName:
|
||||
this.HandleMachineName(model as unknown as MachineNameDto);
|
||||
break;
|
||||
case BinaryDtoType.ScreenData:
|
||||
this.HandleScreenData(model as unknown as ScreenDataDto);
|
||||
break;
|
||||
case BinaryDtoType.ScreenSize:
|
||||
this.HandleScreenSize(model as unknown as ScreenSizeDto)
|
||||
break;
|
||||
case DynamicDtoType.ClipboardText:
|
||||
this.ProcessClipboardText(model as unknown as ClipboardTextDto);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ProcessClipboardText(clipboardText: ClipboardTextDto) {
|
||||
Remotely.ClipboardWatcher.SetClipboardText(clipboardText.ClipboardText);
|
||||
PopupMessage("Clipboard updated.");
|
||||
HandleAudioSample(audioSample: AudioSampleDto) {
|
||||
Sound.Play(audioSample.Buffer);
|
||||
}
|
||||
ProcessMachineName(machineNameDto: MachineNameDto) {
|
||||
document.title = `${machineNameDto.MachineName} - Remotely Session`;
|
||||
}
|
||||
ProcessScreenData(screenDataDto: ScreenDataDto) {
|
||||
UI.UpdateDisplays(screenDataDto.SelectedScreen, screenDataDto.DisplayNames);
|
||||
}
|
||||
|
||||
ProcessScreenSize(screenSizeDto: ScreenSizeDto) {
|
||||
UI.SetScreenSize(screenSizeDto.Width, screenSizeDto.Height);
|
||||
}
|
||||
|
||||
ProcessCaptureFrame(captureFrame: CaptureFrameDto) {
|
||||
HandleCaptureFrame(captureFrame: CaptureFrameDto) {
|
||||
if (UI.AutoQualityAdjustCheckBox.checked &&
|
||||
Number(UI.QualitySlider.value) != captureFrame.ImageQuality) {
|
||||
UI.QualitySlider.value = String(captureFrame.ImageQuality);
|
||||
@ -68,7 +70,7 @@ export class RtcMessageHandler {
|
||||
img.src = url;
|
||||
this.PartialCaptureFrames = [];
|
||||
|
||||
if (Remotely.Debug) {
|
||||
if (MainRc.Debug) {
|
||||
this.FpsStack.push(Date.now());
|
||||
while (Date.now() - this.FpsStack[0] > 1000) {
|
||||
this.FpsStack.shift();
|
||||
@ -80,4 +82,21 @@ export class RtcMessageHandler {
|
||||
this.PartialCaptureFrames.push(captureFrame.ImageBytes);
|
||||
}
|
||||
}
|
||||
HandleClipboardText(clipboardText: ClipboardTextDto) {
|
||||
MainRc.ClipboardWatcher.SetClipboardText(clipboardText.ClipboardText);
|
||||
PopupMessage("Clipboard updated.");
|
||||
}
|
||||
HandleCursorChange(cursorChange: CursorChangeDto) {
|
||||
UI.UpdateCursor(cursorChange.CursorInfo);
|
||||
}
|
||||
HandleMachineName(machineNameDto: MachineNameDto) {
|
||||
document.title = `${machineNameDto.MachineName} - Remotely Session`;
|
||||
}
|
||||
HandleScreenData(screenDataDto: ScreenDataDto) {
|
||||
UI.UpdateDisplays(screenDataDto.SelectedScreen, screenDataDto.DisplayNames);
|
||||
}
|
||||
|
||||
HandleScreenSize(screenSizeDto: ScreenSizeDto) {
|
||||
UI.SetScreenSize(screenSizeDto.Width, screenSizeDto.Height);
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,10 @@
|
||||
import * as UI from "./UI.js";
|
||||
import * as Utilities from "../Utilities.js";
|
||||
import { Remotely } from "./Main.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
export class RtcSession {
|
||||
constructor() {
|
||||
this.MessagePack = window['MessagePack'];
|
||||
}
|
||||
Init() {
|
||||
this.PeerConnection = new RTCPeerConnection({
|
||||
iceServers: [
|
||||
@ -28,7 +31,7 @@ export class RtcSession {
|
||||
};
|
||||
this.DataChannel.onmessage = async (ev) => {
|
||||
var data = ev.data;
|
||||
Remotely.RtcMessageHandler.ParseBinaryMessage(data);
|
||||
MainRc.RtcMessageHandler.ParseBinaryMessage(data);
|
||||
};
|
||||
this.DataChannel.onopen = (ev) => {
|
||||
console.log("Data channel opened.");
|
||||
@ -43,7 +46,7 @@ export class RtcSession {
|
||||
console.log("ICE connection state changed to " + this.iceConnectionState);
|
||||
};
|
||||
this.PeerConnection.onicecandidate = async (ev) => {
|
||||
await Remotely.RCBrowserSockets.SendIceCandidate(ev.candidate);
|
||||
await MainRc.RCBrowserSockets.SendIceCandidate(ev.candidate);
|
||||
};
|
||||
}
|
||||
Disconnect() {
|
||||
@ -55,7 +58,7 @@ export class RtcSession {
|
||||
return this.PeerConnection.remoteDescription.sdp.length > 0;
|
||||
}).then(async () => {
|
||||
await this.PeerConnection.setLocalDescription(await this.PeerConnection.createAnswer());
|
||||
await Remotely.RCBrowserSockets.SendRtcAnswer(this.PeerConnection.localDescription);
|
||||
await MainRc.RCBrowserSockets.SendRtcAnswer(this.PeerConnection.localDescription);
|
||||
});
|
||||
}
|
||||
async ReceiveCandidate(candidate) {
|
||||
@ -66,5 +69,8 @@ export class RtcSession {
|
||||
console.log("Set ICE candidate.");
|
||||
});
|
||||
}
|
||||
SendDto(dto) {
|
||||
this.DataChannel.send(this.MessagePack.encode(dto));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=RtcSession.js.map
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"RtcSession.js","sourceRoot":"","sources":["RtcSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,OAAO,UAAU;IAGnB,IAAI;QACA,IAAI,CAAC,cAAc,GAAG,IAAI,iBAAiB,CAAC;YACxC,UAAU,EAAE;gBACR,EAAE,IAAI,EAAE,+BAA+B,EAAE;gBACzC,EAAE,IAAI,EAAE,+BAA+B,EAAE;aAC5C;SACJ,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,CA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AAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YACrD,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACtC,CAAC,CAAC,CAAA;IACN,CAAC;IAED,OAAO,CAAC,GAAQ;QACZ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;CACJ"}
|
||||
@ -1,10 +1,11 @@
|
||||
import * as UI from "./UI.js";
|
||||
import * as Utilities from "../Utilities.js";
|
||||
import { Remotely } from "./Main.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
|
||||
export class RtcSession {
|
||||
PeerConnection: RTCPeerConnection;
|
||||
DataChannel: RTCDataChannel;
|
||||
MessagePack: any = window['MessagePack'];
|
||||
Init() {
|
||||
this.PeerConnection = new RTCPeerConnection({
|
||||
iceServers: [
|
||||
@ -32,7 +33,7 @@ export class RtcSession {
|
||||
};
|
||||
this.DataChannel.onmessage = async (ev) => {
|
||||
var data = ev.data as ArrayBuffer;
|
||||
Remotely.RtcMessageHandler.ParseBinaryMessage(data);
|
||||
MainRc.RtcMessageHandler.ParseBinaryMessage(data);
|
||||
|
||||
};
|
||||
this.DataChannel.onopen = (ev) => {
|
||||
@ -49,7 +50,7 @@ export class RtcSession {
|
||||
console.log("ICE connection state changed to " + this.iceConnectionState);
|
||||
}
|
||||
this.PeerConnection.onicecandidate = async (ev) => {
|
||||
await Remotely.RCBrowserSockets.SendIceCandidate(ev.candidate);
|
||||
await MainRc.RCBrowserSockets.SendIceCandidate(ev.candidate);
|
||||
};
|
||||
}
|
||||
|
||||
@ -63,7 +64,7 @@ export class RtcSession {
|
||||
return this.PeerConnection.remoteDescription.sdp.length > 0;
|
||||
}).then(async () => {
|
||||
await this.PeerConnection.setLocalDescription(await this.PeerConnection.createAnswer());
|
||||
await Remotely.RCBrowserSockets.SendRtcAnswer(this.PeerConnection.localDescription);
|
||||
await MainRc.RCBrowserSockets.SendRtcAnswer(this.PeerConnection.localDescription);
|
||||
})
|
||||
}
|
||||
async ReceiveCandidate(candidate: RTCIceCandidate) {
|
||||
@ -74,4 +75,8 @@ export class RtcSession {
|
||||
console.log("Set ICE candidate.");
|
||||
})
|
||||
}
|
||||
|
||||
SendDto(dto: any) {
|
||||
this.DataChannel.send(this.MessagePack.encode(dto));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Remotely } from "./Main.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
import { PopupMessage } from "../UI.js";
|
||||
import { RemoteControlMode } from "../Enums/RemoteControlMode.js";
|
||||
import { GetDistanceBetween } from "../Utilities.js";
|
||||
import { GetDistanceBetween, ConvertUInt8ArrayToBase64 } from "../Utilities.js";
|
||||
export var AudioButton = document.getElementById("audioButton");
|
||||
export var MenuButton = document.getElementById("menuButton");
|
||||
export var MenuFrame = document.getElementById("menuFrame");
|
||||
@ -73,19 +73,19 @@ export function ApplyInputHandlers(sockets) {
|
||||
PopupMessage("Clipboard sent!");
|
||||
});
|
||||
ConnectButton.addEventListener("click", (ev) => {
|
||||
Remotely.ConnectToClient();
|
||||
MainRc.ConnectToClient();
|
||||
});
|
||||
CtrlAltDelButton.addEventListener("click", (ev) => {
|
||||
if (!Remotely.ServiceID) {
|
||||
if (!MainRc.ServiceID) {
|
||||
ShowMessage("Not available for this session.");
|
||||
return;
|
||||
}
|
||||
closeAllHorizontalBars(null);
|
||||
Remotely.RCBrowserSockets.SendCtrlAltDel();
|
||||
MainRc.RCBrowserSockets.SendCtrlAltDel();
|
||||
});
|
||||
DisconnectButton.addEventListener("click", (ev) => {
|
||||
ConnectButton.removeAttribute("disabled");
|
||||
Remotely.RCBrowserSockets.Connection.stop();
|
||||
MainRc.RCBrowserSockets.Connection.stop();
|
||||
if (location.search.includes("fromApi=true")) {
|
||||
window.close();
|
||||
}
|
||||
@ -93,7 +93,7 @@ export function ApplyInputHandlers(sockets) {
|
||||
document.querySelectorAll("#sessionIDInput, #nameInput").forEach(x => {
|
||||
x.addEventListener("keypress", (ev) => {
|
||||
if (ev.key.toLowerCase() == "enter") {
|
||||
Remotely.ConnectToClient();
|
||||
MainRc.ConnectToClient();
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -118,21 +118,21 @@ export function ApplyInputHandlers(sockets) {
|
||||
var button = ev.currentTarget;
|
||||
button.classList.toggle("toggled");
|
||||
if (button.classList.contains("toggled")) {
|
||||
Remotely.RCBrowserSockets.SendToggleBlockInput(true);
|
||||
MainRc.RCBrowserSockets.SendToggleBlockInput(true);
|
||||
}
|
||||
else {
|
||||
Remotely.RCBrowserSockets.SendToggleBlockInput(false);
|
||||
MainRc.RCBrowserSockets.SendToggleBlockInput(false);
|
||||
}
|
||||
});
|
||||
InviteButton.addEventListener("click", (ev) => {
|
||||
var url = "";
|
||||
if (Remotely.Mode == RemoteControlMode.Normal) {
|
||||
url = `${location.origin}${location.pathname}?sessionID=${Remotely.ClientID}`;
|
||||
if (MainRc.Mode == RemoteControlMode.Normal) {
|
||||
url = `${location.origin}${location.pathname}?sessionID=${MainRc.ClientID}`;
|
||||
}
|
||||
else {
|
||||
url = `${location.origin}${location.pathname}?clientID=${Remotely.ClientID}&serviceID=${Remotely.ServiceID}`;
|
||||
url = `${location.origin}${location.pathname}?clientID=${MainRc.ClientID}&serviceID=${MainRc.ServiceID}`;
|
||||
}
|
||||
Remotely.ClipboardWatcher.SetClipboardText(url);
|
||||
MainRc.ClipboardWatcher.SetClipboardText(url);
|
||||
PopupMessage("Link copied to clipboard.");
|
||||
});
|
||||
KeyboardButton.addEventListener("click", (ev) => {
|
||||
@ -419,6 +419,18 @@ export function ShowMessage(message) {
|
||||
messageDiv.remove();
|
||||
}, 5000);
|
||||
}
|
||||
export function UpdateCursor(cursor) {
|
||||
if (cursor.CssOverride) {
|
||||
ScreenViewer.style.cursor = cursor.CssOverride;
|
||||
}
|
||||
else if (cursor.ImageBytes.byteLength == 0) {
|
||||
ScreenViewer.style.cursor = "default";
|
||||
}
|
||||
else {
|
||||
var base64 = ConvertUInt8ArrayToBase64(cursor.ImageBytes);
|
||||
ScreenViewer.style.cursor = `url('data:image/png;base64,${base64}') ${cursor.HotSpot.X} ${cursor.HotSpot.Y}, default`;
|
||||
}
|
||||
}
|
||||
export function UpdateDisplays(selectedDisplay, displayNames) {
|
||||
ScreenSelectBar.innerHTML = "";
|
||||
for (let i = 0; i < displayNames.length; i++) {
|
||||
@ -453,7 +465,7 @@ function uploadFiles(fileList) {
|
||||
FileTransferProgress.parentElement.setAttribute("hidden", "hidden");
|
||||
if (xhr.status === 200) {
|
||||
ShowMessage("File upload completed.");
|
||||
Remotely.RCBrowserSockets.SendSharedFileIDs(xhr.responseText);
|
||||
MainRc.RCBrowserSockets.SendSharedFileIDs(xhr.responseText);
|
||||
}
|
||||
else {
|
||||
ShowMessage("File upload failed.");
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,9 +1,10 @@
|
||||
import { RCBrowserSockets } from "./RCBrowserSockets.js";
|
||||
import { Remotely } from "./Main.js";
|
||||
import { MainRc } from "./Main.js";
|
||||
import { PopupMessage } from "../UI.js";
|
||||
import { RemoteControlMode } from "../Enums/RemoteControlMode.js";
|
||||
import { Point } from "../Models/Point.js";
|
||||
import { GetDistanceBetween } from "../Utilities.js";
|
||||
import { GetDistanceBetween, ConvertUInt8ArrayToBase64 } from "../Utilities.js";
|
||||
import { CursorInfo } from "../Models/CursorInfo.js";
|
||||
|
||||
export var AudioButton = document.getElementById("audioButton") as HTMLButtonElement;
|
||||
export var MenuButton = document.getElementById("menuButton") as HTMLButtonElement;
|
||||
@ -78,19 +79,19 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
PopupMessage("Clipboard sent!");
|
||||
});
|
||||
ConnectButton.addEventListener("click", (ev) => {
|
||||
Remotely.ConnectToClient();
|
||||
MainRc.ConnectToClient();
|
||||
});
|
||||
CtrlAltDelButton.addEventListener("click", (ev) => {
|
||||
if (!Remotely.ServiceID) {
|
||||
if (!MainRc.ServiceID) {
|
||||
ShowMessage("Not available for this session.");
|
||||
return;
|
||||
}
|
||||
closeAllHorizontalBars(null);
|
||||
Remotely.RCBrowserSockets.SendCtrlAltDel();
|
||||
MainRc.RCBrowserSockets.SendCtrlAltDel();
|
||||
});
|
||||
DisconnectButton.addEventListener("click", (ev) => {
|
||||
ConnectButton.removeAttribute("disabled");
|
||||
Remotely.RCBrowserSockets.Connection.stop();
|
||||
MainRc.RCBrowserSockets.Connection.stop();
|
||||
if (location.search.includes("fromApi=true")) {
|
||||
window.close();
|
||||
}
|
||||
@ -98,7 +99,7 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
document.querySelectorAll("#sessionIDInput, #nameInput").forEach(x => {
|
||||
x.addEventListener("keypress", (ev: KeyboardEvent) => {
|
||||
if (ev.key.toLowerCase() == "enter") {
|
||||
Remotely.ConnectToClient();
|
||||
MainRc.ConnectToClient();
|
||||
}
|
||||
})
|
||||
});
|
||||
@ -123,21 +124,21 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
var button = ev.currentTarget as HTMLButtonElement;
|
||||
button.classList.toggle("toggled");
|
||||
if (button.classList.contains("toggled")) {
|
||||
Remotely.RCBrowserSockets.SendToggleBlockInput(true);
|
||||
MainRc.RCBrowserSockets.SendToggleBlockInput(true);
|
||||
}
|
||||
else {
|
||||
Remotely.RCBrowserSockets.SendToggleBlockInput(false);
|
||||
MainRc.RCBrowserSockets.SendToggleBlockInput(false);
|
||||
}
|
||||
});
|
||||
InviteButton.addEventListener("click", (ev) => {
|
||||
var url = "";
|
||||
if (Remotely.Mode == RemoteControlMode.Normal) {
|
||||
url = `${location.origin}${location.pathname}?sessionID=${Remotely.ClientID}`;
|
||||
if (MainRc.Mode == RemoteControlMode.Normal) {
|
||||
url = `${location.origin}${location.pathname}?sessionID=${MainRc.ClientID}`;
|
||||
}
|
||||
else {
|
||||
url = `${location.origin}${location.pathname}?clientID=${Remotely.ClientID}&serviceID=${Remotely.ServiceID}`;
|
||||
url = `${location.origin}${location.pathname}?clientID=${MainRc.ClientID}&serviceID=${MainRc.ServiceID}`;
|
||||
}
|
||||
Remotely.ClipboardWatcher.SetClipboardText(url);
|
||||
MainRc.ClipboardWatcher.SetClipboardText(url);
|
||||
PopupMessage("Link copied to clipboard.");
|
||||
});
|
||||
KeyboardButton.addEventListener("click", (ev) => {
|
||||
@ -464,6 +465,19 @@ export function ShowMessage(message: string) {
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
export function UpdateCursor(cursor: CursorInfo) {
|
||||
if (cursor.CssOverride) {
|
||||
ScreenViewer.style.cursor = cursor.CssOverride;
|
||||
}
|
||||
else if (cursor.ImageBytes.byteLength == 0) {
|
||||
ScreenViewer.style.cursor = "default";
|
||||
}
|
||||
else {
|
||||
var base64 = ConvertUInt8ArrayToBase64(cursor.ImageBytes);
|
||||
ScreenViewer.style.cursor = `url('data:image/png;base64,${base64}') ${cursor.HotSpot.X} ${cursor.HotSpot.Y}, default`;
|
||||
}
|
||||
}
|
||||
|
||||
export function UpdateDisplays(selectedDisplay: string, displayNames: string[]) {
|
||||
ScreenSelectBar.innerHTML = "";
|
||||
for (let i = 0; i < displayNames.length; i++) {
|
||||
@ -500,7 +514,7 @@ function uploadFiles(fileList: FileList) {
|
||||
FileTransferProgress.parentElement.setAttribute("hidden", "hidden");
|
||||
if (xhr.status === 200) {
|
||||
ShowMessage("File upload completed.");
|
||||
Remotely.RCBrowserSockets.SendSharedFileIDs(xhr.responseText);
|
||||
MainRc.RCBrowserSockets.SendSharedFileIDs(xhr.responseText);
|
||||
}
|
||||
else {
|
||||
ShowMessage("File upload failed.");
|
||||
|
||||
53
Shared/Enums/BinaryDtoType.cs
Normal file
53
Shared/Enums/BinaryDtoType.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Remotely.Shared.Enums
|
||||
{
|
||||
[DataContract]
|
||||
public enum BinaryDtoType
|
||||
{
|
||||
[EnumMember(Value = "CaptureFrame")]
|
||||
CaptureFrame = 0,
|
||||
[EnumMember(Value = "ScreenData")]
|
||||
ScreenData = 1,
|
||||
[EnumMember(Value = "ScreenSize")]
|
||||
ScreenSize = 2,
|
||||
[EnumMember(Value = "MachineName")]
|
||||
MachineName = 3,
|
||||
[EnumMember(Value = "ClipboardText")]
|
||||
ClipboardText = 4,
|
||||
[EnumMember(Value = "AudioSample")]
|
||||
AudioSample = 5,
|
||||
[EnumMember(Value = "CursorChange")]
|
||||
CursorChange = 6,
|
||||
[EnumMember(Value = "SelectScreen")]
|
||||
SelectScreen = 7,
|
||||
[EnumMember(Value = "MouseMove")]
|
||||
MouseMove = 8,
|
||||
[EnumMember(Value = "MouseDown")]
|
||||
MouseDown = 9,
|
||||
[EnumMember(Value = "MouseUp")]
|
||||
MouseUp = 10,
|
||||
[EnumMember(Value = "Tap")]
|
||||
Tap = 11,
|
||||
[EnumMember(Value = "MouseWheel")]
|
||||
MouseWheel = 12,
|
||||
[EnumMember(Value = "KeyDown")]
|
||||
KeyDown = 13,
|
||||
[EnumMember(Value = "KeyUp")]
|
||||
KeyUp = 14,
|
||||
[EnumMember(Value = "CtrlAltDel")]
|
||||
CtrlAltDel = 15,
|
||||
[EnumMember(Value = "AutoQualityAdjust")]
|
||||
AutoQualityAdjust = 16,
|
||||
[EnumMember(Value = "ToggleAudio")]
|
||||
ToggleAudio = 17,
|
||||
[EnumMember(Value = "ToggleBlockInput")]
|
||||
ToggleBlockInput = 18,
|
||||
[EnumMember(Value = "ClipboardTransfer")]
|
||||
ClipboardTransfer = 19,
|
||||
[EnumMember(Value = "KeyPress")]
|
||||
KeyPress = 20,
|
||||
[EnumMember(Value = "QualityChange")]
|
||||
QualityChange = 21
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Remotely.Shared.Enums
|
||||
{
|
||||
[DataContract]
|
||||
public enum DynamicDtoType
|
||||
{
|
||||
[EnumMember(Value = "CaptureFrame")]
|
||||
CaptureFrame = 0,
|
||||
[EnumMember(Value = "ScreenData")]
|
||||
ScreenData = 1,
|
||||
[EnumMember(Value = "ScreenSize")]
|
||||
ScreenSize = 2,
|
||||
[EnumMember(Value = "MachineName")]
|
||||
MachineName = 3,
|
||||
[EnumMember(Value = "ClipboardText")]
|
||||
ClipboardText = 4
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Remotely.Shared.Models
|
||||
{
|
||||
interface IDynamicDto
|
||||
public interface IBinaryDto
|
||||
{
|
||||
DynamicDtoType DtoType { get; }
|
||||
BinaryDtoType DtoType { get; }
|
||||
}
|
||||
}
|
||||
@ -4,10 +4,10 @@ using System.Runtime.Serialization;
|
||||
namespace Remotely.Shared.Models.RtcDtos
|
||||
{
|
||||
[DataContract]
|
||||
public class CaptureFrameDto : IDynamicDto
|
||||
public class CaptureFrameDto : IBinaryDto
|
||||
{
|
||||
[DataMember(Name = "DtoType")]
|
||||
public DynamicDtoType DtoType { get; } = DynamicDtoType.CaptureFrame;
|
||||
public BinaryDtoType DtoType { get; } = BinaryDtoType.CaptureFrame;
|
||||
|
||||
[DataMember(Name = "EndOfFrame")]
|
||||
public bool EndOfFrame { get; set; }
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Text;
|
||||
namespace Remotely.Shared.Models.RtcDtos
|
||||
{
|
||||
[DataContract]
|
||||
public class ClipboardTextDto : IDynamicDto
|
||||
public class ClipboardTextDto : IBinaryDto
|
||||
{
|
||||
public ClipboardTextDto(string clipboardText)
|
||||
{
|
||||
@ -19,6 +19,6 @@ namespace Remotely.Shared.Models.RtcDtos
|
||||
|
||||
|
||||
[DataMember(Name = "DtoType")]
|
||||
public DynamicDtoType DtoType { get; } = DynamicDtoType.ClipboardText;
|
||||
public BinaryDtoType DtoType { get; } = BinaryDtoType.ClipboardText;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Text;
|
||||
namespace Remotely.Shared.Models.RtcDtos
|
||||
{
|
||||
[DataContract]
|
||||
public class MachineNameDto : IDynamicDto
|
||||
public class MachineNameDto : IBinaryDto
|
||||
{
|
||||
public MachineNameDto(string machineName)
|
||||
{
|
||||
@ -15,7 +15,7 @@ namespace Remotely.Shared.Models.RtcDtos
|
||||
}
|
||||
|
||||
[DataMember(Name = "DtoType")]
|
||||
public DynamicDtoType DtoType { get; } = DynamicDtoType.MachineName;
|
||||
public BinaryDtoType DtoType { get; } = BinaryDtoType.MachineName;
|
||||
|
||||
[DataMember(Name = "MachineName")]
|
||||
public string MachineName { get; }
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Text;
|
||||
namespace Remotely.Shared.Models.RtcDtos
|
||||
{
|
||||
[DataContract]
|
||||
public class ScreenDataDto : IDynamicDto
|
||||
public class ScreenDataDto : IBinaryDto
|
||||
{
|
||||
public ScreenDataDto(string selectedScreen, string[] displayNames)
|
||||
{
|
||||
@ -20,7 +20,7 @@ namespace Remotely.Shared.Models.RtcDtos
|
||||
|
||||
|
||||
[DataMember(Name = "DtoType")]
|
||||
public DynamicDtoType DtoType { get; } = DynamicDtoType.ScreenData;
|
||||
public BinaryDtoType DtoType { get; } = BinaryDtoType.ScreenData;
|
||||
|
||||
[DataMember(Name = "SelectedScreen")]
|
||||
public string SelectedScreen { get; }
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Text;
|
||||
namespace Remotely.Shared.Models.RtcDtos
|
||||
{
|
||||
[DataContract]
|
||||
public class ScreenSizeDto : IDynamicDto
|
||||
public class ScreenSizeDto : IBinaryDto
|
||||
{
|
||||
public ScreenSizeDto(int width, int height)
|
||||
{
|
||||
@ -22,6 +22,6 @@ namespace Remotely.Shared.Models.RtcDtos
|
||||
public int Height { get; }
|
||||
|
||||
[DataMember(Name = "DtoType")]
|
||||
public DynamicDtoType DtoType { get; } = DynamicDtoType.ScreenSize;
|
||||
public BinaryDtoType DtoType { get; } = BinaryDtoType.ScreenSize;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user