Close window on remote control disconnect if originating from API call.

This commit is contained in:
Jared Goodwin 2020-01-13 22:17:01 -08:00
parent 10f7a40419
commit 8a1a642d2b
4 changed files with 8 additions and 2 deletions

View File

@ -102,7 +102,7 @@ namespace Remotely.Server.API
else
{
var rcSession = RCDeviceSocketHub.SessionInfoList.Values.FirstOrDefault(x=>x.DeviceID == targetDevice.Value.ID && !existingSessions.Any(y=>y.Key != x.RCSocketID));
return Ok($"{HttpContext.Request.Scheme}://{Request.Host}/RemoteControl?clientID={rcSession.RCSocketID}&serviceID={targetDevice.Key}");
return Ok($"{HttpContext.Request.Scheme}://{Request.Host}/RemoteControl?clientID={rcSession.RCSocketID}&serviceID={targetDevice.Key}&fromApi=true");
}
}
else

View File

@ -81,6 +81,9 @@ export function ApplyInputHandlers(sockets) {
DisconnectButton.addEventListener("click", (ev) => {
ConnectButton.removeAttribute("disabled");
RemoteControl.RCBrowserSockets.Connection.stop();
if (location.search.includes("fromApi=true")) {
window.close();
}
});
document.querySelectorAll("#sessionIDInput, #nameInput").forEach(x => {
x.addEventListener("keypress", (ev) => {

File diff suppressed because one or more lines are too long

View File

@ -86,6 +86,9 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
DisconnectButton.addEventListener("click", (ev) => {
ConnectButton.removeAttribute("disabled");
RemoteControl.RCBrowserSockets.Connection.stop();
if (location.search.includes("fromApi=true")) {
window.close();
}
});
document.querySelectorAll("#sessionIDInput, #nameInput").forEach(x => {
x.addEventListener("keypress", (ev: KeyboardEvent) => {