From f3e38ed2ed2d47ebc954b63c7441e0a247ebf79f Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Thu, 26 Mar 2020 20:04:57 -0700 Subject: [PATCH] Finish Alerts API. --- README.md | 70 +++++++++++++++---- Server/API/AlertsController.cs | 2 +- Server/API/RemoteControlController.cs | 2 +- Server/Pages/_IndexLoggedIn.cshtml | 17 ++++- Server/wwwroot/scripts/InputEventHandlers.js | 23 +++++- .../wwwroot/scripts/InputEventHandlers.js.map | 2 +- Server/wwwroot/scripts/InputEventHandlers.ts | 24 ++++++- Server/wwwroot/scripts/UI.js | 1 + Server/wwwroot/scripts/UI.js.map | 2 +- Server/wwwroot/scripts/UI.ts | 1 + 10 files changed, 118 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index a1cf284c0..7b8db383d 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Multi-Tenant Demo Server: https://app.remotely.one * Endpoint devices require the .NET Core runtime to be installed. * For Windows, the Desktop Runtime is required. * Download Link: https://dotnet.microsoft.com/download/dotnet-core/current/runtime + * The installer will automatically download and install the runtime if missing. ## Build Instructions (Windows 10) The following steps will configure your Windows 10 machine for building the Remotely server and clients. @@ -98,14 +99,6 @@ Ideally, you'd be doing remote control from an actual computer or laptop. Howev * Click-and-drag: Tap and hold with one finger, tap and release a second finger (without pinch-zooming) * The click-and-drag operation will begin where finger one is held. -## Shortcut Keys -There are a few shortcut keys available when using the console. -* / : Slash will open the autocomplete for selecting the current command mode. The names are configurable in the Account - Options page. -* Up/Down: Use arrow up/down to cycle through input history. -* Ctrl + Up/Down: Scroll the console output window. -* Ctrl + Q: Clear the output window. -* Esc: Close the autocomplete window. - ## Configuration The following settings are available in appsettings.json. @@ -131,6 +124,24 @@ Note: To retain your settings between upgrades, copy your settings to appsetting * Only works on Windows agents. * Session recording will not work if a WebRTC connection is made. + +## .NET Core Deployments +* .NET Core has two methods of deployment: framework-dependent and self-contained. + * Framework-dependent deployments require the .NET Core runtime to be installed on the target computers. It must be the same version that was used to build the app. + * Self-contained deployments include a copy of the runtime, so you don't need to install it on the target computers. As a result, the total file size is much larger. +* .NET Core uses runtime identifiers that are targeted when building. + * Link: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog + + +## Shortcut Keys +There are a few shortcut keys available when using the console. +* / : Slash will open the autocomplete for selecting the current command mode. The names are configurable in the Account - Options page. +* Up/Down: Use arrow up/down to cycle through input history. +* Ctrl + Up/Down: Scroll the console output window. +* Ctrl + Q: Clear the output window. +* Esc: Close the autocomplete window. + + ## API and Integrations Remotely has a basic API, which can be browsed at https://app.remotely.one/swagger (or your own server instance). Most endpoints require authentication via an API access token, which can be created by going to Account - API Access. @@ -153,10 +164,39 @@ Below is an example API request: Get-Location - -## .NET Core Deployments -* .NET Core has two methods of deployment: framework-dependent and self-contained. - * Framework-dependent deployments require the .NET Core runtime to be installed on the target computers. It must be the same version or higher that was used to build the app. - * Self-contained deployments include a copy of the runtime, so you don't need to install it on the target computers. As a result, the total file size is much larger. -* .NET Core uses runtime identifiers that are targeted when building. - * Link: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog +## Alerts +The Alerts API gives you the ability to add monitoring and alerting functionality to your device endpoints. This feature is intended to add basic RMM-type functionality without diverging too far from Remotely's primary purpose. + +Alerts can be set up to show a notification on the Remotely website, send an email, and/or perform a separate API request. + +To use Alerts, you'd first need to make an API token (or multiple tokens) for your devices to use. Then create a scheduled task or some other recurring script to do the work. Below is an example of how to use PowerShell to create a Scheduled Job that checks the disk space on a daily schedule. + +``` +$Trigger = New-JobTrigger -Daily -At "5 AM" +$Option = New-ScheduledJobOption -RequireNetwork + +Register-ScheduledJob -ScriptBlock { + $OsDrive = Get-PSDrive -Name C + $FreeSpace = $OsDrive.Free / ($OsDrive.Used + $OsDrive.Free) + if ($FreeSpace -lt .1) { + Invoke-WebRequest -Uri "https://localhost:5001/api/Alerts/Create/" -Method Post -Headers @{ + Authorization="3e9d8273-1dc1-4303-bd50-7a133e36b9b7:S+82XKZdvg278pSFHWtUklqHENuO5IhH" + } -Body @" + { + "AlertDeviceID": "f2b0a595-5ea8-471b-975f-12e70e0f3497", + "AlertMessage": "Low hard drive space. Free Space: $([Math]::Round($FreeSpace * 100))%", + "ApiRequestBody": null, + "ApiRequestHeaders": null, + "ApiRequestMethod": null, + "ApiRequestUrl": null, + "EmailBody": "Low hard drive space for device Maker.", + "EmailSubject": "Hard Drive Space Alert", + "EmailTo": "translucency_software@outlook.com", + "ShouldAlert": true, + "ShouldEmail": true, + "ShouldSendApiRequest": false + } +"@ -ContentType "application/json" + } +} -Name "Check OS Drive Space" -Trigger $Trigger -ScheduledJobOption $Option +``` \ No newline at end of file diff --git a/Server/API/AlertsController.cs b/Server/API/AlertsController.cs index 92cd36397..7567da1c4 100644 --- a/Server/API/AlertsController.cs +++ b/Server/API/AlertsController.cs @@ -92,7 +92,7 @@ await EmailSender.SendEmailAsync(alertOptions.EmailTo, return Ok(); } - [HttpPost("Delete/{alertID}")] + [HttpDelete("Delete/{alertID}")] public async Task Delete(string alertID) { Request.Headers.TryGetValue("OrganizationID", out var orgID); diff --git a/Server/API/RemoteControlController.cs b/Server/API/RemoteControlController.cs index 4c84cfba9..2c24ce055 100644 --- a/Server/API/RemoteControlController.cs +++ b/Server/API/RemoteControlController.cs @@ -101,7 +101,7 @@ private async Task InitiateRemoteControl(string deviceID, string var stopWatch = Stopwatch.StartNew(); - Func remoteControlStarted = () => RCDeviceSocketHub.SessionInfoList.Values.Any(x => x.DeviceID == targetDevice.Value.ID && !existingSessions.Any(y => y.Key != x.RCDeviceSocketID)); + bool remoteControlStarted() => RCDeviceSocketHub.SessionInfoList.Values.Any(x => x.DeviceID == targetDevice.Value.ID && !existingSessions.Any(y => y.Key != x.RCDeviceSocketID)); if (!await TaskHelper.DelayUntil(remoteControlStarted, TimeSpan.FromSeconds(15))) { diff --git a/Server/Pages/_IndexLoggedIn.cshtml b/Server/Pages/_IndexLoggedIn.cshtml index f97370c02..d32be6446 100644 --- a/Server/Pages/_IndexLoggedIn.cshtml +++ b/Server/Pages/_IndexLoggedIn.cshtml @@ -3,18 +3,23 @@
- + +
@foreach (var alert in Model.Alerts) { -
+
@alert.CreatedOn.ToString()
@if (!string.IsNullOrWhiteSpace(alert.Device?.DeviceName)) @@ -22,6 +27,12 @@
@alert.Device.DeviceName
}

@alert.Message

+
+ +
} diff --git a/Server/wwwroot/scripts/InputEventHandlers.js b/Server/wwwroot/scripts/InputEventHandlers.js index ff27e8ec2..38d0c4ddb 100644 --- a/Server/wwwroot/scripts/InputEventHandlers.js +++ b/Server/wwwroot/scripts/InputEventHandlers.js @@ -15,7 +15,7 @@ export function ApplyInputEventHandlers() { clickStartRemoteControlButton(); consoleTabSelected(); deviceGroupSelectChanged(); - clickAlertsButtons(); + addAlertHandlers(); window.addEventListener("resize", ev => { PositionCommandCompletionWindow(); }); @@ -157,13 +157,32 @@ function consoleTabSelected() { UI.ConsoleFrame.scrollTop = UI.ConsoleFrame.scrollHeight; }); } -function clickAlertsButtons() { +function addAlertHandlers() { UI.AlertsButton.addEventListener("click", ev => { UI.AlertsFrame.classList.toggle("open"); }); UI.CloseAlertsButton.addEventListener("click", ev => { UI.AlertsFrame.classList.toggle("open"); }); + document.querySelectorAll(".alert-dismiss-button").forEach(element => { + element.addEventListener("click", ev => { + var alertID = ev.currentTarget.getAttribute("alert"); + var xhr = new XMLHttpRequest(); + xhr.open("delete", location.origin + "/api/Alerts/Delete/" + alertID); + xhr.onload = function () { + if (xhr.status == 200) { + document.getElementById(alertID).remove(); + var currentCount = Number(UI.AlertsCount.innerText); + currentCount--; + UI.AlertsCount.innerText = String(currentCount); + } + else { + UI.ShowModal("API Error", "There was an error deleting the alert."); + } + }; + xhr.send(); + }); + }); } function clickToggleAllDevices() { document.getElementById("toggleAllDevices").addEventListener("click", function (e) { diff --git a/Server/wwwroot/scripts/InputEventHandlers.js.map b/Server/wwwroot/scripts/InputEventHandlers.js.map index 5ee14ceb4..448ced8f6 100644 --- a/Server/wwwroot/scripts/InputEventHandlers.js.map +++ b/Server/wwwroot/scripts/InputEventHandlers.js.map @@ -1 +1 @@ -{"version":3,"file":"InputEventHandlers.js","sourceRoot":"","sources":["InputEventHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACxG,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,UAAU,uBAAuB;IACnC,eAAe,EAAE,CAAC;IAClB,sBAAsB,EAAE,CAAC;IACzB,sBAAsB,EAAE,CAAC;IACzB,oBAAoB,EAAE,CAAC;IACvB,qBAAqB,EAAE,CAAC;IACxB,6BAA6B,EAAE,CAAC;IAChC,kBAAkB,EAAE,CAAC;IACrB,wBAAwB,EAAE,CAAC;IAC3B,kBAAkB,EAAE,CAAC;IAErB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE;QACnC,+BAA+B,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,uBAAuB,CAAC,CAAgB;IAC7C,IAAI,CAAC,CAAC,OAAO,EAAE;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,WAAW,EAAE;YACpC,EAAE,CAAC,iBAAiB,CAAC,SAAS,IAAI,EAAE,CAAC;SACxC;aACI,IAAI,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,SAAS,EAAE;YACvC,EAAE,CAAC,iBAAiB,CAAC,SAAS,IAAI,EAAE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,QAAQ,CAAC,cAAc,CAAC,0BAA0B,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC;QACrF,IAAI,eAAe,GAAG,QAAQ,CAAC,kBAAkB,EAAE,CAAC;QACpD,IAAI,eAAe,CAAC,MAAM,IAAI,CAAC,EAAE;YAC7B,EAAE,CAAC,YAAY,CAAC,iCAAiC,CAAC,CAAC;SACtD;aACI,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,EAAE,CAAC,YAAY,CAAC,6CAA6C,CAAC,CAAC;SAClE;aACI;YACD,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,eAAe,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;SAChE;IACL,CAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAS,wBAAwB;IAC7B,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE;QACnD,QAAQ,CAAC,aAAa,CAAC,WAAW,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;QAChE,IAAI,EAAE,CAAC,iBAAiB,CAAC,aAAa,IAAI,CAAC,EAAE;YACzC,QAAQ,CAAC,aAAa,CAAC,aAAa,GAAG,IAAI,CAAC;SAC/C;aACI;YACD,QAAQ,CAAC,aAAa,CAAC,aAAa,GAAG,KAAK,CAAC;SAChD;QACD,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC"} \ No newline at end of file diff --git a/Server/wwwroot/scripts/InputEventHandlers.ts b/Server/wwwroot/scripts/InputEventHandlers.ts index c41c43d1f..1373bc86e 100644 --- a/Server/wwwroot/scripts/InputEventHandlers.ts +++ b/Server/wwwroot/scripts/InputEventHandlers.ts @@ -17,7 +17,7 @@ export function ApplyInputEventHandlers() { clickStartRemoteControlButton(); consoleTabSelected(); deviceGroupSelectChanged(); - clickAlertsButtons(); + addAlertHandlers(); window.addEventListener("resize", ev => { PositionCommandCompletionWindow(); @@ -164,13 +164,33 @@ function consoleTabSelected() { UI.ConsoleFrame.scrollTop = UI.ConsoleFrame.scrollHeight; }); } -function clickAlertsButtons() { +function addAlertHandlers() { UI.AlertsButton.addEventListener("click", ev => { UI.AlertsFrame.classList.toggle("open"); }); UI.CloseAlertsButton.addEventListener("click", ev => { UI.AlertsFrame.classList.toggle("open"); }); + + document.querySelectorAll(".alert-dismiss-button").forEach(element => { + element.addEventListener("click", ev => { + var alertID = (ev.currentTarget as HTMLButtonElement).getAttribute("alert"); + var xhr = new XMLHttpRequest(); + xhr.open("delete", location.origin + "/api/Alerts/Delete/" + alertID); + xhr.onload = function () { + if (xhr.status == 200) { + document.getElementById(alertID).remove(); + var currentCount = Number(UI.AlertsCount.innerText); + currentCount--; + UI.AlertsCount.innerText = String(currentCount); + } + else { + UI.ShowModal("API Error", "There was an error deleting the alert."); + } + }; + xhr.send(); + }) + }); } function clickToggleAllDevices() { document.getElementById("toggleAllDevices").addEventListener("click", function (e) { diff --git a/Server/wwwroot/scripts/UI.js b/Server/wwwroot/scripts/UI.js index 7c486c951..409b8ec33 100644 --- a/Server/wwwroot/scripts/UI.js +++ b/Server/wwwroot/scripts/UI.js @@ -19,6 +19,7 @@ export var GridFilter = document.getElementById("gridFilter"); export var AlertsButton = document.getElementById("alertsButton"); export var CloseAlertsButton = document.getElementById("closeAlertsFrameButton"); export var AlertsFrame = document.getElementById("alertsFrame"); +export var AlertsCount = document.getElementById("alertsCount"); export function PopupMessage(message) { var messageDiv = document.createElement("div"); messageDiv.classList.add("float-message"); diff --git a/Server/wwwroot/scripts/UI.js.map b/Server/wwwroot/scripts/UI.js.map index e50938638..f81cdc778 100644 --- a/Server/wwwroot/scripts/UI.js.map +++ b/Server/wwwroot/scripts/UI.js.map @@ -1 +1 @@ -{"version":3,"file":"UI.js","sourceRoot":"","sources":["UI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;SAC5D;IACL,CAAC,CAAC,CAAC;IACH,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,UAAU,CAAC;AACtB,CAAC;AAAA,CAAC;AACF,MAAM,UAAU,aAAa,CAAC,YAA8B;IACxD,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,EAAE;QAC/B,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC;YACvB,QAAQ,EAAE,kHAAkH;YAC5H,KAAK,EAAE,YAAY,CAAC,iBAAiB;SACxC,CAAC,CAAC;QACH,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC;KAChB;SACI;QACD,OAAO,IAAI,CAAC;KACf;AACL,CAAC"} \ No newline at end of file diff --git a/Server/wwwroot/scripts/UI.ts b/Server/wwwroot/scripts/UI.ts index 4659ef716..c0a2972ef 100644 --- a/Server/wwwroot/scripts/UI.ts +++ b/Server/wwwroot/scripts/UI.ts @@ -21,6 +21,7 @@ export var GridFilter = document.getElementById("gridFilter") as HTMLInputElemen export var AlertsButton = document.getElementById("alertsButton") as HTMLButtonElement; export var CloseAlertsButton = document.getElementById("closeAlertsFrameButton") as HTMLButtonElement; export var AlertsFrame = document.getElementById("alertsFrame") as HTMLDivElement; +export var AlertsCount = document.getElementById("alertsCount") as HTMLSpanElement; export function PopupMessage(message: string) {