mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Add connection request denied.
This commit is contained in:
parent
2da785e96a
commit
9409dba68f
@ -311,6 +311,14 @@ namespace Remotely.Desktop.Win.ViewModels
|
||||
Services.GetRequiredService<IScreenCaster>().BeginScreenCasting(screenCastRequest);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// Run on another thread so it doesn't tie up the UI thread.
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await CasterSocket.SendConnectionRequestDenied(screenCastRequest.ViewerID);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
private void SessionIDChanged(object sender, string sessionID)
|
||||
|
||||
@ -29,12 +29,11 @@ namespace Remotely.ScreenCast.Core.Communication
|
||||
|
||||
public HubConnection Connection { get; private set; }
|
||||
public bool IsConnected => Connection?.State == HubConnectionState.Connected;
|
||||
private IScreenCaster ScreenCaster { get; }
|
||||
private IFileTransferService FileDownloadService { get; }
|
||||
private IAudioCapturer AudioCapturer { get; }
|
||||
|
||||
private IClipboardService ClipboardService { get; }
|
||||
private IFileTransferService FileDownloadService { get; }
|
||||
private IKeyboardMouseInput KeyboardMouseInput { get; }
|
||||
private IScreenCaster ScreenCaster { get; }
|
||||
public async Task Connect(string host)
|
||||
{
|
||||
if (Connection != null)
|
||||
@ -89,6 +88,11 @@ namespace Remotely.ScreenCast.Core.Communication
|
||||
await Connection.SendAsync("SendConnectionFailedToViewers", viewerIDs);
|
||||
}
|
||||
|
||||
public async Task SendConnectionRequestDenied(string viewerID)
|
||||
{
|
||||
await Connection.SendAsync("SendConnectionRequestDenied", viewerID);
|
||||
}
|
||||
|
||||
public async Task SendCtrlAltDel()
|
||||
{
|
||||
await Connection.SendAsync("CtrlAltDel");
|
||||
|
||||
@ -134,6 +134,11 @@ namespace Remotely.Server.Services
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("SelectScreen", displayName, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public Task SendAutoQualityAdjust(bool isOn)
|
||||
{
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("AutoQualityAdjust", isOn, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public Task SendClipboardTransfer(string transferText, bool typeText)
|
||||
{
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("ClipboardTransfer", transferText, typeText, Context.ConnectionId);
|
||||
@ -143,15 +148,18 @@ namespace Remotely.Server.Services
|
||||
{
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("FrameReceived", bytesReceived, Context.ConnectionId);
|
||||
}
|
||||
public Task SendIceCandidateToAgent(string candidate, int sdpMlineIndex, string sdpMid)
|
||||
{
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("ReceiveIceCandidate", candidate, sdpMlineIndex, sdpMid, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public Task SendQualityChange(int qualityLevel)
|
||||
{
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("QualityChange", qualityLevel, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public Task SendAutoQualityAdjust(bool isOn)
|
||||
public Task SendRtcAnswerToAgent(string sdp)
|
||||
{
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("AutoQualityAdjust", isOn, Context.ConnectionId);
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("ReceiveRtcAnswer", sdp, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task<Task> SendScreenCastRequestToDevice(string screenCasterID, string requesterName, int remoteControlMode)
|
||||
@ -260,15 +268,5 @@ namespace Remotely.Server.Services
|
||||
{
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("TouchUp", Context.ConnectionId);
|
||||
}
|
||||
|
||||
public Task SendIceCandidateToAgent(string candidate, int sdpMlineIndex, string sdpMid)
|
||||
{
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("ReceiveIceCandidate", candidate, sdpMlineIndex, sdpMid, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public Task SendRtcAnswerToAgent(string sdp)
|
||||
{
|
||||
return RCDeviceHub.Clients.Client(ScreenCasterID).SendAsync("ReceiveRtcAnswer", sdp, Context.ConnectionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,12 +162,25 @@ namespace Remotely.Server.Services
|
||||
{
|
||||
return RCBrowserHub.Clients.Clients(viewerIDs).SendAsync("ConnectionFailed");
|
||||
}
|
||||
|
||||
public Task SendConnectionRequestDenied(string viewerID)
|
||||
{
|
||||
return RCBrowserHub.Clients.Client(viewerID).SendAsync("ConnectionRequestDenied");
|
||||
}
|
||||
public Task SendCursorChange(CursorInfo cursor, string viewerID)
|
||||
{
|
||||
return RCBrowserHub.Clients.Client(viewerID).SendAsync("CursorChange", cursor);
|
||||
}
|
||||
|
||||
public Task SendIceCandidateToBrowser(string candidate, int sdpMlineIndex, string sdpMid, string viewerID)
|
||||
{
|
||||
if (AppConfig.UseWebRtc)
|
||||
{
|
||||
return RCBrowserHub.Clients.Client(viewerID).SendAsync("ReceiveIceCandidate", candidate, sdpMlineIndex, sdpMid);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task SendMachineName(string machineName, string viewerID)
|
||||
{
|
||||
return RCBrowserHub.Clients.Client(viewerID).SendAsync("ReceiveMachineName", machineName);
|
||||
@ -182,16 +195,6 @@ namespace Remotely.Server.Services
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
public Task SendIceCandidateToBrowser(string candidate, int sdpMlineIndex, string sdpMid, string viewerID)
|
||||
{
|
||||
if (AppConfig.UseWebRtc)
|
||||
{
|
||||
return RCBrowserHub.Clients.Client(viewerID).SendAsync("ReceiveIceCandidate", candidate, sdpMlineIndex, sdpMid);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task SendScreenCapture(byte[] captureBytes, string rcBrowserHubConnectionID, int left, int top, int width, int height, long imageQuality)
|
||||
{
|
||||
if (AppConfig.RecordRemoteControlSessions)
|
||||
|
||||
@ -158,6 +158,11 @@ export class RCBrowserSockets {
|
||||
UI.ShowMessage("Connection failed. Please reconnect.");
|
||||
this.Connection.stop();
|
||||
});
|
||||
hubConnection.on("ConnectionRequestDenied", () => {
|
||||
this.Connection.stop();
|
||||
UI.StatusMessage.innerHTML = "Connection request denied.";
|
||||
UI.ShowMessage("Connection request denied.");
|
||||
});
|
||||
hubConnection.on("Unauthorized", () => {
|
||||
UI.ConnectButton.removeAttribute("disabled");
|
||||
UI.StatusMessage.innerHTML = "Authorization failed.";
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -176,6 +176,11 @@ export class RCBrowserSockets {
|
||||
UI.ShowMessage("Connection failed. Please reconnect.");
|
||||
this.Connection.stop();
|
||||
});
|
||||
hubConnection.on("ConnectionRequestDenied", () => {
|
||||
this.Connection.stop();
|
||||
UI.StatusMessage.innerHTML = "Connection request denied.";
|
||||
UI.ShowMessage("Connection request denied.");
|
||||
});
|
||||
hubConnection.on("Unauthorized", () => {
|
||||
UI.ConnectButton.removeAttribute("disabled");
|
||||
UI.StatusMessage.innerHTML = "Authorization failed.";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user