mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Rebranding.
This commit is contained in:
parent
f320eb883e
commit
aec2e76067
Binary file not shown.
@ -176,13 +176,9 @@ namespace Remotely_Agent.Services
|
||||
}));
|
||||
hubConnection.On("TransferFiles", async (string transferID, List<string> fileIDs, string requesterID) =>
|
||||
{
|
||||
Logger.Write("File transfer started.");
|
||||
Logger.Write($"File transfer started by {requesterID}.");
|
||||
var connectionInfo = Utilities.GetConnectionInfo();
|
||||
var sharedFilePath = Directory.CreateDirectory(Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
|
||||
"Remotely",
|
||||
"SharedFiles"
|
||||
)).FullName;
|
||||
var sharedFilePath = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(),"RemotelySharedFiles")).FullName;
|
||||
|
||||
foreach (var fileID in fileIDs)
|
||||
{
|
||||
|
||||
@ -9,6 +9,9 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Win32;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Remotely_ScreenCast.Sockets
|
||||
{
|
||||
@ -30,8 +33,7 @@ namespace Remotely_ScreenCast.Sockets
|
||||
|
||||
hubConnection.On("KeyDown", (int keyCode, string viewerID) =>
|
||||
{
|
||||
var viewer = Program.Viewers[viewerID];
|
||||
if (viewer.HasControl)
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
Win32Interop.SendKeyDown((User32.VirtualKeyShort)keyCode);
|
||||
}
|
||||
@ -39,8 +41,7 @@ namespace Remotely_ScreenCast.Sockets
|
||||
|
||||
hubConnection.On("KeyUp", (int keyCode, string viewerID) =>
|
||||
{
|
||||
var viewer = Program.Viewers[viewerID];
|
||||
if (viewer.HasControl)
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
Win32Interop.SendKeyUp((User32.VirtualKeyShort)keyCode);
|
||||
}
|
||||
@ -48,8 +49,7 @@ namespace Remotely_ScreenCast.Sockets
|
||||
|
||||
hubConnection.On("KeyPress", (int keyCode, string viewerID) =>
|
||||
{
|
||||
var viewer = Program.Viewers[viewerID];
|
||||
if (viewer.HasControl)
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
Win32Interop.SendKeyDown((User32.VirtualKeyShort)keyCode);
|
||||
Win32Interop.SendKeyUp((User32.VirtualKeyShort)keyCode);
|
||||
@ -58,15 +58,14 @@ namespace Remotely_ScreenCast.Sockets
|
||||
|
||||
hubConnection.On("MouseMove", (double percentX, double percentY, string viewerID) =>
|
||||
{
|
||||
var viewer = Program.Viewers[viewerID];
|
||||
if (viewer.HasControl)
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
var mousePoint = ScreenCaster.GetAbsoluteScreenCoordinatesFromPercentages(percentX, percentY, viewer.Capturer);
|
||||
Win32Interop.SendMouseMove(mousePoint.Item1, mousePoint.Item2);
|
||||
}
|
||||
});
|
||||
|
||||
hubConnection.On("ViewerDisconnected", (string viewerID) =>
|
||||
hubConnection.On("ViewerDisconnected", async (string viewerID) =>
|
||||
{
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer))
|
||||
{
|
||||
@ -83,6 +82,7 @@ namespace Remotely_ScreenCast.Sockets
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
await hubConnection.InvokeAsync("ViewerDisconnected", viewerID);
|
||||
});
|
||||
hubConnection.On("FrameSkip", (int delayTime, string viewerID) =>
|
||||
{
|
||||
@ -91,6 +91,93 @@ namespace Remotely_ScreenCast.Sockets
|
||||
viewer.NextCaptureDelay = delayTime;
|
||||
}
|
||||
});
|
||||
|
||||
hubConnection.On("SessionID", (string sessionID) =>
|
||||
{
|
||||
var formattedSessionID = "";
|
||||
for (var i = 0; i < sessionID.Length; i += 3)
|
||||
{
|
||||
formattedSessionID += sessionID.Substring(i, 3) + " ";
|
||||
}
|
||||
|
||||
// TODO: Send to desktop app.
|
||||
formattedSessionID.Trim();
|
||||
});
|
||||
|
||||
hubConnection.On("SelectScreen", (int screenIndex, string viewerID) =>
|
||||
{
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer))
|
||||
{
|
||||
viewer.Capturer.SelectedScreen = screenIndex;
|
||||
}
|
||||
});
|
||||
|
||||
hubConnection.On("TouchDown", (string viewerID) =>
|
||||
{
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
User32.GetCursorPos(out var point);
|
||||
Win32Interop.SendLeftMouseDown(point.X, point.Y);
|
||||
}
|
||||
});
|
||||
hubConnection.On("LongPress", (string viewerID) =>
|
||||
{
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
User32.GetCursorPos(out var point);
|
||||
Win32Interop.SendRightMouseDown(point.X, point.Y);
|
||||
Win32Interop.SendRightMouseUp(point.X, point.Y);
|
||||
}
|
||||
});
|
||||
hubConnection.On("TouchMove", (double moveX, double moveY, string viewerID) =>
|
||||
{
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
User32.GetCursorPos(out var point);
|
||||
Win32Interop.SendMouseMove(point.X + moveX, point.Y + moveY);
|
||||
}
|
||||
});
|
||||
hubConnection.On("TouchUp", (string viewerID) =>
|
||||
{
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
User32.GetCursorPos(out var point);
|
||||
Win32Interop.SendLeftMouseUp(point.X, point.Y);
|
||||
}
|
||||
});
|
||||
hubConnection.On("Tap", (string viewerID) =>
|
||||
{
|
||||
if (Program.Viewers.TryGetValue(viewerID, out var viewer) && viewer.HasControl)
|
||||
{
|
||||
User32.GetCursorPos(out var point);
|
||||
Win32Interop.SendLeftMouseDown(point.X, point.Y);
|
||||
Win32Interop.SendLeftMouseUp(point.X, point.Y);
|
||||
}
|
||||
});
|
||||
hubConnection.On("SharedFileIDs", (List<string> fileIDs) => {
|
||||
fileIDs.ForEach(id =>
|
||||
{
|
||||
var url = $"{Program.Host}/API/FileSharing/{id}";
|
||||
var webRequest = WebRequest.CreateHttp(url);
|
||||
var response = webRequest.GetResponse();
|
||||
var contentDisp = response.Headers["Content-Disposition"];
|
||||
var fileName = contentDisp
|
||||
.Split(";".ToCharArray())
|
||||
.FirstOrDefault(x => x.Trim().StartsWith("filename"))
|
||||
.Split("=".ToCharArray())[1];
|
||||
|
||||
var dirPath = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "RemotelySharedFiles")).FullName;
|
||||
var filePath = Path.Combine(dirPath, fileName);
|
||||
using (var fs = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
using (var rs = response.GetResponseStream())
|
||||
{
|
||||
rs.CopyTo(fs);
|
||||
}
|
||||
}
|
||||
Process.Start("explorer.exe", dirPath);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ using Remotely_Server.Data;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
@ -32,7 +33,6 @@ namespace Remotely_Server.API
|
||||
return null;
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
[HttpPost]
|
||||
[RequestSizeLimit(500_000_000)]
|
||||
public List<string> Post()
|
||||
@ -44,6 +44,6 @@ namespace Remotely_Server.API
|
||||
fileIDs.Add(id);
|
||||
}
|
||||
return fileIDs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ namespace Remotely_Server.Services
|
||||
}
|
||||
public async Task SendSharedFileIDs(List<string> fileIDs)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("SharedFileIDs", fileIDs, Context.ConnectionId);
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("SharedFileIDs", fileIDs);
|
||||
}
|
||||
|
||||
public async Task Tap()
|
||||
|
||||
@ -32,6 +32,17 @@ namespace Remotely_Server.Services
|
||||
private DataService DataService { get; }
|
||||
private IHubContext<BrowserSocketHub> BrowserHub { get; }
|
||||
private IHubContext<RCBrowserSocketHub> RCBrowserHub { get; }
|
||||
private List<string> ViewerList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Context.Items.ContainsKey("ViewerList"))
|
||||
{
|
||||
Context.Items["ViewerList"] = new List<string>();
|
||||
}
|
||||
return Context.Items["ViewerList"] as List<string>;
|
||||
}
|
||||
}
|
||||
|
||||
private RandomGenerator RNG { get; }
|
||||
|
||||
@ -41,18 +52,30 @@ namespace Remotely_Server.Services
|
||||
}
|
||||
public override async Task OnDisconnectedAsync(Exception exception)
|
||||
{
|
||||
await base.OnDisconnectedAsync(exception);
|
||||
if (AttendedSessionList.ContainsKey(Context.Items["SessionID"].ToString()))
|
||||
await RCBrowserHub.Clients.Clients(ViewerList).SendAsync("ScreenCasterDisconnected");
|
||||
if (Context.Items.ContainsKey("SessionID") && AttendedSessionList.ContainsKey(Context.Items["SessionID"].ToString()))
|
||||
{
|
||||
while (!AttendedSessionList.TryRemove(Context.Items["SessionID"].ToString(), out var value))
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await base.OnDisconnectedAsync(exception);
|
||||
}
|
||||
public void ViewerDisconnected(string viewerID)
|
||||
{
|
||||
lock (ViewerList)
|
||||
{
|
||||
ViewerList.Remove(viewerID);
|
||||
}
|
||||
}
|
||||
public async Task SendScreenCountToBrowser(int primaryScreenIndex, int screenCount, string rcBrowserHubConnectionID)
|
||||
{
|
||||
lock (ViewerList)
|
||||
{
|
||||
ViewerList.Add(rcBrowserHubConnectionID);
|
||||
}
|
||||
await RCBrowserHub.Clients.Client(rcBrowserHubConnectionID).SendAsync("ScreenCount", primaryScreenIndex, screenCount);
|
||||
}
|
||||
|
||||
@ -76,33 +99,6 @@ namespace Remotely_Server.Services
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task SendRTCSessionToBrowser(object offer, string browserHubConnectionID)
|
||||
{
|
||||
await RCBrowserHub.Clients.Client(browserHubConnectionID).SendAsync("RTCSession", offer);
|
||||
}
|
||||
public async Task SendIceCandidateToBrowser(object candidate, string browserHubConnectionID)
|
||||
{
|
||||
await RCBrowserHub.Clients.Client(browserHubConnectionID).SendAsync("IceCandidate", candidate);
|
||||
}
|
||||
|
||||
|
||||
public async Task NotifyViewerDesktopSwitching(string viewerID)
|
||||
{
|
||||
await RCBrowserHub.Clients.Client(viewerID).SendAsync("DesktopSwitching");
|
||||
}
|
||||
public async Task LaunchRCInNewDesktop(string serviceID, string[] viewerIDs, string desktop)
|
||||
{
|
||||
await DeviceHub.Clients.Client(serviceID).SendAsync("LaunchRCInNewDesktop", viewerIDs, serviceID, desktop);
|
||||
}
|
||||
public async Task NotifyRequesterDesktopSwitchCompleted(string rcBrowserConnectionID)
|
||||
{
|
||||
await RCBrowserHub.Clients.Client(rcBrowserConnectionID).SendAsync("SwitchedDesktop", Context.ConnectionId);
|
||||
}
|
||||
public async Task DesktopSwitchFailed(string rcBrowserConnectionID)
|
||||
{
|
||||
await RCBrowserHub.Clients.Client(rcBrowserConnectionID).SendAsync("DesktopSwitchFailed");
|
||||
}
|
||||
public async Task GetSessionID()
|
||||
{
|
||||
var random = new Random();
|
||||
|
||||
@ -106,7 +106,7 @@ export function GetCommandMode() {
|
||||
}
|
||||
/** Processes the command input. */
|
||||
export function ProcessCommand() {
|
||||
var commandText = UI.ConsoleTextArea.value;
|
||||
var commandText = UI.ConsoleTextArea.value.trim();
|
||||
Store.InputHistoryItems.push(commandText);
|
||||
Store.InputHistoryPosition = Store.InputHistoryItems.length;
|
||||
UI.ConsoleTextArea.value = "";
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -115,7 +115,7 @@ export function GetCommandMode() {
|
||||
|
||||
/** Processes the command input. */
|
||||
export function ProcessCommand() {
|
||||
var commandText = UI.ConsoleTextArea.value;
|
||||
var commandText = UI.ConsoleTextArea.value.trim();
|
||||
Store.InputHistoryItems.push(commandText);
|
||||
Store.InputHistoryPosition = Store.InputHistoryItems.length;
|
||||
UI.ConsoleTextArea.value = "";
|
||||
|
||||
@ -72,6 +72,7 @@ var commands = [
|
||||
UI.AddConsoleOutput(paramDictionary["message"]);
|
||||
}),
|
||||
new ConsoleCommand("ExpandResults", [], "Expands the results of the last scripting command.", "expandresults", "", (parameters, paramDictionary) => {
|
||||
// TODO
|
||||
$(UI.ConsoleOutputDiv).find(".command-harness").last().find(".collapse")['collapse']('show');
|
||||
}),
|
||||
new ConsoleCommand("CollapseResults", [], "Collapses all scripting results.", "collapseresults", "", (parameters, paramDictionary) => {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -126,6 +126,7 @@ var commands: Array<ConsoleCommand> = [
|
||||
"expandresults",
|
||||
"",
|
||||
(parameters, paramDictionary) => {
|
||||
// TODO
|
||||
$(UI.ConsoleOutputDiv).find(".command-harness").last().find(".collapse")['collapse']('show');
|
||||
}
|
||||
),
|
||||
|
||||
@ -120,7 +120,7 @@ export class RCBrowserSockets {
|
||||
UI.ConnectButton.removeAttribute("disabled");
|
||||
UI.StatusMessage.innerHTML = "Session ID not found.";
|
||||
});
|
||||
hubConnection.on("RCProcessStopped", () => {
|
||||
hubConnection.on("ScreenCasterDisconnected", () => {
|
||||
this.Connection.stop();
|
||||
});
|
||||
hubConnection.on("DesktopSwitching", () => {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -128,7 +128,7 @@ export class RCBrowserSockets {
|
||||
UI.ConnectButton.removeAttribute("disabled");
|
||||
UI.StatusMessage.innerHTML = "Session ID not found.";
|
||||
});
|
||||
hubConnection.on("RCProcessStopped", () => {
|
||||
hubConnection.on("ScreenCasterDisconnected", () => {
|
||||
this.Connection.stop();
|
||||
});
|
||||
hubConnection.on("DesktopSwitching", () => {
|
||||
|
||||
@ -115,13 +115,13 @@ export function ApplyInputHandlers(sockets) {
|
||||
});
|
||||
ScreenViewer.addEventListener("mousemove", function (e) {
|
||||
e.preventDefault();
|
||||
if (Date.now() - lastPointerMove < 50) {
|
||||
if (Date.now() - lastPointerMove < 25) {
|
||||
return;
|
||||
}
|
||||
lastPointerMove = Date.now();
|
||||
var percentX = e.offsetX / ScreenViewer.clientWidth;
|
||||
var percentY = e.offsetY / ScreenViewer.clientHeight;
|
||||
sockets.SendMouseMove(percentX, percentY);
|
||||
//sockets.SendMouseMove(percentX, percentY);
|
||||
});
|
||||
ScreenViewer.addEventListener("mousedown", function (e) {
|
||||
if (e.button != 0 && e.button != 2) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -121,13 +121,13 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
|
||||
});
|
||||
ScreenViewer.addEventListener("mousemove", function (e) {
|
||||
e.preventDefault();
|
||||
if (Date.now() - lastPointerMove < 50) {
|
||||
if (Date.now() - lastPointerMove < 25) {
|
||||
return;
|
||||
}
|
||||
lastPointerMove = Date.now();
|
||||
var percentX = e.offsetX / ScreenViewer.clientWidth;
|
||||
var percentY = e.offsetY / ScreenViewer.clientHeight;
|
||||
sockets.SendMouseMove(percentX, percentY);
|
||||
//sockets.SendMouseMove(percentX, percentY);
|
||||
});
|
||||
ScreenViewer.addEventListener("mousedown", function (e) {
|
||||
if (e.button != 0 && e.button != 2) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user