mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Bug fixes to touch events on remote control, cursor map, console results, and auto updating.
This commit is contained in:
parent
92739d218f
commit
b8c70903da
@ -131,7 +131,7 @@ namespace Remotely_Agent.Services
|
||||
CommandType = "Bash",
|
||||
StandardOutput = StandardOut,
|
||||
ErrorOutput = "WARNING: The command execution froze and was forced to return before finishing. " +
|
||||
"The results may be partial, and the console process has been reset." +
|
||||
"The results may be partial, and the console process has been reset. " +
|
||||
"Please note that interactive commands aren't supported." + Environment.NewLine + ErrorOut
|
||||
};
|
||||
ProcessIdleTimeout_Elapsed(this, null);
|
||||
|
||||
@ -132,7 +132,7 @@ namespace Remotely_Agent.Services
|
||||
CommandType = "CMD",
|
||||
StandardOutput = StandardOut,
|
||||
ErrorOutput = "WARNING: The command execution froze and was forced to return before finishing. " +
|
||||
"The results may be partial, and the console process has been reset." +
|
||||
"The results may be partial, and the console process has been reset. " +
|
||||
"Please note that interactive commands aren't supported." + Environment.NewLine + ErrorOut
|
||||
};
|
||||
ProcessIdleTimeout_Elapsed(this, null);
|
||||
|
||||
@ -32,11 +32,28 @@ namespace Remotely_Agent.Services
|
||||
HubConnection = new HubConnectionBuilder()
|
||||
.WithUrl(ConnectionInfo.Host + "/DeviceHub")
|
||||
.Build();
|
||||
|
||||
HubConnection.Closed += HubConn_Closed;
|
||||
|
||||
RegisterMessageHandlers(HubConnection);
|
||||
|
||||
await HubConnection.StartAsync();
|
||||
try
|
||||
{
|
||||
await HubConnection.StartAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Write(ex);
|
||||
if (!ConnectionInfo.Host.StartsWith("https"))
|
||||
{
|
||||
Logger.Write($"Failed to connect to {ConnectionInfo.Host}. Trying with HTTPS.");
|
||||
ConnectionInfo.Host = ConnectionInfo.Host.ToLower().Replace("http:", "https:");
|
||||
Utilities.SaveConnectionInfo(ConnectionInfo);
|
||||
Connect();
|
||||
return;
|
||||
}
|
||||
throw;
|
||||
}
|
||||
|
||||
var device = Device.Create(ConnectionInfo);
|
||||
|
||||
@ -45,7 +62,7 @@ namespace Remotely_Agent.Services
|
||||
if (string.IsNullOrWhiteSpace(ConnectionInfo.ServerVerificationToken))
|
||||
{
|
||||
IsServerVerified = true;
|
||||
ConnectionInfo.ServerVerificationToken = Guid.NewGuid().ToString().Replace("-","");
|
||||
ConnectionInfo.ServerVerificationToken = Guid.NewGuid().ToString();
|
||||
await HubConnection.InvokeAsync("SetServerVerificationToken", ConnectionInfo.ServerVerificationToken);
|
||||
Utilities.SaveConnectionInfo(ConnectionInfo);
|
||||
}
|
||||
@ -61,8 +78,6 @@ namespace Remotely_Agent.Services
|
||||
HeartbeatTimer = new Timer(300000);
|
||||
HeartbeatTimer.Elapsed += HeartbeatTimer_Elapsed;
|
||||
HeartbeatTimer.Start();
|
||||
|
||||
Updater.CheckForCoreUpdates();
|
||||
}
|
||||
|
||||
public static void SendHeartbeat()
|
||||
|
||||
@ -129,7 +129,7 @@ namespace Remotely_Agent.Services
|
||||
CommandType = "WinPS",
|
||||
StandardOutput = StandardOut,
|
||||
ErrorOutput = "WARNING: The command execution froze and was forced to return before finishing. " +
|
||||
"The results may be partial, and the console process has been reset." +
|
||||
"The results may be partial, and the console process has been reset. " +
|
||||
"Please note that interactive commands aren't supported." + Environment.NewLine + ErrorOut
|
||||
};
|
||||
ProcessIdleTimeout_Elapsed(this, null);
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
Remove this element if your application requires this virtualization for backwards
|
||||
compatibility.
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
@ -9,7 +9,7 @@ namespace Remotely_Library.Models
|
||||
public class CommandContext
|
||||
{
|
||||
[Key]
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString().Replace("-", "");
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString();
|
||||
public string CommandMode { get; set; }
|
||||
public string CommandText { get; set; }
|
||||
public string SenderUserID { get; set; }
|
||||
|
||||
@ -6,7 +6,7 @@ namespace Remotely_Library.Models
|
||||
{
|
||||
public class ConnectionInfo
|
||||
{
|
||||
public string DeviceID { get; set; } = Guid.NewGuid().ToString().Replace("-", "");
|
||||
public string DeviceID { get; set; } = Guid.NewGuid().ToString();
|
||||
private string host;
|
||||
public string Host
|
||||
{
|
||||
|
||||
@ -9,7 +9,7 @@ namespace Remotely_Library.Models
|
||||
public class Drive
|
||||
{
|
||||
[Key]
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString().Replace("-", "");
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString();
|
||||
public DriveType DriveType { get; set; }
|
||||
public string RootDirectory { get; internal set; }
|
||||
public string Name { get; internal set; }
|
||||
|
||||
@ -9,7 +9,7 @@ namespace Remotely_Library.Models
|
||||
public class EventLog
|
||||
{
|
||||
[Key]
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString().Replace("-", "");
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString();
|
||||
public EventTypes EventType { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string Source { get; set; }
|
||||
|
||||
@ -8,7 +8,7 @@ namespace Remotely_Library.Models
|
||||
public class InviteLink
|
||||
{
|
||||
[Key]
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString().Replace("-", "");
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString();
|
||||
public string InvitedUser { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
public DateTime DateSent { get; set; }
|
||||
|
||||
@ -8,7 +8,7 @@ namespace Remotely_Library.Models
|
||||
public class Organization
|
||||
{
|
||||
[Key]
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString().Replace("-", "");
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString();
|
||||
|
||||
[StringLength(25)]
|
||||
public string OrganizationName { get; set; }
|
||||
|
||||
@ -9,7 +9,7 @@ namespace Remotely_Library.Models
|
||||
public class PermissionGroup
|
||||
{
|
||||
[Key]
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString().Replace("-", "");
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString();
|
||||
[StringLength(100)]
|
||||
public string Name { get; set; }
|
||||
public virtual Organization Organization { get; set; }
|
||||
|
||||
@ -7,7 +7,7 @@ namespace Remotely_Library.Models
|
||||
public class RemotelyUserOptions
|
||||
{
|
||||
[Key]
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString().Replace("-", "");
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString();
|
||||
[Display(Name ="Console Prompt")]
|
||||
[StringLength(5)]
|
||||
public string ConsolePrompt { get; set; } = "~>";
|
||||
|
||||
@ -8,7 +8,7 @@ namespace Remotely_Library.Models
|
||||
public class SharedFile
|
||||
{
|
||||
[Key]
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString().Replace("-", "");
|
||||
public string ID { get; set; } = Guid.NewGuid().ToString();
|
||||
public string FileName { get; set; }
|
||||
public string ContentType { get; set; }
|
||||
public byte[] FileContents { get; set; }
|
||||
|
||||
@ -21,7 +21,7 @@ namespace Remotely_Server.API
|
||||
[HttpGet()]
|
||||
public string Get()
|
||||
{
|
||||
var filePath = Path.Combine(HostingEnv.ContentRootPath, "CurrentAgentVersion.txt");
|
||||
var filePath = Path.Combine(HostingEnv.ContentRootPath, "CurrentVersion.txt");
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
{
|
||||
return "0.0.0.0";
|
||||
|
||||
@ -1 +0,0 @@
|
||||
2019.03.20.0708
|
||||
1
Remotely_Server/CurrentVersion.txt
Normal file
1
Remotely_Server/CurrentVersion.txt
Normal file
@ -0,0 +1 @@
|
||||
2019.03.20.1209
|
||||
@ -1709,7 +1709,7 @@
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="CurrentAgentVersion.txt">
|
||||
<None Update="CurrentVersion.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="ffmpeg.exe">
|
||||
|
||||
@ -165,6 +165,7 @@ namespace Remotely_Server.Services
|
||||
$"Login ID (if logged in): {Context?.User?.Identity?.Name}. " +
|
||||
$"Requester IP Address: " + Context?.GetHttpContext()?.Connection?.RemoteIpAddress?.ToString()
|
||||
});
|
||||
|
||||
ScreenCasterID = screenCasterID;
|
||||
Mode = (RemoteControlMode)remoteControlMode;
|
||||
RequesterName = requesterName;
|
||||
|
||||
@ -14,7 +14,7 @@ namespace Remotely_Server.Services
|
||||
public class RCDeviceSocketHub : Hub
|
||||
{
|
||||
public static ConcurrentDictionary<string, string> AttendedSessionList { get; set; } = new ConcurrentDictionary<string, string>();
|
||||
public static object SaveLock { get; } = new object();
|
||||
|
||||
public RCDeviceSocketHub(DataService dataService,
|
||||
IHubContext<BrowserSocketHub> browserHub,
|
||||
IHubContext<RCBrowserSocketHub> rcBrowserHub,
|
||||
|
||||
@ -117,6 +117,7 @@ button[disabled] {
|
||||
max-width: 99vw;
|
||||
max-height: 99vh;
|
||||
z-index: 1;
|
||||
touch-action: double-tap-zoom;
|
||||
}
|
||||
|
||||
#connectBox {
|
||||
|
||||
@ -62,6 +62,11 @@ a.navbar-brand {
|
||||
.record-row {
|
||||
cursor: pointer;
|
||||
}
|
||||
.table tbody tr td {
|
||||
padding: .5rem;
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
|
||||
#tabContentWrapper {
|
||||
overflow: auto;
|
||||
|
||||
@ -42,6 +42,8 @@ var cursorMap = {
|
||||
"567017879": "col-resize",
|
||||
"925305447": "row-resize",
|
||||
"-1670772177": "col-resize",
|
||||
"6883365": "copy"
|
||||
"6883365": "copy",
|
||||
"852495": "col-resize",
|
||||
"395343": "col-resize"
|
||||
};
|
||||
//# sourceMappingURL=CursorMap.js.map
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"CursorMap.js","sourceRoot":"","sources":["CursorMap.ts"],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,YAAY;CACzB,CAAA"}
|
||||
@ -43,5 +43,7 @@ var cursorMap = {
|
||||
"567017879": "col-resize",
|
||||
"925305447": "row-resize",
|
||||
"-1670772177": "col-resize",
|
||||
"6883365": "copy"
|
||||
"6883365": "copy",
|
||||
"852495": "col-resize",
|
||||
"395343": "col-resize"
|
||||
}
|
||||
|
||||
@ -17,14 +17,10 @@ export var FileTransferInput = document.getElementById("fileTransferInput");
|
||||
export var FileTransferProgress = document.getElementById("fileTransferProgress");
|
||||
export var KeyboardButton = document.getElementById("keyboardButton");
|
||||
var lastPointerMove = Date.now();
|
||||
var lastTouchPointX;
|
||||
var lastTouchPointY;
|
||||
var lastTouchStart = Date.now();
|
||||
var touchList = new Array();
|
||||
var longPressTimeout;
|
||||
var isDragging;
|
||||
var lastTouchDistanceMoved = 0;
|
||||
var currentPointerDevice;
|
||||
var currentTouchCount;
|
||||
var rightClickOpen;
|
||||
export function ApplyInputHandlers(sockets) {
|
||||
document.querySelector("#menuButton").addEventListener("click", (ev) => {
|
||||
HorizontalBars.forEach(x => {
|
||||
@ -116,7 +112,7 @@ export function ApplyInputHandlers(sockets) {
|
||||
ConnectToClient();
|
||||
});
|
||||
ScreenViewer.addEventListener("mousemove", function (e) {
|
||||
currentPointerDevice = "Touch";
|
||||
currentPointerDevice = "Mouse";
|
||||
e.preventDefault();
|
||||
if (Date.now() - lastPointerMove < 25) {
|
||||
return;
|
||||
@ -151,99 +147,72 @@ export function ApplyInputHandlers(sockets) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
else if (currentPointerDevice == "Touch") {
|
||||
else if (currentPointerDevice == "Touch" && currentTouchCount == 0) {
|
||||
var percentX = e.offsetX / ScreenViewer.clientWidth;
|
||||
var percentY = e.offsetY / ScreenViewer.clientHeight;
|
||||
sockets.SendTap(percentX, percentY);
|
||||
}
|
||||
});
|
||||
//ScreenViewer.addEventListener("dblclick", function (e) {
|
||||
// if (currentPointerDevice == "Mouse") {
|
||||
// e.preventDefault();
|
||||
// e.stopPropagation();
|
||||
// }
|
||||
// else if (currentPointerDevice == "Touch") {
|
||||
// }
|
||||
//});
|
||||
ScreenViewer.addEventListener("contextmenu", (ev) => {
|
||||
ev.preventDefault();
|
||||
});
|
||||
ScreenViewer.addEventListener("touchstart", function (e) {
|
||||
if (rightClickOpen) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
isDragging = false;
|
||||
currentPointerDevice = "Touch";
|
||||
currentTouchCount = e.touches.length;
|
||||
KeyboardButton.removeAttribute("hidden");
|
||||
var focusedInput = document.querySelector("input:focus");
|
||||
if (focusedInput) {
|
||||
focusedInput.blur();
|
||||
}
|
||||
//touchList.push(e.changedTouches[0].identifier);
|
||||
//if (e.touches.length > 1) {
|
||||
// window.clearTimeout(longPressTimeout);
|
||||
// return;
|
||||
//}
|
||||
//e.preventDefault();
|
||||
//e.stopPropagation();
|
||||
//if (Date.now() - lastTouchStart < 500) {
|
||||
// sockets.SendTouchDown();
|
||||
// return;
|
||||
//}
|
||||
//lastTouchStart = Date.now();
|
||||
//lastTouchPointX = e.touches[0].clientX;
|
||||
//lastTouchPointY = e.touches[0].clientY;
|
||||
//lastTouchDistanceMoved = 0;
|
||||
//longPressTimeout = window.setTimeout(() => {
|
||||
// if (lastTouchStart > lastPointerMove && touchList.some(x => x == e.changedTouches[0].identifier)) {
|
||||
// sockets.SendLongPress();
|
||||
// }
|
||||
//}, 1500);
|
||||
if (e.touches.length > 2) {
|
||||
var percentX = (e.touches[0].pageX - ScreenViewer.getBoundingClientRect().left) / ScreenViewer.clientWidth;
|
||||
var percentY = (e.touches[0].pageY - ScreenViewer.getBoundingClientRect().top) / ScreenViewer.clientHeight;
|
||||
sockets.SendMouseDown(2, percentX, percentY);
|
||||
sockets.SendMouseUp(2, percentX, percentY);
|
||||
}
|
||||
});
|
||||
ScreenViewer.addEventListener("touchmove", function (e) {
|
||||
if (rightClickOpen) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
currentPointerDevice = "Touch";
|
||||
currentTouchCount = e.touches.length;
|
||||
var percentX = (e.touches[0].pageX - ScreenViewer.getBoundingClientRect().left) / ScreenViewer.clientWidth;
|
||||
var percentY = (e.touches[0].pageY - ScreenViewer.getBoundingClientRect().top) / ScreenViewer.clientHeight;
|
||||
if (e.touches.length == 2) {
|
||||
return;
|
||||
}
|
||||
else if (e.touches.length > 2) {
|
||||
sockets.SendMouseDown(2, percentX, percentY);
|
||||
}
|
||||
else if (isDragging) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
sockets.SendMouseDown(0, percentX, percentY);
|
||||
sockets.SendMouseMove(percentX, percentY);
|
||||
}
|
||||
//lastTouchDistanceMoved = GetDistanceBetween(lastTouchPointX, lastTouchPointY, e.touches[0].clientX, e.touches[0].clientY);
|
||||
//var moveX = (e.touches[0].clientX - lastTouchPointX) * 2;
|
||||
//var moveY = (e.touches[0].clientY - lastTouchPointY) * 2;
|
||||
//sockets.SendTouchMove(moveX, moveY);
|
||||
//lastTouchPointX = e.touches[0].clientX;
|
||||
//lastTouchPointY = e.touches[0].clientY;
|
||||
//lastPointerMove = Date.now();
|
||||
});
|
||||
ScreenViewer.addEventListener("touchend", function (e) {
|
||||
currentPointerDevice = "Touch";
|
||||
currentTouchCount = e.touches.length;
|
||||
if (e.touches.length == 1) {
|
||||
isDragging = true;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (isDragging) {
|
||||
var percentX = (e.changedTouches[0].pageX - ScreenViewer.getBoundingClientRect().left) / ScreenViewer.clientWidth;
|
||||
var percentY = (e.changedTouches[0].pageY - ScreenViewer.getBoundingClientRect().top) / ScreenViewer.clientHeight;
|
||||
sockets.SendMouseUp(0, percentX, percentY);
|
||||
}
|
||||
isDragging = false;
|
||||
if (currentTouchCount == 0 && rightClickOpen) {
|
||||
rightClickOpen = false;
|
||||
}
|
||||
//var index = touchList.findIndex(x => x == e.changedTouches[0].identifier);
|
||||
//touchList.splice(index, 1);
|
||||
//e.preventDefault();
|
||||
//e.stopPropagation();
|
||||
//if (e.touches.length > 0) {
|
||||
// return;
|
||||
//}
|
||||
//if (Date.now() - lastTouchStart < 500 && lastTouchDistanceMoved < 5) {
|
||||
// sockets.SendTap();
|
||||
//}
|
||||
//else {
|
||||
// sockets.SendTouchUp();
|
||||
//}
|
||||
if (isDragging) {
|
||||
var percentX = (e.changedTouches[0].pageX - ScreenViewer.getBoundingClientRect().left) / ScreenViewer.clientWidth;
|
||||
var percentY = (e.changedTouches[0].pageY - ScreenViewer.getBoundingClientRect().top) / ScreenViewer.clientHeight;
|
||||
sockets.SendMouseUp(0, percentX, percentY);
|
||||
}
|
||||
isDragging = false;
|
||||
});
|
||||
ScreenViewer.addEventListener("wheel", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -21,14 +21,10 @@ export var FileTransferProgress = document.getElementById("fileTransferProgress"
|
||||
export var KeyboardButton = document.getElementById("keyboardButton") as HTMLButtonElement;
|
||||
|
||||
var lastPointerMove = Date.now();
|
||||
var lastTouchPointX: number;
|
||||
var lastTouchPointY: number;
|
||||
var lastTouchStart = Date.now();
|
||||
var touchList = new Array<number>();
|
||||
var longPressTimeout: number;
|
||||
var isDragging: boolean;
|
||||
var lastTouchDistanceMoved = 0;
|
||||
var currentPointerDevice: "Mouse" | "Touch";
|
||||
var currentTouchCount: number;
|
||||
var rightClickOpen: boolean;
|
||||
|
||||
export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
document.querySelector("#menuButton").addEventListener("click", (ev) => {
|
||||
@ -123,7 +119,7 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
ConnectToClient();
|
||||
});
|
||||
ScreenViewer.addEventListener("mousemove", function (e) {
|
||||
currentPointerDevice = "Touch";
|
||||
currentPointerDevice = "Mouse";
|
||||
e.preventDefault();
|
||||
if (Date.now() - lastPointerMove < 25) {
|
||||
return;
|
||||
@ -159,106 +155,80 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
else if (currentPointerDevice == "Touch") {
|
||||
else if (currentPointerDevice == "Touch" && currentTouchCount == 0) {
|
||||
var percentX = e.offsetX / ScreenViewer.clientWidth;
|
||||
var percentY = e.offsetY / ScreenViewer.clientHeight;
|
||||
sockets.SendTap(percentX, percentY);
|
||||
}
|
||||
});
|
||||
//ScreenViewer.addEventListener("dblclick", function (e) {
|
||||
// if (currentPointerDevice == "Mouse") {
|
||||
// e.preventDefault();
|
||||
// e.stopPropagation();
|
||||
// }
|
||||
// else if (currentPointerDevice == "Touch") {
|
||||
|
||||
// }
|
||||
//});
|
||||
ScreenViewer.addEventListener("contextmenu", (ev) => {
|
||||
ev.preventDefault();
|
||||
});
|
||||
ScreenViewer.addEventListener("touchstart", function (e) {
|
||||
if (rightClickOpen) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
isDragging = false;
|
||||
currentPointerDevice = "Touch";
|
||||
currentTouchCount = e.touches.length;
|
||||
KeyboardButton.removeAttribute("hidden");
|
||||
var focusedInput = document.querySelector("input:focus") as HTMLInputElement;
|
||||
if (focusedInput) {
|
||||
focusedInput.blur();
|
||||
}
|
||||
//touchList.push(e.changedTouches[0].identifier);
|
||||
|
||||
//if (e.touches.length > 1) {
|
||||
// window.clearTimeout(longPressTimeout);
|
||||
// return;
|
||||
//}
|
||||
|
||||
//e.preventDefault();
|
||||
//e.stopPropagation();
|
||||
//if (Date.now() - lastTouchStart < 500) {
|
||||
// sockets.SendTouchDown();
|
||||
// return;
|
||||
//}
|
||||
//lastTouchStart = Date.now();
|
||||
//lastTouchPointX = e.touches[0].clientX;
|
||||
//lastTouchPointY = e.touches[0].clientY;
|
||||
//lastTouchDistanceMoved = 0;
|
||||
//longPressTimeout = window.setTimeout(() => {
|
||||
// if (lastTouchStart > lastPointerMove && touchList.some(x => x == e.changedTouches[0].identifier)) {
|
||||
// sockets.SendLongPress();
|
||||
// }
|
||||
//}, 1500);
|
||||
if (e.touches.length > 2) {
|
||||
var percentX = (e.touches[0].pageX - ScreenViewer.getBoundingClientRect().left) / ScreenViewer.clientWidth;
|
||||
var percentY = (e.touches[0].pageY - ScreenViewer.getBoundingClientRect().top) / ScreenViewer.clientHeight;
|
||||
sockets.SendMouseDown(2, percentX, percentY);
|
||||
sockets.SendMouseUp(2, percentX, percentY);
|
||||
}
|
||||
});
|
||||
|
||||
ScreenViewer.addEventListener("touchmove", function (e) {
|
||||
if (rightClickOpen) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
currentPointerDevice = "Touch";
|
||||
currentTouchCount = e.touches.length;
|
||||
var percentX = (e.touches[0].pageX - ScreenViewer.getBoundingClientRect().left) / ScreenViewer.clientWidth;
|
||||
var percentY = (e.touches[0].pageY - ScreenViewer.getBoundingClientRect().top) / ScreenViewer.clientHeight;
|
||||
|
||||
if (e.touches.length == 2) {
|
||||
return;
|
||||
}
|
||||
else if (e.touches.length > 2) {
|
||||
sockets.SendMouseDown(2, percentX, percentY);
|
||||
}
|
||||
else if (isDragging) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
sockets.SendMouseDown(0, percentX, percentY);
|
||||
sockets.SendMouseMove(percentX, percentY);
|
||||
}
|
||||
|
||||
//lastTouchDistanceMoved = GetDistanceBetween(lastTouchPointX, lastTouchPointY, e.touches[0].clientX, e.touches[0].clientY);
|
||||
|
||||
//var moveX = (e.touches[0].clientX - lastTouchPointX) * 2;
|
||||
//var moveY = (e.touches[0].clientY - lastTouchPointY) * 2;
|
||||
//sockets.SendTouchMove(moveX, moveY);
|
||||
//lastTouchPointX = e.touches[0].clientX;
|
||||
//lastTouchPointY = e.touches[0].clientY;
|
||||
//lastPointerMove = Date.now();
|
||||
});
|
||||
ScreenViewer.addEventListener("touchend", function (e) {
|
||||
currentPointerDevice = "Touch";
|
||||
currentTouchCount = e.touches.length;
|
||||
|
||||
if (e.touches.length == 1) {
|
||||
isDragging = true;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (isDragging) {
|
||||
var percentX = (e.changedTouches[0].pageX - ScreenViewer.getBoundingClientRect().left) / ScreenViewer.clientWidth;
|
||||
var percentY = (e.changedTouches[0].pageY - ScreenViewer.getBoundingClientRect().top) / ScreenViewer.clientHeight;
|
||||
sockets.SendMouseUp(0, percentX, percentY);
|
||||
}
|
||||
isDragging = false;
|
||||
|
||||
if (currentTouchCount == 0 && rightClickOpen) {
|
||||
rightClickOpen = false;
|
||||
}
|
||||
//var index = touchList.findIndex(x => x == e.changedTouches[0].identifier);
|
||||
//touchList.splice(index, 1);
|
||||
//e.preventDefault();
|
||||
//e.stopPropagation();
|
||||
//if (e.touches.length > 0) {
|
||||
// return;
|
||||
//}
|
||||
//if (Date.now() - lastTouchStart < 500 && lastTouchDistanceMoved < 5) {
|
||||
// sockets.SendTap();
|
||||
//}
|
||||
//else {
|
||||
// sockets.SendTouchUp();
|
||||
//}
|
||||
|
||||
if (isDragging) {
|
||||
var percentX = (e.changedTouches[0].pageX - ScreenViewer.getBoundingClientRect().left) / ScreenViewer.clientWidth;
|
||||
var percentY = (e.changedTouches[0].pageY - ScreenViewer.getBoundingClientRect().top) / ScreenViewer.clientHeight;
|
||||
sockets.SendMouseUp(0, percentX, percentY);
|
||||
}
|
||||
|
||||
isDragging = false;
|
||||
|
||||
});
|
||||
|
||||
ScreenViewer.addEventListener("wheel", function (e) {
|
||||
|
||||
@ -3,35 +3,37 @@ import { TabContentWrapper } from "./UI.js";
|
||||
export function CreateCommandHarness(context) {
|
||||
var collapseClass = context.TargetDeviceIDs.length > 1 ? "collapse" : "collapse show";
|
||||
var commandHarness = document.createElement("div");
|
||||
commandHarness.id = context.ID;
|
||||
var contextID = "c" + context.ID;
|
||||
commandHarness.id = contextID;
|
||||
commandHarness.classList.add("command-harness");
|
||||
commandHarness.innerHTML = `
|
||||
<div class="command-harness-title">
|
||||
Command Type: ${context.CommandMode} |
|
||||
Total Devices: <span id="${context.ID}-totaldevices">${context.TargetDeviceIDs.length}</span> |
|
||||
Completed: <span id="${context.ID}-completed">0%</span> |
|
||||
Errors: <span id="${context.ID}-errors">0</span> |
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${context.ID}-results'>View</button>
|
||||
Total Devices: <span id="${contextID}-totaldevices">${context.TargetDeviceIDs.length}</span> |
|
||||
Completed: <span id="${contextID}-completed">0%</span> |
|
||||
Errors: <span id="${contextID}-errors">0</span> |
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${contextID}-results'>View</button>
|
||||
<a class="btn btn-sm btn-secondary" target="_blank" href="${location.origin}/API/Commands/JSON/${context.ID}">JSON</a>
|
||||
<a class="btn btn-sm btn-secondary" target="_blank" href="${location.origin}/API/Commands/XML/${context.ID}">XML</a>
|
||||
</div>
|
||||
<div id="${context.ID}-results" class="${collapseClass}">
|
||||
<div id="${contextID}-results" class="${collapseClass}">
|
||||
</div>`;
|
||||
return commandHarness;
|
||||
}
|
||||
export function AddPSCoreResultsHarness(result) {
|
||||
var contextID = "c" + result.CommandContextID;
|
||||
var deviceName = DataGrid.DataSource.find(x => x.ID == result.DeviceID).DeviceName;
|
||||
var resultsWrapper = document.getElementById(result.CommandContextID + "-results");
|
||||
var totalDevices = parseInt(document.getElementById(result.CommandContextID + "-totaldevices").innerText);
|
||||
var resultsWrapper = document.getElementById(contextID + "-results");
|
||||
var totalDevices = parseInt(document.getElementById(contextID + "-totaldevices").innerText);
|
||||
var collapseClass = totalDevices > 1 ? "collapse" : "collapse show";
|
||||
var resultDiv = document.createElement("div");
|
||||
resultDiv.innerHTML = `
|
||||
<div class="result-header">
|
||||
Device: ${deviceName} |
|
||||
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes" : "No"} |
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${result.CommandContextID + result.DeviceID}-result'>View</button>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${contextID + result.DeviceID}-result'>View</button>
|
||||
</div>
|
||||
<div id='${result.CommandContextID + result.DeviceID}-result' class="command-result-output ${collapseClass}">
|
||||
<div id='${contextID + result.DeviceID}-result' class="command-result-output ${collapseClass}">
|
||||
<div>Host Output:<br>${result.HostOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
<div>Debug Output:<br>${result.DebugOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
<div>Verbose Output:<br>${result.VerboseOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
@ -39,7 +41,7 @@ export function AddPSCoreResultsHarness(result) {
|
||||
<div>Error Output:<br>${result.ErrorOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
</div>`;
|
||||
if (result.ErrorOutput.length > 0) {
|
||||
var errorSpan = document.getElementById(result.CommandContextID + "-errors");
|
||||
var errorSpan = document.getElementById(contextID + "-errors");
|
||||
var currentErrors = parseInt(errorSpan.innerText);
|
||||
currentErrors += 1;
|
||||
errorSpan.innerText = String(currentErrors);
|
||||
@ -48,23 +50,24 @@ export function AddPSCoreResultsHarness(result) {
|
||||
TabContentWrapper.scrollTop = TabContentWrapper.scrollHeight;
|
||||
}
|
||||
export function AddCommandResultsHarness(result) {
|
||||
var contextID = "c" + result.CommandContextID;
|
||||
var deviceName = DataGrid.DataSource.find(x => x.ID == result.DeviceID).DeviceName;
|
||||
var resultsWrapper = document.getElementById(result.CommandContextID + "-results");
|
||||
var totalDevices = parseInt(document.getElementById(result.CommandContextID + "-totaldevices").innerText);
|
||||
var resultsWrapper = document.getElementById(contextID + "-results");
|
||||
var totalDevices = parseInt(document.getElementById(contextID + "-totaldevices").innerText);
|
||||
var collapseClass = totalDevices > 1 ? "collapse" : "collapse show";
|
||||
var resultDiv = document.createElement("div");
|
||||
resultDiv.innerHTML = `
|
||||
<div class="result-header">
|
||||
Device: ${deviceName} |
|
||||
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes" : "No"} |
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target="#${contextID + result.DeviceID}-result">View</button>
|
||||
</div>
|
||||
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
|
||||
<div id="${contextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
|
||||
<div>Standard Output:<br>${result.StandardOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
<div>Error Output:<br>${result.ErrorOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
</div>`;
|
||||
if (result.ErrorOutput.length > 0) {
|
||||
var errorSpan = document.getElementById(result.CommandContextID + "-errors");
|
||||
var errorSpan = document.getElementById(`${contextID}-errors`);
|
||||
var currentErrors = parseInt(errorSpan.innerText);
|
||||
currentErrors += 1;
|
||||
errorSpan.innerText = String(currentErrors);
|
||||
@ -73,8 +76,9 @@ export function AddCommandResultsHarness(result) {
|
||||
TabContentWrapper.scrollTop = TabContentWrapper.scrollHeight;
|
||||
}
|
||||
export function UpdateResultsCount(commandContextID) {
|
||||
var totalDevices = parseInt(document.getElementById(commandContextID + "-totaldevices").innerText);
|
||||
var percentComplete = Math.round(document.getElementById(commandContextID + "-results").children.length / totalDevices * 100);
|
||||
document.getElementById(commandContextID + "-completed").innerText = String(percentComplete) + "%";
|
||||
var contextID = "c" + commandContextID;
|
||||
var totalDevices = parseInt(document.getElementById(`${contextID}-totaldevices`).innerText);
|
||||
var percentComplete = Math.round(document.getElementById(`${contextID}-results`).children.length / totalDevices * 100);
|
||||
document.getElementById(`${contextID}-completed`).innerText = String(percentComplete) + "%";
|
||||
}
|
||||
//# sourceMappingURL=ResultsParser.js.map
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"ResultsParser.js","sourceRoot":"","sources":["ResultsParser.ts"],"names":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AC;QACnB,SAAS,CAAC,SAAS,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;KAC/C;IACD,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACtC,iBAAiB,CAAC,SAAS,GAAG,iBAAiB,CAAC,YAAY,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,gBAAwB;IACvD,IAAI,SAAS,GAAG,GAAG,GAAG,gBAAgB,CAAC;IACvC,IAAI,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC;IAC5F,IAAI,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,SAAS,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,YAAY,GAAG,GAAG,CAAC,CAAC;IACvH,QAAQ,CAAC,cAAc,CAAC,GAAG,SAAS,YAAY,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC;AAChG,CAAC"}
|
||||
@ -7,27 +7,29 @@ import { ConsoleOutputDiv, TabContentWrapper } from "./UI.js";
|
||||
export function CreateCommandHarness(context: CommandContext): HTMLDivElement {
|
||||
var collapseClass = context.TargetDeviceIDs.length > 1 ? "collapse" : "collapse show";
|
||||
var commandHarness = document.createElement("div");
|
||||
commandHarness.id = context.ID;
|
||||
var contextID = "c" + context.ID;
|
||||
commandHarness.id = contextID;
|
||||
commandHarness.classList.add("command-harness");
|
||||
commandHarness.innerHTML = `
|
||||
<div class="command-harness-title">
|
||||
Command Type: ${context.CommandMode} |
|
||||
Total Devices: <span id="${context.ID}-totaldevices">${context.TargetDeviceIDs.length}</span> |
|
||||
Completed: <span id="${context.ID}-completed">0%</span> |
|
||||
Errors: <span id="${context.ID}-errors">0</span> |
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${context.ID}-results'>View</button>
|
||||
Total Devices: <span id="${contextID}-totaldevices">${context.TargetDeviceIDs.length}</span> |
|
||||
Completed: <span id="${contextID}-completed">0%</span> |
|
||||
Errors: <span id="${contextID}-errors">0</span> |
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${contextID}-results'>View</button>
|
||||
<a class="btn btn-sm btn-secondary" target="_blank" href="${location.origin}/API/Commands/JSON/${context.ID}">JSON</a>
|
||||
<a class="btn btn-sm btn-secondary" target="_blank" href="${location.origin}/API/Commands/XML/${context.ID}">XML</a>
|
||||
</div>
|
||||
<div id="${context.ID}-results" class="${collapseClass}">
|
||||
<div id="${contextID}-results" class="${collapseClass}">
|
||||
</div>`;
|
||||
return commandHarness;
|
||||
}
|
||||
|
||||
export function AddPSCoreResultsHarness(result: PSCoreCommandResult) {
|
||||
var contextID = "c" + result.CommandContextID;
|
||||
var deviceName = DataGrid.DataSource.find(x => x.ID == result.DeviceID).DeviceName;
|
||||
var resultsWrapper = document.getElementById(result.CommandContextID + "-results");
|
||||
var totalDevices = parseInt(document.getElementById(result.CommandContextID + "-totaldevices").innerText);
|
||||
var resultsWrapper = document.getElementById(contextID + "-results");
|
||||
var totalDevices = parseInt(document.getElementById(contextID + "-totaldevices").innerText);
|
||||
var collapseClass = totalDevices > 1 ? "collapse" : "collapse show";
|
||||
|
||||
var resultDiv = document.createElement("div");
|
||||
@ -35,9 +37,9 @@ export function AddPSCoreResultsHarness(result: PSCoreCommandResult) {
|
||||
<div class="result-header">
|
||||
Device: ${deviceName} |
|
||||
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes": "No"} |
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${result.CommandContextID + result.DeviceID}-result'>View</button>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${contextID + result.DeviceID}-result'>View</button>
|
||||
</div>
|
||||
<div id='${result.CommandContextID + result.DeviceID}-result' class="command-result-output ${collapseClass}">
|
||||
<div id='${contextID + result.DeviceID}-result' class="command-result-output ${collapseClass}">
|
||||
<div>Host Output:<br>${result.HostOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
<div>Debug Output:<br>${result.DebugOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
<div>Verbose Output:<br>${result.VerboseOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
@ -45,7 +47,7 @@ export function AddPSCoreResultsHarness(result: PSCoreCommandResult) {
|
||||
<div>Error Output:<br>${result.ErrorOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
</div>`;
|
||||
if (result.ErrorOutput.length > 0) {
|
||||
var errorSpan = document.getElementById(result.CommandContextID + "-errors");
|
||||
var errorSpan = document.getElementById(contextID + "-errors");
|
||||
var currentErrors = parseInt(errorSpan.innerText);
|
||||
currentErrors += 1;
|
||||
errorSpan.innerText = String(currentErrors);
|
||||
@ -54,9 +56,10 @@ export function AddPSCoreResultsHarness(result: PSCoreCommandResult) {
|
||||
TabContentWrapper.scrollTop = TabContentWrapper.scrollHeight;
|
||||
}
|
||||
export function AddCommandResultsHarness(result: GenericCommandResult) {
|
||||
var contextID = "c" + result.CommandContextID;
|
||||
var deviceName = DataGrid.DataSource.find(x => x.ID == result.DeviceID).DeviceName;
|
||||
var resultsWrapper = document.getElementById(result.CommandContextID + "-results");
|
||||
var totalDevices = parseInt(document.getElementById(result.CommandContextID + "-totaldevices").innerText);
|
||||
var resultsWrapper = document.getElementById(contextID + "-results");
|
||||
var totalDevices = parseInt(document.getElementById(contextID + "-totaldevices").innerText);
|
||||
var collapseClass = totalDevices > 1 ? "collapse" : "collapse show";
|
||||
|
||||
var resultDiv = document.createElement("div");
|
||||
@ -64,14 +67,14 @@ export function AddCommandResultsHarness(result: GenericCommandResult) {
|
||||
<div class="result-header">
|
||||
Device: ${deviceName} |
|
||||
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes" : "No"} |
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target="#${contextID + result.DeviceID}-result">View</button>
|
||||
</div>
|
||||
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
|
||||
<div id="${contextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
|
||||
<div>Standard Output:<br>${result.StandardOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
<div>Error Output:<br>${result.ErrorOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
</div>`;
|
||||
if (result.ErrorOutput.length > 0) {
|
||||
var errorSpan = document.getElementById(result.CommandContextID + "-errors");
|
||||
var errorSpan = document.getElementById(`${contextID}-errors`);
|
||||
var currentErrors = parseInt(errorSpan.innerText);
|
||||
currentErrors += 1;
|
||||
errorSpan.innerText = String(currentErrors);
|
||||
@ -80,8 +83,9 @@ export function AddCommandResultsHarness(result: GenericCommandResult) {
|
||||
TabContentWrapper.scrollTop = TabContentWrapper.scrollHeight;
|
||||
}
|
||||
|
||||
export function UpdateResultsCount(commandContextID:string) {
|
||||
var totalDevices = parseInt(document.getElementById(commandContextID + "-totaldevices").innerText);
|
||||
var percentComplete = Math.round(document.getElementById(commandContextID + "-results").children.length / totalDevices * 100);
|
||||
document.getElementById(commandContextID + "-completed").innerText = String(percentComplete) + "%";
|
||||
export function UpdateResultsCount(commandContextID: string) {
|
||||
var contextID = "c" + commandContextID;
|
||||
var totalDevices = parseInt(document.getElementById(`${contextID}-totaldevices`).innerText);
|
||||
var percentComplete = Math.round(document.getElementById(`${contextID}-results`).children.length / totalDevices * 100);
|
||||
document.getElementById(`${contextID}-completed`).innerText = String(percentComplete) + "%";
|
||||
}
|
||||
@ -56,7 +56,7 @@ Set-Location -Path (Get-Item -Path $PSScriptRoot).Parent.FullName
|
||||
|
||||
if ($ArgList.Contains("c")) {
|
||||
# Add Current Version file to root content folder for client update checks.
|
||||
Set-Content -Path ".\Remotely_Server\CurrentAgentVersion.txt" -Value $CurrentVersion.Trim() -Encoding UTF8 -Force
|
||||
Set-Content -Path ".\Remotely_Server\CurrentVersion.txt" -Value $CurrentVersion.Trim() -Encoding UTF8 -Force
|
||||
|
||||
# Copy .NET Framework ScreenCaster to Agent resources for embedding.
|
||||
if ((Test-Path -Path ".\Remotely_Agent\Resources") -eq $false) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user